IT数码 购物 网址 头条 软件 日历 阅读 图书馆
TxT小说阅读器
↓语音阅读,小说下载,古典文学↓
图片批量下载器
↓批量下载图片,美女图库↓
图片自动播放器
↓图片自动播放器↓
一键清除垃圾
↓轻轻一点,清除系统垃圾↓
开发: C++知识库 Java知识库 JavaScript Python PHP知识库 人工智能 区块链 大数据 移动开发 嵌入式 开发工具 数据结构与算法 开发测试 游戏开发 网络协议 系统运维
教程: HTML教程 CSS教程 JavaScript教程 Go语言教程 JQuery教程 VUE教程 VUE3教程 Bootstrap教程 SQL数据库教程 C语言教程 C++教程 Java教程 Python教程 Python3教程 C#教程
数码: 电脑 笔记本 显卡 显示器 固态硬盘 硬盘 耳机 手机 iphone vivo oppo 小米 华为 单反 装机 图拉丁
 
   -> 区块链 -> 搭建自己的以太坊矿池|ETH POOL|ETH矿池搭建 -> 正文阅读

[区块链]搭建自己的以太坊矿池|ETH POOL|ETH矿池搭建


前言

本教程将手把手教你如何搭建自己的简易以太坊矿池。


一、服务器要求

要求配置:最低16G内存,500G硬盘(建议32G内存,1T硬盘)以同步以太坊数据,系统请使用Ubuntu 16.04 LTS。

二、操作步骤

1.环境初始化

使用root用户登录,执行如下命令:

sudo apt-get update
sudo apt-get dist-upgrade

2.安装依赖

apt-get install curl git make -y
apt-get install build-essential libtool autotools-dev autoconf pkg-config libssl-dev -y
apt-get install libboost-all-dev git npm nodejs nodejs-legacy libminiupnpc-dev redis-server -y
apt-get install libdb4.8-dev libdb4.8++-dev -y
apt-get install golang -y
apt-get install nginx -y

安装NODE版本管理工具n:

npm install -g n

要安装最新的 Node.js 版本,请运行以下命令:

n latest

更新软件库并安装Ethereum:

sudo apt-get install software-properties-common -y
sudo add-apt-repository -y ppa:ethereum/ethereum
sudo apt-get update
sudo apt-get install ethereum

创建ETH账户:

geth account new

启动geth客户端开始同步区块数据(使用nohup和&后台运行,并生成实时日志nohup.out):

mkdir /home/ethdata
nohup geth -datadir "/home/ethdata"  --http --http.addr 127.0.0.1  --http.corsdomain="*" --http.api "eth,net,personal,admin"   --http.port 50002 --syncmode "full" --maxpeers 100 --cache 2048 --allow-insecure-unlock &

运行完以上命令,如果没有错误,geth客户端就会开始同步区块了.

3.下载并配置运行矿池

配置并启动池:

git config --global http.https://gopkg.in.followRedirects true
git clone https://github.com/sammy007/open-ethereum-pool.git
git clone https://github.com/fuckgm/ethereum-pool

把ethereum-pool目录的文件复制到open-ethereum-pool目录中覆盖原有文件,并配置config.json文件:

