0

I want to create a graph data of Bitcoin transactions in specific time period. In other words, I am trying to write some kind of program when a user enters specific time range, transactions graph data will be returned, and user will be able to play around with it.

Does anyone know what would be the easiest or best way to do this? I know there are couple of APIs I can use (Blockchain.com, Blockstream), or I can run full node, but wanted to hear people's suggestions. My other concern would be going over memory capacity for retrieving data in big time range.

Thank you!

1
  • It is not clear to me what sort of graph you want to produce. Could you please edit your question to explain in more detail what you are trying to do?
    – Murch
    Jan 19, 2023 at 18:27

1 Answer 1

0

I'm not certain about what is your question exactly, but the transaction graph as you call is literally the block's content. If you want to see all transactions that happened from date X to date Y, you just take the first block whose timestamp is greater or equal to X, and the last block whose timestamp is lesser or equal to Y. All transactions that fall in this period will be inside the blocks between those two blocks.
Any API that allows you to access blocks will do. Pretty much all of them, do. And of course, you can always use your node.
As for memory exhaustion, yes, considerable periods may take a lot of RAM. You might limit the selected period, or else you have to write some summary to disk and only load parts of it.

2
  • If I use my own node, to get a block at right date, don't I have to iterate through entire chain? Also, if there is specific API you recommend to do this? Maybe I am missing, but it seems like blockchain.com api only allow to retreive singe block, or block for one day at a time.
    – xor
    Jan 19, 2023 at 15:53
  • It depends on what exactly you want. Inside a block, you have a list of transactions. Each transaction contains a list of inputs and outputs. The graph I'm assuming you need is money moves from UTXO A and B to UTXO C. This is accomplishable using only block data, without iterating over the whole chain. Yes, it should only allow one block at time, so you have to make multiple requests. Jan 24, 2023 at 20:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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