Smart Contract

How Smart Contract Can Increase Your Profit?

Introduction to Smart Contract

A Smart Contract is a computer service code. That gets executed automatically. Smart Contracts abide by the terms of contract or terms of the agreement. Smart Contract control or document legally relevant events. Smart Contracts take actions based on the agreement.

The objective of Smart Contract is to remove

  • The middle persons (intermediates)
  • Excessive enforcement and arbitration costs.
  • Fraud losses.
  • Central authority
  • Legal system
  • External enforcement mechanism
  • Malicious and accidental/ willful exception.

Smart Contract can transfer values from one account to another just like a stored procedure. The smart contract cannot be manipulated once the transaction is placed in Blockchain.

The terms of the agreement are jointly agreed by the involving parties (like buyer and seller). The contract, piece of code actually then transmitted to the distributed and decentralized blockchain network.

Smart contract’s execution of the contract is controlled and it is audited by a platform itself. Smart contact’s transactions are traceable. Very transparent and immutable in nature.

Thanks to the expansion of the Internet, the world is becoming a global village. This makes it possible to invest money in a foreign company, lend a farmer who is working on the other side of the world, ask a foreign teacher to teach with the exchange of money. For all of these, the trust factor is low and while building a contract, the legal price is just too high.

Smart Contract works on a P2P network. The smart contract provides a solution to this trust issue. They can create a relationship between people, assets, institutions over a P2P network without the need of a third party.

Difference between Smart Contract and traditional contracts?

The smart contract works on “Code is Law’ policy but general contracts can be challenged and changed in the regular court by the govt. laws.

History of Smart Contracts

Nick Szabo proposed smart contract in 1990. Ethereum was introduced in 2015 and any blockchain-based on it uses smart contract. However, Ethereum Foundation or IBM said that a Smart Contract is not always necessarily related to the contract’s classic concept.

Rather smart contract is something related to any computer program. Nick Szabo invented Bit Gold in 1998 by defining a smart contract.

Nick Szabo defined “a set of promises, specified in digital form, including protocols within which the parties perform on the other promises”. A smart contract is deterministic in nature.

In 2017, Decree on Development of Digital economy situated at Belarus legalized smart contract.

Initially, smart contracts are powered by a Byzantine fault-tolerant mechanism with several degrees of Turing Completeness.

  • Bitcoin introduced a Turing incomplete script language that can create a custom smart contract on top of multi-signature accounts, payment channels, scans, time locks, atomic cross-chain trading, oracles or multiparty lottery etc.
  • Ethereum provided a Turing complete language that provided a smart contract framework.
  • Ripple (Codius) stopped smart Contract development in 2015.
  • DAML is a Smart Contract language based on GHC.
  • Solidity is an object-oriented smart contract language.

The ideas that helped to implement smart contract-

  1. Eris Industries dual integration system
  2. Primavera de Fillipi’s – legal framework for crypto- ledger transactions.
  3. R3’s – Smart contract system
  4. Acqui-hired Elevance- model financial agreement.
  5. DeFi protocol and force.
  6. Codefi’s staking as a service.

Smart contracts not only valid for parties involving human. They can work with a machine to machine commerce ecosystem.

How Smart Contract works?

In a normal scenario, a buyer or seller takes help from an agency as the amount of deal is too big and there is always a lack of trust. The middle person agency with a fee of huge money starts the negotiation, on the paperwork, provides necessary artefacts till the complete deal is closed.

A smart contract is able to work alone. It is implemented to support many other smart contracts, they can work pretty well. Just image the vending machine may accept money from money providing apps (GPay PayPal, Paytm etc.) along with the cash.

The vending machine is one of the oldest smart contracts that works on its own. Smart contracts are digitally signed and the keys are kept in a cryptocurrency wallet.

How does the vending machine work?

You select the product, then insert the money.

Condition-1- money inserted less than the product price- vending machine refund the money back (inserted money) – no product.

Condition-2- money inserted is greater than the product price- vending machine returns the extra money and the product.

Condition-3- If the machine detects the price of the product is equal to the money inserted, vending machine ejects the product.

Condition-4- If no change present- you may get the product but not the change. We need to inform the vending machine company.

The vending machine works 24*7.

A smart contract is a super electronic transaction mechanism that is built on the top point of sale (POS) concept (like a digital vending machine.)

A smart contract can then digitally facilitate, or recheck cross-verify or enforce the negotiation or perform the terms of a contract. It can also determine and execute the penalty if any.

Smart contracts can be obtained or involved by parties from within  (another smart contract) or any other external data source.

Oracles inject data (equivalent to smart contract from real-world to smart contract information stroke).

