Chapter 3
Building Blocks: The Transaction’s Journey to the Blockchain
IN THIS CHAPTER
Understanding the cryptocurrency network
Defining different types of nodes on the network
Learning about transaction fees and change addresses
Requesting that the blockchain adds your transaction
Verifying transactions and blocks of transactions
At one end, you’ve got your wallet or your node software. At the other, there’s the blockchain. In between is the network of peer-to-peer nodes and miners creating blocks in the chain. How does a transaction that you set up on your wallet program find its way into the blockchain?
In this chapter, we look at how a transaction leaves your wallet and ends up in the blockchain and the miner’s role in that process. As an example, we use Bitcoin, the first blockchain-based cryptocurrency. Other cryptocurrencies use a similar process, to varying degrees. Each has its own particulars, but understanding how Bitcoin works will give you a really good foundation.
The Cryptocurrency Network
Every cryptocurrency has its own network of nodes, operating across the Internet, and this network has both peer-to-peer and client-server aspects, depending on how you chose to interface with it and which software you utilize. (You may hear the term blockchain network or Bitcoin network , for example.)
You’ll often hear a cryptocurrency network described as a peer-to-peer network, and it is — though the peer-to-peer network can also be used as a client-server network. What’s the difference?
Peer-to-peer networks are networks of equal computers that work together.
Client-server networks are networks on which servers provide services to client computers.
Think about how you work with email. The Internet’s email system also has two aspects. First, it has a peer-to-peer aspect comprising hundreds of thousands of email servers around the world that work together, sending emails between each other.
But the email system also has a client-server aspect, with millions of email clients. Say that you use Outlook on your computer, or perhaps you log into Gmail and use the Gmail email program in your web browser. Either way, the program you’re using to write, send, receive, and read email is known as a client. This client program sends outgoing email to an email server and receives incoming email from a server.
Cryptocurrency networks are similar. First, there is a peer-to-peer network of full nodes, computers that receive and validate transactions and blocks to make sure they abide by the rules of the network and are all valid; this is the network that is doing the work of maintaining the blockchain. These nodes are peers because they’re all equal and work together. (And some of these full nodes, though not all of them, are also miners.) These nodes communicate with each other across the Internet using a particular protocol (a computer language, in the case of Bitcoin using the Bitcoin peer-to-peer protocol ), just like email servers communicate across the Internet using a protocol designed for that purpose.
Then there are client programs — software wallets that people use to send transactions to the full nodes to be added to the blockchain. When you install wallet software on your computer or smartphone or when you set up a custodial wallet by creating an account at an exchange, you’re working with a client program that can communicate on your behalf with the peer-to-peer network of full nodes. (These full nodes are servers to your wallet client.)
Custodial wallets are convenient and incredibly easy to set up; somebody else manages your keys and the wallet software for you. But they are also dangerous. You have to trust the service to protect your keys and to act in your best interests.
To eliminate third parties in their interaction with the blockchain network, users and miners often choose to run their own node as an alternative to custodial wallets and simple wallets that get all their data from full nodes on the network. These nodes receive and verify their own transactions and act as a peer in the peer-to-peer network. A typical personal computer can function as a node with the correct software.
Here are a few software tools that making running a Bitcoin node on a PC or laptop as simple as a few clicks:
Bitcoin Core: https://bitcoin.org/en/bitcoin-core
BTCPay Server: https://btcpayserver.org
OpenNode: www.opennode.com
Samourai Dojo: https://bitcoin-on-raspberry-pi-4.gitbook.io/workspace
Umbrel: https://getumbrel.com
There are also specialized hardware devices that are designed to run only a Bitcoin node. These dedicated hardware nodes often consume less electricity compared to a typical PC and can be much smaller in size. Here is a short list of providers that specialize in dedicated Bitcoin node hardware:
The Bitcoin Machine: https://thebitcoinmachines.com
Lightning in a Box: https://lightninginabox.co
myNode One: https://mynodebtc.com/products/one
Nodl: www.nodl.it
RaspiBlitz: https://shop.fulmo.org/raspiblitz
Samourai Dojo: https://samouraiwallet.com/dojo
Start 9 Labs Embassy: https://store.start9.com/products/embassy
There are actually various different kinds of nodes. In fact, nodes on the Bitcoin network have around 150 different software configuration settings, so really there’s an almost infinite number of different types of nodes. We need to explain at least a few basics, though, so what follows is a bit of a simplification; understand that the following types of nodes have a lot of overlap.
Any computer connected to the network is a node, but different nodes do different things:
Full nodes — more correctly known as fully validating nodes — are systems that fully validate blocks and transactions. Full nodes check that the blocks and transactions being passed around the network follow the network rules. The nodes then pass the blocks and transactions on, across the network to other full nodes, and those nodes will also validate the blocks and transactions. A full node may contain a copy of the entire blockchain, but not all do; nodes may opt to prune, or remove, redundant data to save space. Today, the amount of disk space the Bitcoin blockchain uses is around 430GB, so pruning can be worthwhile. Most full nodes also accept incoming transaction messages from wallets. Full nodes may be listening nodes , often known as super nodes , or nonlistening nodes . Some full nodes are mining rigs.
Читать дальше