11 - Building blocks
Over the past three posts, we explored the ideas of self custody, self sovereignty, and the risk of taking responsibility for your funds through the use of a digital asset wallet. We learned that wallets are where you store your private keys. In order to publish a transaction, you use a private key to generate a signature which tells the network that a transaction is legitimate. Wallets are your personal gateway to the blockchain space but a question still remains: when we say “publish,” what does that mean? Where is the transaction you are publishing actually going?
Nodes
“Publishing a transaction” refers to sending your transaction’s details to a blockchain network. A transaction is made up of very basic information including the recipient’s wallet address, the amount being sent, the transaction fee, the transaction ID and a signature. The transaction is sent from your wallet software to something called a “node.”
Nodes are computers where the blockchain records are stored and blockchains are made up of a collection of nodes. Nodes are important because they both store a blockchain’s history and communicate with other nodes about newly created blocks. On the Island of Yap, all transactions from the first transaction to the most recent are stored in every Yapese’s ledger. The transaction history is maintained by all the Islanders; but in the virtual world, asking everyone using a blockchain to download an entire copy of the blockchain and maintain it is a large request.
When you download wallet software onto your phone or computer, it does not mean you are running a node. The wallet software only stores your private key. The wallet software itself needs to connect to a node so that any transaction you sign can be added to a block on the blockchain. In many instances, the wallet company itself will operate a node to ensure their user’s transactions are published to the blockchain network. In order to send a digital asset your signed transactions are sent from your phone to the node.
Some blockchains such as Bitcoin are designed to be small enough for anyone with a personal computer to run a node and maintain a history of the blockchain. In many cases, however, blockchains grow too large for the entire history to be stored on a personal computer. The large data size leads to nodes’ being run on computers that we designed to be a node. Apart from data storage, there is a knowledge limitation on running your node. Blockchains are constantly upgrading their software, and staying on top of the upgrades is a requirement for maintaining a copy of the blockchain ledger.
The Waitlist
Once a transaction reaches a node, it sits there in something called a “mempool.” Mempool is a fancy tech word for waitlist. Transactions can only be added to a blockchain ledger every time a block is created; so transactions have to wait for the next block in order to be published to the network. How long a transaction has to wait to be added depends on two characteristics: Block time and block size.
Block time is a description of how long a block takes to be created. On the Island of Yap, a page is written on a daily basis; but on the Bitcoin blockchain, blocks get created every 10 minutes. If you increase the block time, then transactions get added to blocks faster and therefore processed quicker. The second characteristic that impacts transaction speed is the amount of transactions that can be included in a block. Physical pages have limits to the amount that can be written on them and blocks have a limit on the amount of data that can be included in them. Only a certain number of transactions can be included in each block; so even if your transaction reaches a node in time for a block, there is a possibility that the block will fill up before your transaction is included.
Block Creation
Block creation is probably the most misunderstood part of the entire blockchain transaction process. In What is a block and why is it chained?, we learned that every block just like every page needs to have a number. Blocks don’t use traditional numbers but rather hashes. The hashes serve two purposes: First, to give the block a unique identifier; and second, to secure the information included in the block. If anything in the block is changed you would be able to tell because the hash will have changed. Blockchain participant’s known as miners are tasked with creating the next block and solving for a valid hash.
In order to create a new block miners must input the most recent block’s hash (page number) and a collection of new transactions, into a hash function. The hash function takes that information and uses it to produce a new hash (page number). The new hash is then used to authenticate the new block. A key aspect of this process is that not all block hashes are acceptable hashes. The blockchain network sets a range of hashes that are acceptable, and miners can solve a hash function, create a hash, and not have it be accepted by the blockchain network. Miners face a high probability that they will have to solve the hash function many times with different inputs. Eventually, the miner hopes to find a set of transactions that create an acceptable hash.
Miners are competing with each other to find acceptable hashes which means they must run their computers 24/7. In return for doing all this work, when a miner discovers a block, they will be rewarded with some newly created bitcoin. In every new block, a certain amount of bitcoin gets created and sent to the miner who created the block. Right now 6.25 BTC or roughly $262,000 worth of value is created in every block. Newly created coins are called a “coinbase” transaction which is where the well known exchange got its name.
Transaction flow
Let’s take a second and review. Transactions start with a signature. The wallet software downloaded on your phone or computer will then send that signed transaction to a node. When it reaches the node, it will sit on a waitlist called a mempool. People finding hash’s known as Miners then select certain transactions from the memepool and use them in hash functions. When an acceptable hash function is found, the block will be added to the network; and then the process to find the next block will begin again. The process of transaction generation and block creation is an ongoing process that will never stop for as long as there are individuals supporting the blockchain space.
Next week we will dive a bit deeper into the game theory associated with mining and gain an understanding of why miners are critical for blockchain network security.