Note- Smart contract, unfortunately, neither smart nor equivalent to a real legal contract. It is for smart people to code.

Smart Contract helps in Exchanging

  • Money
  • Property
  • Shares
  • Any other tangible or intangible things (not love, romance tough : ) )

Example of Smart Contract

Assume,  we sent a car from a car vendor. We book the car by paying in cryptocurrency and we receive a receipt that is nothing but a virtual contract. Now the contract comes with a condition that the vendor must supply the car and key in the date mentioned in the contract.

But if for some reason if the vendor is unable to send the car and digital key, the contract becomes void. It automatically processes a refund and palatines if applicable.

The contract works on if-else then logic. If the vendor sends the digital key, we got the amount (or a token amount).

Where smart contract can work?

  • Financial Sectors (bank, insurance) credit enforcement, Trade-related clearing and settlements, Coupon payment, Insurance claim process, Micro Insurance.
  • Any industry (make a contract, breach a contract)
  • Property related (transfer, sell, buy) (Real estate Sector)
  • Legal process
  • Cross funding.
  • Government- (Voting System_ Smart Contract powered Voting System)
  • Management- Due to accuracy, transparency and automatic in nature the operations team rip the benefit of a smart contract.
  • New Smart Innovation (smartwatch, smartphone, smart car, smart glass etc.)
  • Automobile Sector- Buy, Sell, Ownership transfer.
  • Health Care- No need to carry huge files of patient’s record, birth certificate,Electronic medical records keeping, Population health data access, Personal health, data tracing.
  • Educational Institute- degree, certificate.
  • Technology- Media, Music, Telecom, Energy-Royalty distribution, Automatic electric car (vehicle) changing station.
  • Public Sector  – Public record keeping.

Components of Smart Contract

The smart contract consists of three parts.

  1. Signatories (two or more parties). It will signify if those parties agree to terms and conditions.
  2. The subject of Agreement- It talks about the environment of the contract.
  3. The specific terms- The terms that need to be expressed mathematically and can be coded.

    Smart Contract
    Smart Contract

Smart Contract Environment

  1. Smart contracts work on only in public-key cryptography environment. Users sign off a transaction work their unique cryptographic codes.
  2. Smart contracts work only –on an open and decentralize database. This creates trust factors among the work as the fully automated smart contracts are immutable.
  3. On a reliable certificate (SSC root security certificates). Smart contracts can also use HTTS and other secure connection product code.

Features of a smart contract

Automatic features

  1. Self-verifying (auto audit)
  2. Self-executing (auto enforcement)
  3. Immutable (Tamper-resistant)

Legal features

  1. Automatic mapping of legal obligation.
  2. Greater security.

Economic Features

  1. Very transparent
  2. No or fewer side effects
  3. Lower transactional cost.

Where smart contracts are being used?    

  • Depository Trust and Clearing Corporation (DTCC), Bank of America Merrill Lynch, Citi Bank, Credit Suisse, JP Morgan and many others use Axoni built smart contract.
  • Apart from this Major Japanese and South Korean banks started testing and using Ripple’s blockchain and smart contracts so that these two countries can enable cross border money transfer.
  • The Sber bank, (A Russian bank controlled by the Russian government) started testing and using smart contracts.
  • Insurance company Atlas insurance in Malta and Aya in France tested and prototyped. Smart contract
  • In the Medical field Encrypgen uses Smart contract to transfer patient data in a secure way
  • Government- Smart voting– Application- FollowMyVote uses smart contract and block chain to secure individuals votes from hackers and any other fraud. This leads to a fair voting practice.
  • Crowdfunding- ICO ( Initial Coin Offering)

How to incorporate Smart Contract in an Organization?

Smart contracts are the most used and practical application of Blockchain technology. Smart Contract’s principle- “Any decentralized ledger can be converted to self-executable contracts which later can be translated to code”. The smart contract template is One size fits all that we need to customize for parties. They can use the template as it.

Generally, enterprise blockchain networks contract do not use a token-based system. You need to pick one based on your need and as per your budget.

Anatomy of Smart Contract

Smart contracts are basically set of lines of code, stored on the blockchain and executes only when predefined terms and conditions are met. Smart contract contractually streamlines the process automatically. This will give the dealer, seller, lender or any other parties to a take a quick decision with trust.

Anatomy of Smart Contract
Anatomy of Smart Contract

The simplest form of a smart contract is if/ when….. then….. This code is placed on Blockchain. The node can execute the commands as action. Automatically, as a result, the blockchain can do the following-

  1. Release funds
  2. Register a vehicle
  3. Send notification
  4. Perusing ticket
  5. Register house
  6. Title transfer
  7. So on-

