1.准备环境


## 安装依赖
yum -y install openssl-devel zlib-devel libtool automake autoconf make  
yum -y install git gcc gcc-c++    
## 安装go语言环境
wget https://golang.google.cn/dl/go1.16.15.linux-amd64.tar.gz   
## 配置go的环境变量  
#设置 go 代理
go env -w GOPROXY=https://goproxy.cn,direct  

## 下载代码
#git clone https://github.com/ethereum/go-ethereum.git
## pow共识版本
#git reset --hard 141cd425310b503c5678e674a8c3872cf46b7086  

git clone https://github.com/fedimoss/go-ethereum.git  
## 编译
make geth  
## 或者直接编译,没有提示语
# go run build/ci.go install ./cmd/geth

## Done building.
## Run "./build/bin/geth" to launch geth.

## 构建全部程序
# make all  

## 软连接,方便测试
ln -s ./build/bin/geth ./

2.启动程序

创世块配置(genesis.json)

{
    "config":{
        "chainId":2024,
        "homesteadBlock":0,
        "daoForkSupport":false,
        "eip155Block":0,
        "eip158Block":0,
        "eip150Block":0,
        "eip150Hash":"0x0000000000000000000000000000000000000000000000000000000000000000",
        "byzantiumBlock":0,
        "constantinopleBlock":0,
        "petersburgBlock":0,
        "istanbulBlock":0,
        "muirGlacierBlock":0,
        "berlinBlock":0,
        "londonBlock":0,
        "arrowGlacierBlock":0,
        "grayGlacierBlock":0,
        "ethash": {}
    },
    "coinbase":"0x0000000000000000000000000000000000000000",
    "difficulty":"0x400000000",
    "extraData":"",
    "gasLimit":"0x2cd29c0",
    "nonce":"0x121eb8a",
    "mixhash":"0x0000000000000000000000000000000000000000000000000000000000000000",
    "parentHash":"0x0000000000000000000000000000000000000000000000000000000000000000",
    "timestamp":"0x25c85d00",
    "alloc":{}
}

配置参数详解

config: 这个部分包含了一系列的网络配置参数,用于定义您的私有链的行为和规则.
chainId: 私有链的唯一标识符.在这个示例中,chainId 设置为 2024.
homesteadBlock: 切换到 Homestead 协议版本的块高度.在这个示例中,设置为 0,表示从创世块就采用 Homestead 协议.
daoForkBlock: 切换到 DAO 协议版本的块高度,新链不要设置.如果设置为0,会出现Error: bad DAO pro-fork extra-data.
daoForkSupport: 指定是否支持 DAO 分叉.在这个示例中,设置为 false,不支持 DAO 分叉.
byzantiumBlockconstantinopleBlockeip155Blockeip158Blockeip150Block: 类似于 homesteadBlock,分别指定了切换到对应协议版本的块高度.
eip150Hash: 一个用于安全性的哈希值,与 EIP-150 相关.
coinbase: 矿工的账户地址,用于接收挖矿奖励.在这个示例中,设置为一个全零的地址.
difficulty: 难度目标值,它控制了挖矿的难度.在这个示例中,设置为 0x400000000,测试环境建议调小难度.
extraData: 附加的数据,通常在挖矿过程中包含一些附加信息.
gasLimit: 每个区块所允许的最大燃料消耗量.在这个示例中,设置为 0x1388,表示最大值.
nonce: 一个随机数,用于标识区块的唯一性.在这个示例中,设置为一个非零的值.
mixhash: 一个用于工作量证明的哈希值,与挖矿相关.
parentHash: 前一个区块的哈希值,用于构建区块链.
timestamp: 区块的时间戳,表示区块创建的时间.在这个示例中,设置为 0x00,表示创世块的时间戳.
alloc: 初始分配的以太币和其他代币

启动geth

## 初始化写入创世区块  
./geth init --datadir data genesis.json
# Successfully wrote genesis state 表示成功初始化  

## 启动geth  
./geth --datadir data --networkid 2024  --syncmode "full"  --cache 18000 --rpc.allow-unprotected-txs --txlookuplimit 0 --http --http.addr "0.0.0.0" --http.port 8545 --http.corsdomain "*" --http.api "net,web3,eth" --port 30303 --authrpc.addr "0.0.0.0" --authrpc.port 8551 --allow-insecure-unlock --mine console 2>>geth.log

## nohup ./geth --datadir data --networkid 2024  --http --http.api "net,web3,eth" --http.port 8545 --http.corsdomain "*"  --http.addr "0.0.0.0" --port 30303 --mine  &

