The term “blockchain” first appeared in relation to the Bitcoin cryptocurrency system. Today, this technology is used in various industries and sectors, such as banking, real estate, and identity verification.
What Is Blockchain?
It is a continuous sequential chain of blocks. These blocks contain information that follows specific rules. At first, the term referred to the name of a distributed database implemented in the Bitcoin system. In October 2008, the blockchain technology was first applied with bitcoin. However, now the technology can refer to any system of interconnected information blocks.
The blocks on a blockchain typically contain the following information:
Transaction-related data, such as the date, time, and amount.
A digital signature of the person who is taking part in transactions.
Data that distinguishes each block from other blocks – a hash.
A transaction block is a special structure for recording transactions in the Bitcoin system and those similar to it. A transaction is considered verified when it meets the following conditions:
its format and signatures are confirmed,
it is combined into a group with several other transactions,
it is recorded in a special structure - a block.
Each block contains information about the previous block. All blocks are lined up in a single chain, which contains information about all operations ever performed in the database. A block consists of a header and a list of transactions. The header of the block includes:
its own hash,
the hash of the previous block,
additional service information.
In the Bitcoin system, the first transaction in the block always indicates the receipt of the commission, which will be a miner’s reward for the created block. Next comes the list of transactions generated from the queue of transactions not yet recorded in the previous blocks.
For transactions in the block, a hash with a tree structure is used. Apart from charging the commission for creating a block, transactions contain a reference to a transaction with a previous data state within the input parameter. For example, the Bitcoin system references the transaction for which someone obtained consumable bitcoins.
Other users can accept the created block if the numeric value of the header hash equals or is less than a certain target number, the value of which is adjusted from time to time. The result of the hash function SHA-256 is considered irreversible, so it is possible to obtain the desired result only by random search. If the hash does not satisfy the condition, then the nonce parameter is changed in the header and the hash is recalculated. A large number of recalculations are typically required. When an option is found, the node sends the received block to other connected nodes that check the block. If there are no errors, then the block is considered to be added to the chain, and the next block should contain its hash.
The Bitcoin system adjusts the value of the target number with which the hash is compared after every 2016 blocks. It is planned that the entire network of the Bitcoin system should spend about 10 minutes on forming one block and about two weeks on 2016 blocks. If these 2016 blocks are generated faster, then it becomes harder to reach the target number.
Changing the complexity of the calculations does not affect the reliability of the Bitcoin network. It is only required for the system to generate blocks at an almost constant speed, which is independent of the computing power of the network participants.
How Blockchain Works
The blocks are simultaneously formed by miners. The blocks that meet the acceptance criteria are sent to the network, being included in all replications of the distributed database. It often happens that several new blocks in different parts of a distributed network identify the same block as the previous one, that is, a chain of blocks can branch. It is possible to limit the replication of information about new blocks (for example, one of the chains may develop within the local network). In this case, the parallel building up of various branches is possible.
Each new block contains both identical and different transactions. When the replication of blocks resumes, miners begin to consider the chain to be the main one depending on the level of hash complexity and the length of the chain. If the complexity and length are equal, preference is given to the chain whose final block appeared earlier.
As long as the block does not contain the transaction, the system considers that the number of bitcoins at a specific address remains unchanged. During this time, it is technically possible to issue several different transactions for transferring the same bitcoins from a single address to different recipients. But when one of such transactions is included in the block, the system will ignore the remaining transactions with the same bitcoins. For example, if the block contains a later transaction, the earlier one will be considered erroneous. There is a small probability that during the branching, two such transactions will fall into blocks of different branches and each of them will be considered correct. Only when the branch dies off, one of the transactions will be considered erroneous, no matter the time of the operation.
Thus, entering a transaction into a block confirms its authenticity regardless of other transactions with the same bitcoins. Each new block is considered an extra confirmation of transactions from previous blocks. For example, if a chain contains five blocks, the transactions from the last block will be confirmed once, and those placed in the first block will be confirmed five times. It is enough to wait for several confirmations so it is very unlikely that the transaction will be canceled.
To minimize the impact of such situations on the network, the disposal of bitcoins that have been just received is restricted. The required number of confirmations to unblock the received bitcoins depends on either the client program or instructions from the receiving party.
Is Blockchain Secure?
The blockchain is formed as a continuously growing chain of blocks that records each transaction. Each new block is always added to the end of the blockchain, and its position on the chain is called a height. After a block has been added to the end of the blockchain, it is very difficult to change its contents because of the block’s unique hash code. Hash codes are created by a math function that turns digital data into an alphanumeric string. If someone changes this data, the hash code will be changed, too.
The database publicly stores information on all transactions in an unencrypted form. To prevent multiple wastes of the same amount, it uses timestamps. They are implemented by splitting the database into a chain of special blocks, each of which contains the hash of the previous block and its own sequence number. If someone tries to change the information in a block that is already in the chain, it will be necessary to edit the information in all subsequent blocks. As a result, it is almost impossible to spend the previously spent funds one more time. Some changes are acceptable if they are made to all copies of the database (for example, deleting the last few blocks because of an error in their formation).
For security reasons, blockchain networks have implemented tests for users that want to join and add blocks to the chain. These tests require that the computers “prove” themselves before they can join the blockchain network. One of the most common examples is Bitcoin’s proof of work, where computers must prove that they have done work by solving a complex math problem. If a computer solves one of these problems, it is allowed to add a block to the blockchain. Thanks to this, the cost of a hacker attack on a blockchain will outweigh the benefits and thus such an attack becomes useless.
The blockchain is first of all a revolutionary technology behind the Bitcoin cryptocurrency system, though now it is used more widely. It is a continuous sequential chain of interconnected blocks that contain information following certain rules. Each block in a chain is protected by a cryptographic hash and is almost impossible to change without impacting the entire chain. This makes the blockchain networks extremely secure. Additionally, all computers joining blockchain networks must pass proof of work tests.