準(zhǔn)備工具:
- geth
- eth錢(qián)包下載:https://github.com/ethereum/mist/releases
cd ~/Library/Ethereum/
cat > genesis.json
{
"nonce": "0x0000000000000042",
"difficulty": "0x020000",
"mixhash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"coinbase": "0x0000000000000000000000000000000000000000",
"timestamp": "0x00",
"parentHash": "0x0000000000000000000000000000000000000000000000000000000000000000",
"extraData": "0x11bbe8db4e347b4e8c937c1c8370e4b5ed33adb3db69cbdb7a38e1e50b1b82fa",
"gasLimit": "0x4c4b40",
"config": {
"chainId": 15,
"homesteadBlock": 0,
"eip155Block": 0,
"eip158Block": 0
},
"alloc": {
"0x0000000000000000000000000000000000000001": {"balance": "111111111"},
"0x0000000000000000000000000000000000000002": {"balance": "222222222"}
}
}
geth init genesis.json
// 主網(wǎng)id是1,測(cè)試網(wǎng)絡(luò)是2/3/4.
geth --networkid 10 --rpc --rpcapi "admin,debug,eth,miner,net,personal,shh,txpool,web3" rpcaddr "0.0.0.0" --rpccorsdomain "*" --nodiscover --dev console
打開(kāi), mist 錢(qián)包 ,自動(dòng)進(jìn)入私鏈
創(chuàng)建錢(qián)包;
另開(kāi)一個(gè)終端:
geth attach 'http://127.0.0.1:8545'
miner.start(1)
//如果出現(xiàn)端口被占用
lsof -i:30303
//找到pid
kill -9 pid
//如果沒(méi)有l(wèi)sof 的話..
brew install lsof