What is blockchain and how does it work?

In the context of cryptocurrencies, blockchain technology consists of a stable chain of blocks, each of which stores a list of previously confirmed transactions. Because the blockchain network is maintained by countless computers spread around the world, it functions as a decentralized database – a kind of ledger. This means that each participant maintains a copy of the chain data. They communicate with each other, ensuring that they are all in the same block (a kind of digital accounting page).

Therefore, blockchain transactions occur within a global peer-to-peer network, making Bitcoin a decentralized, digital currency that is censorship and borderless. In addition, most blockchain systems do not require you to trust them because there is no single (centralized) authority to control Bitcoin, and once there is no central control body you can trust!?!

Why is blockchain a secure technology?

The basis of almost every blockchain technology is the process of extraction (cryptocurrency mining), which relies on hashing algorithms. Bitcoin uses the SHA-256 algorithm, which is the English abbreviation of Secure Hash Algoritam. Its value is 256 bits. It has an input of arbitrary length and an output is generated that will always have the same length. The output obtained is called a hash and in this case is always 64 characters, which is 256 bits.

Thus, the same input will result in the same output, no matter how many times the process is repeated. But if you make a small change in the input, the output will change completely. The hash functions are deterministic, and in the world of cryptocurrencies, most of them are designed as one-way hash functions.

Being a one-way function means that it is almost impossible to calculate what the input of an output was. One can only guess what the entrance was, but the chances of knowing one are extremely slim. This is one of the reasons that Bitcoin blockchain technology is protected.

How does blockchain work?

Now that we know what the algorithm is doing, let’s demonstrate how the blockchain works with a simple transaction example.

Imagine that Pesho and Ivan together have a certain balance of bitcoins . Let’s say Pesho owes Ivan the Bitcoin (which makes him pretty rich).

In order for Pesho to send Ivan the 2 bitcoins, he sends a message with the transaction he wants to do to all the diggers on the network.

In this transaction, Pesho gives Ivan the “address” of the diggers and the amount of bitcoins he would like to send. He also provides his digital signature and his public key. The signature was made with Pesho’s private key and the diggers can confirm that she actually owns these bitcoins.

Once the diggers are sure that the transaction is valid, they can place it in one block along with many other transactions and try to work on the block. This is done using the SHA-256 algorithm. The output must start with a number slightly greater than 0 in order to be considered valid. It depends on what is called the “Bitcoin Difficulty” that is changing. Its value is determined by the amount of processing power on the network.

In order to generate an output hash of the desired amount at the beginning, the diggers add to the block what is called a “nonce” before releasing it through the algorithm. Because a small change in the input completely changes the output, the diggers try out random values ​​until they find a valid hash at the output.

Chain of blocks

After the block is harvested, the digger sends this newly discovered block to all other diggers. They then check that the block is valid so that they can add it to their copy of the blockchain. This completes the transaction as well. But in the newly created block, diggers also need to include the output hash of the previous block, which connects the blocks. Hence the name blockchain – a chain of blocks. This is an important part of this technology, showing confidence in its system.

Each digger has their own copy of the blockchain on their computer. It is most trusted in blockchain technology, which has the most accurate calculations embedded in its work, making it the longest blockchain chain. If a digger changes a transaction in a previous block, the output hash for that block will change. This causes all the hashes in the chain to change. This is also due to the fact that the blocks are linked to hashes. The digger will have to process all the information to get someone to assume that this is the “right one: blockchain. So if anyone tries to cheat on this network, they will need to use more than half of the network’s processing power, which is very unlikely to happen. Network attacks like this are called “51% attacks.”

The blockchain computer model is called Proof-of-Work (PoW). There are other models, such as Proof-of-Stake (PoS). It does not require as much computing power, it requires less electricity while attracting more customers.