## Welcome to the Geth JavaScript console! 表示启动成功
## 写入账号密码
echo "123456" > password

### 打开控制台
./geth attach --datadir ./data

geth: 这是执行 geth 客户端的命令.
--datadir: 这个选项指定了数据目录的路径,geth 将在这个目录中存储区块链数据和相关文件.
--networkid: 指定私有链的网络标识符,这个值用于在不同私有链之间进行区分.
--http: 启用 HTTP-RPC 通信接口,允许通过 HTTP 请求与 geth 进行交互.
--http.addr: 设置 HTTP-RPC 服务监听的地址,0.0.0.0 表示允许来自任何 IP 地址的连接.
--http.port: 指定 HTTP-RPC 服务的端口号,一般是 8545.
--http.corsdomain: 配置允许跨域请求的域名,设置为 "*" 表示允许任何域名进行跨域请求.
--http.api: 指定启用的 HTTP-RPC 接口,这里列出了一些常用的接口, "db,eth,net,web3,personal,web3" 包括数据库、以太坊操作、网络信息、Web3 功能和个人账户操作.
--port: 设置 geth 节点的 P2P 网络端口,用于节点间的通信,默认 30303.
--allow-insecure-unlock: 允许以不安全的方式解锁账户.这在测试环境中使用,允许在 HTTP-RPC 上发送解锁账户的请求,但在生产环境中不建议使用.
--mine: 开启挖矿,需要先 ./geth --datadir data account new 创建一个矿工.
--ipcdisable: 每个节点ipc唯一或者禁用ipc,使用参数--ipcpath或者--ipcdisable
--nodiscover: geth.toml参数为 NoDiscovery = true 说明该节点不能被发现.只是能不能被发现的区别,都是可以被连接的.
--nat extip:: 指定节点IP,其他节点尝试连接指定的IP,解决内网中的节点通信问题.

控制台操作

// 打开控制台
./geth attach --datadir ./data

//查询账户
eth.accounts

// 新开窗口,使用geth创建一个新的账户
// 需要指定你的datadir文件加,否则会创建在默认的文件夹下,务必记录私钥文件
// ./geth --datadir data account new

//再次查询账户
eth.accounts

// exit 退出控制台,可以使用 geth console 重新进入控制台

//设置矿工address,刚才创建的账户  
miner.setEtherbase("0x81694fa39b1e810823810e4ffa2afc82820fa0a3")

//开始挖矿  
miner.start()

//停止挖矿  
miner.stop()

//查询挖矿余额  
web3.fromWei(eth.getBalance(eth.coinbase), "ether")
web3.fromWei(eth.getBalance(eth.accounts[0]), "ether")
web3.fromWei(eth.getBalance("0x9C4205bb28B4AC92e58D8f09Fb1D4381ACaE34dc"), "ether")

//查看当前矿工算力
miner.hashrate

// 查询区块高度  
eth.blockNumber

// 查询区块信息  
eth.getBlock(1)

// 查询交易信息  
eth.getTransaction("0x8d37acc5da863a56f39c87aca0767f699135427575188d4fc59078509d3d8a1f")
 
// 查询交易信息  
eth.getTransactionReceipt("0x4c85d0859065ce1d15db33b8423c29cf36c41beb1253b0f10b72af3a36aaa57b")

// 查看本机节点信息  
admin.nodeInfo

//查看peers  
admin.peers

//查看网络状态  
net.peerCount

//查看同步状态  
eth.syncing

//查看挖矿状态  
miner.status

//退出
exit 

//转账

//1.解锁
personal.unlockAccount("0x91fB03D7042906c1db67d9e16966f0feB34D8A6C","123456")

//2.转账,地址使用双引号
//amount=web3.toWei(10,"ether")
//eth.sendTransaction({from:eth.accounts[0],to:eth.accounts[1],value:amount})
eth.sendTransaction({from:"0x91fB03D7042906c1db67d9e16966f0feB34D8A6C", to:"0xDd42A396d7E47475f3D9099e0CF3403a835Debb4", value:web3.toWei(10,"ether")})
//返回交易hash
// 查询交易信息  
eth.getTransaction("0x248eaf614820b79b2d2f2a75e0bb62f99a5ef231ab89dfb2917a180cedf5f932")

//3.查询余额
web3.fromWei(eth.getBalance("0xe3a970a8E105Ce624bDb4667A2507D352695b026"), "ether")


