What Is Blockchain Technology and How Does It Work
At its core, the blockchain is a distributed ledger. But what does that mean? And how is it different from a centralized ledger? What exactly is a blockchain?
We will explain it by comparing a blockchain with a bank.
Your bank maintains a central database, that is, a “ledger”, of all your customer data. This can store account numbers, balances, transactions, and more. Every time you interact with your account, for example, withdrawing money or making a transfer to another person or entity, your bank updates the records.
Only the bank has access to the ledger, so if they decide to make a change, there isn’t much the user can do about it.
Now imagine that a hacker had access to this database. They could modify balances, delete operations, and much more. Your bank may be able to restore data from backups, and there may be many databases that serve this data, but ultimately it is controlled by a central entity.
Distributed ledgers are much smarter. Instead of one person or company is solely responsible for the general ledger, many people have copies of a distributed general ledger, and there are often few restrictions on who can join.
Each user, known as a “node,” stores a copy of the data, from the beginning of the book to the present. The whole lot. For each transaction, multiple nodes verify it, and then all nodes update their records so that everything is kept up to date and in sync.
Each new transaction is grouped with many other transactions in a “block”. These blocks provide some benefits. There is no centralized authority that can manipulate the registry. If a nefarious hacker or node started changing records in a workbook, all other nodes would reject it as the new records would not match the data stored by everyone else.
The only way to manipulate the data is for each node to conspire against each other, which is highly unlikely. In the case of Bitcoin, there are approximately 10,000 different Bitcoin nodes scattered around the world at the time of this writing.
Table of Contents
The blockchain is a secure and collaborative databook
Let’s explain it in another way. Encryption is normally used to lock files, so they can only be accessed by specific people. But what if you have information that needs to be seen by everyone, such as accounting information from a government agency that has to be public by law, and still needs to be safe? There is a problem there: the more people can see and edit information, the less secure it will be.
Blockchains were developed to meet the security needs of these specific situations. In a blockchain, each time the information is accessed and updated, the change is logged and verified, and then sealed by encryption, with no possibility of re-editing. The changeset is saved and added to the total record. The next time someone makes changes, it all starts again, preserving the information in a new “block” that is encrypted and connected to the previous block, hence the “blockchain”. This replay process connects the first version of the information set to the latest, so that everyone can see all the changes made, but can only contribute and edit the latest version.
This idea is a bit resistant to metaphors, but imagine that you are in a group of ten people assembling a LEGO set. Only one part can be added at a time, and no part can be removed at all. Each group member must agree on where the next piece will end. In this way, you can see all the pieces at any time, from the first piece of the project, but you can only modify the last piece.
For something a little more relevant, imagine a collaborative document, like a spreadsheet in Google Docs or Office 365. Everyone who has access to the document can edit it, and every time they do, the change is saved and recorded as a new spreadsheet, and then hangs in the document history. So you can go back, step by step, through the changes made, but you can only add information to the latest version, not modify the previous versions of the spreadsheet that have already been blocked.
As you probably heard, this idea of a secure and constantly updated “ledger” is being applied primarily to financial data, where it makes the most sense. Distributed digital currencies like Bitcoin are the most common use for blockchains; in fact, the first one was made for Bitcoin and the idea spread from there.
Blockchain Validation: Public and Private Keys
As seen above, a blockchain is a decentralized data store, and the most common type of stored data is transactions.
If a user sends a BTC to another, it tells each node that that’s what it’s doing, and they all log the transaction is allowed. By reviewing the ledgers, the nodes can reject the transaction if the user does not have enough Bitcoin to send, or if they are not the account holder.
Every transaction must pass validation, and that’s where block technology gets a little more complicated. Each blockchain “wallet”, think of this as a blockchain bank account, has a public key and a private key.
The public key is not sensitive, but the private key is. Only the true account holder should have access to the private key and if someone gets hold of it, the account could be hijacked. If you want to keep your cryptocurrencies safe, then take a look at this article where we describe the best cryptocurrency cold wallets.
When sending the user the BTC mentioned above, the wallet of the sender presents the public key together with a digital signature. This digital signature is unique and is generated only with the private key. Using the signature and the public key, other nodes can verify that it is a legitimate transaction, all without ever revealing the private key.
This is a simplified example: the cryptography behind the public / private key system is much more complex. Public and private keys are not numbers like bank accounts. Instead, they use the Secure Hash Algorithm 256 (SHA-256) algorithm and the RACE Integrity Primitives Evaluation Message Digest 160 (RIPEMD-160).
If you have never heard of these algorithms don’t worry. An average user does not need to understand them in depth to use cryptocurrencies. You just have to know that these algorithms make the Internet work as we know it, encrypting web pages through SSL and TLS and much more. In the future, other blockchain encryption algorithms may be used.
You just have to know that all this encryption and verification has a cost. Each node needs a lot of computing power to verify all transactions that are made and update its ledger accordingly. This is where mining comes in: users can earn small transaction fees as payment for that verification. By running the book this way, miners running nodes are paid and each transaction is verified. It is a rather simple system. But not everything is perfect.
During periods of high transaction demand, fees can go up. If there aren’t enough nodes for everyone, users can pay more to have their transactions processed before others, and miners end up favoring higher-paying transactions. Those who pay lower fees will continue to be processed, but at a much slower rate, unless the fee is too low, in which case no one will bother verifying the transaction.
In addition to transaction fees, miners can also cash in shiny new Bitcoins. By paying miners a fraction of a BTC in addition to the transaction fee, the new Bitcoins are drip-fed into the market. These unmined Bitcoins become more difficult to mine as time goes by until one day there are no unmined coins left, and miners will only receive payment as transaction fees.
The Technical Things: Step by step, block by block
How does all this work on a computer? It is a combination of cryptography and peer to peer networks.
You may be familiar with peer-to-peer file-sharing – services like BitTorrent that allow users to upload and download digital files from multiple locations more efficiently than from a single connection. Imagine “files” as the core data on a blockchain, and the download process as the cryptography that keeps them up-to-date and secure.
Or, to go back to the Google Docs example above: imagine that the collaborative document you are working on is not stored on a server. Instead, it is on each individual’s computer, which is constantly checking and updating each other to make sure that no one has modified previous records. This makes it “decentralized“.
That is the central idea behind the blockchain: it is cryptographic data that is accessed continuously and securely at the same time, without any centralized server or storage, with a changelog that is incorporated into each new version of the data.
So we have three elements to consider in this relationship. One, the network of peer-to-peer users who store all the copies of the blockchain registry. Second, the data these users add to the last “block” of information, allowing them to be updated and added to the total record. Third, the cryptological sequences that users generate to agree on the last block, fixing it in the data sequence that make up the record.
It is the last part that is the secret sauce of everything related to the blockchain. Using digital cryptography, each user contributes to the power of their computer to help solve some of those super complex math problems that keep the registry secure. These extremely complex solutions, known as “hashes,” resolve central parts of the data in the registry, such as which account added or subtracted money in a ledger, and where that money came from or where it came from. The denser the data, the more complex the cryptography will be and the greater the processing power necessary to solve it. This is where the idea of ’mining‘ in Bitcoin comes into play, which we have cited above.
So, to summarize, we can think of a blockchain as a piece of data that is:
- Constantly updated. Blockchain users can access the data at any time and add information to the most recent block.
- Distributed. Copies of the blockchain data are stored and secured by each user, and everyone must agree on new additions.
- Verified. Both changes to new blocks and copies of old blocks must be agreed by all users through cryptographic verification.
- Insurance. Tampering with old data and altering the security method of new data is avoided both by the cryptographic method and by the non-centralized storage of the data itself.
And believe it or not, it gets even more complicated than this, but that’s the basic idea.
When is a blockchain not a blockchain?
While many blockchains only store transaction details, it is possible to store all kinds of data on a blockchain: medical records, secure messages, smart contracts, and much more.
It is also possible to build your own Blockchain, even one that is private, as long as you have enough nodes to run it. You can remove the encryption, change the rules, or decentralize it.
Many would argue that these changes would mean that the system is no longer a blockchain, but therein lies the problem: without a formal definition or definition of “blockchain, or Blockchain,” there is no trust in the system. Many blockchain projects exist solely to defraud people. Other blockchain projects use the name of the blockchain, using it to improve their bottom line without any real innovation. Bitcoin’s traditional model is the best way to go: a public blockchain, accessible to all, and not centralized.
What else can blockchains do?
Blockchain technology started with Bitcoin, but it’s such an important idea that it didn’t stay there for long. A system that is constantly updated, accessible to everyone, verified by a non-centralized network, and incredibly secure, has many different applications. Financial institutions like JP Morgan Chase and the Australian Stock Exchange are developing blockchain systems to secure and distribute financial data, for conventional money, not for cryptocurrency like Bitcoin. The Bill & Melinda Gates Foundation hopes to use blockchain systems to provide free and distributed banking services to billions of people who cannot afford a regular bank account.
Open source tools like Hyperledger are trying to make blockchain techniques available to a wider range of people, in some cases without needing the monstrous amounts of processing power that is needed to secure other designs. Collaborative work systems can be verified and registered with blockchain techniques. Virtually anything that needs to be constantly recorded, accessed, and updated can be used in the same way.