What Is a Blockchain?
As blockchain moves towards global adoption, more and more companies are wondering: what is a blockchain? Click here to learn more about digital currencies.
Join the DZone community and get the full member experience.Join For Free
I am writing this article to provide an overview of what a blockchain is and how it operates. So, what is a blockchain? I know what you are thinking, and no — it's not Bitcoin.
The blockchain is a medium that helps move digital currencies (such as Bitcoin) from one individual to another.
Okay, now that we know what a blockchain is, let's talk about how it works.
Blockchain: How it Works
First, let me give you an example: Bruce, who stays in New York, wants to send some money to his friend Clark, who is currently living in Tokyo.
How will this money transfer process play out?
Bruce will contact a trusted third party for making a transfer to Clark who lives in Tokyo. Then, the trusted third party organization will verify the identity of Clark in Tokyo, and once his identity is verified, it will take Bruce's money and transfer to Clark's account.
This is a most common method of money transfer in the traditional sense. This method has many drawbacks — it takes days to complete the process. Therefore, it is slow and the third parties have charges in place for these kinds of transactions.
Blockchain aims to make this process immediate and wants to reduce the transaction fees to almost nothing.
How to Achieve That?
Blockchain uses open ledgers to record the transactions, and those transactions connect to each other from the first transaction to the most recent one in the form of a chain. In simple words, an open ledger is a chain of transactions.
Everyone in the network can see the transactions, where the money is, and how much money each individual has. The participants in the network decide the validity of a transaction, and only after that, it gets added to the ledger. Look at the above example. Now, let's say Barry is trying to send $10 to Diana, but Barry doesn't have enough balance to send $10 to Diana. Therefore, the transaction will be invalidated by the participants and will not be added to the chain.
Okay, so now we know how an open ledger is created. However, the chain that we created in the above example is centralized, but the goal of blockchain is to get rid of centralization and make the ledger distributed.
How do we do that? By distributing a copy of the ledger to each participant in the network. Now that everyone in the network holds a copy of the chain of events that occurs inside the network, we do not need the centralized ledger.
Over time, the ledger will add up more transactions to it, and we have to make sure that everyone in the network has the same updated copy of the ledger.
How to Synchronize the Ledgers Across the Network?
Let's say Barry is trying to send $2 to Billy. Barry will publish a broadcast about this on the network and everyone in the network will see it. This transaction is not validated yet.
So, who will validate it? This transaction will be validated by a miner. Miners are specials nodes in a network. They compete among themselves to be the first one to validate a new transaction, and the first miner to validate a transaction gets a financial reward.
Let's assume that Diana and Arthur are two miners in the network, so they will compete to be the first one to validate the transaction for a financial reward. In order to be the first miner who validates the transaction, you need to do two things:
- Validate the transaction — this is the easy part. In our example, the miners will check if Barry has sufficient balance do the transaction, and yes, he has the sufficient funds to be able to transfer $2 to Billy.
- Find a special key that will allow the miner to attach the new validated transaction to the last transaction in the ledger. In order to find this key, a miner has to invest heavy computational power and time because the search of the key is quite random. The miner has to repeatedly search for the key until they find it.
In our example, we have Arthur and Diana as two miners who are competing to get the reward. Let's say Diana manages to validate and find the key first. Then, she does the following things:
- Adds the validated transaction to her own ledger.
- Broadcasts the transaction and the key that enables the validated transaction to be added to the ledger to the entire network.
Now, everyone in the networks uses the key and adds the transaction to their respective ledgers. Voila! The ledgers across the network are synchronized.
This is how a typical blockchain functions. Note that this is just an overview of how a blockchain works. Feel free to correct me if something I have written here seems to be wrong or ask me if you have any questions regarding this in the comments below!
Opinions expressed by DZone contributors are their own.