-
Notifications
You must be signed in to change notification settings - Fork 37.4k
Add getblockheader RPC call #6247
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Alternative to getblock that works even when the block itself has been pruned, returning all available information.
Not against this, but you can get already get block headers using REST |
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 |
That's the general goal of REST - querying public, unauthenticated blockchain data from the blockchain engine. Seems better placed there, than RPC. |
This allows you to get the needed information directly from the Debug window/Console without the needed hackery around the utACK |
@@ -51,6 +51,32 @@ double GetDifficulty(const CBlockIndex* blockindex) | |||
return dDiff; | |||
} | |||
|
|||
UniValue blockheaderToJSON(const CBlockIndex* blockindex) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
.
Tested ACK |
@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. |
076badb Add getblockheader RPC call (Peter Todd)
Needs to be updated in the docs? |
Bitcoin 0.12 RPC PRs 1 Cherry-picked from the following upstream PRs: - bitcoin/bitcoin#6266 - bitcoin/bitcoin#6257 - bitcoin/bitcoin#6271 - bitcoin/bitcoin#6158 - bitcoin/bitcoin#6307 - bitcoin/bitcoin#6290 - bitcoin/bitcoin#6262 - bitcoin/bitcoin#6088 - bitcoin/bitcoin#6339 - bitcoin/bitcoin#6299 (partial, remainder in #2099) - bitcoin/bitcoin#6350 - bitcoin/bitcoin#6247 - bitcoin/bitcoin#6362 - bitcoin/bitcoin#5486 - bitcoin/bitcoin#6417 - bitcoin/bitcoin#6398 (partial, remainder was included in #1950) - bitcoin/bitcoin#6444 - bitcoin/bitcoin#6456 (partial, remainder was included in #2082) - bitcoin/bitcoin#6380 - bitcoin/bitcoin#6970 Part of #2074.
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.