安装
从官网下载:https://dogecoin.com/
wget https://github.com/dogecoin/dogecoin/releases/download/v1.14.8/dogecoin-1.14.8-x86_64-linux-gnu.tar.gz
tar -zxvf dogecoin-1.14.8-x86_64-linux-gnu.tar.gz
cd dogecoin-1.14.8/bin/
配置
配置文件参考:https://github.com/dogecoin/dogecoin/blob/master/contrib/debian/examples/dogecoin.conf
创建配置文件
mkdir /data
cd /data & touch dogecoin.conf
vi /data/dogecoin.conf
写入配置
rpcuser=dogecoin123
rpcpassword=dogecoin123
server=1 # 是否是服务器
txindex=1
dbcache=2 # 如果需要挖矿,dbcache改大点,比如2000,如果不挖矿,改小点3,4,5都行
gen=0 # 不挖矿
rpcallowip=0.0.0.0/0 #允许调用RPC的ip
rpcbind=0.0.0.0
启动和停止
- 进入/data/dogecoin-1.14.8/bin/ 目录
- 启动:sudo ./dogecoind -conf=/data/dogecoin/dogecoin.conf -datadir=/data/dogecoin/blockdata -daemon 后台运行 -conf 定义配置文件 -datadir 定义数据文件夹
- 日志:tail -f /data/dogecoin/debug.log
- 停止:./dogecoin-cli -conf=/data/dogecoin/dogecoin.conf stop
- 查询余额:./dogecoin-cli -conf=/data/dogecoin/dogecoin.conf getbalance
- 监听区块数据:./dogecoin-cli -conf=/data/dogecoin/dogecoin.conf listtransactions “*” 10 0 true
php 监听充值,提币
<?php
namespace app\command;
class dogeMonitor extends Command
{
protected function configure()
{
// 指令配置
$this->setName('doge:monitor')
->setDescription('php think doge:monitor --block 123')
->addOption('block', null, Option::VALUE_REQUIRED, 'block number');
}
protected function execute(Input $input, Output $output)
{
// 指令输出
$output->info("DOGE链开启监听");
$stt = app()->make(DogeCoin::class);
while (true) {
// DOGE地址列表
$address_list = app()->make(UserRepository::class)->getDogeAddress();
$userExtract = app()->make(UserExtractRepository::class);
try {
$transactions = $stt->listtransactions();
} catch (\RuntimeException $e) {
$output->info($e->getMessage());
$transactions = [];
}
echo count($transactions) . '--' . date('Y-m-d H:i:s') . "\r\n";
if (count($transactions) > 0) {
$address_list = array_map('strtolower', $address_list);
if(!$address_list){
sleep(3);
$output->info('用户地址为空!');
continue;
}
foreach ($transactions as $data){
if ($data['category'] == 'receive' && $data['confirmations'] >= 6 && isset($data['address'])) {
}
}
}
sleep(3);
$output->info('监听成功,继续监听!');
}
}
}
运行命令:nohup php think doge:monitor &