Code si Law? All about Smart Contract

0 19
Avatar for Crypt.Walk
3 years ago

In this digital age, have you heard about code is law? Where digital technology enforce rules. Do we need lawyers or can we live in a fully automated world where code dictates what we can and we can not do? With the development of smart contracts, can this scenario be possible?

Good day for everyone! I am Ray from the country Philippines. Here are some things i learned from smart contracts. Hope you will find it interesting and may learn something new.

Smart contracts

  • A piece of code that can be executed automatically in a deterministic way

  • It is usually stored and executed in a blockchain to be trustless and secured

  • It has the capability of receiving, storing and sending funds or can even call other smart contracts.

  • It follows if-the semantics, which they are

    easy to program

If-then semantics - present situation and possible outcome

  • It is aimed to remove human factor from decision making

Human factor is proven the most error prone and unreliable element in a standard traditional contract

  • It relies purely on the information available in the blockchain

If someone gives 10 tokens (A), they will also get 10 tokens (B)

  • It can also relies on the external data source

On the ethereum or S&P 500 price makes smart contract difficult as they have to trust on real world data. This can be minimized by oracle services but they also have to trust the oracle services.

Ethereum is a good example of blockchain that supports smart contracts. It is possible for a programmer to implement their own smart contract.

  • It is written in a code called solidity which is created for that sole purpose.

Solidity is an object oriented programming language used in writing smart contracts.

  • It is immutable

Once deployed in the blockchain it can not be modified that may create certain risks

  • It is decentralized

There is no single machine that controls smart contracts.

  • Coined by a well known cryptographer by Nick Szabo in early 1990's

Nick Szabo

Vending machines is a good analogy of smart contracts as it shares similarities. A typical vending machine is programmed in a way that allows certain action and state transcations based on the input. It also works in fully deterministic way.

Ex: you want to buy a soda in a vending machind that cost 2$ and you only have 1$. No matter how many times you try to buy it, you won't be able to get the drink. In the other hand,if you have 3$, the vending machine will give you the soda and appropriate change.

Smart Contracts VS Traditional Contracts

Examples:

If Peter sends X number of tokens (A) and Mary sends the same amount of X number of tokens (B). The token will be swapped. Peter receives Mary's token and Mary will recieve Peter's token.

Traditional Contract - without trust, they need to have an escrow contract with a third party. The third party will collect Peter's token (A) with the same number of Mary's token (B) and sends the respected swapped tokens. This kind of transactions shows a problem in a traditional smart contract

  • Trusting intermediaries - there is no guarantee that the third party will not run away with the received tokens

  • Time consuming - depending of the intermediaries, transaction can wait for days or weeks to settle the transition of tokens

  • Cost - it is not just expensive because of the intermediaries that wants to make profit on the transaction. There is also a risk of hidden cost like arbitration and enforcement once there is a problem in the contract.

  • Reusability - they will sign separate contracts and pay the respected fees to the intermediary.

  • Fraud - another hidden cost for the intermediary itself. They need to prove that the tokens are legitimate before doing the swap

Smart Contract

  • fully automated and deterministic way making sure that both of the parties will receive the fund when met the initial criteria of depositing coins.

  • It can be done in seconds.

  • Smart contracts that is used by Peter and Mary can be also used by anyone who wants to swap tokens.

  • Tokens are verified in the blockchain and with digital signatures, both parties are verified automatically if they are eligle for the swap

Use Cases

Smart contracts has a growing number of use cases ranging from payments, decentralized finance, supply chain and crowd funding.

Smart contracts is the basic building blocks for a decentralized application also known as DApps.

Example Use of smart contracts

  • DeFi (decentralized finance) - a new industry that relies in smart contracts. It uses decentralized stablecoin. With the use of smart contract, we can create a stable coin that is pegged to US dollar without using dollar in the real world

  • Automated liquidity provisioning - a set of smart contracts can allow users can provide liquidity and swap tokens in a complete permissionless decentralized passion

  • Provision of more transparency to supoly chains

  • Crowd funding - you can imagine a contract that unlocks funds as soon as certain goals are met

More examples

It may be too soon, but in the future it may be possible. So what if we can use smart contract on ride-sharing, apartment renting and charity. Imagine a fully automated fund that will send directly to people who needed them the most without middleman or intermediaries.

Ex: the fund could determine a certain area that is struck by a catastrophe and directly send funds in to that region.

Risk of Smart Contracts

  • Software bugs - a good example is the DAO hack resulting of million dollars worth of ether lost. Because of this smart contracts undergo a security audit performed by mulitple teams

  • Protocol Changes - if smart contract is cleared with bug and pass the security audit, we still can't guarantee that it will not cause a problem in the platform level. Imagine if ethereum is upgraded, it may cause some problems in smart contracts and start behaving differently. Remember, smart contracts are imuutable.

  • Real world issues - oracle services can get reliable information in the real world into the blockchain. Example: you rented a car and get into an accident. How would the smart contract without human intervention can know about it

Summary of smart contract pros and cons

PROS

  1. Fully automated

  2. Deterministic results

  3. Trustless

  4. Fast

  5. Cost efficient

  6. Secure

  7. Precise

  8. Transparent

CONS

  1. Software bug

  2. Protocol changes

  3. Unclear regulations

  4. Unclear tax

Can we now replace lawyers with code?

In my opinion not quite or not right now. All the things that i have read and learned about smart contract has still some minor problems. Maybe in the future, i think.

Take note: smart contracts are still in early development and problems are still solvable

Any suggestions, questions or topics that you wanted to know, please leave a comment. I will try my hardest to explain it further or create a informative article.

Sponsors of Crypt.Walk
empty
empty
empty

6
$ 0.14
$ 0.09 from @TheRandomRewarder
$ 0.05 from @Eybyoung
Sponsors of Crypt.Walk
empty
empty
empty
Avatar for Crypt.Walk
3 years ago

Comments