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
標籤:
BlockChain,
Ethereum
eth syncmode
還不是很確定,先翻譯貼過來
Full - 拿到所有資料
Fast - 差不多的意思,但不執行transaction
Light - 只拿到現在的狀態,但不能驗證
https://ethereum.stackexchange.com/questions/11297/what-is-geths-light-sync-and-why-is-it-so-fast
更好的解釋:
主要是fast 跟 full 的差別
full 可以驗證每個 state,但 fast 因為只有 process 最近的 transactions,所以不能驗證舊的 state
https://ethereum.stackexchange.com/questions/1161/what-is-geths-fast-sync-and-why-is-it-faster
https://github.com/ethereum/go-ethereum/pull/1889
標籤:
BlockChain,
Ethereum
訂閱:
文章 (Atom)