How blockchain works
Blockchain is a special system underlying many cryptocurrencies and other developments
13.12.2021
4059
9 min
1
. It is a digital database that securely stores information and protects data from hacking and changes.
The technology has become popular due to the growing use of cryptocurrencies. But blockchain has great potential in other areas as well, such as real estate transactions, legal contracts, medical records, and other industries for which secure data storage is relevant.
“Blockchain is a technology. Bitcoin is just the first large-scale realization of its potential,” Vitalik Buterin, co-founder of Ethereum and Bitcoin Magazine.
Basic principles of blockchain operation
- Each block of data is linked to the previous one, forming an unbroken sequence protected by cryptographic algorithms.
- Network participants are peers and can transfer data directly, without intermediaries.
- Information is stored in a decentralized manner, which ensures data integrity even if one or more nodes fail.
- Data is almost impossible to alter or fake, which creates trust between people.
- Blockchain cannot be altered by an interested person or organization for its own purposes; it is an independent system of algorithms.
Principles of blockchain operation, based on the example of bitcoin
The MIT Technology Review, a journal of the Massachusetts Institute of Technology, says: “The whole point of using blockchain is to allow people, particularly those who do not trust each other, to exchange valuable data in a secure and tamper-proof way.” This is the main essence of the technology, but how does it all work “from the inside?”
Blocks
A block is the unit of data storage in a blockchain. Each block is securely linked to the previous block with a hash, and if you make changes to one block, you will have to change all subsequent blocks. This method of storage ensures that the information is immutable.
Each block consists of several basic elements:
- Nonce (from English “number that can only be used once”), an integer that is chosen in such a way that the block hash begins with a pre-defined number of zero bits.
- Hash of the previous block.
- Transaction data (in the case of bitcoin, it is packaged as a Merkle tree).
- The hash is a 256-bit number, a block identifier. The hash is calculated from the three previous elements. It starts with a set number of zeros, depending on the current complexity of the network.
Hash
A hash is a cryptographic representation of a set of information. Regardless of the initial volume, the output is a fixed-length string.
The bitcoin blockchain uses the SHA-256 hashing algorithm with a 256-bit sequence in the output. Some blockchains differ from others in the hashing algorithm used, leading to an interesting variety of different cryptographic solutions.
Requirements of the hash function:
- The principle of "a small change in the input yields a large change in the output", which means that it is enough to replace one character and the hash will change completely.
- The same hash will never be repeated twice.
- Irreversibility, that is, inability to retrieve the original message from the hash.
- Determinism, the same output message will always give the same hash.
Nodes
A node (from the Latin nodus) is a device on a blockchain network that stores copies of transactions and performs their verification and validation. In fact, any computer connected to the Internet can be a node. Nodes transmit information about transactions and blocks using a peer-to-peer (P2P) protocol.
The blockchain architecture is designed in such a way that anyone can have completely unfettered access to transaction records. With this system, users can easily track a transaction on the blockchain using its identifier.
Thanks to nodes, copies of data are saved and distributed, which is a critical component for the operation of the network. Some nodes store blockchain databases, they are called full nodes. Others only receive and transmit transactions, they are called light nodes. Nodes that are involved in validating transactions are called miners.
Mining
New blocks appear in the chain through a process called mining. When users want to send funds to someone, they form a new transaction and send it to the network. Next, they have to wait for other users of the network (nodes) to check and validate it. Miners are responsible for collecting such transactions and grouping them into a new block.
Miners use special software and equipment to find the hash value. To validate a new block, the miner needs to find a block hash that meets the requirements of the network, the so-called difficulty.
The difficulty of mining a block depends on the number of zeros at the beginning of its hash. The more zeros, the more processing power is required. In the bitcoin blockchain, the mining difficulty is adjusted every two weeks so that one new block appears every 10 minutes. That is, if a lot of miners join the network, the blocks will be mined faster. Therefore, after some time, the difficulty will increase and the speed of finding new blocks will stabilize. This scheme also works in the opposite direction. Sometimes there are fewer miners, the block is mined for longer than 10 minutes, hence the complexity decreases.
Approximate hash type:
«0000000000000000000b39e10cb246407aa676b43bdc6229a1536bd1d1643679»
To get a new block, the miner needs to collect the hash of the previous block, its candidate block data, and nonce. After that, it is necessary to generate a hash sum from the received information that will meet the stated requirements of the network. However, since it is not initially known which combination will produce the required number of zeros at the beginning of the hash, the miners randomly go through the nonce value until the desired sequence is found.
When the combination is found, the block is added to the chain, and information about it is sent to other nodes for verification. In this way, the entire network receives information about the new element of the chain.
This sophisticated mining system makes the network resistant to hacker attacks. It would take a lot of time and processing power to make changes to any block. In this case, hackers would have to make changes not only to the target block but also to all subsequent ones.
The reward for a mined block consists of two elements: a subsidy from the network itself and a transaction fee. The block subsidy is the newly generated coins, which are the main part of the reward. The other part consists of transaction fees that are included in the block.
Each new transaction goes to the mempool, where it waits for confirmation from the miners. This usually takes about 10 minutes, but the time can vary, depending on the network and miners’ workload. When forming, miners are more likely to choose transactions with a higher commission. That is, the higher the commission of the transaction, the faster it will be validated. You can read more about transaction validation in our separate article.
Miners perform several functions at once, which allows the network to exist:
- combine transactions into a block;
- confirm transactions;
- protect the network from a 51% attack.
Wallets
To make a transaction, you must have a wallet. When creating a bitcoin wallet, private and public keys are created. The private key is randomly generated and available only to the owner of the wallet. The public key is hashed based on the private key and then generates an address using a certain algorithm. The private key is used as an electronic signature and is needed to verify bitcoin ownership.
How keys work:
- The sender receives the recipient's public key.
- The sender creates the transaction.
- The sender uses their private key to validate the transaction.
- The addressee uses their private key as an electronic signature to receive coins.
How blockchain will change the economy and the rest of the world
“We are seeing a gradual transformation of requests from businesses that used to say: we need to figure out where you can implement blockchain. Now, it is a request of the form: there is a certain problem, we think that blockchain technology can be a solution,” Artem Tolkachev, founder and CEO of Tokenomica and Sputnik DLT.
Countries and companies have already begun to exploit the huge potential of blockchain. The technology has begun to transform various industries, it allows small companies to trade internationally, and it simplifies data storage and transfer processes for large companies. There are already some blockchain development trends.
By 2021, many countries have come to accept and regulate cryptocurrencies. For example, 103 states have already introduced legislative cryptocurrency regulation, taxation, and AML programs, according to the report by the Global Legal Research Directorate of the US Law Library of Congress (GLRD).
The financial sector will be a leader in the use of blockchain technology
The banking and financial services sectors do not need to radically change existing processes to adopt new technologies. Financial institutions are already ready to use blockchain not only for regular banking transactions but also for collateralization, issuance, stock trading, and document management. According to a recent study, such solutions will help reduce costs for financial enterprises by nearly $20 billion per year by 2023.
Demand for blockchain experts will grow
As the potential of blockchain is recognized, the demand for experts in the field is growing. Online freelance platform Upwork recently reported a significant increase in blockchain-related jobs. A shortage of personnel also means higher salaries. This will give novice specialists an incentive and new career opportunities.
New ways of application will emerge
Blockchain is already being used beyond the financial sector, in healthcare and medicine, logistics, land registries, government, and corporate document management, thanks to its convenient, decentralized way of storing information and strong data security.
Blockchain is a universal technology for storing, protecting, and transmitting data
Blockchain is a universal development. Its structure allows information to be stored and transmitted securely, making transactions between strangers on the network more transparent. But blockchain also has its drawbacks, which prevent its mass distribution. Blockchain is hard to scale, it stores thousands of small and unnecessary transactions. The size of a full bitcoin node is now over 300 GB, which makes it difficult to mine and maintain nodes. The shortage of qualified people can make it difficult to develop and implement the technology. Nevertheless, as interest in blockchain increases, there will be more resources to develop it.
It is worth keeping in mind that blockchain is not just bitcoin: cryptocurrency is only one way to use it. Its functionality is used by large companies (Google, Amazon) and governments of different countries. Not all protocols work on the same principle anymore, and the concept of “blockchain” has become much broader than just online transactions.
Useful material?
Basics
Why Satoshi Nakamoto’s technical manifesto for a decentralized money system matters
Oct 31, 2022
Basics
Experts evaluated the development prospects of the new ecosystem and the investment attractiveness of its token
Oct 20, 2022
Basics
How to track fluctuations correctly and create an effective income strategy
Sep 13, 2022
Basics
Review of the most profitable offers from proven trading platforms
Aug 29, 2022
Basics
The Ethereum Foundation team has published a breakdown of major misconceptions about the upcoming network upgrade
Aug 18, 2022
Basics
What benefits the exchange offers, and what else is in the near future
Aug 4, 2022