Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: Radacoin on April 30, 2013, 12:52:01 PM



Title: How to parse blocks
Post by: Radacoin on April 30, 2013, 12:52:01 PM
Hi guys,

can you please point me to the right direction on how to parse blocks? Block format, what the blocks, chainstate, database directories are for. Stuff like that.

P.S.
I know how to read code (C, Java, ...).



Title: Re: How to parse blocks
Post by: nevafuse on April 30, 2013, 01:51:26 PM
If you can read C++, then you can probably just look at the bitcoin-qt source code...https://github.com/bitcoin/bitcoin (https://github.com/bitcoin/bitcoin)

Otherwise the wiki may give you a better summary of how the block is parsed...https://en.bitcoin.it/wiki/Blocks (https://en.bitcoin.it/wiki/Blocks)

https://en.bitcoin.it/wiki/Bitcoind#Theory_of_Operation (https://en.bitcoin.it/wiki/Bitcoind#Theory_of_Operation)


Title: Re: How to parse blocks
Post by: DannyHamilton on April 30, 2013, 04:11:11 PM
Here's a good resource for understanding the basic structure of a block:

http://james.lab6.com/2012/01/12/bitcoin-285-bytes-that-changed-the-world/


Title: Re: How to parse blocks
Post by: kjj on April 30, 2013, 04:32:06 PM
I haven't upgraded to 0.8 on my development box yet, so I haven't had a need to peer into the new block files.  Are they the same format as the old ones, just smaller, or did they get changed?


Title: Re: How to parse blocks
Post by: dserrano5 on April 30, 2013, 07:33:27 PM
I haven't upgraded to 0.8 on my development box yet, so I haven't had a need to peer into the new block files.  Are they the same format as the old ones, just smaller, or did they get changed?

Same format.


Title: Re: How to parse blocks
Post by: Radacoin on May 02, 2013, 07:25:05 AM
Thanks a lot guys.

Question: I thought the difficulty is also included in the blocks - but it seems not.

How can I calculate (historic) difficulty?

Reason I'm asking this: I wanna set up some charts for Alt-Coins.


edit: Found it myself: https://en.bitcoin.it/wiki/Difficulty#How_is_difficulty_stored_in_blocks.3F