Block Header - Encoding/Serialization

0

Bitcoin Block Header

I have read that Previous Block hash takes around 32 bytes in the Block Header. Since it is a SHA256 hash which is 64 characters long, shouldn't it take 64 bytes as well? Similarly, Merkle root and other parameters.

Take a look at the following: 010000009500c43a25c624520b5100adf82cb9f9da72fd2447a496bc600b0000000000006cd862370395dedf1da2841ccda0fc489e3039de5f1ccddef0e834991a65600ea6c8cb4db3936a1ae3143991

Length: 160

Apparently, it is x2 of what is actually written everywhere.

What kind of encoding is used here?

Areeb

Posted 2019-05-10T08:32:00.843

Reputation: 125

Answers

4

That is hex encoding, two ASCII characters per byte.

SHA256 output is 32 bytes, or 64 characters when hex encoded.

Anonymous

Posted 2019-05-10T08:32:00.843

Reputation: 10 054

Yes, apparently you can store the full hash in BINARY(32). Right?Areeb 2019-05-10T08:47:25.670

1Right. It’s 32 binary bytes irrespective of the representation of them.Anonymous 2019-05-10T09:22:55.077