This will only happen once the predefined and agreed conditions are met and verified by the network. The blockchain registers the transactions and upload them as immutable manner.

How the code for Smart Contract looks like?

Smart contracts can be written in the following languages-
  1. LLL– A declarative LSP like Syntax oriented programming language. This is rarely used now a day.
  2. Serpent– An imperative or procedural language similar to python.
  3. Solidity– An imperative language similar to java C++. It is the most popular language.
  4. Vyper– Similar to Serpent.
  5. Bamboo– Influenced by Erlang. This language aims to reduce side effects and increases audibility.

A smart contract is also known as a crypto contract. Smart contract primarily deals with digital currencies or digital assets between parties. Smart contracts automate the process, control behaviours, audits real-time and accesses the risks.

Example- EveryDAPP, DAO blockchain-based Smart Contract, Augur, Slock.It, Boardroom etc.

Smart Contract removes the administrative overhead from the parties involved in making a successful contract. Because of the nature of work, many prefer to call them Smart Agent or Software Agent.

The agreement will look


If/when << Name of buyer>> pays<< Name of the seller>>, <<the currency>. <<Amount>>
Then, << Name of the buyer>> will get the ownership of << Name/ description of goods>>

Like- If Arya pays Animesh Rs. 300, Then Animesh will get the ownership of the pen.

Smart contract code can be-

  1. Sole manifestation
  2. Agreement between parties
  3. A compliment of a traditional test contract.
Deep drive into more examples of code
If the event "A" occurs then
Execute step ‘B’
Else
Execute step C
  • Step B may be enquiry the payment of funds when certain triggering events occurs at A.
  • Step C may be imposing financial palm ties if event A does not occur.

A smart contract can be smarter than paper-based contracts as Artificial Intelligence is involved. They can instantly execute pre-programmed steps. They can take corrective measures automatically.

The life cycle of Smart Contract

  1. Smart contracts are written in solidity language. It is a high-level language.
  2. Once a smart contract is written it is compiled to convert it to low-level byte code.
  3. The byte code can be executed in only EVM modes.
  4. The compiled byte code is deployed to a smart contract platform (like-Ethereum).
  5. The platform assigns a special address to this smart contract.
  6. Each contract can be identified by this special address.
  7. This address is unique and can be used in transactions.
  8. A smart contract does not run on its own. Rather it relies on some trigger to get activated.
  9. All transactions are atomic in nature.
  10. Smart contracts, once trigged can run completely and update the blockchain.
  11. Incase smart contract ends up failing in execution, the role back mechanism gets activated. The failed transaction, however, is recorded on the blockchain.

Best practices for smart contracts

  1. At this point, parties should enter a contract using a hybrid approach (a combination of text and code). Surely once everything is falling in place, they can migrate to only code.
  2. While using a hybrid contract, both code and text should complement each other.
  3. If parties are dependent on third party oracles to provide off-chain data, the contract should have a clause if oracles can not provide the correct data. Oracles can be an API, real-time users, hardware/ software-based.
  4. Coding is always risk-prone. Parties should be careful about coding errors and risks associated with it.
  5. The contract should tell which one will be given higher priority if a conflict arises between code and text.

    Smart Contract and IoT
    Smart Contract and IoT

