When computing a normalized transaction id, when do I finalize the sha256 hash?

1

I'm trying to compute the normalized transaction ID so that it matches what is on blockchain.into at the following URL

 http://blockchain.info/q/hashtontxid/  --- normal TX ID here ----

Given that I need to create a canonical id of some type (just the tx inputs, etc), can anyone go into technical detail as to how the hash is created?

Some variations I've tried

  1. foreach input and output, add them to the sha256 engine. call finalize at the end.
  2. foreach input and output, add them to the sha256 engine. call finalize at each round. Use the finalized output to initialize each round, and then the next data[] (input or output array)
  3. make everything one flat memory array, laid out sequentially, hash and finalize.

I'm assuming that the byte[] layout in memory is no different than what it is on the bitcoin network.

I might be dealing with yet another endian issue, so any confirmation on approach will reduce my troubleshooting.

goodguys_activate

Posted 2014-03-10T01:52:06.257

Reputation: 11 898

Thanks I read that, the pull request, and tried to figure out the proposed changes that "were not supposed to be a serious proposal for inclusion into the code" and am having trouble matching C# with what is in block chain.goodguys_activate 2014-03-10T11:43:11.030

Just now the core BTC devs decided to not support normalized txids.Steven Roose 2014-03-11T00:45:31.607

No answers