What is blockchain?
In brief, a blockchain is a data record list that works like a decentralized digital ledger. The data is organized into blocks. All blocks of the network are in strict chronological order and are linked by cryptography. All network blocks are in strict chronological order and are linked together by a cryptography created using sophisticated mathematical algorithms.
The earliest blockchain model was developed in the early 1990s, when a computer scientist Stuart Haber and a physicist W. Scott Stornetta used cryptographic techniques in the blockchain technology to protect digital documents from data tampering.
The creativity of Haber and Stornetta became an example for many other computer scientists and cryptography enthusiasts, and that is how Bitcoin, the first decentralized electronic monetary system, was born.
Of course, blockchain technology has existed longer than cryptocurrencies, but its prospects were recognized only after the creation of bitcoin in 2008. Since then, interest in blockchain technology has grown steadily around the world, and today cryptocurrencies are widely accepted all over the world.
How does Blockchain technology work?
Blockchain - a continuous consecutive chain of blocks (a linked list) containing information arranged according to certain rules. The blockchain network acts as a decentralized database (or ledger) because it is operated by multiple computers across the globe. Thus, each of the participants (nodes) stores its own copy of the blockchain data, and they interact with each other to make sure that all the data on one page (or block) is unified.
Blockchain technology is suitable for many other types of digital data and can be used in many different cases, but it is mostly used to record cryptocurrency transactions. Bitcoin is the oldest, most secure and largest blockchain network. It was created through a careful and thoughtful combination of cryptography and general game theory.
Why is bitcoin a decentralized digital currency?
Blockchain transactions take place in a peer-to-peer global network. That's why cryptocurrencies like Bitcoin are decentralized, immutable, resistant to censorship, borderless, and independent of central banks and governments.
The main part of almost every blockchain is the mining process, which is based on hashing algorithms. Bitcoin comes from the SHA-256 hashing algorithm. (this algorithm is secure). The algorithm takes input data of any length and generates output data that always has the same length. The result is called a "hash" and always consists of 64 characters (256 bits) in this case.
Even If you repeat this process several times, the same input will lead to the same output. But once the input makes a small change, the output will change totally. Thus, hash functions in the cryptocurrency world are most often developed as one-way hash functions, and hash functions are deterministic, and it is almost impossible to understand from the output what was on the input. You most likely won't be able to guess what the input was. This is the reason why the Bitcoin blockchain is safe.
Now that we know exactly what occurs in the algorithm, let's use the simplest example of a transaction to look at how blockchain works.
Imagine that Mary and Dan have a bitcoin account. Suppose Mary owes Dan one bitcoin. If Mary wants to send Dan 1 bitcoin, Mary sends a message with the transaction she wishes to send to all the miners on the network. In that transaction, Mary tells the miners Dan's address and the amount of bitcoins she wishes to tranfer, and gives them her digital signature and her public key.Maria's private key is used for the signature, and the miners will confirm that Maria really owns the coins.
Then, when the miners are satisfied that the transaction is valid, they are allowed to put it into a block along with all the other transactions and try to mine the block. To do this, the block goes through the SHA-256 algorithm. The block must start with a certain number 0 to be valid.The required number of 0's depends on the so-called " difficulty", which varies depending on the amount of processing power in the network.
The miners add a so-called "nonce" to the block before they run it through the algorithm in order to get a hash with the right number of 0's at the beginning. Because a small change in the input data changes the output data completely, the miners try random nonces until they find the correct output hash.
As soon as a block is mined, the miner sends this new block to all other miners. They check if the transaction block is valid to add it to their copy of the blockchain. The transaction is then considered complete. But the hash of the previous block must also be included in the block by the miners, so that all blocks are linked together, hence the blockchain name.
A copy of the blockchain is stored on every computer on the network. Each miner relies on the blockchain with the most computational work, which is the longest (has the longest blockchain).After the miner modifies the transaction hash in the previous block, the output hash for that block will change. This will cause all subsequent hashes to change as well, since blocks like hashes.
For a Miner to get the blockchain recognized as correct would have to redo the whole job. Thus, if a miner wanted to scam, he would need over 50% of the processing power of the network, which is hardly possible. So, network attacks are called 51% attacks.
Proof-of-Work (PoW) is a model that makes computers work to create blocks. There are also models such as Proof-of-Stake (PoS), which require much less energy and still have more users.