// 添加其他节点
admin.addPeer("enode://<enode-info>")  

验证私链

// 使用钱包生成账户私钥,并控制台导入
//web3.ssh.addPrivateKey("0xcf2bde5348c5f66b9672f442021e23ca154ba8a0b19ea490786145aec18df285").then(console.log);
//web3.eth.accounts.privateKeyToAccount("0xcf2bde5348c5f66b9672f442021e23ca154ba8a0b19ea490786145aec18df285");

## 没有0x前缀的私钥
echo "cf2bde5348c5f66b9672f442021e23ca154ba8a0b19ea490786145aec18df285" > 0xDd42A396d7E47475f3D9099e0CF3403a835Debb4.txt
## 暂停控制台挖矿,导入账户
./geth --datadir data account import 0xDd42A396d7E47475f3D9099e0CF3403a835Debb4.txt
## 查询账户
eth.accounts

发布合约

使用remix/sdk发布合约测试

多节点

参考: https://geth.ethereum.org/docs/fundamentals/private-network

注意:bootnode使用UDP协议,不是TCP协议,防火墙设置时一定要注意!!!!!!!!!!!!

bootnode

bootnode是一个专门用于网络引导和节点发现的节点,而普通节点是实际参与网络运作的节点.bootnode不直接参与交易验证或区块生成,其主要作用是为其他节点提供连接信息,帮助网络中的新节点加入并构建整个区块链网络.
gethbootnode 是以太坊的两个不同组件,各自有着不同的作用和功能.虽然它们都是以太坊客户端的一部分,但它们并不完全相同,因此不能完全互相替代.

## 编译bootnode
cd cmd/bootnode 
go build -o bootnode

## 生成 boot.key
./bootnode -genkey boot.key

##启动bootnode
###默认bootnode必须是公网IP,如果使用内网,可以使用netrestrict参数限制网络. -verbosity 5 显示debug日志,用于问题排查
#./bootnode -nodekey boot.key -addr :30301 -netrestrict 192.168.1.1/24 -verbosity 5
./bootnode -nodekey boot.key -addr :30301

## 输出如下
#enode://c53daebd8946a1aa617d38d52fa64c4671c9cc8c818288b0f6ebf6b11bafb12a736e6140930a03fa816323ab0aa5d40a061d9c0a23d929b8ae9a5941b813f41c@127.0.0.1:0?discport=30301

##enode可以简写如下,配置到geth.toml的 BootstrapNodes 和 BootstrapNodesV5
#c53daebd8946a1aa617d38d52fa64c4671c9cc8c818288b0f6ebf6b11bafb12a736e6140930a03fa816323ab0aa5d40a061d9c0a23d929b8ae9a5941b813f41c@192.168.1.121:30301


启动多个节点


// 查看第一个节点的 enode
admin.nodeInfo.enode

// 1. 使用相同的配置初始化创世块
./geth init --datadir data genesis.json
// 建议手动验证一下创世块的hash

// 2. 生成配置文件
./geth --datadir data --networkid 2024  --syncmode "full"  --cache 18000 --rpc.allow-unprotected-txs --txlookuplimit 0 --http --http.addr "0.0.0.0" --http.port 8545 --http.corsdomain "*" --http.api "net,web3,eth" --port 30303 --authrpc.addr "0.0.0.0" --authrpc.port 8551 --mine  dumpconfig > ./geth2.toml
//注意 删除FilterLogCacheSize,InsecureUnlockAllowed属性,指定 IPCPath,修改 BootstrapNodes BootstrapNodesV5 StaticNodes TrustedNodes 为 ["第一个节点的enode"]   

// 3. 其他节点使用配置文件启动geth
nohup ./geth --config ./geth.toml --mine &

// 带密码启动挖矿
# nohup ./geth --config ./geth.toml --mine --unlock 0 --password ./password --allow-insecure-unlock &

// 打开控制台
// ./geth attach --datadir ./data
// 查看日志
// tail -f nohup.out

// 有控制台
// ./geth --config ./geth.toml --mine console 2>>geth.log


// 4.新节点创建矿工账户,并开启挖矿,用于同步区块
//./geth --datadir data account new
//miner.setEtherbase("0x9C4205bb28B4AC92e58D8f09Fb1D4381ACaE34dc")
//miner.start()

// 5.检查同步状态: 如果返回 false,表示该节点已经完全同步.如果返回一个对象,表示节点正在同步中.等待所有节点都完成同步
eth.syncing

