Skip to content
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

Getrawtransactionsinblock #4369

Closed
wants to merge 2 commits into from

Conversation

crispweed
Copy link

This adds a new 'getrawtransactionsinblock' rpc command.
The use case for this is essentially for any application that connects over RPC to process transactions in each new block, as they come in (for example, for a wallet application).
(I use this in the SwapBill client, but essentially just because the SwapBill client needs to maintain it's own wallet separately from the wallet in bitcoind or litecoind.)
This is only possible through the current RPC interface if txindex is turned on. But in fact a full transaction index should not be necessary for this, because we already know the hash of the block containing the transactions.
A second reason is then that it is also much more efficient to obtain all of the transactions in a block this way, rather than querying for the set of txids in a block and then making a whole bunch of calls to getrawtransaction.
See https://bitcointalk.org/index.php?topic=630370.0 for some more discussion!

@laanwj
Copy link
Member

laanwj commented Jun 19, 2014

With getblock <hash> false you can already get the entire block data, including the transactions.
Edit: in that case you have to chop up the block data yourself to get the separate transactions, but adding a new RPC to return data that is already available in a slightly different format seems overkill.

@BitcoinPullTester
Copy link

Automatic sanity-testing: PASSED, see http://jenkins.bluematt.me/pull-tester/306d3fd0948642f386b59faec6ac66766fa01fb5 for binaries and test log.
This test script verifies pulls every time they are updated. It, however, dies sometimes and fails to test properly. If you are waiting on a test, please check timestamps to verify that the test.log is moving at http://jenkins.bluematt.me/pull-tester/current/
Contact BlueMatt on freenode if something looks broken.

@crispweed
Copy link
Author

With getblock false you can already get the entire block data, including the transactions

Ok, I wasn't aware of the second parameter to getblock, in fact.
Yes this does what I need, then.
(Chopping up the block data is no problem. I need txids also, but can get these with getblock true..)

@crispweed crispweed closed this Jun 19, 2014
@Elbandi
Copy link
Contributor

Elbandi commented Jun 19, 2014

https://en.bitcoin.it/wiki/Original_Bitcoin_client/API_calls_list
doc is missing about this false parameter...

@laanwj
Copy link
Member

laanwj commented Jun 19, 2014

Update the wiki then...

@bitcoin bitcoin locked as resolved and limited conversation to collaborators Sep 8, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants