I'm writing a blockchain parser for bitcoin core with C++ and now I want to enrich the data I read with the raw transaction and the previous and next block hashes.
I used this library to convert the hexadecimal to a double sha256 but now my problem is to bring the data I read into the correct format, for example, the VarInt is serialized as corresponding hexadecimal (for example 77 -> 4d). But on some things, I don't find myself, for example in the conversion of integers of the type uint32 and int32.
I'll give you an example The version number of the genesis block is 1 and the serialization to the correct hash is 01000000
or the conversion of the nonce of the genesis block which is 2083236893 but the correct form for the serialization is 7c2bac1d
NBits = 486604799 -> serialization = 1d00ffff timestamp = 1231469665 -> serialization = 495fab29
Sorry for my terrible English but I'm learning.
______ Solution ______
Bitcoin core to use the method for serializing block, into file blk and sending data into the network, to create the hash.
Then, the hash block do create with all data into little endian form.