{
  "threads": 2,
  "coin": "eth",
  "name": "main",
  
  "proxy": {
    "enabled": true,
    "listen": "0.0.0.0:9999",
    "limitHeadersSize": 1024,
    "limitBodySize": 256,
    "behindReverseProxy": false,
    "stratum": {
      "enabled": true,
      "listen": "0.0.0.0:8008",
      "timeout": "120s",
      "maxConn": 8192
    },
	
    "blockRefreshInterval": "120ms",
    "stateUpdateInterval": "3s",
    "difficulty": 2000000000,
    "healthCheck": true,
    "maxFails": 100,
    "hashrateExpiration": "3h",

    "policy": {
      "workers": 8,
      "resetInterval": "60m",
      "refreshInterval": "1m",
      "banning": {
        "enabled": false,
        "ipset": "blacklist",
        "timeout": 1800,
        "invalidPercent": 30,
        "checkThreshold": 30,
        "malformedLimit": 5
      },
      "limits": {
        "enabled": false,
        "limit": 30,
        "grace": "5m",
        "limitJump": 10
      }
    }
  },

  "api": {
    "enabled": true,
    "listen": "0.0.0.0:8080",
    "statsCollectInterval": "5s",
    "purgeInterval": "10m",
    "hashrateWindow": "30m",
    "hashrateLargeWindow": "3h",
    "luckWindow": [64, 128, 256],
    "payments": 50,
    "blocks": 50,
    "purgeOnly": false
  },

  "upstreamCheckInterval": "5s",
  "upstream": [
    {
      "name": "main",
      "url": "http://127.0.0.1:50002", 
      "timeout": "10s"
    },
    {
      "name": "backup",
      "url": "http://127.0.0.2:50002",
      "timeout": "10s"
    }
  ],

  "redis": {
    "endpoint": "127.0.0.1:6379",
    "poolSize": 10,
    "database": 0,
    "password": ""
  },

  "unlocker": {
    "enabled": false,
    "poolFee": 1.0,
    "poolFeeAddress": "0x7f1dC5932a1A6C860Cf5949cD66883111baFd954",
    "donate": true,
    "depth": 120,
    "immatureDepth": 20,
    "keepTxFees": false,
    "interval": "10m",
    "daemon": "http://127.0.0.1:50002",
    "timeout": "10s"
  },

  "payouts": {
    "enabled": false,
    "requirePeers": 25,
    "interval": "12h",
    "daemon": "http://127.0.0.1:50002",
    "timeout": "10s",
    "address": "0x7f1dC5932a1A6C860Cf5949cD66883111baFd954",
    "autoGas": true,
    "gas": "21000",
    "gasPrice": "50000000000",
    "threshold": 500000000,
    "bgsave": false
  }
}

附配置文件(带备注):

