How Does the Blockchain Work?

Blockchain technology explained in simple words

Credit: Ani_Ka/DigitalVision Vectors/Getty
  1. We can turn the bet into a contract. With a contract in place both parties will be more prone to pay. However, should either of the two decide not to pay, the winner will have to pay additional money to cover legal expenses and the court case might take a long time. Especially for a small amount of cash, this doesn’t seem like the optimal way to manage the transaction.
  2. We can involve a neutral third party. Each of us gives $50 to a third party, who will give the total amount to the winner. But hey, she could also run away with all our money. So we end up with one of the first two options: trust or contract.

The Basics of Bitcoin

Images courtesy of author.
Fig. 1 - Bitcoin ledger digital file simplified
Fig. 2 - Transaction request message simplified
  • While you can generally trust your bank, the bitcoin network is distributed and if something goes wrong there is no help desk to call or anyone to sue.
  • The blockchain system is designed in such a way that no trust is needed; security and reliability are obtained via special mathematical functions and code.
Fig. 3 - Digital Signature transaction encryption simplified

Tracking Your Wallet Balance

Each node in the blockchain is keeping a copy of the ledger. So, how does a node know your account balance? The blockchain system doesn’t keep track of account balances at all; it only records each and every transaction that is verified and approved. The ledger in fact does not keep track of balances, it only keeps track of every transaction broadcasted within the bitcoin network (Fig. 4). To determine your wallet balance, you need to analyze and verify all the transactions that ever took place on the whole network connected to your wallet.

Fig. 4 - Blockchain Ledger
Fig. 5 - Blockchain transaction request structure

But Is It Really Safe? And Why Is It Called Blockchain?

Anyone can access the bitcoin network via an anonymous connection (for example, the TOR network or a VPN network), and submit or receive transactions revealing nothing more than his public key. However if someone uses the same public key over and over, it’s possible to connect all the transactions to the same owner. The bitcoin network allows you to generate as many wallets as you like, each with its own private and public keys. This allows you to receive payments on different wallets, and there is no way for anyone to know that you own all these wallets’ private keys, unless you send all the received bitcoins to a single wallet.

The total number of possible bitcoin addresses is 2¹⁶⁰ or 1461501637330902918203684832716283019655932542976.

This large number protects the network from possible attacks while allowing anyone to own a wallet.

Fig. 6 — The block chain sequence structure simplified
Fig.7 - End of chain ambiguity logic

Transactions in the Bitcoin blockchain system are protected by a mathematical race: Any attacker is competing against the whole network.

Let’s see how Mary could leverage this end-of-chain ambiguity to perform a double-spending attack. Mary sends money to John, John ships the product to Mary. Since nodes always adopt the longer tail as the confirmed transactions, if Mary could generate a longer tail that contains a reverse transaction with the same input references, John would be out of both his money and his product.

Fig. 8 - Mary’s double-spending attack
Fig. 9 - Blockchain transactions security

Mining Bitcoin

In order to send bitcoins, you need to reference an incoming transaction to your own wallet. This applies to every single transaction across the network. So, where do bitcoins come from in the first place?

Blockchain Benefits and Challenges

Now that you have a general understanding of how the blockchain works, let’s take a quick look at why it’s so interesting.

  • The cost to perform a value transaction from and to anywhere on the planet is very low. This allows micropayments.
  • Value can be transferred in a few minutes, and the transaction can be considered secure after a few hours, rather than days or weeks.
  • Anyone at any time can verify every transaction made on the blockchain, resulting in full transparency.
  • It’s possible to leverage the blockchain technology to build decentralized applications that would be able to manage information and transfer value fast and securely.
  • Though many exchange platforms are emerging, and digital currencies are gaining popularity, it’s still not easy to trade bitcoins for goods and services.
  • Bitcoin, like many other cryptocurrencies, is very volatile: There aren’t many bitcoins available in the market and the demand is changing rapidly. Bitcoin price is erratic, changing based on large events or announcements in the cryptocurrencies industry.

Useful Links

Building real-time finance at @Superfluid_HQ