• Aucun résultat trouvé

Findel: Secure Derivative Contracts for Ethereum

N/A
N/A
Protected

Academic year: 2021

Partager "Findel: Secure Derivative Contracts for Ethereum"

Copied!
27
0
0

Texte intégral

(1)

Findel: Ethereum Derivatives

Biryukov, Khovratovich,

Tikhomirov

Introduction Financial Languages Composable Contracts Ethereum Our Contribution

Findel DSL Examples Gateways Conclusion

Findel: Secure Derivative Contracts for Ethereum

Alex Biryukov Dmitry Khovratovich Sergei Tikhomirov

1st Workshop on Trusted Smart Contracts In Association with Financial Cryptography 17

7 April 2017, Malta

(2)

Findel: Ethereum Derivatives

Biryukov, Khovratovich,

Tikhomirov

Introduction Financial Languages Composable Contracts Ethereum Our Contribution

Findel DSL Examples Gateways Conclusion

... and Smart Contract Developer

(3)

Findel: Ethereum Derivatives

Biryukov, Khovratovich,

Tikhomirov

Introduction Financial Languages Composable Contracts Ethereum Our Contribution

Findel DSL Examples Gateways Conclusion

Contract Programming is Different

I ”Move fast and break things”: unacceptable!

I Real money (property, resources) at stake

I Side-effects often cause trouble (The DAO)

I We need a formally verifiable contract language

(4)

Findel: Ethereum Derivatives

Biryukov, Khovratovich,

Tikhomirov

Introduction Financial Languages Composable Contracts Ethereum Our Contribution

Findel DSL Examples Gateways Conclusion

A Secure Financial DSL Helps

I Avoid misinterpretation

I Standardize templates

I Prove correctness

I Facilitate automated processing

(5)

Findel: Ethereum Derivatives

Biryukov, Khovratovich,

Tikhomirov

Introduction Financial Languages Composable Contracts Ethereum Our Contribution

Findel DSL Examples Gateways Conclusion

Composable Contracts [Peyton Jones et al. 2003]

I Ten primitives to compose complex agreements

I Declarative paradigm

I Implemented as an embedded DSL in Haskell

Example: zero-coupon bond

when (at 2018-01-01) (scale (konst 100)) (one $))

(6)

Findel: Ethereum Derivatives

Biryukov, Khovratovich,

Tikhomirov

Introduction Financial Languages Composable Contracts Ethereum Our Contribution

Findel DSL Examples Gateways Conclusion

Composable Contracts [Peyton Jones et al. 2003]

I Ten primitives to compose complex agreements

I Declarative paradigm

I Implemented as an embedded DSL in Haskell Example: zero-coupon bond

when (at 2018-01-01) (scale (konst 100)) (one $))

(7)

Findel: Ethereum Derivatives

Biryukov, Khovratovich,

Tikhomirov

Introduction Financial Languages Composable Contracts Ethereum Our Contribution

Findel DSL Examples Gateways Conclusion

Ethereum

I Turing-complete virtual machine

I Key feature: trustless execution

I Perfect match for financial agreements!

(8)

Findel: Ethereum Derivatives

Biryukov, Khovratovich,

Tikhomirov

Introduction Financial Languages Composable Contracts Ethereum Our Contribution

Findel DSL Examples Gateways Conclusion

Ethereum Meets Composable Contracts

I Map declarative DSL to blockchain execution paradigm

I Retrieve and validate external data

I Ensure that execution cost is bearable

(9)

Findel: Ethereum Derivatives

Biryukov, Khovratovich,

Tikhomirov

Introduction Financial Languages Composable Contracts Ethereum Our Contribution

Findel DSL Examples Gateways Conclusion

Financial Derivatives Language (Findel)

I Contract: agreement between issuer and owner

I Contract description defines rights and obligations

I Description is a tree of primitives

I Description and issuer are immutable

I Ownership may be transferred

I Smart contract acts as execution environment

(10)

Findel: Ethereum Derivatives

Biryukov, Khovratovich,

Tikhomirov

Introduction Financial Languages Composable Contracts Ethereum Our Contribution

Findel DSL Examples Gateways Conclusion

Findel Primitives 1/2

I Zero – do nothing

I One – transfer 1 unit of currency from issuer to owner

I Scale(k, c) – multiply all payments by a constant value

