1

I would like to extract all transactions in history. What I'm presently doing is calling getrawtransaction and than decoderawtransaction for each transaction in the block. This works, except that the extraction process takes forever.

Is there a faster way to do this?

3

Use getblock with verbosity level 2. e.g.

getblock 0000000000000000000cedb96c93635edfb2755a3357e7febe5929fb6db1658d 2

This will return the block with all of the transactions already decoded.


Since you mentioned that you are doing getrawtransaction and then decoderawtransaction, getrawtransaction has another parameter to decode a transaction for you so you don't have to go to decoderawtransaction. You can do something like

getrawtransaction 0374d2bab7ce78429dc8660fb0100f260e1528dca4854ca7d761dd849211ff75 true

Lastly, most RPCs have a set of options with a description of what they do and an explanation of the output. You can do something lie

help getblock

to get the help description. In the future, you can do this for any command that you are using so that you can use it to its fullest potential.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.