技術討論QQ群:325411816 ?歡迎你的加入
Part 1?
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? geth
安裝
C++? bash <(curl https://install-eth.ethereum.org -L)
Go? ? bash <(curl https://install-geth.ethereum.org -L)
1.1? geth常用命令
geth console / geth 啟動命令
geth attach 開啟JavaScript控制臺
geth --networkid “a”? a為網絡id (輸入>2的任意數字即可啟動私鏈)
geth --testnet? 連接到以太坊測試鏈
geth --rpc 啟動HTTP-RPC服務
geth --rpccorsdomain? 設置請求ip白名單 * 為所有
常用組合命令? geth --networkid "888" --rpccorsdomain="*" --rpc
1.2 JavaScript控制臺常用命令
admin.nodeInfo? 查詢當前節(jié)點信息
admin.peers 查詢已連接的節(jié)點信息
etc.accounts 查詢賬戶列表信息
personal.newAccount(“123456")
創(chuàng)建新的賬戶 123456 為密碼
personal.unlockAccount(‘0xaaa…’, '123456', 1000)
解鎖賬戶0xaaa… 密碼為 123456? 解鎖時間? 1000s
eth.getBalance(‘0xaaa…’)
查詢賬戶以太幣信息
eth.sendTransaction({from: ‘0xaaa…’, to: ‘0xbbb..’, value: web3.toWei(100,? “ether")})
發(fā)送以太幣? 從0xaaa...給 0xbbb…
1.2.1 常用js方法
查詢所有賬戶以太幣信息
function checkAllBalances() { var i =0;
web3.eth.accounts.forEach( function(e){
console.log("eth.accounts["+i+"]: " +? e + "\tbalance:
"+web3.fromWei(web3.eth.getBalance(e), "ether") + " ether"); i++; })};
1.3? 相關名詞解釋
請參考http://www.ethfans.org/topics/102