以太坊計(jì)劃過度到pos共識(shí)機(jī)制,這使得挖礦變得過時(shí)。
-
開啟挖礦
//--mine開啟挖礦,不帶這個(gè)參數(shù),啟動(dòng)的節(jié)點(diǎn)不會(huì)挖礦 //--minnerthreads 挖礦的線程數(shù),默認(rèn)是CPU核心數(shù) geth --mine --minerthreads=1 -
可以在console中開啟或者停止挖礦
>miner.start(8) //開啟8個(gè)線程挖礦 true >miner.stop() //停止挖礦 true -
設(shè)置挖礦收益賬號(hào)
geth --etherbase 1 --mine //設(shè)置第二個(gè)賬號(hào)為挖礦收益賬號(hào) geth --etherbase '0x32a6d3706ac2f88c86058cf204f325fe0660038d' --mine //設(shè)置賬號(hào)地址為挖礦收益賬號(hào) -
設(shè)置挖礦收益賬號(hào)(console)
miner.setEtherbase(eth.accounts[2]) -
設(shè)置額外信息
miner.setExtra("liangbin extra") -
獲取計(jì)算hash速度 H/s(Hash operations per second)
>miner.hashrate -
獲取挖礦收益值
> eth.getBalance(eth.coinbase).toNumber(); 70000000000000000000 -
解鎖賬號(hào),否則不能花費(fèi)以太
> personal.unlockAccount(eth.coinbase) Unlock account 0x8cc4c2455b2d06b535606becc2f95e6a8b3ca258 Passphrase: true -
查看哪些區(qū)塊是我挖出的
-
定義js方法并保存在/home/lb/go-ethereum1.8.4/jsdir/minedBlocks.js
function minedBlocks(lastn, addr) { addrs = []; if (!addr) { addr = eth.coinbase } limit = eth.blockNumber - lastn for (i = eth.blockNumber; i >= limit; i--) { if (eth.getBlock(i).miner == addr) { addrs.push(i) } } return addrs } // scans the last 1000 blocks and returns the blocknumbers of blocks mined by your coinbase // (more precisely blocks the mining reward for which is sent to your coinbase). minedBlocks(1000, eth.coinbase); //[352708, 352655, 352559]-
進(jìn)入console環(huán)境并加載js文件
geth console > loadScript("/home/lb/go-ethereum1.8.4/jsdir/minedBlocks.js") true -
調(diào)用方法
> minedBlocks(20, eth.coinbase); [2318, 2317, 2316, 2315, 2314, 2313, 2312]
-
-
歡迎加入我的星球
我正在「哈斯卡和他的朋友們」和朋友們討論有趣的話題,你一起來吧

我的星球.jpg