Sitemap
crypto_astronuts

crypto_astronuts

This page is only intended to be used as a knowledge system for myself and others who enjoy reading it.

Smart contracts

10 min readDec 31, 2021

--

In this post, we are going to read briefly about smart contracts, how they operate, and real-world examples…

Smart contract

A smart contract is a set of promises, specified in digital form, including protocols within which the parties perform on these promises. Nick Szabo

The concept of contract introduces a set of promises agreed between different parties in order to formalize the kind of relationship that they want to have. (marriage, business, politics and etc..)

In this concept, the exorbitant cost of replacing(fraud) the contract makes it worthwhile(for both bodies) to both preserve and execute it.

In traditional contracts, there are written clauses based on the mutual understanding between parties, and the sides of the contract both sign the agreement as a legal document that engages both parties and obligates them to do their part of the deal.

Smart contracts are the implementation of the traditional contracts (consisting of contractual clauses such as liens, bonding, delineation of property rights, etc.) in computer software and hardware.

A smart contract is a self-executing contract with the terms of the agreement between parties being directly written into lines of code. The code and the agreements contained therein exist across a distributed, decentralized blockchain network. The code controls the execution, and transactions are trackable and irreversible.

Basic principles of contract design

A deal should meet basic criteria to be eligible to be called a contract.

observability

Observation of an in-process contract due to the detection of signs for breach and minimization of losses.

verifiability

The ability of a principal to prove to an arbitrator that a contract has been performed or breached.

privity

The principle that knowledge and control over the contents and performance of a contract should be distributed among parties only as much as is necessary for the performance of that contract.

enforceability

A fourth objective is “enforceability”, and at the same time minimizing the need for enforcement. Improved verifiability often also helps meet this fourth objective. Reputation, built-in incentives, “self-enforcing” protocols, and verifiability can all play a strong part in meeting the fourth objective.

Why do we need smart contracts?

Basically, like any other concept which technology reshaped and improved it. The traditional contracts came with 4(which are the exact basic criteria of a contract) main flaws in their essence and so far we have been trying to solve them by patching solutions in order to make them convenient and easy to be used and it’s the contract turns to be digitalized.

  • Extreme Centrality
  • Contract Conflict of Interest
  • Enforcement
  • Transparency

Extreme Centrality

The problem with centrality is as same as the problem which comes with trust, in any process that you need to put trust in a third external party you are increasing the risk of flaws in the contract. Let’s have an analogy of real-world, When you put your money in a bank they will have custody of your money and they can choose to freeze it, or otherwise, they will charge you… and history has shown to us when the banks are in a problem the customer means nothing(for example with the great depression banks didn’t let people withdraw money because they were insolvent.).

Within the scope of the contract concept, there is a huge risk that you put it aside and decide to trust in a middleman in order to observe and arbitrate in case of discontent of parties but smart contracts fix the centralization and issues with trust with decentralized agreements. These agreements are written in blockchain so they are irreversible and they automatically are executed based on an event that parties have chosen.

Contract Conflict of Interest

Another issue with traditional contracts is that on some occasions when there is a conflict of interest the party with the higher executive power usually abuses the system and tries to not commit their part of the deal. An example of this problem would be insurance companies.

An insurance company doesn’t make money by giving out money! they make money by taking people’s money and not giving it back in time of need. A great example is that in 2005 during Katrina, a year you would expect insurance to pay huge sums of money and lose money, when in fact they profited 44 billion dollars, which was a 20% surge from the prior year.

Enforcement

A realistic and simple reaction to all of these mentioned problems would be ok I will file a lawsuit… Besides the expenses and efforts you have to put on to take a case to court, you may need the sums of money right away and time would be valuable essence that is not on your side. (if you win the case you lost time and if you lose …)

Smart Contracts automatically execute whenever the parameters are met, so you don’t have to worry about someone upholding their end of the bargain, or being forced to uphold their end of the bargain. With smart contracts, the enforcement in infrastructural.

Transparency

Transparency is another big issue and makes a huge difference in today’s age. There are lots of examples that transparency makes the huge headline in news for example what Facebook did with people’s data without them knowing it. Nick Szabo gave an example in his article about smart contracts let’s have it here:

In a grocery store POS machines don’t tell customers whether or not their names are being linked to their purchases in a database. The clerk don’t even know, the customer probably processed thousands of such transactions and via hidden action of the transaction software the customer is giving away information they might consider valuable or confidential.

A lot of things can happen under the hood of everyday simple actions and processes that we may know how would happen or process but reality tells another story.

Smart contracts on the other hand take care of privacy and transparency, cryptographic algorithms put your data in an envelope-like-concept and transmit your data so no one other than you wouldn't be able to read them and at the same time all the process is open to the public and anyone can see the network and what is happening under the hood.

Examples of real-world smart contracts

Buying a house

