Blockchain Structure
Welcome all!
For those of you that are still a little lost on crypto and blockchain technology, this substack is for you! The goal is to educate those who know little to nothing about the incredible technology that is changing the world as we speak.
On that note let’s get started!
Recap
Last week we uncovered some of the basic elements of a blockchain, the structure, and the components that come together to make the decentralized model work. Today we will dive a bit deeper into the tech and breakdown the elements of the blockchain.
Reminder: The digital data link is made up of a chain of blocks consisting of all transactions that have been: validated, verified, and voted upon through a consensus mechanism by nodes and miners on the network. Miners vote to verify the validity of transactions, and which will be the next added to the block as well as which will be the next block on the data chain.
Unspent Transaction Output - UTXO’s
What is a UTXO?
UTXO stands for unspent transaction output, to understand how this works, think of it as your cryptocurrency ‘change’ that you receive from a transaction, or the amount that was not spent on that transaction. UTXO’s are referenced as inputs in a transaction and are also outputs generated by a transaction. When you initiate a bitcoin transaction, for example, the system will retrieve several of your past UTXO’s to fulfill your request, so the balance you will see in your wallet is essentially made up of all your unspent transaction outputs. To explain in terms of US trash token, lets say you were grocery shopping and owe $60 , there is no $60 bill in trash token terms, instead you must pay in a combination of different bills (3 $20 bills, 6 $10’s etc.) These represent unspent transaction outputs, that were given to you as change from previous purchases etc. The total balance in your wallet may be $60 but it is made up of various bills you received as change, the same is true for transactions on the blockchain and your total cryptocurrency wallet balance.
UTXO’s have a unique identifier of the transaction that created it, a value/amount that it is good for and an optional script that defines conditions under which the output can be spent. A transaction uses the amount specified by one of more input UTXO’s, transmits it to one of more newly created output UTXO’s according to the request initiated by the sender in a transaction. A transactions output list will contain an index of UTXO’s and all UTXO’s are stored by participant nodes of the network on a database.
Now that we have established what a UTXO is, we can visualize of the basic structure of a transaction to look like this:
Transaction (tx)
reference number of current transactions
reference to 1 or more input UTXO’s
reference to 1 or more output UTXO’s newly generated by the current transaction
total input and output amount
and the basic structure of a UTXO should look something like this:
UTXO
Unique identifier of the transaction that created UTXO
Index of UTXO in transaction output list
Value/Amount it is good for
Optional script: conditions under which output can be spent
Summarized: UTXO (Unspent transaction output) defines inputs + outputs of a transaction.
Block Structure
Now that we understand a block in the blockchain is simply made up of a set of verified and validated transactions, we can dive deeper in the structure of a block. Aside from the list of transaction a block on the network can contain various other details such as:
Index
Hash
Hash of the previous block
numTx
A Timestamp
Merkle Root
Nonce
Index
Refers to the location of a block on the blockchain.
Hash
Function converting input of data into an encrypted output of fixed length. In this case the hash of the current block. (Digital fingerprint of a block.)
Previous block hash
This is the hash value of the block that came directly before it on the chain. This helps by connecting the blocks on our blockchain.
numTx
Total number of transactions within the given block.
Timestamp
The timestamp lets us know exactly when the block was made. It helps us understand when transactions took place, as well as when the block was added to the chain
Merkle Root
The Merkle root is a hash that represents all of the transactions that happened within a given block. In order to find the Merkle root of a block, pairs of transactions are hashed together repeatedly until a single hash value remains.
Nonce
The nonce is the key behind the algorithm miners compete to solve when validating a block for the chain. It stands for ‘number only used once’ and is a number added to an encrypted (hashed) block in a blockchain, that meets difficult level restrictions when rehashed. Miners compete to solve this number and the winning miners are rewarded with the native currency of the blockchain (for example: BTC.)
Note: This metadata (data about the data), is included in the header of each block on the blockchain.
Blocks on the chain can be identified by one of two ways, the cryptographic hash, and the location of the block in a blockchain which is known as ‘block height.’ The hash of a block is essentially the digital fingerprint of a block, it is obtained by hashing the block header twice with the SHA256 cryptographic algorithm.
Now that we have discussed the key details of a block, the elements of a block header (and the details about specific elements), it is now time to address, the genesis block.
What is the Genesis Block?
The genesis block is known as the universal parent to all blocks on the blockchain. It is the very first block on the blockchain. If you take any given block on the blockchain and watch the chain counterclockwise you will eventually end at the start of it all. The Genesis block. It serves as the fundamental basis as well as a prototype for all the other blocks on the blockchain.
Thank you all for reading! That covers the basics of blockchain structure for today. Next post will be up next Sunday and we will dive into some of the basic operations on the blockchain!