Author

Topic: Bitcoin RPC - How to get transaction history from a address (Read 140 times)

legendary
Activity: 2870
Merit: 7490
Crypto Swap Exchange
Depending on your goal, using open source block explorer (such as Esplora) is more practical option.

But AFAIK, Bitcoin Core won't specifically calculate the balance or organise the TXes related to "all the addresses" because addresses isn't really represented as such in the protocol level. You can try crawling through the Blockchain and see if you can index them yourself.

On a side note, there are few attempts to make index for address on Bitcoin Core, but never realized.

Example,
https://github.com/bitcoin/bitcoin/pull/2802
https://github.com/bitcoin/bitcoin/pull/10370
https://github.com/bitcoin/bitcoin/pull/14053
member
Activity: 79
Merit: 28
Im using txindex=1 for searching for transactions. But as you said its just for transactions.
As you suggested I will maybe try to index it by myself and store it in an mysql database. I first have to find out how exactly I will do it but I think its the best way.
legendary
Activity: 3038
Merit: 4418
Crypto Swap Exchange
Bitcoin Core doesn't keep a transaction index of transactions that are not pertinent to the addresses generated by your client by default. By enabling txindex (txindex=1) will make Bitcoin Core build the transaction database index and index them for the transactions to be found easily.

But AFAIK, Bitcoin Core won't specifically calculate the balance or organise the TXes related to "all the addresses" because addresses isn't really represented as such in the protocol level. You can try crawling through the Blockchain and see if you can index them yourself.
member
Activity: 79
Merit: 28
I'm currently working on a bitcoin blockchain explorer for personal use. Everything is working fine so far but I have problems to implement the possibility to search for addresses and list all made transactions. I'm using bitcoin rpc and PHP.

After some internet search I found the RPC command importaddress but I read that it would need to rescan the whole blockchain which takes to long. Then I found the command scantxouset which
lets me scan the txout's. But I can't figure out to use this command even after visiting several websites. I'm not very familiar with JSON.
One was: https://developer.bitcoin.org/reference/rpc/scantxoutset.html
Another problem is that this command can only search for unspent outputs.

Anyone has a idea how I can achieve to get all transactions made from a given address.

Jump to: