Price: $1.314
Pools: 1954
Epoch: 250
Slot: 268428
Date: 28-02-2021


Contracts can be smarter on Cardano

Blockchain is used as a transactional network. The big step forward would be if the blockchain technologies are used also for agreements. It is just a natural and logical step and programmable money will be a standard in the future. 13-11-2020, 13:21 · 14 mins read
Share this

The future of money

Paper agreements between parties can be perceived as a layer above money. Every money exchange has a context. The context can have many forms. It can be verbal and informal when conditions are simple, parties know each other well, see each other in one place, or disputes are not expected. For example, when you pay at the cash desk, both parties see each other. The context can be formal and it can have a written form. It is needed when parties do not know and trust each other. It is usual in the business world. For example, when one business partner will pay for a house when the data is changed in the cadastre.

Currently, we use blockchain as a transactional network. It can be said that the processing of transactions is decentralized. Regarding the transaction contexts, they are not usually decentralized. It works fine for verbal and informal contexts. However, it is worse for formal or complex contexts. It is possible to use decentralized transactions and stick to the current centralized form of agreements. For example, it is possible to create a paper contract that will state that one party will pay for a piece of art by cryptocurrencies. It has a few disadvantages:

  • Decentralized and centralized worlds are mixed together which will not probably work fine since the legal framework has no power to enforce the law in the digital world of blockchain. A party can be punished in the physical world, though.
  • The identities must be always known in the centralized world.
  • It can work fine in a local context but it can be slow, expensive, and more difficult for global business partners. Mainly when disputes occur.
  • Sending a blockchain transaction is a very easy task. It can be a bit cumbersome to deal with a paper agreement.
  • It can go against the main principle of the whole decentralization movement. There is no reason to use cryptocurrencies for payments and still rely on the current financial and legal systems. Decentralization is about transparency, censorship-resistance, and possibly privacy. The legal system can be corrupted and it will always depend on the decisions of individuals. Thus, it will never be fully trusted and reliable.

It is obvious that having the possibility to rely on blockchain technologies regarding agreements can be very beneficial and significantly increase independence on the current centralized structures. It is naive to think that we can decentralize the infrastructure and keep using slow, expensive, unreliable, and sometimes corrupted systems. If blockchain can be used for decentralized sending of transactions and we are able to innovate and improve abilities of it then we basically must try it. Decentralization is not a binary switch. When we enhance the abilities of decentralization we improve freedom, independence, privacy, and autonomy.

Paper agreements are a tool of the traditional finance world and they are an inevitable part of our financial lives. At least in western countries. We must try to create technologies that help us to decentralize paper agreements. Luckily, technology has been already invented and you have probably heard about it. The name of it is a smart contract.

The future of money lies in the ability to be programmable. As you will see later, we will need smart contracts for establishing trust between parties that do not trust each other or do not even know each other. It will be probably necessary to use digital contracts more often in a decentralized world than it is necessary in the centralized world. There are a variety of reasons for that. The most significant one is the possibility to avoid dependency on the current legal system or dramatically reduce the need to rely on it. Let’s now have a look at how paper agreements look like. You probably know it well but let’s go quickly through it.

Paper agreement

Although oral agreements are legal and binding in many situations, they are often difficult to enforce in court. That is why it is smart to have a written agreement. It is basically a document that clearly specifies each party’s rights and obligations. In the business world, a written agreement is a must even if the law does not explicitly require that.

Every agreement contains the legal identification of parties. It must be clear who is responsible for performing obligations that are stated by the contract. It must be also clear who has the legal rights to require enforcement. The body of the agreement must specify the rights and obligations of each party and there must be all necessary details of the contract. In the world of contract law, a judge is just a third party that can read only the paper agreement and naturally does not know what has been agreed verbally. It can be impossible or very difficult to prove something that has not been written. If a right or condition is not written and parties say a different variant of the story then it cannot be legally enforced. A good agreement usually contains information about handling disputes. If parties are located in different states then the law of only one state should be chosen. That law will be applied to resolve disputes.

The most important things are related to payments. An agreement specifies who pays whom. Next, when the payments must be made and the conditions for making payments. Parties should be very careful regarding the exact amount, date, times, method of payments, and conditions for making payments.

How to describe an agreement

