Author

Topic: [technical] How read prev block hash from binary (Read 38 times)

member
Activity: 138
Merit: 25
It is ok: bd48bb791b61de487e3235820c8ae578d9d6e335ccd651e05e6059dc096a5ba4 is 17,
simply blocks are not sorted and this is OK.
member
Activity: 138
Merit: 25
Already I know: this hashes are computed by simply Bitcoin double sha256, and I have:
Code:
MAINNET
blk00000.dat (1/106)
Prev=0000000000000000000000000000000000000000000000000000000000000000
Hash=12a765e31ffd4059bada1e25190f6e98c99d9714d334efa41a195a7e7e04bfe2

Prev=12a765e31ffd4059bada1e25190f6e98c99d9714d334efa41a195a7e7e04bfe2
Hash=80ca095ed10b02e53d769eb6eaf92cd04e9e0759e5be4a8477b42911ba49c78f

Prev=4bddcbae91541afa4d01bb94cabd39c21886bfd139a4df7e1dfd983ebca541c8
Hash=bd48bb791b61de487e3235820c8ae578d9d6e335ccd651e05e6059dc096a5ba4

Prev=80ca095ed10b02e53d769eb6eaf92cd04e9e0759e5be4a8477b42911ba49c78f
Hash=13957807cdd1d02f993909fa59510e318763f99a506c4c426e3b254af09f40d7

Prev=bd48bb791b61de487e3235820c8ae578d9d6e335ccd651e05e6059dc096a5ba4
Hash=34517832ff48996278d56124ca31963b404acbcd77a7ab8eaaa530be835cb64d

Prev=13957807cdd1d02f993909fa59510e318763f99a506c4c426e3b254af09f40d7
Hash=dec173dda2735ff11376b68bdfda804cede230c1fa6f1a11765cddfd8edf4398

Prev=34517832ff48996278d56124ca31963b404acbcd77a7ab8eaaa530be835cb64d
Hash=6ea63d7aa791c13042b72c6855f089ef78ed45c3b8dc3263fc0e8cb8b3070f05

Prev=dec173dda2735ff11376b68bdfda804cede230c1fa6f1a11765cddfd8edf4398
Hash=5007153e4c02602dd2ee1df62efc727f5d5c261a942c2f254fa89fb6e6a8f0cf

Prev=6ea63d7aa791c13042b72c6855f089ef78ed45c3b8dc3263fc0e8cb8b3070f05
Hash=a4ad8c78654e76a729c12dd10522a40ba7077167bbf5b28fc9c71d25fcd67226

Prev=5007153e4c02602dd2ee1df62efc727f5d5c261a942c2f254fa89fb6e6a8f0cf
Hash=f5355c3b8c86642a51a8a49c619adb9fe34093bde86ae73ed3073f2c0c4a09b1

Prev=a4ad8c78654e76a729c12dd10522a40ba7077167bbf5b28fc9c71d25fcd67226
Hash=31ed087d6effc647d37b6e04f7e7da9e04b270d95262b21c8275aa10fc0c7104

Prev=f5355c3b8c86642a51a8a49c619adb9fe34093bde86ae73ed3073f2c0c4a09b1
Hash=6642a515e5c5ec0d26d49454f5da974c2cf8e59953c5cf1a170a1e14a5df9ae1
This is next problem: 1->0 ok
but I see TWO interleaved blockchains, it is true?
member
Activity: 138
Merit: 25
I have hex dump beginning:

Records beginnings are: 0, 0x120, 0x1ff,..
I read record 0:
prev: 0000000000000000000000000000000000000000000000000000000000000000
compute hash: 0000050c34a64b415b6b15b37f2216634b5b1669cb9a2e38d76f7213b0671e00
seems to ok, (begin with 00000)

I read record 0:
compute hash: 00000bf2367a38c55d68c4145f9e12788b755f702ced1d2ed34c722bb75652c0
prev: 12a765e31ffd4059bada1e25190f6e98c99d9714d334efa41a195a7e7e04bfe2
Huh
https://live.blockcypher.com/ltc/block/12a765e31ffd4059bada1e25190f6e98c99d9714d334efa41a195a7e7e04bfe2/

Two problems:
1.
I use
Code:
scrypt_1024_1_1_256((const char*)(&header), (char*)charBlockHash);

I must next hash this value? (which function? sha256?)

2.Records One has 12a765e31ffd4059bada1e25190f6e98c99d9714d334efa41a195a7e7e04bfe2 as PREVIOUS, but blockcypher says that is Litecoin Block 1 (!!!!) no 0.


00000ab604b006c53366cc373e895690dc4d2ea60d1263948cd1f958e77a4735
4bddcbae91541afa4d01bb94cabd39c21886bfd139a4df7e1dfd983ebca541c8
00000d108e311f832249d9c9f0bafb2668970015497d3d364ebedfc08c421916
80ca095ed10b02e53d769eb6eaf92cd04e9e0759e5be4a8477b42911ba49c78f
0000045b11ebeeecd2857bb79556a2673f86196c589b6d67e20a0ca596ab2278
bd48bb791b61de487e3235820c8ae578d9d6e335ccd651e05e6059dc096a5ba4
00000edd633effebb3480807fed299b5cd1d7f5cfdd58653abb6516d7562b724
13957807cdd1d02f993909fa59510e318763f99a506c4c426e3b254af09f40d7
Jump to: