`
yuan29346
  • 浏览: 14977 次
  • 性别: Icon_minigender_1
  • 来自: 上海
社区版块
存档分类
最新评论

以太坊入门

 
阅读更多
  创建初始化文件init.json
{
  "config": {
        "chainId": 0,
        "homesteadBlock": 0,
        "eip155Block": 0,
        "eip158Block": 0
    },
  "alloc"      : {},
  "coinbase"   : "0x0000000000000000000000000000000000000000",
  "difficulty" : "0x20000",
  "extraData"  : "",
  "gasLimit"   : "0x2fefd8",
  "nonce"      : "0x0000000000000042",
  "mixhash"    : "0x0000000000000000000000000000000000000000000000000000000000000000",
  "parentHash" : "0x0000000000000000000000000000000000000000000000000000000000000000",
  "timestamp"  : "0x00"
}

 

 
以太坊 创世区块初始化 
./geth  --datadir "/app/chain" init init.json 
以太坊启动命令
./geth --rpc --rpccorsdomain "*" --datadir "/opt/app/chain" --port "30303" --rpcapi "db,eth,net,web3" --networkid 100000 console
进入命令行,创建账户
personal.newAccount()   新账户:0x041d52ddcc8378a5551b81e81664afa4b8a9deb5  0xb0f3b7499dad48a328cac5de24df41773360ca7f
查看账户
personal.listAccounts
查看账户余额
eth.getBalance(eth.accounts[1])
web3.fromWei(eth.getBalance(eth.coinbase), "ether")
开始挖矿
miner.start(1)
停止挖矿
miner.stop()
从我们的默认账户转移1个以太币给我们新创建的账号
eth.sendTransaction({from: '0x041d52ddcc8378a5551b81e81664afa4b8a9deb5', to: '0xb0f3b7499dad48a328cac5de24df41773360ca7f', value: web3.toWei(1, "ether")})
解锁我们的转出账户,再次转账
personal.unlockAccount("0x041d52ddcc8378a5551b81e81664afa4b8a9deb5", "12345", 300)
eth.sendTransaction({from: '0x041d52ddcc8378a5551b81e81664afa4b8a9deb5', to: '0xb0f3b7499dad48a328cac5de24df41773360ca7f', value: web3.toWei(1, "ether")})

 

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics