Close
Register
Close Window

Show Source |    | About   «  16.15. Public Ledgers   ::   Contents   ::   16.17. The Ethereum Virtual Machine and Gas  »

16.16. Smart Contracts

16.16.1. Introduction

Blockchain systems utilize an important protocol called a smart contract. In this module we will discuss about what a smart contract is, why is it useful in blockchain, and implementations of this protocol.

16.16.1.1. What is a Smart Contract?

In specific terms, a smart contract is a computer protocol involving transactions to enforce the terms of an agreed upon contract between two peers. They allow for credible transactions to occur without the consultation of a third party. By using a smart contract, individuals to exchange money, property, or anything of value without having to deal with a middle man. For example, you might have to get some legal document signed and need to see a notary. You will have to go see them, get it signed, and then take the document to the individual who needs it. A smart contract eliminates much of this process. With the agreed upon protocol, one has the ability to send the document off into the system and the smart contract verifies whether this document is acceptable and can be sent to the other participant.

16.16.1.2. Why is it used in Blockchain Systems?

As we have learn, blockchain systems are decentralized and fall into the hands of the users. This is a great reason why a blockchain system uses a smart contract. Whenever Alice commits a transaction to Bob, she never wants to wait and have a third party verfying whether she can pay Bob. The smart contract automatically confirms this.

16.16.1.3. How can this be Implemented?

An implementation of this can be seen if Bob wants to rent an apartment from Alice and decides to pay with a cryptocurrency. Bob receives a receipt held within their smart contract. Bob is to receive a digital key on the specified date. If Bob does not receive the key on the day Alice told him he would, the smart contract triggers the blockchain to refund Bob. If Alice sends the key on the specified date, then the contract will inform the blockchain to issue Bob’s payment to Alice and give him a key. In this scenerio, our smart contract operates on an If-Then assertion that everyone on the blockchain can see ensuring no faulty exchanges. If Alice gives Bob the key, she can be paid. If Bob sends the correct payment, he can receive the key and anything else will be cancelled.

   «  16.15. Public Ledgers   ::   Contents   ::   16.17. The Ethereum Virtual Machine and Gas  »

nsf
Close Window