I'm trying to fetch transactions for a certain bitcoin address, but I only need to fetch transactions within a specific date range.

Now, I had a look at the blockchain.info api and it seems like the best solution to get transactions for a address is: https://blockchain.info/rawaddr/$bitcoin_address

(as seen on this page: https://blockchain.info/api/blockchain_api )

My problem is that the array of transactions returns all transactions, but I just want to fetch a small subset of transactions within 2 dates.

I know that I can then filter the transactions myself based on the expected date range, but I'd like to reduce the payload for the initial response, otherwise I can end up with hundreds or thousands of transactions that I don't need.

Question: Is there a recommended, easier method to get transactions, belonging to a specific address, but only within a certain date range?

  • I think such filters are possible using blockchair.com API, not sure because I have not used it recently but it had lot of options to sort and filter results when I used it few months back. blockchair.com/api/docs
    – Prayank
    Aug 7 '20 at 13:26

im looking at the same thing what you will find is that rawadddr only gives you 50 transactions not the full list, if the address has more than 50 txns you have to use limit and offset to go through the results pages of txns like paging through pages of search results, use &sort=1 so that it sorts oldest first that way if new txns come in while you are looping through the indexes wont get bumped up

you will have to get all the txns, loop them and look at the timestamp to see if it fits in the range blockchain.info cant give you what you want directly i dont think, of you will have to page through till you hit your date range and then keep paging till you get to the end

the api from blockcypher.com pages by block height which is not time but i think is closer to time, if im right and you stored the times that blocks got confirmed in a look up table you could call your date range through finding if the block was confirmed in the time range, if there is more than 50 txns it has a has_more attribute that you can use to page through and the set wont shift on you


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.