2018年5月6日 星期日

Mac OS 用 Geth 跑 ETH ethereum node 全節點


https://github.com/ethereum/go-ethereum/wiki/Installation-Instructions-for-Mac


brew tap ethereum/ethereum
brew install ethereum

然後跑

geth --syncmode "fast" --cache=1024

就會開始 sync 主鏈的全節點,節點會存在

database=/Users/wayne/Library/Ethereum/geth/chaindata

路徑裡,在geth 啟動時就可以看到 database 的路徑

fast 參數是 syncmode,詳細介紹: https://everyday1percent.blogspot.com/2018/05/eth-syncmode.html



如果要 sync testnet 可以這樣:

Sync testnet (Ropsten)

```
geth --testnet --syncmode "fast" --datadir /usr/local/var/ethereum-testnet-data console 2>> /usr/local/var/log/geth.testnet.log
```

開啟 API
```
geth -- testnet  -- syncmode "fast"  -- rpc  -- rpcapi db,eth,net,web3,personal,admin  -- cache=1024  -- rpcport 8545
```

開啟 console
```
geth --testnet --syncmode "fast" console 2>> /usr/local/var/log/geth.testnet.log
```


```
echo "Geth at work!"
screen -dmS geth geth --testnet --syncmode "fast" --rpc --rpcapi db,eth,net,web3,personal --cache=1024  --rpcport 8545 --rpcaddr 0.0.0.0 --rpccorsdomain "*"
```
然後
```
geth attach http://localhost:8545
```
就可以進 console


https://ethereum.stackexchange.com/questions/392/how-can-i-get-a-geth-node-to-download-the-blockchain-quickly/4210#4210

https://medium.com/@jacksonngtech/syncing-geth-to-the-ethereum-blockchain-9571666f3cfc

沒有留言:

張貼留言