Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: Taras on March 09, 2014, 03:28:30 AM



Title: Is there a way to parse the blockchain to see which blocks have spent coinbases?
Post by: Taras on March 09, 2014, 03:28:30 AM
There HAS to be a program for this or something. It's unbelievably stressful manually ciphering through one block at a time.
I mean blocks which have their coins spent after being mined.


Title: Re: Is there a way to parse the blockchain to see which blocks have spent coinbases?
Post by: DannyHamilton on March 09, 2014, 11:02:41 PM
There HAS to be a program for this or something. It's unbelievably stressful manually ciphering through one block at a time.
I mean blocks which have their coins spent after being mined.

As far as I know, the only way to know if the block reward has been spent is to search through the entire blockchain to see if ANY other transaction references the transactionID of the block reward in its list of inputs.

Any such program that is going to run efficiently would probably need to pre-process the entire blockchain loading all transactions into an indexed table that would allow you to query input hashes.

Blockchain.info has such as database, and using their API it would be exceedingly simply to create a short script that would find each block reward and determine if/when it was spent.

I'm not sure if blockchain.info would be very happy though with someone flooding their servers with almost 600,000 requests in a short period of time.

Barring that, you'll need to find (or write) a program that will parse the blockchain and load it into something like mySQL.


Title: Re: Is there a way to parse the blockchain to see which blocks have spent coinbases?
Post by: fbueller on March 10, 2014, 11:46:08 AM
Such scripts are incredibly slow. I'm running a script at the moment to scan every block for payments to p2sh addresses (just check all outputs for ones going to addresses with version byte \x05) and it's taken about two weeks to get to block 180000, before it got painfully slow. I'm still leaving it run anyway, but I think a flexible resource to query the blockchain would be invaluable to researchers, especially those who can't code their own tools.