// 查看加入的节点,显示连接到当前节点的其他节点列表.
admin.peers

// 查询多个节点的相同区块,验证块hash是否一致
eth.getBlock(100)

geth.toml

[Eth]
NetworkId = 2024
SyncMode = "full"
EthDiscoveryURLs = []
SnapDiscoveryURLs = []
NoPruning = false
NoPrefetch = false
TxLookupLimit = 2350000
LightPeers = 100
UltraLightFraction = 75
DatabaseCache = 9000
DatabaseFreezer = ""
TrieCleanCache = 2700
TrieCleanCacheJournal = "triecache"
TrieCleanCacheRejournal = 3600000000000
TrieDirtyCache = 4500
TrieTimeout = 3600000000000
SnapshotCache = 1800
Preimages = false
EnablePreimageRecording = false
RPCGasCap = 50000000
RPCEVMTimeout = 5000000000
RPCTxFeeCap = 1e+00

[Eth.Miner]
GasFloor = 0
GasCeil = 30000000
GasPrice = 1000000000
Recommit = 3000000000
Noverify = false

[Eth.Ethash]
CacheDir = "ethash"
CachesInMem = 2
CachesOnDisk = 3
CachesLockMmap = false
DatasetDir = "data/.ethash"
DatasetsInMem = 1
DatasetsOnDisk = 2
DatasetsLockMmap = false
PowMode = 0
NotifyFull = false

[Eth.TxPool]
Locals = []
NoLocals = false
Journal = "transactions.rlp"
Rejournal = 3600000000000
PriceLimit = 1
PriceBump = 10
AccountSlots = 16
GlobalSlots = 5120
AccountQueue = 64
GlobalQueue = 1024
Lifetime = 10800000000000

[Eth.GPO]
Blocks = 20
Percentile = 60
MaxHeaderHistory = 1024
MaxBlockHistory = 1024
MaxPrice = 500000000000
IgnorePrice = 2

[Node]
DataDir = "data"
IPCPath = "geth.ipc"
HTTPHost = "0.0.0.0"
HTTPPort = 8545
HTTPCors = ["*"]
HTTPVirtualHosts = ["localhost"]
HTTPModules = ["net", "web3", "eth"]
AuthAddr = "localhost"
AuthPort = 8551
AuthVirtualHosts = ["localhost"]
WSHost = "0.0.0.0"
WSPort = 8546
WSModules = ["net", "web3", "eth"]
GraphQLVirtualHosts = ["localhost"]
AllowUnprotectedTxs = true

[Node.P2P]
MaxPeers = 50
NoDiscovery = false
BootstrapNodes = ["enode://c53daebd8946a1aa617d38d52fa64c4671c9cc8c818288b0f6ebf6b11bafb12a736e6140930a03fa816323ab0aa5d40a061d9c0a23d929b8ae9a5941b813f41c@192.168.1.121:30301"]
BootstrapNodesV5 = ["enode://c53daebd8946a1aa617d38d52fa64c4671c9cc8c818288b0f6ebf6b11bafb12a736e6140930a03fa816323ab0aa5d40a061d9c0a23d929b8ae9a5941b813f41c@192.168.1.121:30301"]
StaticNodes = []
TrustedNodes = []
ListenAddr = ":30303"
DiscAddr = ""
EnableMsgEvents = false

[Node.HTTPTimeouts]
ReadTimeout = 30000000000
ReadHeaderTimeout = 30000000000
WriteTimeout = 30000000000
IdleTimeout = 120000000000

[Metrics]
HTTP = "127.0.0.1"
Port = 6060
InfluxDBEndpoint = "http://localhost:8086"
InfluxDBDatabase = "geth"
InfluxDBUsername = "test"
InfluxDBPassword = "test"
InfluxDBTags = "host=localhost"
InfluxDBToken = "test"
InfluxDBBucket = "geth"
InfluxDBOrganization = "geth"

GPU挖矿

挖矿软件(NBMiner) ---> 矿池软件(open-ethereum-pool) ---> 以太坊节点(geth)

不建议使用Windows,本文使用CentOS8

安装CUDA


### 安装依赖
yum -y install openssl-devel zlib-devel libtool automake autoconf make  
yum -y install gcc gcc-c++ 
yum -y install kernel-devel

## 下载最新的 CUDA驱动,已经带有显卡驱动,不要再单独安装显卡驱动了
wget https://developer.download.nvidia.com/compute/cuda/12.3.1/local_installers/cuda_12.3.1_545.23.08_linux.run

