How Does Blockchain Work?

On the internet as we know it, all services are located on centralized servers and are fully controlled by the companies that own them. If you want to interact with a service or any unfamiliar users in its ecosystem, you need to make sure you trust them, which is often hard.

Blockchain technology changes these principles. Blockchain is a distributed database and a data exchange protocol that are run by a global network of users rather than a centralized authority. Anyone who satisfies the conditions of the protocol can update it, so the parties interacting through this protocol don’t have to trust each other — a trust in the particular blockchain is enough.

The first real-world implementation of blockchain technology was Bitcoin. Today, cryptocurrency is still its main use case, but there are also many others. Each cryptocurrency runs on its own blockchain; some cryptocurrencies run on the blockchains of other cryptos.

Why is blockchain considered one of the main technological breakthroughs of the XXI century?

Here are the other core characteristics of blockchain that make it a revolutionary invention:

  • It’s a distributed database, meaning that all the members of the network simultaneously hold the same database and update it in real-time. Instead of a central authority, there is a consensus algorithm that ensures the agreement of all nodes regarding the updates to the database and the protocol. This means that no single company, bank, or government can alter what is happening in the blockchain — it’s impossible to freeze any account or withhold a transaction.
  • Blockchain is transparent. The database that the nodes hold is open to everyone through block explorers. If you’ve sent your money to someone, you can prove this using the public data from the ledger, and they won’t have any reason not to believe you.
  • Blockchain is immutable. Whatever is written in the blockchain, it cannot be altered or forged retroactively. This fact raises trust in this technology.

How does blockchain work?

Blocks

The first miner to solve the problem shows the Bitcoin network their Proof of Work that demonstrates they’ve found an optimal solution for the block. If the network agrees, the miner gets the right to add this block to the database and receives the mining reward (currently, 6.25 BTC for a block). This block will forever stay in this database and will never be altered. The database looks like a chain of these blocks — the blockchain.

Hash

A hash function is a mathematical operation that transforms input information of any size into a fixed number of characters, which looks like an array of letters and numbers. Bitcoin leverages the SHA-256 function. Every input in it can be transformed into a unique combination of 64 letters and numbers; minimal changes in the input follow with the complete change of the output. You can test how SHA-256 works online — for example, here.

Here’s what hash we will get after hashing the word “Bitcoin”:

b4056df6691f8dc72e56302ddad345d65fead3ead9299609a826e2344eb63aa4

But here’s what we’ll get if we hash “bitcoin”:

6b88c087247aa2f07ee1c5956b8e1a9f4c7f892a70e324f1bb3d161e05ca107b

Hashing any amount of data is a very fast process (as you can make sure using the link provided). Whenever you send a transaction, your wallet will instantly display you the transaction hash — a unique identifier that allows you to track the transaction in a block explorer.

But why is it necessary to hash blocks of transactions, and why is it so difficult?

When new transactions are sent in the Bitcoin network, miners pick them up and consecutively hash them several times. As a result, we get one hash for all transactions in a block, and it’s called the Merkle root hash (and the whole structure is called the Merkle tree):

Merkle root is one of the three main block components. Two others are the hash of the previous block and the nonce — a random number (we will explain what it serves for below). By hashing these three pieces of data, we easily get the hash of the block.

The difficulty in mining is that this hash has to correspond to one criterion — in the output, there should be several zeros at the beginning of the string. Here’s what block 700367 hash looks like (mined on September 13, 2021):

0000000000000000000bb4629f421f14de975adba2d9eebca19013d0e2a8baf9

To get such a hash, you need to vary the nonce multiple times because you can’t guess in advance that nonce will correspond to the needed hash. And you have to do it so many times that people buy special hardware (GPUs and ASICs) to gain an advantage in computing it as fast as possible.

Why is this so important?

  1. The more zeros have to be at the beginning of the hash, the more difficult it is to find such a hash. Mining (hashing) difficulty exists so that it wouldn’t be too easy to mine a block. If anyone could do it, malicious actors with very few resources could add any wrong information to the blockchain, whereas with high mining difficulty, they’d have to put in billions of dollars to achieve this.
  2. As we already mentioned, every block contains a hash of the previous block. If malicious actors want to alter a certain block, they will have to change all the subsequent blocks (because if you change one block’s hash, all the subsequent blocks become invalid). This would also require the concentration of huge computing resources.

Now, let’s consider two main types of blockchains — public and private ones.

Public blockchains — permissionless ledgers for all

A true boom of cryptocurrency started in 2015, when Ethereum was invented with the purpose to enlarge the blockchain’s functionality. The platform enabled smart contracts — contracts in which all conditions are written in code and if met by two parties, get executed without any further human intervention. Hundreds of developers flooded into Ethereum and began building decentralized (blockchain-based) applications (dApps) for lending and borrowing, games and collectibles, which provoked the first large crypto boom in 2017.

Private blockchains — permissioned enterprise networks

Private blockchains have drastically enlarged the range of blockchain use cases. They don’t usually power cryptocurrencies — rather, they are used to prove the authenticity of items, record ownership rights, and manage supply chains.

Although these blockchains are private, they are still decentralized protocols for data storage and exchange. Let’s consider an example: a chain store wants to make sure that it buys fresh fish. It opens a supply chain that is joined by the fishery. The fishery adds to this ledger the data about the time and conditions in which the fish was caught; a logistics company will inform on its delivery status; the shop will verify all this info and put labels on the packages so that buyers could check the freshness of the fish via a QR code.

All fair parties have an interest in working transparently, and that’s why private blockchains are beneficial for everyone. With their help, companies can track the authenticity of gemstones, check different items’ ownership, and some governments even run elections.

The revolution of blockchain: the main outcomes and perspectives

Blockchain changes fundamentally the very way people cooperate. It gives people more control over their funds and allows for near-instant cross-border payments free from third parties. But even more importantly, blockchain is not governed by central authorities, and no one can stop transactions or change their record at their will. Moreover, one doesn’t need any permission to build dApps, offering decentralized solutions for a wide range of cases.

Permissioned blockchains have a big future, too. They are the same as transparent and immutable, which is why corporations and their alliances can become more open and gain more trust. The companies don’t need to spend millions on audits anymore. And by setting such a standard of openness, blockchain can eliminate out of competition the services that are not ready to offer such transparency. It seems that this is a win-win situation for all.

All things described above have only happened in 12 years. If in 2009, anyone said that millions of people would use bank-free loans and free instant remittances, that would have sounded impossible. That’s why it’s hard to imagine what blockchain will offer us in the next decade. However, we may be sure this will be something special.

ChangeNOW is an instant cryptocurrency exchange service for limitless crypto conversions. We support over 200 coins and are account-free! https://changenow.io/