I ScaleObs(obs, c) – multiply all payments by an observable value (think exchange rate)

I Give(c) – swap parties

(11)

Findel: Ethereum Derivatives

Biryukov, Khovratovich,

Tikhomirov

Introduction Financial Languages Composable Contracts Ethereum Our Contribution

Findel DSL Examples Gateways Conclusion

Findel Primitives 1/2

I Zero – do nothing

I One – transfer 1 unit of currency from issuer to owner

I Scale(k, c) – multiply all payments by a constant value

I ScaleObs(obs, c) – multiply all payments by an observable value (think exchange rate)

I Give(c) – swap parties

(12)

Findel: Ethereum Derivatives

Biryukov, Khovratovich,

Tikhomirov

Introduction Financial Languages Composable Contracts Ethereum Our Contribution

Findel DSL Examples Gateways Conclusion

Findel Primitives 1/2

I Zero – do nothing

I One – transfer 1 unit of currency from issuer to owner

I Scale(k, c) – multiply all payments by a constant value

I ScaleObs(obs, c) – multiply all payments by an observable value (think exchange rate)

I Give(c) – swap parties

(13)

Findel: Ethereum Derivatives

Biryukov, Khovratovich,

Tikhomirov

Introduction Financial Languages Composable Contracts Ethereum Our Contribution

Findel DSL Examples Gateways Conclusion

Findel Primitives 1/2

I Zero – do nothing

I One – transfer 1 unit of currency from issuer to owner

I Scale(k, c) – multiply all payments by a constant value

I ScaleObs(obs, c) – multiply all payments by an observable value (think exchange rate)

I Give(c) – swap parties

(14)

Findel: Ethereum Derivatives

Biryukov, Khovratovich,

Tikhomirov

Introduction Financial Languages Composable Contracts Ethereum Our Contribution

Findel DSL Examples Gateways Conclusion

Findel Primitives 1/2

I Zero – do nothing

I One – transfer 1 unit of currency from issuer to owner

I Scale(k, c) – multiply all payments by a constant value

I ScaleObs(obs, c) – multiply all payments by an observable value (think exchange rate)

I Give(c) – swap parties

(15)

Findel: Ethereum Derivatives

Biryukov, Khovratovich,

Tikhomirov

Introduction Financial Languages Composable Contracts Ethereum Our Contribution

Findel DSL Examples Gateways Conclusion

Findel Primitives 2/2

I And (c1, c2) – execute both sub-contracts

I Or (c1, c2) – owner chooses which sub-contract to execute

I If (obs, c1, c2) – execute one of sub-contracts (depending on observable)

I Timebound (t0, t1, c) – execute c, if within time bounds

(16)

Findel: Ethereum Derivatives

Biryukov, Khovratovich,

Tikhomirov

Introduction Financial Languages Composable Contracts Ethereum Our Contribution

Findel DSL Examples Gateways Conclusion

Findel Primitives 2/2

I And (c1, c2) – execute both sub-contracts

I Or (c1, c2) – owner chooses which sub-contract to execute

I If (obs, c1, c2) – execute one of sub-contracts (depending on observable)

I Timebound (t0, t1, c) – execute c, if within time bounds

(17)

Findel: Ethereum Derivatives

Biryukov, Khovratovich,

Tikhomirov

Introduction Financial Languages Composable Contracts Ethereum Our Contribution

Findel DSL Examples Gateways Conclusion

Findel Primitives 2/2

I And (c1, c2) – execute both sub-contracts

I Or (c1, c2) – owner chooses which sub-contract to execute

I If (obs, c1, c2) – execute one of sub-contracts (depending on observable)

I Timebound (t0, t1, c) – execute c, if within time bounds

(18)

Findel: Ethereum Derivatives

Biryukov, Khovratovich,

Tikhomirov

Introduction Financial Languages Composable Contracts Ethereum Our Contribution

Findel DSL Examples Gateways Conclusion

Findel Primitives 2/2

I And (c1, c2) – execute both sub-contracts

I Or (c1, c2) – owner chooses which sub-contract to execute

I If (obs, c1, c2) – execute one of sub-contracts (depending on observable)

I Timebound (t0, t1, c) – execute c, if within time bounds

(19)

Findel: Ethereum Derivatives

Biryukov, Khovratovich,

Tikhomirov

