MAC 以太坊環鏡安裝

安裝步驟以下:

一、下載GO語言安裝包:https://storage.googleapis.com/golang/go1.10.darwin-amd64.pkghtml

GO語言開發環境參考
http://www.javashuo.com/article/p-fmysmcus-b.htmlgit

二、安裝以太坊github

brew install ethereum

三、錢包下載頁面:golang

http://ethfans.org/wikis/Ethereum-Wallet-Mirrorweb

https://github.com/ethereum/mist/releasesjson

==Mac以太坊構建本地私有網絡 https://segmentfault.com/a/1190000013635759==segmentfault

經常使用命令

#開發
geth --dev 

#全部用戶信息
personal.listAccounts
#解鎖用戶
personal.unlockAccount(eth.accounts[0])

#查詢當前獲取幣的賬戶
eth.coinbase
# 查詢區塊高度
eth.blockNumber
#查詢全部賬戶信息
eth.accounts
# 查詢賬戶金額
eth.getBalance(eth.accounts[0])
#友好顯示賬戶金額
web3.fromWei(eth.getBalance(eth.accounts[0]),"ether")
#請求交易
eth.sendTransaction({from: "0x4008c676edcd32167d751ff8034eba8722ff9442", to: "0x0076b9c28a1ef05e85d59369c4410a097e6a1437", value: web3.toWei(1, "ether")})
另一種語法
eth.sendTransaction({from: eth.accounts[0], to: eth.accounts[1], value: web3.toWei(1, "ether")})



#設置挖礦獲取收益賬戶
miner.setEtherbase(eth.accounts[1])

# MAC 錢包打開私有鏈 /workspace/ethereum/gw/geth.ipc 私有鏈地址
./Ethereum\ Wallet.app/Contents/MacOS/Ethereum\ Wallet --rpc "/workspace/ethereum/gw/geth.ipc"

本機開發命令整理

#啓動
geth --datadir="/workspace/ethereum/my" --dev  console 2>> b

問題及解決方法

==問題:001 tag:鏈接==

<!--命令-->
geth attach http://10.8.42.91:8545
<!--報錯-->
Fatal: Failed to start the JavaScript console: api modules: Post http://10.8.42.91:8545: context deadline exceeded


====解決方法====
關閉91服務器防火牆

==問題:002 tag:初始化==

<!--命令-->
geth --datadir "/workspace/ethereum/gw" init genesis.json
<!--報錯-->
Failed to write genesis block: genesis has no chain configuration

解決方法:修改genesis.json,增長config節點。api

修改後內容以下(genesis.json):服務器

{
  "config": {
    "chainId": 10,
    "homesteadBlock": 0,
    "eip155Block": 0,
    "eip158Block": 0
  },
  "nonce": "0x0000000000000042",
  "timestamp": "0x0",
  "parentHash":"0x0000000000000000000000000000000000000000000000000000000000000000",
  "gasLimit": "0x80000000",
  "difficulty": "0x400",
  "mixhash":"0x0000000000000000000000000000000000000000000000000000000000000000",
  "coinbase": "0x3333333333333333333333333333333333333333",
  "alloc": {
  }
}

參考:http://blog.csdn.net/superswords/article/details/75049323網絡

相關文章
相關標籤/搜索