I've been struggling to reproduce the hashing procedure used by the RPC command
dumptxoutset (for the latest release 28.0).
I was hoping that maybe someone could give me a hint what I am doing wrong.
I am assuming that it is using the
HASH_SERIALIZED type (not the mysterious
MUHASH).
In which case, is should be just a simple SHA256 of all the "Coin" records, ordered like in the file created by
dumptxoutset.
Looking at the source code, I think each record is written to the hasher like this:
32 bytes of TxID (in the same order as stored in memory)
4 bytes of VOut (little endian)
4 bytes of 2*block_heigh+coinbase (little endian)
8 bytes of Amount (little endian)
the spending script (uncompressed, variable length, as stored in memory)
So all he records go one-after-another and at the end I do another SHA256 on the result.
Unfortunately, this does not work, because I don't get the value from the "txoutset_hash" filed returned by dumptxoutset.
I wonder whether there is some kind of script_length filed between the Amount and the script itself?