{
  // Set to the number of CPU cores of your server
  "threads": 2,
  // Prefix for keys in redis store
  "coin": "eth",
  // Give unique name to each instance
  "name": "main",

  "proxy": {
    "enabled": true,

    // Bind HTTP mining endpoint to this IP:PORT
    "listen": "0.0.0.0:8888",

    // Allow only this header and body size of HTTP request from miners
    "limitHeadersSize": 1024,
    "limitBodySize": 256,

    /* Set to true if you are behind CloudFlare (not recommended) or behind http-reverse
      proxy to enable IP detection from X-Forwarded-For header.
      Advanced users only. It's tricky to make it right and secure.
    */
    "behindReverseProxy": false,

    // Stratum mining endpoint
    "stratum": {
      "enabled": true,
      // Bind stratum mining socket to this IP:PORT
      "listen": "0.0.0.0:8008",
      "timeout": "120s",
      "maxConn": 8192
    },

    // Try to get new job from geth in this interval
    "blockRefreshInterval": "120ms",
    "stateUpdateInterval": "3s",
    // Require this share difficulty from miners
    "difficulty": 2000000000,

    /* Reply error to miner instead of job if redis is unavailable.
      Should save electricity to miners if pool is sick and they didn't set up failovers.
    */
    "healthCheck": true,
    // Mark pool sick after this number of redis failures.
    "maxFails": 100,
    // TTL for workers stats, usually should be equal to large hashrate window from API section
    "hashrateExpiration": "3h",

    "policy": {
      "workers": 8,
      "resetInterval": "60m",
      "refreshInterval": "1m",

      "banning": {
        "enabled": false,
        /* Name of ipset for banning.
        Check http://ipset.netfilter.org/ documentation.
        */
        "ipset": "blacklist",
        // Remove ban after this amount of time
        "timeout": 1800,
        // Percent of invalid shares from all shares to ban miner
        "invalidPercent": 30,
        // Check after after miner submitted this number of shares
        "checkThreshold": 30,
        // Bad miner after this number of malformed requests
        "malformedLimit": 5
      },
      // Connection rate limit
      "limits": {
        "enabled": false,
        // Number of initial connections
        "limit": 30,
        "grace": "5m",
        // Increase allowed number of connections on each valid share
        "limitJump": 10
      }
    }
  },

  // Provides JSON data for frontend which is static website
  "api": {
    "enabled": true,
    "listen": "0.0.0.0:8080",
    // Collect miners stats (hashrate, ...) in this interval
    "statsCollectInterval": "5s",
    // Purge stale stats interval
    "purgeInterval": "10m",
    // Fast hashrate estimation window for each miner from it's shares
    "hashrateWindow": "30m",
    // Long and precise hashrate from shares, 3h is cool, keep it
    "hashrateLargeWindow": "3h",
    // Collect stats for shares/diff ratio for this number of blocks
    "luckWindow": [64, 128, 256],
    // Max number of payments to display in frontend
    "payments": 50,
    // Max numbers of blocks to display in frontend
    "blocks": 50,

    /* If you are running API node on a different server where this module
      is reading data from redis writeable slave, you must run an api instance with this option enabled in order to purge hashrate stats from main redis node.
      Only redis writeable slave will work properly if you are distributing using redis slaves.
      Very advanced. Usually all modules should share same redis instance.
    */
    "purgeOnly": false
  },

  // Check health of each geth node in this interval
  "upstreamCheckInterval": "5s",

  /* List of geth nodes to poll for new jobs. Pool will try to get work from
    first alive one and check in background for failed to back up.
    Current block template of the pool is always cached in RAM indeed.
  */
  "upstream": [
    {
      "name": "main",
      "url": "http://127.0.0.1:8545",
      "timeout": "10s"
    },
    {
      "name": "backup",
      "url": "http://127.0.0.2:8545",
      "timeout": "10s"
    }
  ],

  // This is standard redis connection options
  "redis": {
    // Where your redis instance is listening for commands
    "endpoint": "127.0.0.1:6379",
    "poolSize": 10,
    "database": 0,
    "password": ""
  },

  // This module periodically remits ether to miners
  "unlocker": {
    "enabled": false,
    // Pool fee percentage
    "poolFee": 1.0,
    // Pool fees beneficiary address (leave it blank to disable fee withdrawals)
    "poolFeeAddress": "",
    // Donate 10% from pool fees to developers
    "donate": true,
    // Unlock only if this number of blocks mined back
    "depth": 120,
    // Simply don't touch this option
    "immatureDepth": 20,
    // Keep mined transaction fees as pool fees
    "keepTxFees": false,
    // Run unlocker in this interval
    "interval": "10m",
    // Geth instance node rpc endpoint for unlocking blocks
    "daemon": "http://127.0.0.1:8545",
    // Rise error if can't reach geth in this amount of time
    "timeout": "10s"
  },

  // Pay out miners using this module
  "payouts": {
    "enabled": false,
    // Require minimum number of peers on node
    "requirePeers": 25,
    // Run payouts in this interval
    "interval": "12h",
    // Geth instance node rpc endpoint for payouts processing
    "daemon": "http://127.0.0.1:8545",
    // Rise error if can't reach geth in this amount of time
    "timeout": "10s",
    // Address with pool balance
    "address": "0x0",
    // Let geth to determine gas and gasPrice
    "autoGas": true,
    // Gas amount and price for payout tx (advanced users only)
    "gas": "21000",
    "gasPrice": "50000000000",
    // Send payment only if miner's balance is >= 0.5 Ether
    "threshold": 500000000,
    // Perform BGSAVE on Redis after successful payouts session
    "bgsave": false
  }
}

在ethereum-pool目录下运行:

nohup ./ethereum-pool config.json &

没有报错则运行成功.

3.Web界面前端配置

进入www目录,执行:

npm install -g ember-cli@2.9.1
npm install -g bower
npm install
bower install
./build.sh

