ABSTRACT

In this computer world, digital transformation is a thoughtful and unavoidable one. The impact of this digital transformation is reflected both in government and private sectors. Amongst these, financial and business sectors must face a lot of challenges to undergo this transformation. In financial sector, transaction between two parties has become a part of their life. A transaction normally happens with the help of few centralized authorities.

In the centralized system, all the transaction needs to be verified and signed by a centralized authority. But there are many issues exist in executing this methodology. Among them two important issues concerned with financial sector are, large storage space required for processing and cost of committing a transaction. Blockchain, a blooming technology has overcome this drawback by changing the execution model.

Blockchain makes use of distributed ledger and crypto currencies, thus converting the centralized processing into a distributed processing system. Here, all the ledgers needed for the transaction are maintained as distributed database. Block chain also minimizes the process by executing all the rules with the help of software. The software that acts as the execution unit of the blockchain is known as smart contract.

Smart contracts facilitate the implementation of user-defined operations of uninformed complexity which are not probably plain cryptocurrency protocols. It facilitates user to realize the constraints, instructions, and policies of the domain applications. To explore the feature of the smart contracts, it should be properly designed and coded.

Smart contracts work in the application layer of the blockchain. All the rules for the applications can be realized using smart contract. Data for the verification can also be obtained from external sources. i.e., usually, the data for the contract execution is supplied through the transactions. But it can also be obtained from external sources.

Each smart contract in the blockchain is assigned a unique address of size 20 bytes. To run a contract, the transaction must be sent to the contract's address. The smart contract performs the necessary operation and when all the protocols are satisfied, the smart contract by itself executes the transaction. This transaction will be run by different miners whose output will be validated and the block of the miner who wins it will be added to the chain.

Smart contracts run on Ethereum virtual machine and solidity is the programming language used for writing smart contracts. Ethereum smart contracts need gas to run. When the required gas is not found, then the requested transactions cannot be executed. In this chapter, the detailed explanation of the smart contract along with its architecture is discussed. Also, designing of the smart contract using the programming language solidity is discussed.