## 执行安装
chmod 755 ./cuda_12.3.1_545.23.08_linux.run
./cuda_12.3.1_545.23.08_linux.run

##等待一会,可能会有报错,提示需要禁用 nouveau ,重启一下服务器,再重新安装cuda


## 安装成功之后,会有两个提示,按照提示操作
Please make sure that
 -   PATH includes /usr/local/cuda-12.3/bin
 -   LD_LIBRARY_PATH includes /usr/local/cuda-12.3/lib64, or, add /usr/local/cuda-12.3/lib64 to /etc/ld.so.conf and run ldconfig as root

To uninstall the CUDA Toolkit, run cuda-uninstaller in /usr/local/cuda-12.3/bin
To uninstall the NVIDIA Driver, run nvidia-uninstall
Logfile is /var/log/cuda-installer.log

#1. 修改/etc/profile,把/usr/local/cuda-12.3/bin加入到PATH
export PATH=$PATH:/usr/local/cuda-12.3/bin
#2. 在/etc/ld.so.conf中增加/usr/local/cuda-12.3/lib64,然后root权限运行 ldconfig

以太坊节点

## 启动&挖矿,需要加上 --mine 配合NBMiner之类的挖矿软件,需要先 ./geth --datadir data account new 创建一个矿工
## nohup ./geth --mine --datadir data --networkid 2024  --http --http.api "net,web3,eth" --http.port 8545 --http.corsdomain "*"  --http.addr "0.0.0.0" --port 30303 --password ./password &

nohup ./geth --mine --datadir data --networkid 2024  --http --http.api "net,web3,eth" --http.port 8545 --http.corsdomain "*"  --http.addr "0.0.0.0" --port 30303 &

矿池

使用open-ethereum-pool作为矿池实现,比较简单的单矿工实现.

配置文件

### 构建后端
git clone https://github.com/fedimoss/open-ethereum-pool.git
cd open-ethereum-pool
make
go build

## 启动后端
./open-ethereum-pool config.json

##构建前端,node使用 10.x版本
cd www
npm install -g ember-cli@2.9.1
npm install -g bower
npm install
bower install

##把 www/config/environment.js 中修改为自己的 ApiUrl

##编译
./build.sh

## Nginx运行编译后的静态文件

config.json基于config.example.json修改即可:

{
    "threads": 8,
    "coin": "eth",
    "name": "main",

    "proxy": {
        "enabled": true,
        "listen": "0.0.0.0:8888",
        "limitHeadersSize": 1024,
        "limitBodySize": 256,
        "behindReverseProxy": false,
        "blockRefreshInterval": "120ms",
        "stateUpdateInterval": "3s",
        "difficulty": 17179869184,
        "hashrateExpiration": "3h",
        "healthCheck": true,
        "maxFails": 100,

        "stratum": {
            "enabled": true,
            "listen": "0.0.0.0:8008",
            "timeout": "120s",
            "maxConn": 8192
        },

        "policy": {
            "workers": 1000,
            "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,
        "purgeOnly": false,
        "purgeInterval": "10m",
        "listen": "0.0.0.0:8080",
        "statsCollectInterval": "5s",
        "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:8545",
            "timeout": "10s"
        }
    ],

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

    "unlocker": {
        "enabled": false,
        "poolFee": 10.0,
        "poolFeeAddress": "0xDB53d4eBce983Bbe87a42555300C443037234B0C",
        "donate": false,
        "depth": 120,
        "immatureDepth": 20,
        "keepTxFees": false,
        "interval": "10m",
        "daemon": "http://127.0.0.1:8545",
        "timeout": "10s"
    },

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

    "newrelicEnabled": false,
    "newrelicName": "MyEtherProxy",
    "newrelicKey": "SECRET_KEY",
    "newrelicVerbose": false
}

配置说明

