Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Block structure isn't optimum when parsing a block without parsing TX #88

Open
Thireus opened this issue Mar 25, 2015 · 0 comments
Open

Comments

@Thireus
Copy link

Thireus commented Mar 25, 2015

What differentiates Peercoin from Bitcoin is also its block structure. Peercoin adds a few new elements to the block structure such as transaction time and block signature. The signature is found at the end of each block after the transaction elements, and has a variable length:

v_chBlockSigSize; // Variable length integer block signature - signed by coin base txout[0]'s owner
m_chBlockSig; // Raw byte code data for the block signature

These two elements have a big impact on the block parsing processing optimization, especially if someone wants to dump the Blockchain without processing transactions (only the block header and signature). In Bitcoin the block size is described in the block header, and since the transaction elements (of variable size) are found at the end of each block, it allows the parser to calculate where the transaction fields end and jump to the next block without processing transactions. Regarding Peercoin, there is both: transaction elements and block signature. These two are of variable size, and it is thus not possible to know at which position the transaction description ends. By consequence, if someone wants to dump blocks without processing transactions he can't because transactions have to be processed in order to know where the v_chBlockSigSize is located...

An appropriate solution would either be to add an element to the block header to provide the transaction elements size or signature size. Or to move the signature elements above the transaction elements, just after the header (because v_chBlockSigSize would be directly accessible from the header).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant