How to Implement Blockchain Technology
How to Implement Blockchain Technology
The blockchain has gone through a popularization course. You no longer need to remember the interest that was caused by blockchain technology a decade ago, more and more it is being introduced into our daily life.
Blockchain is a kind of decentralized accounting (which is very difficult to falsify), it allows you to verify transactions in real time, without requiring permission from a trusted third party. The use cases of the blockchain are endless, so many companies have moved from PoC (proof of concept) to concrete achievements of the blockchain technology.
The main achievements of the technology are open source, any aspiring developer can implement a small private blockchain at his workplace and run it on a network of several computers. The opportunity to study in practice the concepts of such an environment, for example, the mining of cryptocurrencies or the work of a “smart contract” arouse great interest among young developers.
Blockchain placed in a decentralized system. This means that no single person or group of people is able to take control of the entire system. Despite the fact that each node of the system has copies of all the data, it is impossible to change or destroy them yourself. This unique feature allows for maximum transparency and security, providing users with various possibilities.
Using blockchain technology, interaction between the two parties through a peer-to-peer model occurs easily and without the need for a third party. Blockchain uses the P2P protocol, which gives a chance to all members of the network to store an identical copy of transactions, which allows approval of actions through consensus. For example, if you want to perform any transaction from one part of the world to another using the blockchain, you can do it yourself within a few seconds. Moreover, any breaks or additional fees will not be deducted during the transaction.
The immutability property of a blockchain indicates that any data once written in a blockchain cannot be changed.
After processing, the block can not be changed or deleted. In the case of a blockchain, if you are trying to change the data of one block, you will have to change the data in all subsequent ones, since each block retains the hash of its previous block. Changing one hash will result in a change in all of the following hashes. It is extremely difficult to change all the hashes at the same time, since this requires too much computational power. Consequently, the data stored in the blockchain is immune to changes or hacker attacks due to the immutability of the network.
Due to the quality, such as immutability, embedded in the flowchart, it is much easier to detect data fraud. Blockchains are considered to be maximally protected from unauthorized access, since any change even of one block can be easily detected. There are two main ways to detect fraud: hashes and blocks.
As said above, each hash function associated with a block is unique. Any change to the data will change the hash function. Since the hash function of one block is closely related to the next block, in order for the hacker to make any changes, he will have to change the hashes of all subsequent blocks, which is quite difficult to do.
There are two types of blockchain: public and private.
Public Blockchain. As the name implies, a public blockchain is a public network that anyone can use without the permission of third parties. Anyone who has access to the Internet has the right to access the public blockchain. Of the features of such a system, you can select the verification of all transactions throughout the system. Public blockchain ecosystems usually reward their members for mining and maintaining the immutability of the network. An example of using a public blockchain is Bitcoin Blockchain.
Public blockchains allow communities around the world to openly and securely share information. However, the obvious disadvantage of this type of blockchain is that it can be compromised. The rules adopted and applied from the very beginning of the blockchain system cannot be changed long after their aceptance.
Private Blockchain. Unlike a public blockchain, private blockchains are those that are used only by trusted participants. General control over the network is in the hands of the system owners. Moreover, the rules of a private blockchain system can be changed depending on different levels of power, exposure, number of participants, authorization, and so on.
Private blockchains can operate independently of other processes or they can be combined with other blockchains. This use case is usually used by enterprises and organizations. Thus, the level of trust that is required among participants is higher in private chains than in public.
There are many solutions for creating blockchain platforms such as Ethereum, Hyperledger, Multichain, Open Ledger, Chain, Bitcoin Blockchain, Corda, etc. Some of them are still immature platforms. Thus, it is necessary to choose the most suitable platform for your desires based on your needs.
Ethereum platform is the most popular for creating blockchain projects. Due to the dynamism and responsiveness of the Ethereum community, as well as the richness of its documentation, the concept of the blockchain built on this platform means that the objects will be completely autonomous and belong only to themselves.
Hyperledger Fabric is the second by popularity platform.
Hyperledger Fabric is a relatively new platform for building a blockchain. Hyperledger Fabric has several distinctive features compared to other modern blockchain models; whether these characteristics are advantages or disadvantages often depends on the context.
Hyperledger Fabric is a software framework for developing applications and specialized blockchain-based business solutions.
One of the features of Hyperledger is the prinicipal rejection of creating your own cryptoactive assets. Hyperledger members develop projects especially as information technology.
Regardless of how the blockchain technology will be used, companies will either turn to their supplier partners for software development or work on technology development within the company.
It should be noted that regardless of whether the company makes the implementation of blockchain technology through an internal or external team, it is important that the company gain experience with blockchain technology, since the technology is new and complex for most companies.
For IT stores that want to implement a blockchain project, there is a very broad, though immature, ecosystem developing around blockchain technology. According to a recent report by 451 Research, there are nearly 300 Bitcoin and blockchain startups around the world working on developing technologies in the areas of financial, grocery, storage services, smart contracts(on Ethereum), social networks, supply chain management, identity management, retail and IoT. Most major IT manufacturers are actively working on the blockchain, in particular, IBM, which has allocated significant resources for the Hyperledger project for the Linux Foundation and Microsoft, which works with the R3 CEV banking industry consortium to enable testing of system chains using Microsoft Azure.
To initialize a blockchain, you need to create the first block, then the blocks will be automatically created and structured. This unit must contain all the characteristics of the circuit. After that, the blocks will be available for all nodes (or users) of the network. To start creating a chain block, you need to create a JSON file. You need to specify several parameters: “nonce” (a normal cryptographic hash that generates a random value), “time tag” (the test time between two consecutive blocks), etc. After filling in the JSON file, everything depends on the Geth client. Create a folder containing a chain (chaindata) and initialize it.
To ensure the spread of blockchain technology, you must create your own cryptocurrency, which will help to quickly transfer data.
The goal is to be able to replicate as many commands as your network has nodes. For nodes to exchange data in a blockchain, they must be connected to each other. In order for Geth to connect to a node on the network and coordinate many actions, it must have its identifier called enode in Ethereum.
To ensure the spread of technology in the Ethereum ecosystem, it will be necessary to have cryptocurrency in Gas to get the necessary computing power from network participants.
The most important advantage of the blockchain is decentralization. This is a distributed database that the computers involved in it and called “nodes” jointly maintain. All nodes are registers, that is, they store the entire transaction history in a blockchain. The network cannot be destroyed by unloading any central server.
Information records, called “blocks”, are interconnected through a protocol program, and none of the existing blocks can be deleted or changed. Adding a new block is the only way to update a blockchain, any node can do this without any central command.
If a node ignores predefined standards and creates a block, other nodes ignore it. However, if an incompatible node continues to create blocks without adhering to standards and other nodes begin to create blocks on top of non-compliant blocks, then in the community will arise a conflict. A consensus mechanism is needed to prevent the emergence of incompatible nodes creating so-called forks.
There may be malicious nodes that suppress other network nodes using a “distributed denial of service” (DDoS) attack. Such nodes can trigger false actions. Preventing this also requires a consensus mechanism.
Choosing the right consensus protocol is a very important step in introducing the blockchain into the work of your organization, as it will greatly affect its operation and optimization. The main task of the consensus is to solve mathematical problems that require a large amount of computing power. For example, when one of the miners of a cryptocurrency finds the correct solution to a mathematical problem, the answer should be easily and quickly checked by all network participants, therefore there are different consensus systems, for example, Proof of Work (PoW) and Proof of Concept (PoC).
There are more than 25 consensus protocols, each of which has its own characteristics and disadvantages. The most popular at the moment are Proof of Work and Proof of Stake. They are the easiest to implement and understand.
Proof-of-Work (PoW) is used when the miner's technical equipment solves complex math problems. The miner receives a reward in the form of cryptocurrency for adding a verified block to the blockchain. Finding solutions is a complex process that requires significant computational power. As soon as the computer finds a solution, it sends a message to other computers in the community for verification. The solution is easy to verify because other computers are answered.
The key feature of this mathematical problem is asymmetry: it should be moderately difficult for the miner, but rather simple for the network as a whole. This is achieved using cryptography. Every miner in the network tries to find a solution to the problem first; at the same time, it can actually be found only by the brute force method, therefore, a successful solution requires many attempts.
Proof of Stake (PoS) is used when the miner blocks a predetermined number of coins to check a block of transactions. Cryptographic computing in PoS is much easier for computers. You need to prove only that you own a certain percentage of all coins available in a given currency. For example, if someone owns 2% of the total ether (ETH), he will be able to get 2% of all transactions through Ethereum. Some people think that PoS will be a fairer system than PoW, since technically anyone can become a miner. PoS offers a linear scale relative to the percentage of blocks that the miner can confirm based on the share of that person in the cryptocurrency. This means that a person who has ten times more coins can create only 10 times more blocks than another.
The idea of Proof-of-Stake was first proposed on the bitcointalk forum back in 2011; a year later, appeared the first cryptocurrencies using this method - Peercoin, ShadowCash, Nxt, BlackCoin, NuShares / NuBits, Qora and Nav Coin.
Unlike Proof-of-Work, where the algorithm rewards miners who perform calculations to validate transactions and create new blocks, in Proof-of-Stake, the creator of a new block is selected by the system in advance based on its state, that is, its share in the total cryptocurrency.
Smart contracts are exactly what helps to completely remove third parties from any industry or business and achieve a true peer-to-peer model. As shown in practice, smart contracts are unbreakable and reliable, allowing the parties to set any rules.
Intellectual contracts contribute to the development of companies - this is a convenient tool for creating new generation platforms, where all participants in the system will be able to quickly and easily transfer data.
Smart contracts work in the same way (in terms of agreements), like paper contracts. The differentiating factor in relation to smart contracts is that they are digital, as well as executable, that is, subject to previously established rules, the contract executes the transaction. This means that when certain conditions are met in the code of these contracts, they are automatically opened. Ethereum, an open-source blockchain platform, has introduced intelligent contracts into its Blockchain ecosystem. Smart contracts can be used for various situations or industries, such as financial agreements, health insurance, documents for real estate, crowdfunding, and so on.
The target language for developing such applications on Ethereum is Solidity. This language is relatively simple and fits an object-oriented programming environment with the concepts of class, attribute, function. In addition to the features of Dapp Ethereum, when a function is used, for example, each transaction has an issuer and associated costs. The code is also more sensitive and the slightest mistake has consequences.
#1. Blockchain benefits
#2. Decentralized system
#3. Peer-to-Peer Network
#4. Network constancy
#6. 1. Choose blockchain type
#7. 2. Select the platform on which the blockchain technology will be created
#8. 3. Create the first blockchain
#9. 4. Choose the most appropriate consensus protocol
#10. 5. Create the first smart contracts