Smart Contracts – How do they work?

Hello everyone!

Smart Contracts were created by Nick Szabo, a famous Cryptographer in the Cryptocurrency world, in 1994

His idea was to use Smart Contracts as a tool to formalize and secure computer networks by combining protocols with user interfaces.

They were mainly developed and used for these application areas:

  • Credit systems
  • Payment processing
  • Content Rights Management

And then became popular, thanks to the appearance of the Ethereum Blockchain, which uses Smart Contracts as the spearhead of its Network. While remaining mostly related to the world of Finance.

We have all at least once in our lives been in contact with at least one machine that uses a Smart Contract to provide us with a service/object. For some it happens almost every day. But in that case, you’re going to say to me, “OK, but what am I using on a daily basis that works with a Smart Contract?

It’s relatively easy to guess. The main function of a Smart Contract, apart from its self-execution, is that it uses the execution order ‘IF … THEN‘, so in practical terms, as soon as you’ve completed a financial transaction, you receive a service or product.

Are you starting to find out?

For the 2 most known, if not the simplest, they are: 

  • Payment terminals
  • Vending machines.

Payment Terminals: 

When you make a purchase in a store, no matter what you buy, no matter what type of store, and you pay by:

  • Contactless
  • Bank card
  • Loyalty card
  • Cash …

The execution order activates: ‘IF … you have the money to pay the bill … THEN … you can leave with your purchases

→ All these transactions work through Smart Contracts 

Vending Machines:

They work on the same principle. You select your drinksnack .., you insert the money Cash, or by Card (or contactless), it is then that the execution order is activated ‘IF … THEN’, and once you have paid, you can retrieve your purchase.

→ The easiest way to understand the usefulness of a Smart Contract.

These 2 objects are inseparable from our daily life, and it becomes commonplace to use them, but be aware that the technology behind all this is relatively complex.

In these 2 caseswe can easily and clearly illustrate how Smart Contracts work 

If you pay with cash (in the case of a Vending Machine), there is no need for a ‘person‘ to make the changethe machine does it all by itself, and if you pay with a credit card, the machine asks your bank, which answers by confirming if you have the funds to pay or not.

These processes only take 1-2 seconds! There is no need for a third party to read the order, check it manually, and then validate or not the order (waste of time, extra costs due to the ‘human’ intervention). 

Paying at a store checkout, or at a vending machineillustrates all the specificities of a Smart Contract:

  • Auto-execution (automatic execution)
  • Payment processing
  • Trustless (when 2 parties do not need to know each other to trust each other)
  • Elimination of intermediaries
  • Cost reduction (operational)

Let’s get back to the subject at hand, Smart Contracts in the Cryptocurrency world.

As said before, Smart Contracts appeared in 1994, created by Nick Szabo, it was not until 2015, and the appearance of Ethereum, co-founded by Vitalik Buterin, that they became popular.

Long before the birth of the Ethereum Blockchain, there were already Smart Contracts, available on the Bitcoin Blockchain, but these are very restrictive (and still are). Because each Blockchain can present a different way of implementing Smart Contracts.

What is good to know and to take into account quickly, is that not everyone can ‘Code’ a Smart Contract, although this one is only a Computer Code, it must be Coded by a professional, Coder, or Web Coder, with the support of a Lawyer possibly.

Each Blockchain uses a specific Code Language, and the most used language is the one of Ethereum, for its ease and simplicity of use:

  • Bitcoin Blockchain, Interpreted language: Script, Developer language: MiniscritpPolicy
  • Bitcoin Cash Blockchain, Interpreted language: Script (modified), Developer language: CashScriptSpedn
  • Ethereum Blockchain, Interpreted language: EVM bytecode, Developer language: SolidityVyper
  • Tezos Blockchain, Interpreted language: Michelson, Developer languages: LiquidityLIGOSmartPyArchetype
  • Cardano Blockchain , Interpreted language : IELE bytecode, Developer language : PlutusMarlowe … 

If we take the example of the Ethereum Smart Contract, it must meet a number of criteria to be acceptable on the Blockchain:

  • Distributed: Replicated and distributed on the entire Ethereum network
  • Deterministic: Performs only the actions for which it was designed, and only if the contractual requirements are met
  • Autonomous: Allows to automate all kinds of tasks, thanks to the auto-execution feature
  • Immutable: Can’t be modified after its deployment (except if the ‘AUTODESTRUCTION‘ function is included in its code, which will then allow to ‘delete’ the Smart Contract)
  • Customizable: It can be coded in different ways, and can be used on Decentralized Applications (dApps)
  • Trustless: Two (or more) parties can interact through a Smart Contract, without necessarily knowing or trusting each other
  • Transparent: Smart Contracts are based on a Public Blockchain, so their code is visible and searchable by everyone.

The fact that a Smart Contracts is based on a Blockchain, is a guarantee of its immutability, but not only, it is not modifiable and cannot be deleted (except if a determined function is registered in its code before its deployment).

It is also very important to specify, that the Smart Contract is a Computer Codecoded by a Human. Although this Code/Smart Contract in itself is immutable, it will do only the task for which it was written, so if the Code contains an error, if a destination address is wrong, or if a condition is not clearly explained, it will not be the fault of the Codebut of the one who coded it, and as it is not modifiable and cannot be deleted after its deployment, it is more than necessary to checkto have checked and to test the code before its deployment, to avoid any future problems.

Since its code is made public, it can also be hacked. Hence the need to also work on the protection of it.

Here are some characteristics that differentiate a Smart Contract from a Classic Contract:

  • The fast and immediate implementation (instead of just for the duration of the Contract)
  • Its readability is easy for the Machine and complicated for the Human, while the Classic Contracts it is the opposite
  • Its drafting is fast, for a person who is adept at Coding
  • Its security is high, unlike a Classic Contract which will have limited security
  • Its archiving is easy
  • The extraction of the data is immediate, while for the Classic Contracts it is slow
  • And finally, the Smart Contract is public, if it is on a Public Blockchain, while the Classic Contract is confidential.

As you may have understood, Smart Contracts are extremely useful to automate tasks (auto-executions when some or all conditions are completed), to simplify and facilitate financial transactions with a saving of time and money. But Smart Contracts can also be vulnerable, and this vulnerability is only the cause of the one who coded it.

See you soon

Christophe WILHELM

Bitcoin Meister

© Bitcoin Meister

Share:

More Posts

What is Tokenization?

Tokenization → Principle that consists in issuing assets in the form of Tokens, on a Blockchain, giving them a value recognized by its users. Since

What are STOs?

In the Universe of Fundraising, in the world of Cryptocurrencies, it is more than necessary to differentiate 3 Types of Fundraising:

What are ICOs?

Many people compare ICOs (Initial Coin Offering) in the Cryptocurrency world to IPOs (Initial Public Offering) in the Corporate world of the stock market. But

Advertisements

Send Us A Message

Advertisements