It is actually very easy to describe an agreement and the very basics are always nearly the same. It is just a set of repeated patterns and the processing can be described by algorithms. An agreement is a set of variables and a description of expected events including their order. In the financial world, clerks often have a similar paper template that is filled in. People can find many agreement templates on the internet. A paper agreement can be created quite fast. The expected behavior of participants is always the same or very similar for a given case. Only the identification of parties, date/time, and figures related to payments, are different. All that are variables. If Alice wants to sell a car to Bob then Alice can download an agreement template and fill in variables together with Bob. The body of the agreement is a description of expected behavior (the order of the events). Once they sign the agreement it is expected that they will act accordingly.

An agreement can be perceived as a collection of payments or a description of the payments’ context. The goal of an agreement is to protect parties against malicious behavior of counterparty. Thus, agreements contain rights and obligations. For example, when Alice sends a payment to Bob expecting Bob to act as an agreement dictates and Bob fails in acting then Alice can contact the third party to enforce the law. The legal authorities will help Alice to get the car from Bob. The agreement is used as the description of expected behavior and as proof that Bob promised to act by that.

Digital smart contracts

A blockchain is a great tool for sending payments. Nowadays, money is just digital numbers. Cryptocurrencies are the same. ADA, BTC, or stable coins are just numbers. Digital coins are numbers in the blockchain that can be moved from address to address. Alice can easily send a payment to Bob. The only thing that Alice needs is the address of Bob to which she sends the coins.

A smart contract needs similar things as a paper agreement needs. These things are the identification of parties, payment details, the order of expected events, and the time till the payments are expected to be sent. In contracts to a paper agreement, a smart contract cannot wait forever for payments. When a party fails to send a payment in time the contracts need to refund participants or do other defined action with sent funds.

When Alice and Bob use a paper agreement, Alice sends money directly to Bob. They agreed on not using the third party that would keep the money until the hands over of the car occurs. When a smart contract is used, there is always the escrow service that is provided by the contract itself. It is necessary and it is actually very useful. Bob will not receive the payment until he proves that Alice is the owner of the car. Thus, Bob is motivated to act honestly to get the payment from Alice. If Bob does not hand over the car then Alice gets her money back automatically from the smart contract. Thus, the physical third party or arbiter is not needed.

The question is how will Bob prove to the smart contract that Alice is the new owner of the car. More options exist. For example, Alice can inform the smart contract that she is really a new owner of the car. Thus, the smart contract will release money from the escrow. What if Alice becomes the owner of the car and does not inform the smart contract? Alice can speculate that she can have the car and also her money back from the escrow. Well, the smart contract must be informed that Bob has done all the necessary steps to hand over the car. Only Bob can do that. When he does it, or he thinks that he has done it, he informs the smart contract. The smart contract will never release money from the escrow back to Alice. So the order of the events can be like that. Bob will inform the smart contract that he has handed over the car to Alice and then Alice will need to confirm that. If Alice does not confirm that then the money will be sent to Bob. Thus, Alice is motivated to inform the smart contract whether it is true or false. Actually, she only needs to do that only when she is not the owner of the car. When Alice really becomes the owner of the car then it is the end of the story.

The only case that cannot be resolved by the smart contract is the state when Bob claims that he has handed over the car to Alice and it is not true. Bob still keeps the car. Alice informs the contract that she does not have a car despite the fact that Bob has informed that smart contract that she is the owner. Here, either Alice or Bob lies. The only thing the smart contract can do is to send Alice’s funds to an address of the arbiter.

The problem is that the car is a physical item. The possible solution here is to tokenize the car. If it would be possible to prove the ownership of physical items by owning corresponding non-fungible tokens then it would be an easy task for the smart contract. Once stocks, bonds, CBDC, and other financial instruments are tokenized the smart contracts will be very useful in the financial world. Let’s go back to the car. Another possible solution would be input from the third party. In many countries, the ownership of the car can be found in registers. In this case, Oracles can provide the information to the smart contract.

We have another very simple solution that will work fine also for physical items. Parties will act honestly when they are economically motivated to do so. When there are defined penalties for dishonest or wrong behavior then it is probable that nobody will want to lose money. Alice and Bob can send 10% or even 50% of the price of the car to escrow and it will be returned equally to them only if the contract ends up as expected. They can agree that if the third party will have to decide then the winner takes all. Bob cannot just simply claim that he has handed over the car to Alice if it is not true and it can be easily proved. Alice cannot simply claim that she does not have the car when she actually has it since she would not get back the money that is used for the possible penalty.

