Mitha Rachel Jose
The new blockchain technology redefines the way how transactions are happening through internet. It’s a transformation that has already begun. Blockchain has the potential to change the way we buy and sell, interact with government, and verify the authenticity of everything from property to organic vegetables. Blockchain gives everyone a safer and faster way to verify key information and establish trust.
Blockchain technology has attained a lot of attention from both industry and academia due to its decentralized, persistency, secrecy and auditability properties. This paper discusses how the smart contracts react on multiple blockchain platforms with respect to scalability, system complexity and consensus protocol factors.
Differ from the traditional paper contracts that is based on middle men and third-party intermediary’s for execution, smart contracts automate contractual procedures, minimize interaction between parties and reduce administration cost (Mohanta, Jena, Panda & Sobhanayak, 2019). Because of these reasons the technology can widely be used for commercial applications. Therefore this paper concludes that the emergence of blockchain through smart contract can provide a strong framework for distributed application and the newly introduced business communities.
Background
In the past decade, the advances in distributed computing and cryptography have given birth to a new information technology called blockchain. Nakamoto (2008) introduced the model comprising a network of nodes that collaborate with the aim of maintaining a distributed and secure database (Macrinici, Cartofeanu, & Gao, 2018).
A blockchain is a peer-to-peer network of computers, called nodes, that share all the data and the code in the network. Solidity is an object-oriented, high-level language for developing dApps (Decentralized applications) on the Ethereum blockchain. The blockchain helps to improve the security in keeping records, to reduce/(avoid) corruption, to regain control of our financial privacy, to full control of our sensitive digital records, and to build a sustainable world to live.
How blockchain technology works?
A blockchain is an “open distributed ledger that can record transactions between two parties efficiently and in a verifiable and permanent way”. A blockchain has a list of blocks. It starts with a single block, called the genesis block. Each block contains data, hash (to uniquely identify the block) and hash value of the previous block.
A node is a device connected to the blockchain network that can initiate and verify transactions. Any device that wants to become a node needs to download a wallet. A wallet is a software that creates a pair of cryptographic keys for the node – a public key and a private key. A node’s public key, which is accessible to everyone on the network, acts as its unique identifier.
Blockchain wallets do not maintain a record of the owner’s balance but have access to their copy of blockchain, which stores all transactions that ever happened on the network. So, the creator of each new transaction must specify all those transactions.
Figure 1 shows how hash value in each block links all the blocks together as a blockchain. To preserve the integrity of the newly created transaction, the creator node digitally signs it using its private key, which is hidden from the network.
This transaction is then broadcasted to the neighboring nodes. When a peer receives a new transaction, it first verifies transaction integrity to ensure that it was actually signed by the creator node and was not tampered on its way. These transactions are picked up by miners and grouped together in a block. Miners are nodes that take the responsibility of appending new blocks to the blockchain.
Each block contains a block number, a timestamp, hash of the previous block and a subset of transactions. A block’s hash is a unique 64-digit hexadecimal number, generated by feeding the block’s contents into SHA256 hashing algorithm. SHA256 converts input of any length and type, into a unique 64-digit hash (Brincat, Lombardo, Morabito & Quattropani, 2019).
Adding a new block requires computing the hash of the new block. This task is made highly difficult by restricting the value of the calculated hash to be lower than a specific threshold value. Since the block contents are static and will always result in the same hash, a variable value called Nonce is included in block contents to find a hash below the target. Once a miner mines the new block, it is relayed over the network to be confirmed by other nodes and miners.
When majority of peers agree on the correctness of the new block (Consensus), it is appended in the blockchain (Mistry, Tanwar, Tyagi, & Kumar, 2019). Modifying the blocks, which are a part of the blockchain, requires huge computational power and speed. If a malicious node tries to alter a block, it would change the hash of the altered block and would not match the hash present in next block (in the field: Previous Block Hash). Due to invalid hash in the contents, the next block’s hash also becomes invalid. All the subsequent blocks become invalid. Figure 2 shows the steps that how blockchain works.
Security Mechanisms Used in Blockchain
Consensus Algorithm:
This is also called Proof of Work. Basically, this is a cryptographic puzzle that the computer has to solve whenever wants to put a new block on the chain. It takes at least 10 minutes time to solve it. This process is called mining.
P2P Network (peer to peer Network):
Everyone who wants to join on the network can enter into the network. There are lots of blocks on the network and if a new block is added to the network, it should be verified and that block can also be able to see all transactions. If someone tries enter into the block chain and everyone else in the chain is not ready to agree with the new one, then it seems like a hacker is trying to enter into the chain. And therefor it will be neglected from the chain.
Smart Contract
A smart contract is a computer program, which consists of a set of rules run on the blockchain. The state of a blockchain is updated when a valid transaction is recorded on chain and smart contracts can be used to automatically trigger transactions under certain condition.
Smart contracts can be of two types – public smart contracts and permissioned smart contracts. Public blockchain set no requirements for peer to participate, hence all peers have the right to deploy smart contracts.
In order to prevent spamming, when instantiating or invoking smart contracts on, a blockchain is often required to pay a fee (Rashid & Siddique, 2019). Examples of public block chains are health care and medical records, identity management etc. Permissioned smart contracts are residing on permissioned blockchains.
Compared to the inefficient and expensive validation process of public blockchain, permissioned blockchains are more suitable for business collaborations, e.g. banking, provenance and supply chain, voting or insurance.
Ethereum
Ethereum uses three mechanisms for building smart contracts: Proof of Work (PoW), Ethereum Virtual Machines (EVM) and Externally Controlled Account (EOA). PoW is used for mining protocol for network consensus. It is important to understand concepts Ethereum Virtual Machine (EVM) and Gas.
The purpose of EVM is to act as a run time environment for smart contracts based on Ethereum. This can be considered as a global super computer that runs all the smart contracts. Contracts written in a smart contract specific programming language are compiled into ‘bytecode’ which the EVM feature can read and execute.
Every node in the network holds a copy of the transaction and smart contract history of the network in addition to keeping track of the current state. When a user performs an action, all the nodes on the network need to come to an agreement that this change took place.
Gas is a unit of measurement used to assign a fee (Ether) to each transaction with a smart contract. Each computation, that happens in the EVM, requires gas. It needs more gas to execute the smart contract. Every transaction specifies the gas it is willing to pay in Ether for each unit of gas allowing the market to decide the relationship between the price of the Ether and the cost of computing operations. Gas is the combination of two: total fee paid by a transaction = total gas used * gas price paid (Macrinici, Cartofeanu, & Gao, 2018)
Benefits of Blockchain Technology
Conclusion
Blockchain-based smart contract has become a growing field in the blockchain technology. The security of a smart contract needs to be built properly in order for it to be considered safe to use.
Smart contracts have certain advantages for many industry sectors, such as reducing overhead costs, providing transparency and saving time. Compared to paper contracts, they are more reliable, secure, efficient and trustworthy.
We at Centria made a smart recycling contract decentralized app (Dapp) for recycling plastic. Smart Recycling Contract is a proposal for recycling the plastic materials generated by some companies and it should be recycled back to them. For instance, if a food packaging company selling their food packages and they are recycling the plastic waste of those food packages.
For this purpose, we made a smart decentralized application with a smart contract for the communication between the manufacture and the recycler. As the name indicates “SMART RECYCLING CONTRACTS”, it reduces the manpower needed to handle the recycling process. There is no intermediate person communicating between the manufacturer and the recycler.
Also, we made a smart contract called digitracking as a business model with supply chain management for Interreg Nord project CYNIC.
References:
Brincat, A. A., Lombardo, A., Morabito, G. & Quattropani, S., 2019. On the use of Blockchain technologies in WiFi networks, Computer Networks 162.
Mohanta, B. K., Jena, D., Panda, S. S. & Sobhanayak, S., 2019. Blockchain technology: A survey on applications and security privacy Challenges. Internet of Things 8. Available: https://doi.org/10.1016/j.iot.2019.100107
Macrinici, D., Cartofeanu, C. & Gao, S., 2018. Smart contract applications within blockchain technology: A systematic mapping study. Telematics and Informatics 35, 2337-2354. Available: https://doi.org/10.1016/j.tele.2018.10.004
Nakamoto, S., 2008. Bitcoin: A peer-to-peer electronic cash system. Available: https://bitcoin.org/bitcoin.pdf
Rashid, A. & Siddique M. J., 2019. Smart Contracts Integration between Blockchain and Internet of Things: Opportunities and challenges. 2nd International Conference on Advancements in computational Sciences (ICACS), Lahore, 18-20 February 2019.
Mistry, I., Tanwar, S., Tyagi, S., & Kumar, N., 2019. Blockchain for 5G-enabled IoT for industrial automation: A systematic review, solutions, and challenges. Mechanical Systems and Signal Processing 135.
Mitha Rachel Jose
RD-developer
Centria University of Applied Sciences
tel. 040 352 5497