How Does Blockchain Actually Work?

Given the ripple impact it is having on different industries, including finance, industry, and education, blockchain technology has to be one of the most significant breakthroughs of the twenty-first century. Lets take a short dive into the all-the-talk tech.
Jacob Poulsen

Jacob Poulsen

Co-Founder

What is blockchain?

A blockchain, in a nutshell, is a collection of data records that serves as a decentralised digital ledger. The data is organised into pieces that are sequentially arranged and encrypted.

In the early 1990s, computer scientist Stuart Haber and physicist W. Scott Stornetta created the initial blockchain idea, which employed cryptographic techniques in a chain of blocks to safeguard digital documents from data modification.

The work of Haber and Stornetta surely affected the work of many other computer scientists and cryptography enthusiasts, eventually leading to the creation of Bitcoin, the first decentralised electronic monetary system (or simply the first cryptocurrency).

Although blockchain technology predates cryptocurrencies, its potential was initially realised with the creation of Bitcoin in 2008. Since then, interest in blockchain technology has expanded steadily, and cryptocurrencies are becoming more widely recognised.

Blockchain technology is most often used to record bitcoin transactions, but it also works well with other forms of digital data and may be used to a wide range of applications. The Bitcoin blockchain network is the oldest, safest, and largest, and it was built via a planned and balanced combination of cryptography and game theory.

How does blockchain work?

In the context of cryptocurrencies, a blockchain is a reliable chain of blocks, each of which contains a list of previously validated transactions. The blockchain network functions as a decentralised database since it is maintained by a huge number of computers situated all over the world (or ledger). This means that each participant (node) maintains a copy of the blockchain data and interacts with one another to ensure that everyone is on the same page (or block).

As a consequence, blockchain transactions take place inside a peer-to-peer global network, which identifies Bitcoin as a borderless and censorship-resistant decentralised digital currency. Furthermore, since they do not need any sort of confidence, most blockchain systems are classified as trustless. Bitcoin is not under the control of a single entity.

Mining, which is based on hashing algorithms, is an essential component of almost every blockchain. Bitcoin employs the SHA-256 algorithm (Secure hash algorithm 256 bits). It takes any length input and always generates the same length output. In this example, the final output is known as a “hash,” and it is always made up of 64 characters (256bits).

As a result, no matter how many times the process is repeated, the same input will always provide the same output. However, if the input is slightly altered, the output will be drastically altered. As a consequence, hash functions are deterministic, and the vast majority of them in the cryptocurrency industry are built as one-way hash functions.

It is almost impossible to determine what was the input from the output since it is a one-way function. The only thing one can do is estimate what the input was, but the odds of being accurate are quite slim. This is one of the reasons Bitcoin’s blockchain is secure.

Lets get an example

Now that we know what the algorithm accomplishes, let’s have a look at how a blockchain works by using a simple transaction as an example.

Take a look at Matias and Arthur, together with their Bitcoin balance. Let’s say Matias owes Arthur two Bitcoins.

To give Arthur the two bitcoins, Matias broadcasts a message to all miners in the network detailing the transaction she intends to carry out.

In that transaction, Matias gives the miners Arthur’s address, the amount of Bitcoins she wants to send, a digital signature, and her public key. The signature is made using Matias’ private key, and miners may confirm that Matias is the legal owner of those coins.

How do you confirm the authenticity?

After determining that the transaction is authentic, miners may put it in a block with many other transactions and attempt to mine the block. This is performed by running the SHA-256 algorithm on the block. The output must begin with a certain number of 0’s in order to be considered legitimate. The “difficulty,” which changes depending on the amount of computer power available on the network, determines the number of 0’s necessary.

Miners insert a “nonce” into the block before running it through the algorithm to generate an output hash with the appropriate number of 0’s at the start. Miners try random nonces until they achieve a correct output hash since a little change in the input substantially impacts the result.

The miner publishes the block to all other miners after it has been mined. They then confirm the authenticity of the block before adding it to their copy of the blockchain, and the transaction is complete. However, miners must also include the preceding block’s output hash in the block so that all blocks are connected together, thus the word blockchain. This is a vital component because of how trust operates in the system.

Every miner has their own copy of the blockchain on their computer, and everyone believes the blockchain has had the most computational work put into it, which is the longest blockchain. When a miner updates a transaction in a previous block, the output hash for that block changes, forcing all hashes after it to change due to the blocks being linked with hashes. The miner would have to redo all of his work to convince anybody to recognise his blockchain as the right one. To cheat, a miner would need more than 50% of the network’s processing capacity, which is very unlikely. As a consequence, network attacks like this are known as 51 percent attacks.

Proof-of-Work (PoW) is a paradigm for having computers work to generate blocks; other models, such as Proof-of-Stake (PoS), do not need as much processing power and are designed to spend less energy while scaling to more users.