I've been struggling the past couple of days to deserialize a merkleblock message. I'm writing a go app that uses the bitcoin rpc client to call gettxoutproof, but only need the merkle proof (array of required tx hashes needed to hash merkle root) of given transaction (want to verify the transaction in an ethereum smart contract).
So I've looked at how the serialization is defined in merkleblock.h which looks pretty straight forward. The problem i'm having is figuring out how CDataStream serializes the CMerkleBlock object, and finding the transaction hashes in the hex string.
Example: This is the block im looking at: Testnet Block
it only contains one tx:
When I run the gettxoutproof command I get the following output:
Initially I expected to find the tx hash somewhere in that hex string, since its the only tx in the block and has to be included, but its no where to be found. Since the docs say that gettxoutproof returns a serialized, hex encoded string I thought maybe the tx hash has been hex encoded, but it isn't. I've tried figuring this out with other blocks, that for example contain 2 transactions but have had no luck. I've looked at how CDataStream serializes the data but fail to understand it.
Would be very happy if someone could help me out!