Title: Bitcoin RPC - How to get transaction history from a address Post by: ?QuestionMark? on December 23, 2020, 03:15:35 PM 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. Title: Re: Bitcoin RPC - How to get transaction history from a address Post by: ranochigo on December 23, 2020, 03:23:09 PM 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
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. Title: Re: Bitcoin RPC - How to get transaction history from a address Post by: ?QuestionMark? on December 23, 2020, 04:01:48 PM 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. |