5. ‹#›
INPUT | OUTPUT
What Is A Smart Contract?
• Computer programs that execute predefined actions
when certain conditions within the system are met.
• Provide the language of transactions that allow the
ledger state to be modified.
• Can facilitate the exchange and transfer of anything of
value (e.g. shares, money, content, property).
6. ‹#›
INPUT | OUTPUT
What Is A Smart
Contract?
Party
1
Party
2
------
------
1
2
Create Transaction
Included In A Block
Blockchain / Ledger
Transaction
Smart Contract
7. ‹#›
INPUT | OUTPUT
• A developing part of a nascent technology with high
projected growth potential.
• In addition to smart contracts between individuals,
enterprise smart contracts are expected to grow
• Many current blockchain-as-a-service (BaaS) platformas
allow enterprises to create a variety of smart contract
applications e.g. Azure Supply Chain Track & Trace
https://azure.microsoft.com/en-us/solutions/blockchain/
8. ‹#›
INPUT | OUTPUT
• Particularly beneficial for certain industries, especially
those involving sensitive information or needing to
follow regulation like Know Your Customer (KYC)
• Smart contracts are designed and implemented
within blockchains, and therefore they inherit some
of the blockchain’s properties e.g. immutability, being
distributed.
9. ‹#›
INPUT | OUTPUT
Increase
Reduce
• Reliability - No single
entity is in control of data
or money.
• Trust - Business
agreements are
automatically executed
and enforced
• Fraud - Stored in
blockchain & outcome is
validated by everyone in
that network.
• Costs - Eliminating
intermediaries removes
additional fees
• Deal Directly - Remove the need for intermediaries and allow for
transparent, direct relationships with customers.
• Record keeping - All contract transactions are stored in the
blockchain and can be accessed with the complete audit trail.
10. ‹#›
INPUT | OUTPUT
A Practical Example
A smart contract can perform crowdfunding actions – sharing
projects, setting goals, and collecting donations; but without a third
party. If funding goal not met funds reimbursed automatically
12. ‹#›
INPUT | OUTPUT
• One of the major concerns regarding smart contracts is security.
• Poor coding and mistakes have led to several instances of multi-
millionaire dollar losses
• University of Pennsylvania study of 50 ICOs concluded “stark
absence of any real established procedures of vetting smart contracts.”
• NUS & UCL “analysed 3,759 smart contracts and determined that
roughly 3.4 percent–a stunning figure when applied across an entire
enterprise–were vulnerable to manipulation by bad actors to
permanently lock funds, force random leaks, or kill them altogether”
13. ‹#›
INPUT | OUTPUT
Other Challenges
• Scalability
• Interoperability
• Limitations and flaws in existing languages
• Not considering business vertical needs
• Not fun
15. ‹#›
INPUT | OUTPUT
o Single Blockchain Cardano Settlement Layer (SL)
o One sidechain implementation
o UTxO-style accounting each end
o Multiple Native Assets (not just ADA)
o Restricted Plutus Core
o Basic bitcoin style validator/redeemer style blockchain/script interaction
o Multiple Blockchain Cardano Computational Layer (CL)
o Hybrid leger also need account style accounting (for interaction with EVM style programs)
o Multiple Assets
o Managed like ADA in UTxO or hybrid (UTxO/Accounts)
o Can be created on SL & costs will be covered by fees
o ERC20 token can be backed by a native asset
Design | Overview
17. ‹#›
INPUT | OUTPUT
Architecture | SL & CLVirtual Machine Main Design Features Target
K-EVM ❖ Using hybrid UTxO/accounts ledger
❖ Only ADA; no other labelled native currencies for EVM
compatibility;
❖ Running K-EVM
❖ EVM style blockchain/script interaction
Legacy EVM scripts and
languages
IELE ❖ Using hybrid UTxO/accounts ledger;
❖ With multiple labelled assets, not just Ada
❖ Running IELE
❖ IELE extensions to work with native currencies
❖ EVM style blockchain/script interaction
Legacy EVM languages and
extensions, and Plutus
Plutus / Marlowe ❖ Using UTxO ledger
❖ Extended UTxO-style blockchain/script interaction
❖ With multiple native currencies, not just ADA;
❖ With Plutus core, full gas model
Plutus and Marlowe
All CL’s running the main Cardano SL Haskell code & sidechain implementation (sidechain-side)
Design | Virtual Machines
19. ‹#›
INPUT | OUTPUT
Language & VM | K-EVM, IELE
Hackers have huge incentives to exploit flaws in smart contracts and
underlying infrastructure (financial gain, irreversible)
What can we do about the execution environment to increase security?
Everything must be rigorously designed
• Nodes: provably correct VMs or interpreters
• Smart Contracts: use well-designed programming languages, with
provably correct compilers or interpreters
• Verification: Smart contracts provably correct with regards specifications
20. ‹#›
INPUT | OUTPUT
Language & VM | K-EVM, IELE
Deductive
program
verifierParser
Interpreter
Compiler
(semantic)
Debugger
Symbolic
execution
Model
checker
Formal Language Definition
(Syntax and Semantics)
…
Ideal Language Framework
Offering to address this by
Grigore Rosu and Runtime
Verification Inc. was the K-
framework
21. ‹#›
INPUT | OUTPUT
Language & VM | K-EVM, IELE
“Deliver IELE Virtual Machine (VM) for CL and
associated translators to allow users to define
smart contracts in high level languages (all using
K-framework)”
22. ‹#›
INPUT | OUTPUT
Language & VM | K-EVM, IELE
• KEVM - Semantics of the Ethereum Virtual Machine (EVM) in K
https://github.com/kframework/evm-semantics
• Run your Solidity contracts just like EVM
• VM completed and available as IOHK testnet at
http://testnet.iohkdev.io/kevm/ Has Faucet, CLI ; web-based IDE
pending
• Will be integrated into Cardano
• Try it out!
Done
23. ‹#›
INPUT | OUTPUT
Language & VM | K-EVM, IELE
• Provides better performance and is register-based. More accurate gas
cost predictions, as well as lower gas cost for contracts.
• Designed & implemented using formal methods & semantics
• Run your Solidity contracts just like EVM (some will fail intentionally!)
• Available as testnet http://testnet.iohkdev.io/kevm/ with web-based IDE
• Translators for Plutus under development; more planned. What
language would you like?
• Try it out & let us know your feedback!
Done
24. ‹#›
INPUT | OUTPUT
Language & VM | K-EVM, IELE
• IDE Plugins For IELE and additional training materials (community-
driven)
• Semantics Based Compilation (SBC)
• Surface Languages
• Performance Improvement
• Expanded Tools For Provability
25. ‹#›
INPUT | OUTPUT
Language & VM | Plutus
“Programming model for smart contracts &
decentralised apps”
1. Convenience For App Developers (Full Stack)
2. Superior Safety & Security
3. Integrates With Cardano UTxO Ledger
26. ‹#›
INPUT | OUTPUT
Language & VM | Plutus
Safe & Secure
• Functional Programming
(Clean Semantics)
• Plutus Core: Foundation
for code safety & security
Integration With Cardano
• Bring scripting power of
account-based model to
UTxO
• Elegant, Simple
Full Stack
• Template Haskell
30. ‹#›
INPUT | OUTPUT
Language & VM | Plutus
An Example
Payment into a crowd funding campaign
until a payment deadline
• If funding goal reached, campaign owner
can collect funds
• If funding goal not reached, refunds can
be obtained by contributors
• If campaign owner does not collect by
collection deadline, contributors can also
obtain refunds
Smart contracts
for non-developers!
We expect to be able to generate many of
these scripts with Marlowe ….
31. ‹#›
INPUT | OUTPUT
Language | Marlowe
• Special purpose language
(financial contracts)
• Links core technology
with things we need to
do smart contracts
32. ‹#›
INPUT | OUTPUT
Language | Marlowe
• Special purpose language (financial contracts)
• DSL (Domain Specific Language) as a Haskell data type
• Observations and Questions
• Deliverables Include:
• Financial Domain Specific Language (DSL) on the blockchain
• Tools to support the DSL, e.g. simulation, verification (Meadow)
33. ‹#›
INPUT | OUTPUT
Language | Marlowe
• Interaction with outside world
• Recording of commitments,
random observations etc.
• Special considerations for
commitments