安裝基礎(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()