Price: $1.305
Pools: 2521
Epoch: 260
Slot: 287157
Date: 19-04-2021


Cardano Smart Contracts

The part of the decentralized future will not only be transactions but also the execution of smart contracts. The impact might be huge since it allows us to avoid the legal system. 15-10-2019, 22:00 · 12 mins read
Share this

We will describe what problems smart contracts solve and why we need them. Then we will explain how they work. We will talk about Cardano smart contract languages Plutus and Marlowe.

The old way to create a contract

Smart contracts idea is probably older than you think. Smart contracts were first proposed by Nick Szabo, who coined the term in 1994. You can check his original work:

What is a contract

First of all, let’s have a look at the dictionary definition of a contract:

“A written or spoken agreement, especially one concerning employment, sales, or tenancy, that is intended to be enforceable by law.”

A contract is an agreement between two parties that mutually agreed to behave or act as the contract states. The contract usually has to have a specific form (date, conditions, names, signatures) and if any party does not agree with the acting or not acting of the other party then the law have to get engaged to solve the issue.

The issue is that in the real world a paper contract cannot enforce the correct or honest behavior of the participants. There must be a third party that solves all possible issues. Thus there are so-called legally binding contracts. “Legally binding” means that the parties must obey the terms written in the contract and perform their contract duties as stated. Failure to do so may result in legal consequences, such as a damages award.

We are able to avoid middle-man when we want to send a transaction. A distributed network can act as a middle-man and ensure that a transaction sent by Alice to Bob will be processed as expected if all conditions are met. Bitcoin does it quite well.

Why smart contracts

What if we could create a digital contract and use it similarly as a transaction between Alice and Bob? What if Alice and Bob could create a digital contract between each other and a distributed network, as a middle-man, ensures correct execution and enforces both to act honestly? This is exactly what a smart contract can do. Let’s have a look at what Nick Szabo wrote about it in his work:

We also see that to implement a full customer-vendor transaction, we need more than just the digital cash protocol; we need a protocol that guarantees that the product will be delivered if payment is made and vice versa. Current commercial systems use a wide variety of techniques to accomplish this, such as certified mail, face to face exchange, reliance on credit history and collection agencies to extend credit, etc. Smart contracts have the potential to greatly reduce the fraud and enforcement costs of many commercial transactions. Digital cash protocols use several of the rich new building blocks coming out of the fields of cryptography and computer science. Most of these components have not yet been widely exploited to facilitate contractual arrangements, but the potential is vast.

Finally, we can extend the concept of smart contracts to property. Smart property might be created by embedding smart contracts in physical objects. These embedded protocols would automatically give control of the keys for operating the property to the agent who rightfully owns that property, based on the terms of the contract. For example, a car might be rendered inoperable unless the proper challenge-response protocol is completed with its rightful owner, preventing theft. If a loan was taken out to buy that car, and the owner failed to make payments, the smart contract could automatically invoke a lien, which returns control of the car keys to the bank.

Nick Szabo

As you can see, Nick stated that we need more than just a transaction system to guarantee that the product will be delivered if payment is made.

It works fine with fiat since there is the law. If an online shop does not deliver a product for that you have already paid then you will engage the law. You will call the police or contact the appropriate national authority. You have a signed paper agreement in your hands and it is what the authority needs to process. It can take some time but eventually, you will probably get your money back or the dishonest online shop will be closed.

Bitcoin network is not able to ensure trust for such simple tasks as online shopping or even sending a value to a person you have never met before. You have to build trust between the counter-party if you want to transact with each other. For example, it can work for the relationship employer-employee. Still, if the employer decides not to pay you after you have hardly worked the whole month you will have to again engage the law.

Even if you do it via an escrow account the parties must find a person to whom they both believe. It is still too complicated and trusted.

So if we really want to utilize the whole potential of distributed networks we need to resolve the mentioned payment issues and establish trust between parties. It is what smart contracts can do for us.

How smart contracts work

A paper contract is just an agreement and parties are responsible for execution. For example, if Alice promises Bob to pay him $1000 for 4 Tesla stocks then they are both responsible to hand over the money and stocks. They can do it hand-to-hand if they are close to each other. If not, Alice could pay in advance and Bob will send stocks once he receives the money from Alice. In this case, Alice must trust Bob that he is honest and will send the stocks. Alice is at a disadvantage.

A digital smart contract is responsible also for the execution part of the agreement.

A smart contract takes care of the execution.

The situation will be much better for Alice and Bob if they utilize a smart contract. First of all, they make an agreement and create a digital form of it. In the smart contract, there will be Bob’s address for the payment and the amount of money Alice must send. There will also be Alice address for the stocks and expected amount. Once the contract is so-called deployed, what is a similar process to signing a paper agreement, the execution part is fully in control of the distributed network that processes the smart contract and nobody is able to change it or stop it. Neither Alice and Bob nor anybody else in the world.

