|
August 24, 2017, 03:10:57 AM |
|
I am looking to create an open source blockchain explorer for altcoins. It is written in react and I am using a firebase backend to store the blockchain information.
I was wondering if anyone knows of a good way to gather the information for a given address so I can easily create a richlist and other statistics based on a given address. And to simply be able to search the blockchain and get information about a given address.
Currently the only way I know how is to start at block 0, really and gather each and every address and save the txids associated with that address. I can just do a simple
Address: Txid1 Txid2 etc. etc.
or I could save more information like txid, value out or value in so I can then just use that value information to get a running balance of the given address.
I am writing the front end in reactjs and using cloud functions to query the firebase real time db. I would cache information for each block and txid and address for a period of time so that the data is quicker for each person after the first query for a set amount of time.
For simplicity of the db I think having an address and then a list of txids would be able to do the trick. I can do a query in the cloud functions of a given address and then iterate over the list of txids and parse all the info for the balance and such. After the first time doing that, I can save the running balance of the address to the address node on the same level as the txids too.
Is there a better way or am i on the right track ?
|