New RPC commands: getblockhash and getblock #727

pull gavinandresen wants to merge 1 commits into bitcoin:master from gavinandresen:getblock changing 2 files +94 −27
  1. gavinandresen commented at 9:34 PM on December 23, 2011: contributor

    This is designed to work nicely with 'gettransaction' and new 'blockhash'/'blockindex' information returned in listtransactions; it is modified from the 'getblock' that was in my monitorreceived patch.

    getblockhash <index> Returns hash of block in best-block-chain at <index>.

    e.g. getblockhash 0 returns 000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f (genesis block hash)

    getblock <hash> Returns details of a block with given block-hash.

    e.g. ./bitcoind getblock $(./bitcoind getblockhash 0) returns the genesis block:

    { "hash" : "000000000019d6689c085ae165831e934ff763ae46a2a6c172b3f1b60a8ce26f", "blockcount" : 0, "version" : 1, "merkleroot" : "4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b", "time" : 1231006505, "nonce" : 2083236893, "difficulty" : 1.00000000, "tx" : [ "4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b" ], "hashnext" : "00000000839a8e6886ab5951d76f411475428afc90947ee320161bbf18eb6048" }

  2. New RPC commands: getblockhash and getblock 8a53cb0b9d
  3. jgarzik commented at 3:27 AM on December 24, 2011: contributor

    ACK

    though I still prefer original getblock/dumpblock, which provides more information than 'gettransaction' presently provides: full script dump, full expansion of vin/vout, etc. Much more raw and programmer-oriented.

  4. gavinandresen commented at 6:31 PM on December 24, 2011: contributor

    If you feel like a little after-Christmas coding, I'd be OK with an expanded gettransaction that returns all the gory details. Or that returns information for non-wallet transactions.

  5. sipa commented at 2:20 PM on December 25, 2011: member

    ACK

  6. jgarzik commented at 7:39 PM on December 25, 2011: contributor

    I would lean towards adding a separate 'dumptx' that returns all the gory details, keeping it separate from current gettx.

    But that's separate from this pull request...

  7. gavinandresen merged this on Jan 3, 2012
  8. gavinandresen closed this on Jan 3, 2012

  9. destenson referenced this in commit eeb4e9c11a on Jun 26, 2016
  10. dexX7 referenced this in commit e6e67a5057 on Aug 13, 2018
  11. kallewoof referenced this in commit 64f8be13cf on Oct 4, 2019
  12. rajarshimaitra referenced this in commit e59b9349d9 on Aug 5, 2021
  13. DrahtBot locked this on Sep 8, 2021

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-05-02 15:16 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me