For instance, Let’s imagine that Mr. X wishes to buy Y’s house. This agreement is formed on the Ethereum blockchain using a smart contract.

Get crypto_astronuts’s stories in your inbox

Join Medium for free to get updates from this writer.

In the simplest terms, the agreement will look like this “WHEN X pays Y 200 Ether, THEN X will receive ownership of the house”.

Once this smart contract agreement has been put into place, it cannot be changed

meaning X can feel safe to pay Y 200 Ether for the house.

Without the use of a smart contract in this scenario, X and Y would have to pay lots of fees to third-party companies. Including the bank, a lawyer, and a house broker.

Flight-delay insurance

Mr. X wants to purchase a flight ticket and the company Y sells ticket and compensate for flight delays(according to their claims)

So Mr. X and company Y seal a smart contract on Ethereum blockchain Mr. X put 1 Ether(let’s say it is the price of a ticket and Ether is Ethereum native coin) in the smart contract wallet and Company Y puts the compensation (let’s say 2 Ether)

According to the smart contract clauses the flight ticket flying time is on12 A.M

All the value is locked within the smart contracts(Ethers, contract clauses, and …)

When the time of flight comes the smart contract sends a request to an oracle(read more about oracles here) and the oracle gives a response that says the flight is delayed.

The smart contract then sends the 3Ether(compensation plus ticket price) to MR. X and contract are finished.

On the other way around the smart contract will send the Ethers to Company Y.

The history behind the smart contracts:

The idea of smart contracts dates back to the 1990s. Writing in 1994, the computer scientist Nick Szabo defined a smart contract as “a computerized transaction protocol that executes the terms of a contract.”

I call these new contracts “smart”, because they are far more functional than their inanimate paper-based ancestors. No use of artificial intelligence is implied. A smart contract is a set of promises, specified in digital form, including protocols within which the parties perform on these promises.
Nick Szabo.

Nick mentioned in the article that the existence of smart contracts is somehow goes back to older decades he said that the precursor of smart contracts is Vending machines. (For more read his article)

What is a smart contract?

A smart contract is an agreement between two people in the form of computer code. They run on the blockchain, so they are stored on a public database and cannot be changed.

The transactions that happen in a smart contract are processed by the blockchain, which means they can be sent automatically without a third party. This means there is no one to rely on!

The transactions only happen when the conditions in the agreement are met — there is no third party, so there are no issues with trust.

Features of a smart contract:

  • Smart contracts exist in an electronic or digital form.
  • Smart contracts are designed to automatically execute when predetermined conditions are met.
  • The conditions are generally expressed in the logic of “If x occurs, then y executes” — creating a binary outcome.
  • For the contract to work the conditions and execution steps must be able to be specific and objectively defined to be written into computer code (so there is no room for qualitative judgment or human discretion).

The potential of smart contracts:

According to Szabo, the objectives of smart contract design are to minimize breaches of contractual obligations (malicious and accidental), minimize the need for trusted intermediaries to verify and enforce contractual performance, ultimately reduce transaction costs. This implies a greater capacity for contracting in the digital environment.

Are Smart Contracts are Currently Being?

Insurance
Two insurance companies, Atlas Insurance in Malta and Axa in France, tested smart contracts in 2017. They had prototypes that compensated airline customers if their flights were delayed.

Health Industry
Health systems will use smart contracts to record and safely transfer data. (EncrypGen is an application that uses smart contracts to transfer patient data in a secure way, allowing no access from third parties.)

This way, the patients are in control of their own data. If researchers want to use patient data, they must pay for it. Not only that, but the patient has to choose whether or not they want to sell it to them.

Governments
The blockchain can make voting systems completely trustless and much more secure. (Follow my vote application uses smart contracts and blockchain technology to protect votes from fraud. When the voting transaction is written to the blockchain, it cannot be changed. When the voting is over, the smart contract will send a token to an address that represents the winner of the vote.)

Business Management
Instead of paying staff to run payrolls, they can use smart contracts.

Businesses can just set up a smart contract that says WHEN the date is 28.03.18, the Business sends X 2 ETH. This means X will always be paid on time, and he will never be underpaid. The business benefits because it is all automated, saving them lots of time and money!

Smart Contracts and Smart Legal Contracts

The term “contract” has different meanings for computer scientists compared to lawyers. For smart contracts to be an enforceable contract under Common Law it must satisfy the traditional elements of a common law contract (the existence of an agreement, an intention for the parties to create a legally binding relationship, consideration — usually in the form of valuable payment, and compliance with any regulatory formalities). These elements will be assessed on a case-by-case basis considering all the relevant factual evidence. As smart contracts become more widely used to conduct business, it is inevitable that disputes will arise and dispute resolution mechanisms will be needed.

--

--

crypto_astronuts
crypto_astronuts

Written by crypto_astronuts

This page is only intended to be used as a knowledge system for myself and others who enjoy reading it.