安装步骤如下:
1、下载GO语言安装包:https://storage.googleapis.com/golang/go1.10.darwin-amd64.pkg
GO语言开发环境参考
https://www.cnblogs.com/heinoc/p/3801161.html
2、安装以太坊
brew install ethereum
3、钱包下载页面:
http://ethfans.org/wikis/Ethereum-Wallet-Mirror
https://github.com/ethereum/mist/releases
Mac以太坊构建本地私有网络 https://segmentfault.com/a/1190000013635759
常用命令
#开发
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节点。
修改后内容如下(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