Add getblockheader RPC call #6247

Merged
merged 1 commit into from Jul 2, 2015

Conversation

Projects
None yet
6 participants
@petertodd
Contributor

petertodd commented Jun 7, 2015

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.

Add getblockheader RPC call
Alternative to getblock that works even when the block itself has been
pruned, returning all available information.
@laanwj

This comment has been minimized.

Show comment
Hide comment
@laanwj

laanwj Jun 7, 2015

Member

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

Member

laanwj commented Jun 7, 2015

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

@jonasschnelli

This comment has been minimized.

Show comment
Hide comment
@jonasschnelli

jonasschnelli Jun 7, 2015

Member

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>.)?

Member

jonasschnelli commented Jun 7, 2015

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>.)?

@jgarzik

This comment has been minimized.

Show comment
Hide comment
@jgarzik

jgarzik Jun 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.

Contributor

jgarzik commented Jun 7, 2015

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

@paveljanik

This comment has been minimized.

Show comment
Hide comment
@paveljanik

paveljanik Jun 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

Contributor

paveljanik commented Jun 8, 2015

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

@laanwj laanwj added the RPC/REST/ZMQ label Jun 9, 2015

@@ -51,6 +51,32 @@ double GetDifficulty(const CBlockIndex* blockindex)
return dDiff;
}
+UniValue blockheaderToJSON(const CBlockIndex* blockindex)

This comment has been minimized.

@laanwj

laanwj Jun 12, 2015

Member

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.

@laanwj

laanwj Jun 12, 2015

Member

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.

@laanwj

This comment has been minimized.

Show comment
Hide comment
@laanwj

laanwj Jun 30, 2015

Member

Tested ACK

Member

laanwj commented Jun 30, 2015

Tested ACK

@petertodd

This comment has been minimized.

Show comment
Hide comment
@petertodd

petertodd Jun 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.

Contributor

petertodd commented Jun 30, 2015

@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.

@laanwj laanwj merged commit 076badb into bitcoin:master Jul 2, 2015

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

laanwj added a commit that referenced this pull request Jul 2, 2015

Merge pull request #6247
076badb Add getblockheader RPC call (Peter Todd)

@petertodd petertodd referenced this pull request in petertodd/python-bitcoinlib Nov 11, 2015

Closed

Add getblockheader RPC call #95

@dcousens

This comment has been minimized.

Show comment
Hide comment
@dcousens

dcousens Dec 4, 2015

Contributor

Needs to be updated in the docs?

Contributor

dcousens commented Dec 4, 2015

Needs to be updated in the docs?

@str4d str4d referenced this pull request in zcash/zcash Feb 14, 2017

Merged

Bitcoin 0.12 RPC PRs 1 #2100

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment