Add getblockheader RPC call #6247

pull petertodd wants to merge 1 commits into bitcoin:master from petertodd:getblockheader-rpc-call changing 4 files +85 −0
  1. petertodd commented at 4:58 AM on June 7, 2015: contributor

    Alternative to getblock that works even when the block itself has been pruned, returning all available information. Right now the fact that you can't get this information in pruned mode makes pruned nodes quite a bit less useful for some applications.

  2. Add getblockheader RPC call
    Alternative to getblock that works even when the block itself has been
    pruned, returning all available information.
    076badb60f
  3. laanwj commented at 6:58 AM on June 7, 2015: member

    Not against this, but you can get already get block headers using REST /rest/headers/<count>/<hash>.<ext>.

  4. jonasschnelli commented at 7:08 AM on June 7, 2015: contributor

    Also not against this, but i think public blockchain data like blocks (headers), transactions or UTXO queries should go over REST instead over an authenticated RPC call. This would follow a more logical design.

    Nevertheless, this can be useful because we never merge JSON support for REST Headers (https://github.com/bitcoin/bitcoin/pull/5486/files).

    What about getting more in line with REST and also support requesting more than one header (/rest/headers/***<count>***/<hash>.<ext>.)?

  5. jgarzik commented at 7:16 AM on June 7, 2015: contributor

    That's the general goal of REST - querying public, unauthenticated blockchain data from the blockchain engine. Seems better placed there, than RPC.

  6. paveljanik commented at 5:57 AM on June 8, 2015: contributor

    This allows you to get the needed information directly from the Debug window/Console without the needed hackery around the -rest cmdline etc. Very useful! Thanks Peter.

    utACK

  7. laanwj added the label RPC on Jun 9, 2015
  8. in src/rpcblockchain.cpp:None in 076badb60f
      50 | @@ -51,6 +51,32 @@ double GetDifficulty(const CBlockIndex* blockindex)
      51 |      return dDiff;
      52 |  }
      53 |  
      54 | +UniValue blockheaderToJSON(const CBlockIndex* blockindex)
    


    laanwj commented at 3:30 PM on June 12, 2015:

    There's a strong overlap with #5486 here - even the function is called the same. This does expose a few more values, also derived ones like confirmation and chainwork.

  9. laanwj commented at 5:00 AM on June 30, 2015: member

    Tested ACK

  10. petertodd commented at 5:16 AM on June 30, 2015: contributor

    @jgarzik Re: "unauthenticated" data, remember that this is trusted data in the sense that the client would be trusting the full node's opinion on what the valid chain is; I'm not sure I'd use the term "unauthenticated" in describing that, rather, public and trusted.

  11. laanwj merged this on Jul 2, 2015
  12. laanwj closed this on Jul 2, 2015

  13. laanwj referenced this in commit 726e28643c on Jul 2, 2015
  14. dcousens commented at 5:53 AM on December 4, 2015: contributor

    Needs to be updated in the docs?

  15. zkbot referenced this in commit 9af55822fb on Feb 15, 2017
  16. zkbot referenced this in commit a7cf698873 on Mar 4, 2017
  17. 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-04-13 15:15 UTC

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