Bitcoin Forum

Bitcoin => Bitcoin Discussion => Topic started by: baudetph on February 03, 2016, 10:22:28 AM



Title: How do miners access to transaction referenced in the inputs of new transactions
Post by: baudetph on February 03, 2016, 10:22:28 AM
i don't understand how miners prevent easily an output tx from double spent. I understand that when a transaction is broadcasted to the network, miners will try to add it to a block. For that they will check that signature script of each input match with pubkey script of corresponding output of the corresponding previous transaction. My question is :
- how do miners get easily the previous tx from which bitcoins are to be spent knowing only its identifier. Tx identifier doesn't tell in what block this transaction is mined, and block headers don't provide this information meaning you have to look out the whole blocks.
- Does each miner maintain its own ledger of transactions (tx id, block in which it is included, spent ("yes" or "no") and if "yes" in what block and transaction) ?


Title: Re: How do miners access to transaction referenced in the inputs of new transactions
Post by: Cuidler on February 03, 2016, 10:47:26 AM
Full nodes maintain list of unspend outputs, UTXO set. Prefferably in memory and is about 1GB in size currently. When output is spend, it is removed from UTXO set, and added to UTXO set for each output address in added transaction to the blockchain. It is quickest way to know whether received transaction from peer is valid.


Title: Re: How do miners access to transaction referenced in the inputs of new transactions
Post by: baudetph on February 03, 2016, 10:49:31 AM
Thank You.