DOGE节点安装和搭建

安装

从官网下载: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

启动和停止

  1. 进入/data/dogecoin-1.14.8/bin/ 目录
  2. 启动:sudo ./dogecoind -conf=/data/dogecoin/dogecoin.conf -datadir=/data/dogecoin/blockdata -daemon 后台运行 -conf 定义配置文件 -datadir 定义数据文件夹
  3. 日志:tail -f /data/dogecoin/debug.log
  4. 停止:./dogecoin-cli -conf=/data/dogecoin/dogecoin.conf stop
  5. 查询余额:./dogecoin-cli -conf=/data/dogecoin/dogecoin.conf getbalance
  6. 监听区块数据:./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 & 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

weixin_41997115

您的鼓励是我最大的动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值