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) ?
|