技術(shù)討論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 啟動(dòng)命令
geth attach 開啟JavaScript控制臺(tái)
geth --networkid “a”? a為網(wǎng)絡(luò)id (輸入>2的任意數(shù)字即可啟動(dòng)私鏈)
geth --testnet? 連接到以太坊測(cè)試鏈
geth --rpc 啟動(dòng)HTTP-RPC服務(wù)
geth --rpccorsdomain? 設(shè)置請(qǐng)求ip白名單 * 為所有
常用組合命令? geth --networkid "888" --rpccorsdomain="*" --rpc
1.2 JavaScript控制臺(tái)常用命令
admin.nodeInfo? 查詢當(dāng)前節(jié)點(diǎn)信息
admin.peers 查詢已連接的節(jié)點(diǎn)信息
etc.accounts 查詢賬戶列表信息
personal.newAccount(“123456")
創(chuàng)建新的賬戶 123456 為密碼
personal.unlockAccount(‘0xaaa…’, '123456', 1000)
解鎖賬戶0xaaa… 密碼為 123456? 解鎖時(shí)間? 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? 相關(guān)名詞解釋
請(qǐng)參考http://www.ethfans.org/topics/102