Blockchain Explained: A Beginner's Guide to Decentralized Transactions
Ever wonder if there's an easier way to complete transactions without having to deal with online wallets, banks, and third-party applications? Well, it's possible thanks to blockchain. Here's everything you need to know about this transformative technology.
Understanding Transaction Challenges
Imagine a group of friends—Jack, Ted, Sam, and Phil—meet up for dinner. After they're done, Jack pays the bill, and all of them decide to split the expense amongst each other.
Now, on the next day, when Phil sends his share to Jack via online money transfer, the transaction goes through without a hitch. Then, Ted and Sam send their respective shares to Jack, but their transactions don't go through. The failed transaction cites some issues at the bank. That's when Jack discovers the numerous ways a bank transaction can fail. It could be due to technical issues at the bank, one of their accounts being hacked, daily transfer limits being exceeded, and sometimes additional charges like transfer fees associated with moving money.
The Rise of Cryptocurrencies
To solve these problems, the concept of cryptocurrency came into existence. Cryptocurrencies are a form of digital or virtual currency that run on a technology known as blockchain. Thanks to blockchain, cryptocurrencies are immune to counterfeiting, don't require a central authority, and are protected by strong and complex encryption algorithms. In a market with thousands of cryptocurrencies like Litecoin, Ethereum, and Zcash, one reigns supreme: Bitcoin.
How Blockchain Works: A Practical Example
Now, let's revisit our previous example and have Phil, Ted, and Sam send Jack two bitcoins each as their contribution to the previous night's dinner. Let's assume Phil, Ted, and Sam each have three bitcoins in reserve, while Jack has five.
First, Phil sends two bitcoins to Jack. A record is created in the form of a block. The transaction details between them are permanently inscribed in this block. This record also holds the number of bitcoins each of the friends owns. So, after Phil's transaction, Jack has seven bitcoins, while Phil has one.
Following this, Sam and Ted send two bitcoins to Jack. A new block is created for each of these transactions. These blocks hold the transaction details as well as how many bitcoins Sam, Ted, and Jack have in reserve. These blocks are linked to each other, as each of them takes reference from the previous one for the number of bitcoins each friend owns. This chain of records, or blocks, is called a ledger, and this ledger is shared among all the friends, which acts as a public distributed ledger. This forms the basis of blockchain.
Security and Immutability
So, what happens when Phil has only one bitcoin left and he tries to send two more bitcoins to Jack? The transaction will not go through. This is because all his friends have copies of the ledger, and it's clear that Phil has only one bitcoin left. His friends will flag this transaction as invalid.
A hacker will not be able to alter the data in the blockchain because each user has a copy of the ledger. The data within the blocks are encrypted by complex algorithms. All of this is made possible with the help of blockchain technology. Blockchain can be described as a collection of records linked with each other, strongly resistant to alteration, and protected using cryptography.
A Closer Look at a Bitcoin Transaction
Now, let's have a closer look at the Bitcoin transaction between Jack and Phil and find out how it works.
Every user in the Bitcoin network has two keys: a public key and a private key. - Public Key: An address that everyone in the network knows of, like an email address of a user. - Private Key: A unique address that only the user has knowledge of, something like a password.
First, Phil passes the number of bitcoins he wants to send to Jack, along with his and Jack's unique wallet address, through a hashing algorithm. All of this is part of the transaction details. These details are encrypted using encryption algorithms and using Phil's unique private key. This is done to digitally sign the transaction and to indicate that the transaction came from Phil.
This output is now transmitted across the world using Jack's public key. With this, the message or transaction can be decrypted only by Jack's private key, which only Jack has knowledge of.
Different cryptocurrencies use various hashing algorithms. For instance, Bitcoin uses the SHA-256
algorithm, while Ethereum, which is also a famous cryptocurrency, uses one known as Ethash
.
Mining and Proof of Work
This transaction and several other similar ones are taking place all around the world. These transactions are validated and then added block by block. The people who validate these blocks are called miners. For a block to be validated and added to a blockchain, miners need to solve a complex mathematical problem. The miner who solves this first adds the block to the blockchain and is rewarded (for example, with 12.5 bitcoins, though this reward changes over time).
The process of solving the complex mathematical problem is called "proof of work," and the process of adding a block to the blockchain is called "mining." With this, Phil's and Jack's wallets are updated, just like every person in the network who has completed a transaction.
Real-World Application: Improving Supply Chains
Let's have a look at how a major retailer like Walmart uses blockchain to provide its customers with better service. Walmart was facing problems in delivering quality products to its customers. They were facing a high return rate and large amounts of refunds due to their products' bad quality. They were unable to determine the point of failure in the supply chain, which started from the farm to storage, to transportation, to processing, all the way to the customer.
Then, Walmart adopted blockchain technology. With blockchain, the quality of the goods at each step was permanently inscribed within a block. For example, when a customer flags a product as damaged, it can be correctly identified where the product got damaged in the entire supply chain. This helps Walmart to identify the problem areas and fix them.
This is just one of several ways blockchain is used in real-life applications.
Join the 10xdev Community
Subscribe and get 8+ free PDFs that contain detailed roadmaps with recommended learning periods for each programming language or field, along with links to free resources such as books, YouTube tutorials, and courses with certificates.