Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: smemo92 on September 17, 2014, 01:37:38 PM



Title: Where transaction's hashes are stored?
Post by: smemo92 on September 17, 2014, 01:37:38 PM
Hi, I'm tryng to understand how transactions works and how they are organized. I understand the structure of a transaction, made up of a list of input and output https://en.bitcoin.it/wiki/File:TxBinaryMap.png .
First 32 bytes of tx input are the hash of the previous transaction (and then 4 bytes of index), that is the transaction where there is the unspent output that I use as input in this transaction. This is the idea, right?
But in transaction structure there is no hash field, transaction are stored in blocks, and blocks have their own hash and the merkle root hash.
I can't understand how with transaction hash we can check if in that transaction there is an unspent output.
How can i find a transaction from its hash if it isn't stored anywhere?

I've also read that there is a structure that contains all utxo but i can't find detail about that.


Title: Re: Where transaction's hashes are stored?
Post by: fbueller on September 17, 2014, 01:44:14 PM
For your current transaction, the txid is just SHA256d of the whole transaction. this is why transactions are malleable, as any change produces a different hash.

The 'inputs' txids are stored in the transaction, but are in little endian notation so you may not recognize it immediately if you stare at a raw transaction hex..