Basic elements of smart contracts

Smart contracts have been here for a few years but it is still a challenge to write one that would be secure and reliable. A smart contract cannot be changed once it is deployed. Thus, it is necessary to ensure that a contract does exactly what is expected in all possible cases. Simplicity is the key to security. The IOG team has developed a Domain Specific Language called Marlowe and created a great graphical tool called Blockly. Blockly allows users to create programs in a similar way like playing with puzzles. Marlowe is designed for experts in a given domain. For example, for experts for the finance domain. Instead of programming skills, a person using Marlowe needs domain skills. Marlowe is designed in a way that protects users from writing a bad program. Due to that, a program written in Marlowe can be hardly exploited. Users are able to check the program thoroughly and see all possible paths of development.

You can ask how is that possible. It is simple. When using Blockly, a Marlowe program is constructed by combining a small number of building blocks. Every block describes a small piece of the puzzle. For example, there are blocks for payments, observations, actions, waiting until a certain condition becomes true, etc. When a user selects a certain block it is forced to plug in other blocks. For example, there is a block for defining a deposit. When a deposit block is used then it is necessary to define party, amount, currency, and role. Users will not forget to provide some information that is needed and it keeps the development simple. When two parties are supposed to deposit funds then two deposit blocks are used. Users can define parties by calling them simply Alice and Bob. Marlowe forces users to define all possible paths of contract development.

Let’s explain in simple words how a program that is written for example in Java or Solidity works. A program consists of a few basic elements like variables, conditions, and actions. Variables are used to describe the physical world. So you can describe your bank account, user name, amount of payment, etc. Action can be a payment that uses the variables. For example, action can be a payment to a given bank account. Condition elements are used to describe conditions that must come true in order to execute actions. For example, a payment is sent only when another payment has settled.

Marlowe allows users to write a smart contract without the need to understand what are variables, conditions, and actions. Users, in this case, finance domain experts, just need to know that it is necessary to define parties and specify payments and conditions. To create a simple smart contract for swapping two digital assets, users need to use two deposit blocks, two payment blocks, and filling them with other blocks to specify details about parties and payments.

When users want to write more complex programs they can use Marlowe, Javascript, and Plutus. We strongly suggest you check the Marlowe playground. The Marlowe playground allows you to create a program, run it in a simulator, and see what happens when you send transactions.


Smart contracts will extend the abilities of blockchain technology. People are able to use blockchain transactions so it will be easy for them to use smart contracts. It will not be an option but a necessity once decentralization becomes the mainstream. Decentralization is about our own responsibility for our lives and to be able to do so we need to substitute the current financial and legal systems. Blockchain transactions are insufficient to reach the goal since you will never know whether the counterparty will act honestly. Moreover, when he or she will wish to be anonymous then there must be some mechanism that establishes trust between parties. Smart contracts are able to do so. If we want higher privacy then we need to use smart contracts. Programmability is the future of money.

Source: Contracts can be smarter on Cardano

We are cryptocurrency enthusiasts, especially believing in Cardano. We are official ambassadors operating staking pool. We write articles, translate them and develop tools for the community.
Support the Author 🙏
Author´s StakePool
Pool ID
Read next

Security of Cardano

The security of public networks is not governed by a centralized authority. It is something that evolves organically with the growth of projects. Let's have a look at how secure Cardano is.... 25-01-2021, 14:46 · 18 min read

Who will maintain Cardano

Cardano is a public global protocol with open source code. Millions of people can use it every day. The question is who should be responsible for maintaining the global protocol that is supposed to be...
12-02-2021, 14:13 · 14 min read ·

Hydra: Cardano scalability solution

In the future, most transactions will be processed by second-layers solutions. The first layers might not be able to satisfy high transaction demand. Cardano has the second layer solution and its name...
18-03-2020, 23:00 · 20 min read ·

Cardano Staking

Let's dive into Cardano staking and explain how it works....
29-07-2020, 11:35 · 0 min read ·

Cardano will be needed when crypto goes mainstream

We do not need decentralized infrastructure right now since adoption is low and the HODL narrative prevents the real usage of crypto in daily lives. If it is going to change and people adopt Bitcoin a...
14-09-2020, 09:15 · 19 min read ·