Bitcoin Mechanism: 3 Ways It Revolutionizes Security

This article is about the Bitcoin mechanism. Whereas the discussion in the first two chapters was relatively generalized, we now delve into the details. We’ll look at real data structures, real scripts, and learn the details and language of Bitcoin in a precise way to set up the discussion in the rest of this book. This chapter is challenging, because it is detail oriented and we cover a lot of ground. You’ll learn the specifics and the quirks that make Bitcoin what it is.

To recap where we left off in this article, the Bitcoin mechanism gives us an append-only ledger, a data structure that we can only write to. Once data is written to it, it’s there forever. A decentralized protocol establishes consensus about the value of that ledger, and miners use the protocol and validate transactions. The protocol and miners together make sure that transactions are well formed, that the the bitcoins involved aren’t already spent, and that the ledger and network can function as a currency.

At the same time, we assumed that a currency existed to motivate these miners. In this chapter we look at the details of how that currency is engineered to motivate the miners who make this whole process happen.

BITCOIN TRANSACTIONS

BITCOIN TRANSACTIONS

Let’s start with transactions, Bitcoin mechanism’s fundamental building block. We use a simplified model of a ledger for the moment. Instead of blocks, let’s suppose individual transactions are added to the ledger one at a time.

How can we build a currency based on such a ledger? The first model you might think of, which is actually the mental model many people have of how Bitcoin works, is an account-based system. You can add some transactions that create new coins and credit them to somebody. And then later you can transfer the coins.

A transaction would be something like “move 17 coins from Alice to Bob,” and it would be signed by Alice. That’s all the information in the ledger about the transaction. after Alice receives 25 coins in the first transaction and then transfers 17 coins to Bob in the second, she’d have 8 bitcoins left in her account.

The downside to this way of doing things in Bitcoin mechanism is that anyone who wants to determine whether a transaction is valid will have to keep track of these account balances. Take another look at Figure 3.1. Does Alice have the 15 coins that she’s trying to transfer to David?

To figure this out, you’d have to track every transaction affecting Alice back in time to determine whether her net balance when she tries to transfer 15 coins to David is greater than 15 coins. Of course we can make this a bit more efficient with some data structures that track Alice’s balance after each transaction. But that’s going to require a lot of extra housekeeping besides the ledger itself.

Bitcoin mechanism
Bitcoin track of transactions

Because of these drawbacks, Bitcoin mechanism doesn’t use an account-based model. Instead, Bitcoin uses a ledger that just keeps track of transactions.

TRANSACTIONS SPECIFICATIONS

Transactions specify a number of inputs and a number of outputs (recall PayCoins in Scroogecoin). You can think of the inputs as coins being consumed (created in a previous transaction) and the outputs as coins being created. For transactions in which new currency is being minted, no coins are being consumed (recall CreateCoins in Scroogecoin). Each transaction has a unique identifier. Outputs are indexed beginning with 0, so we refer to the first output as “output 0.”

Let’s now work our way through Figure below explain the Bitcoin mechanism: Transaction 1 has no inputs, because this transaction is creating new coins, and it has an output of 25 coins going to Alice. Also, since this is a transaction where new coins are being created, no signature is required. Now suppose that Alice wants to send some of those coins to Bob. To do so, she creates a new transaction, transaction 2 in our example. In the transaction, she has to explicitly refer to the previous transaction where these coins are coming from.

The only output of transaction

Here, she refers to output 0 of transaction 1 (indeed the only output of transaction 1), which assigned 25 bitcoins to Alice. She also must specify the output addresses in the transaction. In this example, Alice specifies two outputs, 17 coins to Bob and 8 coins to Alice. And, of course, the entire content of the transaction is signed by Alice, so that we know that Alice actually authorizes it.

change address
A transaction-based ledger. This is the type of ledger used by Bitcoin.

Change addresses. Why does Alice have to send money to herself in this example? Just as coins in Scroogecoin are immutable, in Bitcoin, either all or none of a transaction output must be consumed by another transaction. Alice only wants to pay 17 bitcoins to Bob, but the output that she owns is worth 25 bitcoins. So she needs to create a new output, where 8 bitcoins are sent back to herself. It could be a different address from the one that owned the 25 bitcoins, but it would have to be owned by her. This is called a change address.

TRANSACTIONS VERIFICATION

Efficient verification. When a new transaction is added to the ledger, how easy is it to check whether it is valid? In this example, we need to look up the transaction output that Alice referenced, make sure that it has a value of 25 bitcoins, and that it hasn’t already been spent. Looking up the transaction output is easy, since we’re using hash pointers.

To ensure it hasn’t been spent, we need to scan the block chain between the referenced transaction and the latest block. We don’t need to go all the way back to the beginning of the block chain, and it doesn’t require keeping any additional data structures (although, as we’ll see, additional data structures will speed things up).

Consolidating funds. As in Scroogecoin, since transactions can have many inputs and many outputs, splitting and merging value is easy. For example, suppose Bob received money in two different transactions—17 bitcoins in one, and 2 in another. Bob might want to have a single transaction output available for later, so that he can spend all 19 bitcoins he controls. That’s easy—he creates a transaction using the two inputs and one output, with the output address being one that he owns. That lets him consolidate those two transactions.

Exploring the Different Aspects of the Bitcoin Mechanism

The Bitcoin mechanism involves various aspects that work together to ensure that transactions on the network are verified, secure, and transparent.

Here are some other aspects for Bitcoin Mechanism:

  1. Consensus algorithm: Bitcoin’s consensus algorithm, Proof-of-Work (PoW), is a critical component of the Bitcoin mechanism that ensures secure transaction verification and blockchain maintenance. Miners compete to solve complex mathematical problems, with the first miner to solve the problem being awarded the right to add the next block of transactions to the blockchain. This process ensures that the Bitcoin network remains secure and resistant to attacks.
  2. Wallets: Bitcoin wallets are essential for storing, sending, and receiving Bitcoin securely. There are various types of wallets available, including hardware wallets, software wallets, web wallets, and paper wallets. Each wallet has its unique features and benefits, but all of them are designed to keep your Bitcoin safe and secure.

Other aspects for Bitcoin Mechanism:

  1. Mining: Bitcoin mining is a process by which new Bitcoin is created and added to the blockchain. Miners use specialized hardware to solve complex mathematical problems, which is the key to verifying transactions and adding new blocks to the blockchain. Mining is essential for maintaining the integrity and security of the Bitcoin network.
  2. Halving: Bitcoin undergoes a “halving” event every four years. This event cuts the reward for mining new Bitcoin in half, limiting the total supply of Bitcoin to 21 million. The halving event is designed to ensure that the value of Bitcoin remains stable over time.
  3. Decentralization: Bitcoin is a decentralized digital currency, which means that there is no central authority controlling the network. Transactions are conducted directly between users without the need for intermediaries, making it a fast, secure, and cost-effective way to transfer value. The decentralized nature of Bitcoin makes it resistant to censorship and government interference, ensuring that you have full control over your money at all times.

CONCLUSION

The mechanism behind Bitcoin is a groundbreaking innovation that has disrupted the traditional financial system. Bitcoin operates on a decentralized network, which allows for secure and transparent transactions without the need for intermediaries such as banks or financial institutions. The blockchain technology that underpins Bitcoin ensures that all transactions are recorded in a secure and tamper-proof manner, making it virtually impossible for fraudulent activities to occur.

The limited supply of Bitcoin, coupled with its increasing demand, has made it a popular store of value and investment asset. Despite its volatility and regulatory challenges, Bitcoin has proven to be a resilient and valuable asset in the rapidly evolving digital economy.