美文网首页
以太坊命令

以太坊命令

作者: 坠叶飘香 | 来源:发表于2018-08-06 18:54 被阅读0次

    1.解锁账户

    personal.unlockAccount(eth.accounts[0])
    Unlock account 0x593f30c2b86449893f3e2fe24a98d9f2a0034421
    Passphrase:
    true

    2.列出所有地址

    eth.accounts
    ["0x593f30c2b86449893f3e2fe24a98d9f2a0034421", "0xc7bd2ff6f02237eba282f6fcd9f4e6f56bfec5c5", "0x1cd142874456efb00076c37f77ce5242687ced79"]

    3.发起交易

    字符转换 http://www.bejson.com/convert/ox2str/
    字符串:HELLO! 16进制:0x48454c4c4f21

    > eth.sendTransaction({from: eth.accounts[0], to: "0xc7bd2ff6f02237eba282f6fcd9f4e6f56bfec5c5", value: web3.toWei(1, "ether"), data:"0x48454c4c4f21"})
    INFO [08-06|17:29:17] Submitted transaction                    fullhash=0xa6d98ebda3dfb14eb39c5a370c6207aa8b32cfd2d4063ade68fd30fff1504e95 recipient=0xc7bD2ff6F02237ebA282f6Fcd9f4e6f56bfEc5C5
    

    4.创建账户

    > personal.newAccount("密码")
    "0x36f3aea6646d3e90c6f0f81b73086954d7f5eaae"
    

    5.通过区块高度获得区块信息

    > eth.getBlock(1)
    {
      difficulty: 249472,
      extraData: "0xd883010810846765746888676f312e31302e31856c696e7578",
      gasLimit: 4290772993,
      gasUsed: 0,
      hash: "0x23e2c80c4e3920edcded6bc20d7662970d1c10da970ca2963a1f5c65e20d158a",
      logsBloom: "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
      miner: "0xd0e34c529c1e83018de6941c8a46bfae2b315457",
      mixHash: "0x837d943a878888e043d079f3b9baf1bb2db21a45d6facb15065d46d06d5cd9dc",
      nonce: "0x270f07179504ed53",
      number: 1,
      parentHash: "0xa0e580c6769ac3dd80894b2a256164a76b796839d2eb7f799ef6b9850ea5e82e",
      receiptsRoot: "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
      sha3Uncles: "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",
      size: 537,
      stateRoot: "0xac7bcba40904055c4929aa52db505f34f5f4f05a6221f1546cfd72885b7611a6",
      timestamp: 1537242776,
      totalDifficulty: 511616,
      transactions: [],
      transactionsRoot: "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",
      uncles: []
    }
    

    相关文章

      网友评论

          本文标题:以太坊命令

          本文链接:https://www.haomeiwen.com/subject/vsmgvftx.html