is it possible to get mempool transactions as hex using bitcoin-core?

0

getrawmempool returns only TXID (verbose off), what I'm doing is calling getrawtransaction for each transaction ID to get a transaction hex.

Bitcoin core doesn't support batch requests and each RPC call takes 0.06 sec, for ~ 5000 transactions, it takes 5 min which is so expensive. can I get mempool transactions as hex instantly?

Adam

Posted 2018-04-09T04:34:34.877

Reputation: 3 215

Answers

2

Bitcoin core doesn't support batch requests

Yes it does. Bitcoin Core uses the follows the JSON-RPC Specification for batching requests. Just use that with a custom client of your choice to interact with the RPC server to get that information. python-bitcoinrpc makes this easy to do.

Andrew Chow

Posted 2018-04-09T04:34:34.877

Reputation: 40 910

1

Are you sure you need Bitcoin Core and RPC calls for this task?

May be you need some tool for sniffing bitcoin network for all transactions. Have a look to this: https://github.com/sebicas/bitcoin-sniffer

This tool is very old. I am not sure that it works today. Take the main idea.


Another solution is implementing your own RPC-command. Something like "dumpwholemempool". I think it is not too difficult.

amaclin

Posted 2018-04-09T04:34:34.877

Reputation: 5 763