Introduction Financial Languages Composable Contracts Ethereum Our Contribution

Findel DSL Examples Gateways Conclusion

Example 1/3: Currency Exchange

And (Give(One(EUR)), ScaleObs(exchAddr, One(USD)))

(20)

Findel: Ethereum Derivatives

Biryukov, Khovratovich,

Tikhomirov

Introduction Financial Languages Composable Contracts Ethereum Our Contribution

Findel DSL Examples Gateways Conclusion

Example 2/3: European Option

Timebound (t0− δ, t0+ δ, Or (One(EUR), Zero))

(21)

Findel: Ethereum Derivatives

Biryukov, Khovratovich,

Tikhomirov

Introduction Financial Languages Composable Contracts Ethereum Our Contribution

Findel DSL Examples Gateways Conclusion

Example 3/3: Binary Option

If (orclAddr, Scale(10, One(USD)), Zero)

(22)

Findel: Ethereum Derivatives

Biryukov, Khovratovich,

Tikhomirov

Introduction Financial Languages Composable Contracts Ethereum Our Contribution

Findel DSL Examples Gateways Conclusion

External Data Problem

I Contracts require external data

I Ethereum is isolated from broader Internet

I Our solution: gateways

(23)

Findel: Ethereum Derivatives

Biryukov, Khovratovich,

Tikhomirov

Introduction Financial Languages Composable Contracts Ethereum Our Contribution

Findel DSL Examples Gateways Conclusion

External Data Problem

I Contracts require external data

I Ethereum is isolated from broader Internet

I Our solution: gateways

(24)

Findel: Ethereum Derivatives

Biryukov, Khovratovich,

Tikhomirov

Introduction Financial Languages Composable Contracts Ethereum Our Contribution

Findel DSL Examples Gateways Conclusion

Gateways

I Smart contract pulls and stores external data with timestamp

I Optional proof of authenticity (e.g., signature under known public key)

I Findel marketplace queries gateway when needed

I Parties are responsible for updating gateways

(25)

Findel: Ethereum Derivatives

Biryukov, Khovratovich,

Tikhomirov

Introduction Financial Languages Composable Contracts Ethereum Our Contribution

Findel DSL Examples Gateways Conclusion

What Is Done

I Defined a declarative DSL suited for blockchain

I Implemented a marketplace smart contract in Solidity

I Assessed cost of operation (∼ $0.1 per avg operation)1

(26)

Findel: Ethereum Derivatives

Biryukov, Khovratovich,

Tikhomirov

Introduction Financial Languages Composable Contracts Ethereum Our Contribution

Findel DSL Examples Gateways Conclusion

Future Work

I Enforcement: deal with users defaulting on debt

I Model balances using ERC20 Token

I Extend model to support multi-party contracts

I Look into valuation and verification

(27)

Findel: Ethereum Derivatives

Biryukov, Khovratovich,

Tikhomirov

Introduction Financial Languages Composable Contracts Ethereum Our Contribution

Findel DSL Examples Gateways Conclusion

Questions?

I cryptolux.org

I @serg tikhomirov

I sergei.tikhomirov@uni.lu

Références

Documents relatifs

This is expected because direct access is fetching blocks directly using their hashes, while EQL is searching for information inside the blocks (i.e., the timestamp and number

Data were analysed along the following vari- ables: the Gas price oracle ( oracle gasprice ), the number of unconfirmed transactions ( unconfirmed count ), the block time ( block

Privacy-preserving KYC on Ethereum Biryukov, Khovratovich, Tikhomirov Introduction A decentralized KYC-compliant identity Conclusion and future work 17/20 Implementation details. I

We present the design and implementation of Horus, a framework that helps identifying smart contract attacks based on a sequence of blockchain transactions using Datalog queries..

We classify issues in Solidity source code and develop a static analysis tool – SmartCheck – that detects them.. We test SmartCheck on a large set of real-world contracts and

We implement an Ethereum smart contract that acts as a marketplace for Findel contracts and measure the cost of its operation.. We analyze challenges in modeling financial agreements

Negligible and Incorrect Use of Safe Libraries. In Section 5.2.2 we analysed the safety of 495 token smart contracts. Token contracts perform a number of arithmetic operations such

We can split recent work on formal verification and analysis of Ethereum contracts in methods that work over the on-chain, low-level contract bytecode [9]–[18], and methods that