Skip to Content
Foundations of Blockchain
book

Foundations of Blockchain

by Koshik Raj
January 2019
Beginner to intermediate
372 pages
11h 17m
English
Packt Publishing
Content preview from Foundations of Blockchain

UTXO

A transaction input will always refer to a UTXO. A list of UTXOs is maintained locally. This list is updated whenever a transaction is processed, and is referred to during transaction validation. Although this list could be generated at any time by traversing the entire blockchain, it is maintained in memory to facilitate speedy transaction validation:

class UnspentTxOut: 
    def __init__(self, tx_out_id, tx_out_index, address, amount): 
        self.tx_out_id = tx_out_id 
        self.tx_out_index = tx_out_index 
        self.address = address 
        self.amount = amount 

The list of UTXOs is a simple list that is initially created by processing the genesis transaction.

self.unspent_tx_outs = process_transactions([self.genesis_transaction], [], 0)

Whenever the node creates ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Blockchain Basics

Blockchain Basics

Daniel Drescher
What Is Blockchain?

What Is Blockchain?

Sir John Hargrave, Evan Karnoupakis
Mastering Blockchain

Mastering Blockchain

Lorne Lantz, Daniel Cawrey

Publisher Resources

ISBN: 9781789139396Supplemental Content