欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

unomp比特币矿池搭建

程序员文章站 2022-05-21 10:43:18
...
bitcoin钱包安装

安装bitcoin
apt-get install software-properties-common

wget https://bitcoin.org/bin/bitcoin-core-0.20.0/bitcoin-0.20.0-x86_64-linux-gnu.tar.gz
tar -zxvf bitcoin-0.20.0-x86_64-linux-gnu.tar.gz
cp bitcoin-0.20.0/bin/* /usr/bin

修改配置
mkdir ~/.bitcoin
vim ~/.bitcoin/bitcoin.conf 添加如下内容
rpcuser=rpc用户名
rpcpassword=rpc密码
server=1
rpcallowip=127.0.0.1
rpcport=8332
port=8333
daemon=1

启动bitcoind,这里先使用测试网络testnet,区块数据写入文件夹/test_btc_data中:
mkdir /test_btc_data
bitcoind -datadir=/test_btc_data -testnet -daemon


矿池程序unomp安装

安装redis-server
apt-get install redis-server

安装node管理器:
apt-get install build-essential libssl-dev
wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash
source ~/.bashrc

安装node:
注意:这里一定要安装0.10.25,不要安装高版本
nvm install 0.10.25
nvm use 0.10.25

git clone https://github.com/UNOMP/unified-node-open-mining-portal.git unomp
cd unomp
npm update

进入unomp,cp config.json.example config.json, 修改config.json

{
    "logLevel": "debug",
    "logColors": true,
    "cliPort": 17117,
    "clustering": {
        "enabled": true,
        "forks": "auto"
    },

    "defaultPoolConfigs": {
        "blockRefreshInterval": 1000,
        "jobRebroadcastTimeout": 55,
        "connectionTimeout": 600,
        "emitInvalidBlockHashes": false,
        "validateWorkerUsername": true,
        "tcpProxyProtocol": false,
        "banning": {
            "enabled": true,
            "time": 600,
            "invalidPercent": 50,
            "checkThreshold": 500,
            "purgeInterval": 300
        },
        "redis": {  ## redis配置
            "host": "127.0.0.1",
            "port": 6379,
            "db": 0,
            "password": ""
        }
    },

    "website": {
        "enabled": true,
        "host": "0.0.0.0",  ## 绑定ip
        "siteTitle": "UNOMP Beta", ## 网站标题
        "port": 80,  ## 端口
        "stratumHost": "pool.unomp.org",
        "stats": {
            "updateInterval": 60,
            "historicalRetention": 43200,
            "hashrateWindow": 300,
            "graphColors": ["#058DC7", "#50B432", "#ED561B", "#DDDF00", "#24CBE5", "#64E572",
            "#FF9655", "#FFF263", "#6AF9C4"]
        },
        "adminCenter": {
            "enabled": true,
            "password": "password"  ## web网站密码
        }
    },

    "redis": {  ## redis连接
        "host": "127.0.0.1",
        "port": 6379,
        "db": 0,
        "password": ""
    },

    "switching": {
        "switch1": {
            "enabled": false,
            "algorithm": "sha256",  ## 算法
            "ports": {
                "3333": {
                    "diff": 10,  ## 难度
                    "varDiff": {
                        "minDiff": 16,
                        "maxDiff": 512,
                        "targetTime": 15,
                        "retargetTime": 90,
                        "variancePercent": 30
                    }
                }
            }
        },
        "switch2": {
            ##算法2
        },
        "switch3": {
            ##算法3
          }
    },

    "profitSwitch": {
        "enabled": false,
        "updateInterval": 600,
        "depth": 0.90,
        "usePoloniex": true,
        "useBittrex": true
    }
}

cd pool_configs
cp litecoin.json.example bitcoin.json
vim bitcoin.json

{
    "enabled": true,
    "coin": "bitcoin.json",
    "auxes": [],
    "address": "1PmCjwvrw2Vw7GbWfYx6z4aSU3hz8CvxJL", ## 比特币地址,矿池挖到的币支付到这里
    "rewardRecipients": {
        "1PmCjwvrw2Vw7GbWfYx6z4aSU3hz8CvxJL": 0  ## 将0%的币奖励给这个地址
    },

    "paymentProcessing": {
        "enabled": true,
        "paymentInterval": 600,
        "minimumPayment": 0.01,
        "daemon": {
            "host": "127.0.0.1",
            "port": 8332,
            "user": "root",  ## bitcoind配置文件中的rpcuser和rpcpassword
            "password": "123456"
        }
    },

    "ports": {
        "3008": {
            "diff": 8
        },
        "3032": {
            "diff": 64,
            "varDiff": {
                "minDiff": 8,
                "maxDiff": 512,
                "targetTime": 15,
                "retargetTime": 90,
                "variancePercent": 30
            }
        },
        "3256": {
            "diff": 256
        }
    },

    "daemons": [
        {
            "host": "127.0.0.1",
            "port": 8332,  ## bitcoind配置文件中的rpcport
            "user": "root",  ## bitcoind配置文件中的rpcuser和rpcpassword
            "password": "123456"
        }
    ],
    "p2p": {
        "enabled": false,
        "host": "127.0.0.1",
        "port": 8333, ## bitcoind配置文件中的port
        "disableTransactions": false
    },

    "mposMode": {
        "enabled": false,
        "host": "127.0.0.1",
        "port": 3306,
        "user": "me",
        "password": "mypass",
        "database": "ltc",
        "checkPassword": false,
        "autoCreateWorker": false
    }

}

启动服务:
node init.js

访问:
http://指定的ip


错误集锦:
npm update 报错 bignum相关错误可以尝试单独安装  npm i bignum
npm update 报错 multihashing 相关错误可以尝试单独安装  npm i multihashing