然后编辑config/environment.js文件:

/* jshint node: true */
module.exports = function(environment) {
  var ENV = {
    modulePrefix: 'pool',
    environment: environment,
    rootURL: 'https://www.3pool.cn/', //修改为自己的域名
    locationType: 'hash',
    EmberENV: {
      FEATURES: {
        // Here you can enable experimental features on an ember canary build
        // e.g. 'with-controller': true
      }
    },

    APP: {
      // API host and port
      ApiUrl: '//api.3pool.cn:8080/',//矿池api地址
      // HTTP mining endpoint
      // HttpHost: 'http://eth.3pool.cn',
      // HttpPort: 9009,

      // Stratum mining endpoint
      // StratumHost: 'http://eth.3pool.cn',
      // StratumPort: 9999,

      // Fee and payout details
      //  PoolFee: '1%',
     // PayoutThreshold: '0.06 Ether',

      // For network hashrate (change for your favourite fork)
      BlockTime: 14.4
    }
  };

  if (environment === 'development') {
    /* Override ApiUrl just for development, while you are customizing
      frontend markup and css theme on your workstation.
    */
    ENV.APP.ApiUrl = 'https://api.3pool.cn:8080/'
    // ENV.APP.LOG_RESOLVER = true;
    // ENV.APP.LOG_ACTIVE_GENERATION = true;
    // ENV.APP.LOG_TRANSITIONS = true;
    // ENV.APP.LOG_TRANSITIONS_INTERNAL = true;
    // ENV.APP.LOG_VIEW_LOOKUPS = true;
  }

  if (environment === 'test') {
    // Testem prefers this...
    ENV.locationType = 'none';

    // keep test console output quieter
    ENV.APP.LOG_ACTIVE_GENERATION = false;
    ENV.APP.LOG_VIEW_LOOKUPS = false;

    ENV.APP.rootElement = '#ember-testing';
  }

  if (environment === 'production') {

  }

  return ENV;
};

编辑文件/etc/nginx/nginx.conf文件,并添加以下行:

upstream api {
server 127.0.0.1:8080;
}
location /api {
proxy_pass http://api;
}

至此,我们的矿池搭建完成


  区块链 最新文章
盘点具备盈利潜力的几大加密板块,以及潜在
阅读笔记|让区块空间成为商品,打造Web3云
区块链1.0-比特币的数据结构
Team Finance被黑分析|黑客自建Token“瞒天
区块链≠绿色?波卡或成 Web3“生态环保”标
期货从入门到高深之手动交易系列D1课
以太坊基础---区块验证
进入以太坊合并的五个数字
经典同态加密算法Paillier解读 - 原理、实现
IPFS/Filecoin学习知识科普(四)
上一篇文章      下一篇文章      查看所有文章
加:2022-01-24 10:55:15  更:2022-01-24 10:57:15 
 
开发: C++知识库 Java知识库 JavaScript Python PHP知识库 人工智能 区块链 大数据 移动开发 嵌入式 开发工具 数据结构与算法 开发测试 游戏开发 网络协议 系统运维
教程: HTML教程 CSS教程 JavaScript教程 Go语言教程 JQuery教程 VUE教程 VUE3教程 Bootstrap教程 SQL数据库教程 C语言教程 C++教程 Java教程 Python教程 Python3教程 C#教程
数码: 电脑 笔记本 显卡 显示器 固态硬盘 硬盘 耳机 手机 iphone vivo oppo 小米 华为 单反 装机 图拉丁

360图书馆 购物 三丰科技 阅读网 日历 万年历 2024年11日历 -2024/11/25 22:58:38-

图片自动播放器
↓图片自动播放器↓
TxT小说阅读器
↓语音阅读,小说下载,古典文学↓
一键清除垃圾
↓轻轻一点,清除系统垃圾↓
图片批量下载器
↓批量下载图片,美女图库↓
  网站联系: qq:121756557 email:121756557@qq.com  IT数码