What Smart contract offers? What are the advantages of Smart Contract?

  • Automatic – During the agreement preparation and finalization smart contract eliminates brokers, lawyers and other third parties.  Being networked-based and governed by platform, the smart contract actually removes biases, accidental or intentional modification of a contract.
  • Promote Trust– Smart contract protects documents in an encrypted way on a shared ledger. As a result, the records are immutable. Smart contracts are uncased in nature. This creates the trust of the users.
  • Increase Trust factor- Smart contract executes transactions by following the predefined and agreed rules automatically. Once done, the whole record is encrypted and transmitted over the network for the participants. So, nobody can question the biasness or Falter nation of records for any personal benefits.
  • Records/Transaction/Details backup- As the smart contract is based on blockchain, the same transaction along with the necessary details are transmitted to several modes. Hence records will have a backup. In traditional system records are kept in a single centralized server, if the central repository is crashed, data may be unavailable.
  • Promote safety- Being encrypted, the blockchain keeps the document safe over the network, Smart contracts are not hacked prone.
  • Speed- Being digital and preconfigured, Smart contracts can save huge time and eliminates paperwork.
  • Availability- Smart contracts are available over the network and can be accused anytime and anywhere by providing a key.
  • Lots of Money Saving- Because smart contracts eliminate a lot of paperwork, lawyer and other third parties, it saves a chunk of money for primary two parties.
  • Accurate- Smart contracts are safe, faster, always available, cheaper apart from these they remove manual work ( as well as manual errors).
  • Safety and Security- Blockchain-based smart contracts records are encrypted hence very less Or not hack prone. As the individual encrypted record is linked both previous and next records on the chain it is almost impossible to alter hence immutable.
  • Control of data- Patients can control their own data. If ant external institutes want these data, they can obtain the Same by paying directly to the owner of the data. They do not need to pay to a third party to obtain the data.
  • Time-efficient-  Smart contracts run on code and come a predefined set of rules with the help of internet. Therefore, the speed of completing transactions is way faster than traditional court oriented text-based contracts.
  • Precise- A smart contract-driven from a given template. The template needs to be customized for providing terms and conditions before putting it finally to work. So if a condition is left out will result in an error, during execution. Thus smart contracts are comprehensive and way better than the textual contract.
  •  Internet of things- The smart home connects devices (that works on sensors) can be connected to the smart contract-based blockchain.
  •  Employment Contract- Employment contract can also be automated using employer and employee using a smart contract. In case, any one party ( employer or employee) fails to meet the expectation, a smart contract can take corrective action. The whole transaction is encrypted and placed on the blockchain.During any conflict, the transactions can be referred to. This type of smart contract actually creates a good employee, employer relationship.

    Apart from these smart contracts can be needed for wage payment for vendors, temporary employees, contract jobs. A smart contract can be text-based code, audio clip, video clip to make the agreement better understanding.

  • Music Industry- Smart contracts can be successfully absorbed into the creative industry (like music, video) so that the original creator gets the royalties instead of any other 3rd party.
  • Smart Contract and SEO– Medio companies can create a chain link for a search Engine option to rank an article for a specific period of time.
  • Direct dealing with the customer.
  • Backup KYC can be done very quickly and easily.
  • Record keeping for audit with privacy.

Issues with Smart Contract

The smart contract is an evolving technology and it is in the building state. It has immense potential but currently, it is for away from perfect.

Assume the scenario:

  1. If contact is signed between two parties, the Government cannot know hence cannot obtain tax from it.
  2. If one party sends the wrong key intentionally or unintentionally.
  3. If one party tricks the contract before signing.
  4. All the terms of law may not be known to all parties.

These are a few issues, which are observed. But these are the tip of the iceberg. As technology flourished we may get more buys, issues etc.

  • Smart Contract based on blockchain is visible and accessible to all users that may lead to expose of bugs, security holes (that are yet to discover or may take time to fix).
  • The famous DAO hack is a well-known fact about stealing smart account with a code.
  • If in case one party before signing the agreement wants to check the conditions and parameter hiding inside code. They can still need an expert layer and a smart contract coder.
  • Organization if want to create a different smart contract customized from the template, then the company still need to have expert layer and coder.
  • Smart contract to trigger its clause needs off-chain real and actual data. In case smart contract realizes biasness, wrong data the results can be not satisfactory.
  • To solve the off-chain wrong data issue, parties still need to depend on “Oracle”. But Oracles are trusted third parties who can supply the off-chain correct information. So. Net or net, Smart contracts are not only confined within two parties.
  • Avoiding or termination of smart contracts is a challenge. And these activities may need higher costs than text-based traditional contracts.
  • Smart contracts need a security layer to guarantee payments. This may be a huge amount while parties are going for many contracts.
  • Smart contracts need to abide by the local jurisdictions (should comply with text-based contracts).
  • Smart Contract does not allow a breach of contract. So it is an automatic process of unstoppable transfer of crypto token between the involving parties.
  • A lot many international regulations as a result adoption is difficult.
  • Scalability– Smart contract platform is unclear if they are scalable for a bigger mass audience.
  •  External information- It depends on Oracles heavily.
  •  Not so flexible- Any alternation of the smart contract needy developer’s involvement to make the change. Hence it is not so flexible for normal users.
  •  Privacy issue- The code agreement terms is publicly available to view. It may not be suitable for some contracts.
  •  Latency issue- Smart contracts has some latency issue. The time taken to update the blockchain database is way higher (17 seconds) whereas compared from non-blockchain database (milliseconds).

Conclusion

As smart contracts are new, it will take some time for industries to adopt. Smart contract lacks clear terminology along with clarity.

Smart-contract started eliminating the middle person or agencies already. That day is not so far when the world will be free from middle agencies. Organizations will surely save huge money from working such contracts.

Smart contract implementations come with other upsides and downsides too. Agencies will lose their customer and will be forced to fire working people. People, on the other hand, will lose their job and will be forced to learn new technologies or switch to a new field. This is just like the implementation of computer automation or robot automation in industry. People switched to a new role and new technology for the betterment of the industry.

Share and Enjoy !

Leave a Comment

Your email address will not be published. Required fields are marked *