The smart contract is 100% fair and does exactly what is supposed to do. It does not matter the order in which Alice and Bob send promised assets. The smart contract is able to keep digital cash and stocks in a temporary dedicated account. Once the smart contract is able to swap the assets it does it. If one party does not send the asset then after a specified time the contract sends back the asset that is in the temporary account to the former owner. Nobody can cheat and it never happens that one party has both assets and the other none. The smart contract is a trustworthy and reliable middle-man. Notice, that there is no reason to engage the legal authority at any moment. The smart contract is conflict-free meaning that if it is written smartly then it takes into account all possible results and all parties exactly know what happens under given conditions and when. Smart contracts behave deterministically.

What is a smart contract

A smart contract is a computer code that has to be written by a special smart contract programming language. In other words, a smart contract is an automatically executable set of rules that were provided via a computer program.

The code is written off-chain by a programmer and then has to be deployed what is a similar process as sending a transaction. A transaction is also built in a wallet and then sent to the network. Once the contract is deployed it is stored in the blockchain and it is executed by a special piece of software called virtual machine.

Virtual machines run on nodes in the distributed network and execute smart contracts. The execution result is then taken and mutual consensus among nodes must be achieved. This is very similar to what happens with common transactions. You can imagine that as a big global computer that consists of many distributed nodes. So the contract between Alice and Bob is processed on many computers and the consensus must be achieved to have a single version of the truth and/or behavior.

A smart-contract code allows decentralized automation by facilitating, verifying, and enforcing the conditions of an underlying agreement. During the execution of smart contracts, it is verified whether all conditions are met to produce some expected outcome or perform some predefined action.

Smart contracts will be most beneficial in business collaborations where parties can agree on something, build a contract and let it automatically execute. It is useful for any kind of sales, loans, purchases, bet, and more. Smart contracts reduce the risk of fraud or tampering, and as there is no third-party involved, the costs are also reduced.

Cardano smart contracts programming language Plutus

Smart contracts for Cardano will need to be written in Plutus or IELE and is intended to support a higher level of assurance. Plutus is a smart contract language using the Haskell programming language. Haskell is recognized at the academic and developer level for its mix of academic and industry-grade talent with core credentials in computer science. Thus, writing smart contracts will be safer and more reliable than any other smart contract language. Plutus Platform will be a Haskell library and will be an accessible toolbox for developers to create smart contracts and can support code that runs on-chain and off-chain. Due to peer review and high assurance, the code for the Cardano smart contracts is secure, tested, and documented. Ultimately, it is this research-first driven approach used by a professionally credentialed team of academics and cryptography experts that separates Cardano and Cardano smart contracts from others in the space.

Plutus code

You have a look at Plutus and try to write, compile and test a smart contract in online Plutus Playground:


Marlowe is a new language for modeling financial instruments as smart contracts on a blockchain. It has been designed for people who are business engineers or subject experts rather than experienced developers. It is a simple domain-specific language (DSL) which comprises a small number of powerful building blocks that can be assembled into expressive financial contracts. It is embedded in the Haskell language, which has its own established ecosystem and testing framework. You do not need programming expertise to use Marlowe and you can explore your Marlowe financial constructions with a browser-based contract editor and simulator.


Marlowe interacts with real-world data and enables the expression of smart contacts. It is aimed at fixed-duration financial products, such as hedging, fixed-term deposits, credit swaps, and crowdfunding. Marlowe is ideal for financial start-ups, analysts, or those in the fin-tech community as well as universities who could use it for testing within their financial courses. With Marlowe, you can write smart contracts for financial instruments that are easy to read, write, and understand without programming experience.

Check Marlowe Playground:


As Charles Hoskinson said in one interview “ One of the biggest problems with Bitcoin, is that it’s blind, deaf and dumb and that was by design.”. Bitcoin was never intended to replicate the current financial systems and be compliant with them. However, we desperately need it to continue building a decentralized world. It will not be easy at all and there is a long way to go in front of us. People must learn new programming languages and blockchain principles to build reliable smart contracts. They have to know that what is deployed once it cannot be changed and stopped. There is no space for human errors. It will take a long time until Alice and Bob use a smart contract for swapping assets. However, we believe that we will see that happen in business soon.

Source: Cardano Smart Contracts

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

Cardano adoption will rock

People still hesitate to accept blockchain and use it daily life. In today's article, we look at some of the reasons for the slow adoption of this breakthrough technology. Teams can significantly help... 09-04-2020, 11:56 · 13 min read

Parameter "d" in Cardano

While Cardano recently underwent its hardfork which transitions the blockchain from the federated state of Byron, where IOHK nodes produce all the blocks into Shelley were stakepool come into play the...
04-08-2020, 12:29 · 8 min read · Wunderbaer

Cardano Staking: Practical Information

We would like to put together a few useful and practical information related to Cardano staking. We plan to regularly update the article to keep information precise and valid....
03-09-2020, 07:05 · 9 min read ·

Building a new economy onĀ Cardano

Cryptocurrency fans believe that blockchain has the potential to disrupt banks and create a new form of sound money. There is a close relationship between national currencies and governments. The real...
09-04-2021, 08:47 · 22 min read ·

How a transaction gets into Cardano's blockchain

When Alice sends 1000 ADA coins to Bob she uses her wallet. Bob will receive the coins in a few seconds. In the article, we will go through the whole process and explain what happens behind the scene ...
11-12-2020, 13:49 · 8 min read ·