Technical description of Blockchain
Blockchain, from the English “block chain” – a chain of blocks, is a type of decentralized distributed database in which the list of records is kept in consecutive blocks.
A record is any information that is to be stored in a database, e.g. a record of the transfer of funds from the payer’s account to the payee’s account, a record of the creation of the document, a record of the receipt of the delivery, etc.
New blocks and records are only added to the blockchain, with each subsequent block referring to the previous block. Thus, changing one block would cascade all subsequent blocks. This, when properly implemented, makes records virtually permanent and unchangeable. Entries within the block are also arranged.
Cryptographic tools such as hash functions, hash trees (“merkle tree“) , digital signatures, etc. are used to verify the authenticity of individual records and blocks.
The individual records are verified (validated) by each network participant to meet the criteria of the given database (for example, verification that the given record bears the necessary digital signature).
Validation criteria are shared between all network participants, can be evaluated in the end time and are always evaluated in the same way with respect to the current state of the database, regardless of which computer or at what time they start, in other words do not depend on random or external variables.
The use of external variables, such as the current value of an asset in the markets, requires that these variables be first credibly entered into the database, so called oracle. The oracle is a trusted source of external information that is written as separate entries in the blockchain.
However, the oracle, as the only source of information, can be a security vulnerability, and therefore it is strongly recommended to use some decentralized, BFT implementation (see below The problem of byzantine generals and tolerance of byzantine errors).
The method of creating and selecting new blocks within a decentralized network is called the consensus algorithm. Consensus is a feature of a blockchain in which each participant sees the same, completely ordered set of valid records and blocks.
The algorithm ensures that only transactions that are valid within a given arrangement are selected, and also ensures that it is very difficult to change one or more past blocks and records to ensure that the records are unchangeable.
The deeper the change should take place in the past, the more blocks following the change would need to be replaced. Consensus algorithms use techniques to increase the cost of this compensation in proportion to its size and number of participants, beyond the level of practical applicability of this type of attack.
The main features of blockchain that distinguish it from other databases are:
1. Allows you to connect to multiple nodes,
2. It contains an implicit protection against incorrect behavior of any node,
3. Provides the same view of the set of transactions for all network participants,
4. It ensures the inviolability of the entered records by anyone. In this way no participant has a
5. All participants see the entries entered in the blockchain as valid.
This means that the blockchain solves the problem of transparency and trust between the individual participants.
On the one hand, it ensures that what is written once is unchangeable, verifiable by each participant, and in the case of a digital signature recording measure authentic and undeniable by the author, on the other hand it algorithmically verifies the validity of records and prevents conflicts.
In a broader sense, also other types of decentralized databases (distributed ledgers, DLTs) are considered as blockchain, which do not have to use grouping of records into a block chain but share key characteristic with the blockchain.
In terms of access, we can divide blockchain networks into the following basic types:
1. Public blockchain – anyone can join and participate in the creation of new blocks. Everyone can download the current set of blocks and records, and thus become a verifier of the information entered. Any attempt at unfair behavior (change of historical record, attempt to write invalid information, etc.) is thus quickly detectable by the public.
2. Consortium blockchain – only members of the consortium (determined centrally) can join / participate. The limited number of participants that can join and their approval limit the use of this database as a source of reliable and consistent information. It is necessary to more thoroughly analyze the properties of a given consensus algorithm in order to determine the cost of different types of attacks and thus their practical feasibility. A variant is the Consortium blockchain with public reading access in which the consortium retains the right to create blocks and read access is open to the public.
3. Private blockchain – limited to members of a certain organization. The fact that one organization manages all copies of the database makes it externally untrustworthy.
It is important to remember that the boundary between the individual types is not completely strict and also depends very much on the methods of governance of the blockchain. An example is a blockchain with public access, which is set up from the beginning so that it significantly favors a group of participants, such as founders, when creating blocks (see PoS and DPoS systems in which the founders have retained a significant portion of the tokens).
The type of access chosen depends on the application and its specific needs. In cases where public control is one of the essential requirements, a public blockchain or a consortium blockchain is the ideal solution. If non-public information is shared in a narrow group, it may be appropriate to choose a private blockchain.
One of the key components of blockchain technology is the cryptographic hash function (hash). The hash function has multiple uses in the blockchain area. Such a function calculates an output string of a fixed length from an input string of practically any length (one character, hundreds, thousands or even billions of characters). The cryptographic hash function has the following properties:
1. Speed: it is fast to compute the hash value on available computing systems
2. One-way: the inverse function is extremely difficult, even practically impossible to find. From knowledge output string we can’t calculate the input string.
3. Collision-free: with modern strong hash functions we do not know in real (imaginable) time to find two different inputs leading to the same output; for a given input we cannot find another input producing the same output (or it is extremely unlikely).
4. Avalanche: a small change in the input (eg one bit) will cause a substantial change in the output (usually most of the characters in the output string change).
Hash is most often used in blockchain technology to:
1. Interconnection of blockchain blocks and their securing against change,
2. When storing larger files outside the blockchain (off-chain) – we store their hash in the blockchain as an electronic fingerprint,
3. In the consensus algorithm Proof of work, a frequently used task is to find a string whose
1. by adding we get a specific hash (for example, in Bitcoin we look for a hash starting with a few zeros).
There are many hash functions, today the SHA-256 function is most often used in blockchain. Examples of hashes are listed in the table below:
Table: Examples of hashes (hash function SHA-256)