注意: proxy.difficulty 要和区块链的难度一致,注意进制转换
使用浏览器访问api.listen, http://192.168.1.121:8080

  1. 通用设置

    • "threads": 设置为您服务器的CPU核心数。
    • "coin": 在Redis存储中使用的币种前缀。
    • "name": 为每个实例指定一个唯一名称。
  2. 代理设置 ("proxy"):

    • "enabled": 是否启用代理模块。
    • "listen": 绑定HTTP挖矿端点到指定的IP和端口。
    • "limitHeadersSize": 允许矿工发送的HTTP请求头部大小。
    • "limitBodySize": 允许矿工发送的HTTP请求正文大小。
    • "behindReverseProxy": 如果您位于CloudFlare后面或使用http反向代理,请设置为true以启用从X-Forwarded-For头部检测IP。
    • "stratum": Stratum挖矿端点的设置。
    • "blockRefreshInterval": 尝试从geth获取新工作的时间间隔。
    • "stateUpdateInterval": 矿工状态更新的时间间隔。
    • "difficulty": 要求矿工提交的份额难度。
    • "healthCheck": 是否进行健康检查。
    • "maxFails": 在将矿池标记为病态之前,允许的Redis故障次数。
    • "hashrateExpiration": 矿工统计信息的存活时间(TTL)。
  3. 策略设置 ("policy"):

    • "workers": 允许的矿工数量。
    • "resetInterval": 矿工统计数据的重置间隔时间。
    • "refreshInterval": 矿工统计数据的刷新间隔时间。
    • "banning": 禁止设置,包括是否启用、IP集合名称、禁止超时时间、无效份额百分比阈值、检查阈值和格式错误的请求上限。
    • "limits": 连接速率限制设置。
  4. API设置 ("api"):

    • "enabled": 是否启用API模块。
    • "listen": API模块监听的IP和端口。
    • "statsCollectInterval": 收集矿工统计数据(哈希率等)的时间间隔。
    • "purgeInterval": 清除过时统计数据的时间间隔。
    • "hashrateWindow": 用于快速估算每个矿工哈希率的时间窗口。
    • "hashrateLargeWindow": 用于精确估算哈希率的长时间窗口。
    • "luckWindow": 收集份额/难度比率统计数据的区块数量。
    • "payments": 前端显示的最大支付次数。
    • "blocks": 前端显示的最大区块数。
  5. 上游节点检查 ("upstreamCheckInterval""upstream"):

    • "upstreamCheckInterval": 检查每个geth节点健康状况的时间间隔。
    • "upstream": 用于轮询新工作的geth节点列表。
  6. Redis设置 ("redis"):

    • "endpoint": Redis实例监听命令的地址。
    • "poolSize": 连接池大小。
    • "database": 数据库编号。
    • "password": Redis连接密码。
  7. 解锁器设置 ("unlocker"):

    • "enabled": 是否启用解锁器模块。
    • "poolFee": 矿池费用百分比。
    • "poolFeeAddress": 矿池费用受益地址。
    • "donate": 是否将矿池费用的10%捐赠给开发者。
    • "depth": 解锁区块的深度。
    • "immatureDepth": 不成熟的区块深度。
    • "keepTxFees": 是否保留挖掘交易费用作为矿池费用。
    • "interval": 解锁器运行的时间间隔。
    • "daemon": 解锁区块的geth实例节点RPC端点。
  8. 支付设置 ("payouts"):

    • "enabled": 是否启用支付模块。
    • "requirePeers": 节点上要求的最小对等体数量。
    • "interval": 运行支付的时间间隔。
    • "daemon": 用于支付处理的geth实例节点RPC端点。
    • "timeout": RPC请求的超时时间。
    • "address": 带有矿池余额的地址。
    • "autoGas": 是否让geth确定Gas和GasPrice。
    • "gas": 支付交易的Gas量。
    • "gasPrice": 支付交易的Gas价格。
    • "threshold": 发送支付的矿工余额阈值。
    • "bgsave": 成功支付会话后是否执行Redis的BGSAVE操作。

挖矿软件

  • ethminer:已经不维护了,也不兼容NVidia 30系显卡
  • NBMiner:推荐使用,支持 ETH、RVN、BEAM、CFX、ZIL、ERGO、AE.

不建议使用Windows,挖矿软件的服务器是独享的,不要再安装其他软件!

wget https://dl.nbminer.com/NBMiner_42.3_Linux.tgz
tar -zxvf NBMiner_42.3_Linux.tgz
cd NBMiner_Linux
## 启动GPU挖矿
nohup ./nbminer -a ethash -o stratum+tcp://192.168.1.121:8008 --platform 1 -u 0x81694Fa39b1E810823810E4ffA2aFc82820Fa0a3.worker -log &

## -a 以太坊挖矿算法 ethash
## -o 矿池地址
## --platform 1 只使用NVidia显卡
## -u 矿工钱包地址 .work是设备名称或其他标识符,不同设备命名要区分.

## 查看算力情况
### 使用浏览器访问API默认的22333端口, http://192.168.1.233:22333  

## 查看矿工账号收益