1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
| # eth对象封装了查看交易和区块信息的方法。 # 查看当前区块总数: > eth.blockNumber 304
# 通过区块号(高度)查看区块信息,通过交易hash查看交易: > eth.getBlock(304) { difficulty: 144223, extraData: "0xd88301090e846765746888676f312e31342e32856c696e7578", gasLimit: 3191286136, gasUsed: 0, hash: "0xe544e23bc3e46ad075da379cc752d649e445fe1e4ddbce906d32b7ebab6bcf11", logsBloom: "0x00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", miner: "0x3bd8f1adf6fce874b6fc004629ccdb30f16e5283", mixHash: "0x30d20e4aac3266f4f561bb23b2eca5a1f54733ba1113ea40b4ea0ae9a22a4fb3", nonce: "0x615b10f022b804a6", number: 304, parentHash: "0xed01bbb45f9f42b4a6f0623f358995b6353a7c6a443b8c6ec5ad1c3c09f15f1b", receiptsRoot: "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", sha3Uncles: "0x1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347", size: 539, stateRoot: "0x10b647884f1252a94d8031e8323e8f3a15db904c7439d252099b4ccd7443d6ca", timestamp: 1590569121, totalDifficulty: 42861137, transactions: [], transactionsRoot: "0x56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421", uncles: [] }
# 也可以通过交易hash 查看交易记录
> eth.getTransaction("0xcd8d8788703b52aedb10642a93490144b858fb1a851a80780005c5f26af54a69") { blockHash: "0x2fc36d2f47f521762eafaf349507be8f6db2c6fc05ff0d726e4ff810d40b71e2", blockNumber: 286, from: "0x3bd8f1adf6fce874b6fc004629ccdb30f16e5283", gas: 21000, gasPrice: 1000000000, hash: "0xcd8d8788703b52aedb10642a93490144b858fb1a851a80780005c5f26af54a69", input: "0x", nonce: 0, r: "0x92aecdc0b6236e0eb50f5209e9d71ce4114803755c2ffd7213aef023efd18dc0", s: "0x23f32849c259e367de89318904d11e33c99bf124e9bf6b8ec369625f06455011", to: "0x5407117bbb2bfa61c8ccaefb209d10ffb82224cf", transactionIndex: 0, v: "0x37", value: 5000000000000000000 }
|