Mac 安裝 Ethereum(以太坊) geth

安裝基礎(chǔ)依賴

xcode-select –install

安裝包管理工具

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

安裝以太坊

brew update
brew tap ethereum/ethereum
brew install ethereum

測試安裝結(jié)果

geth --help

以太默認(rèn)安裝路徑

/usr/local/Cellar/ethereum/版本(我的版本是1.8.2,所以下面的命令中的路徑都是1.8.2,如果你的是其他版本,請?zhí)鎿Q路徑)

客戶端啟動(dòng)

  • 創(chuàng)建 piccgenesis.json 文件,內(nèi)容如下
{

 "config": {

    "chainId": 10,

    "homesteadBlock": 0,

    "eip155Block": 0,

    "eip158Block": 0

  },

 "alloc"   : {},

 "coinbase" : "0x0000000000000000000000000000000000000000",

 "difficulty" : "0x1",

 "extraData" : "",

 "gasLimit" : "0xffffffffffffffff",

 "nonce"   : "0x42",

 "mixhash"  : "0x0000000000000000000000000000000000000000000000000000000000000000",

 "parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000",

 "timestamp" : "0x00"

}
  • piccgenesis.json 文件放入 /usr/local/Cellar/ethereum/1.8.2/bin 路徑
  • 執(zhí)行初始化命令
open /usr/local/Cellar/ethereum/1.8.2/bin/
cd /usr/local/Cellar/ethereum/1.8.2/bin/
mkdir /usr/local/Cellar/ethereum/1.8.2/bin/chain
geth --datadir "/usr/local/Cellar/ethereum/1.8.2/bin/chain" init piccgenesis.json
  • 啟動(dòng)客戶端
geth --identity "PICCetherum" --rpc --rpccorsdomain "*" --datadir "/usr/local/Cellar/ethereum/1.8.2/bin/chain" --port 8545 --networkid 95518

客戶端連接

客戶端連接有兩種方案.

  • 命令行連接
geth attach /usr/local/Cellar/ethereum/1.8.2/bin/chain/geth.ipc
  • 錢包圖形界面連接

下載官方圖形界面錢包https://www.ethereum.org/,安裝界面(注意啟動(dòng)方式與應(yīng)用程序不同,如果 雙擊 啟動(dòng),將會(huì)啟動(dòng)新的線程.連接的并不是你啟動(dòng)的客戶端.程序再啟動(dòng)一個(gè)客戶端),使用命令啟動(dòng)"/Applications/Ethereum Wallet.app/Contents/MacOS/Ethereum Wallet" --rpc http://127.0.0.1:8545

命令創(chuàng)建用戶

personal.newAccount('test-account-1') (test-account-1為賬戶鑰匙)

命令行挖礦

啟動(dòng)礦機(jī) miner.start()

停止礦機(jī) miner.stop()

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請結(jié)合常識與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

友情鏈接更多精彩內(nèi)容