Skip to main content

Findel: Secure Derivative Contracts for Ethereum

  • Conference paper
  • First Online:
Financial Cryptography and Data Security (FC 2017)

Part of the book series: Lecture Notes in Computer Science ((LNSC,volume 10323))

Included in the following conference series:

Abstract

Blockchain-based smart contracts are considered a promising technology for handling financial agreements securely. In order to realize this vision, we need a formal language to unambiguously describe contract clauses. We introduce Findel – a purely declarative financial domain-specific language (DSL) well suited for implementation in blockchain networks. 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 in decentralized networks and outline directions for future work (See the author’s post-print at https://orbilu.uni.lu/handle/10993/30975 and the related source code at https://github.com/cryptolu/findel).

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 39.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD 54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Notes

  1. 1.

    The derivatives market is comparable in size to the world’s GDP. The gross market value of all outstanding over-the-counter derivatives is $20.7 trillion [Bis16] (2016). The world GDP in 2015 is $73,9 trillion [Wor16].

  2. 2.

    We may refer to Findel contracts simply as contracts, when the distinction between them and Ethereum smart contracts is clear from the context.

  3. 3.

    INF is a symbol representing infinite time, i.e., \(t_0 < INF\) for every \(t_0\). \(\delta \) is an implementation dependent constant intended for handling imperfect precision of time signal in distributed networks.

  4. 4.

    In case of Or, execute exactly one of the sub-nodes, according to the owner-submitted value indicating the choice; delete the other one. It is the only primitive that requires an additional user-supplied argument for execution.

  5. 5.

    Beware of front-runners: Bob can monitor the network and try to join a contract as soon as he sees Alice’s attempt to do so. Depending on the network latency and miner’s behavior, either transaction can be confirmed.

  6. 6.

    BTCRelay is a prominent example: users submit Bitcoin block headers to a smart contract, which implies their authenticity from the validity of easily verifiable proof-of-work. After a header is stored on the Ethereum blockchain, users check with a Merkle proof that the Bitcoin block contains a given transaction.

  7. 7.

    For simplicity, we only consider 256-bit integers as observable values. Boolean values can be trivially simulated via integers.

  8. 8.

    By definition, an expired contract is equivalent to \(\mathrm {Zero}\).

  9. 9.

    An expired contract should also be deleted even if its owner is offline forever. Our current implementation does not handle the latter case, though it may be considered an attack vector due to increasing storage usage. A possible approach is for a marketplace to offer rewards for keeping track of expired contracts and triggering their deletion.

  10. 10.

    Compare to [JES00]: “If you acquire (c1 or c2) you must immediately acquire either c1 or c2 (but not both)”. We can not force a user to make this decision.

  11. 11.

    In this particular case, an equivalent contract \(\mathrm {Give}(\mathrm {Or}(\mathrm {One}(USD),\mathrm {One}(EUR)))\) solves the issue. In more complex cases this is not necessarily the case.

  12. 12.

    A likely rationale: rounding issues break consensus.

  13. 13.

    Solidity version: 0.4.4+commit.4633f3de.Emscripten.clang.

  14. 14.

    Szabo makes a case against state variables in general, stating that “they should be avoided unless utterly necessary”.

  15. 15.

    In traditional finance, a future is a standardized contract while a forward is not. This distinction is not relevant for our model.

References

  1. Atzei, N., Bartoletti, M., Cimoli, T.: A survey of attacks on ethereum smart contracts. IACR Cryptol. ePrint Arch. 2016, 1007 (2016)

    Google Scholar 

  2. Statistical release. OTC derivatives statistics at end-june 2016 (2016). https://www.bis.org/publ/otc_hy1611.pdf

  3. Browser-solidity online compiler (2016). https://ethereum.github.io/browser-solidity/

  4. A next-generation smart contract and decentralized application platform (2014). https://github.com/ethereum/wiki/wiki/White-Paper

  5. Clack, C.D., Bakshi, V.A., Braine, L.: Smart contract templates: foundations, design landscape and research directions. CoRR, abs/1608.00771 (2016)

    Google Scholar 

  6. Yakoubov, S., Fromknecht, C., Velicanu, D.: A decentralized public key infrastructure with identity retention. Cryptology ePrint Archive, Report 2014/803 (2014). http://eprint.iacr.org/2014/803

  7. Chaudhary, S.: Adventures in financial and software engineering (2015). https://falconair.github.io/2015/01/30/composingcontracts.html

  8. Cox, J.C., Ross, S.A., Rubinstein, M.: Option pricing: a simplified approach. J. Finan. Econ. 7(3), 229–263 (1979)

    Article  MATH  Google Scholar 

  9. del Castillo, M.: JP Morgan, credit suisse among 8 in latest bank blockchain test (2016). http://www.coindesk.com/jp-morgan-credit-suisse-among-8-in-latest-bank-blockchain-test/

  10. Ethstats (2017). https://ethstats.net/

  11. Functional programming for ethereum (2017). https://github.com/fp-ethereum/fp-ethereum

  12. Frankau, S., Spinellis, D., Nassuphis, N., Burgard, C.: Commercial uses: going functional on exotic trades. J. Func. Program. 19(01), 27–45 (2009)

    Article  Google Scholar 

  13. Gaillourdet, J.-M.: A software language approach to derivative contracts in finance (2011). http://ceur-ws.org/vol-750/yrs06.pdf

  14. Gibbons, J.: Functional programming for domain-specific languages. In: Zsók, V., Horváth, Z., Csató, L. (eds.) CEFP 2013. LNCS, vol. 8606, pp. 1–28. Springer, Cham (2015). https://doi.org/10.1007/978-3-319-15940-9_1

    Google Scholar 

  15. Greenspan, G.: Why many smart contract use cases are simply impossible (2016). http://www.coindesk.com/three-smart-contract-misconceptions/

  16. Hvitved, T.: A survey of formal languages for contracts. In: Fourth Workshop on Formal Languages and Analysis of Contract-Oriented Software (FLACOS 2010), pp. 29–32. Citeseer (2010)

    Google Scholar 

  17. Icos, token sales, crowdsales (2017). https://www.smithandcrown.com/icos/

  18. Peyton Jones, S.L., Eber, J.-M.: How to write a financial contract, The Fun of Programming (2003)

    Google Scholar 

  19. Peyton Jones, S.L., Eber, J.-M., Seward, J.: Composing contracts: an adventure in financial engineering, functional pearl. In: ICFP, pp. 280–292. ACM (2000)

    Google Scholar 

  20. Khovratovich, D.: debt.sol (2016). https://gist.github.com/khovratovich/45f68082b556b45eb64e8e1c3eb82892

  21. Lewison, K., Corella, F.: Backing rich credentials with a blockchain PKI (2016). https://pomcor.com/techreports/BlockchainPKI.pdf

  22. Ocaml at lexifi (2000). https://www.lexifi.com/blogs/ocaml

  23. Mortensen, S.: Universal contracts (2016). https://github.com/corda/corda/tree/master/experimental/src

  24. Oraclize (2016). http://www.oraclize.it/

  25. Reality keys (2016). https://www.realitykeys.com/

  26. Revere, R.R.: What is the difference between transaction cost and execution cost in browser solidity? (2016). https://ethereum.stackexchange.com/q/5812/5113

  27. Schiller, T.: Financial domain-specific language listing (2013). http://www.dslfin.org/resources.html

  28. Schuldenzucker, S.: Decomposing contracts (2014). http://www.ifi.uzh.ch/ce/people/schuldenzucker/decomposingcontracts.pdf

  29. Schuldenzucker, S.: An axiomatic framework for no-arbitrage relationships in financial derivatives markets (2016). http://www.ifi.uzh.ch/ce/publications/LPT.pdf

  30. Gün Sirer, E.: Thoughts on the dao hack (2016). http://hackingdistributed.com/2016/06/17/thoughts-on-the-dao-hack/

  31. Seijas, P.L., Thompson, S., McAdams, D.: Scripting smart contracts for distributed ledger technology. Cryptology ePrint Archive, Report 2016/1156 (2016). http://eprint.iacr.org/2016/1156

  32. Szabo, N.: Formalizing and securing relationships on public networks (1997). http://journals.uic.edu/ojs/index.php/fm/article/view/548

  33. Szabo, N.: A formal language for analyzing contracts (2002). http://nakamotoinstitute.org/contract-language/

  34. Tlsnotary (2016). https://tlsnotary.org/

  35. Ethereum improvement proposal: Token standard (2016). https://github.com/ethereum/EIPs/issues/20

  36. van Straaten, A.: Composing contracts (2007). https://web.archive.org/web/20130814194431/http://contracts.scheming.org

  37. Walton, C.: Scala contracts project (2012). https://github.com/channingwalton/scala-contracts/wiki

  38. Wood, G.: Ethereum: a secure decentralised generalised transaction ledger (2014). http://gavwood.com/paper.pdf

  39. Gross domestic product 2015 (2016). http://databank.worldbank.org/data/download/GDP.pdf

  40. Worldcoinindex (2017). https://www.worldcoinindex.com/coin/ethereum

Download references

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Sergei Tikhomirov .

Editor information

Editors and Affiliations

A Examples

A Examples

  • A fixed-rate currency exchange: the owner sells €10 for $11.

    $$\begin{aligned} \mathrm {And}(\mathrm {Give}(\mathrm {Scale}(10, \mathrm {One}(EUR))),\mathrm {Scale}(11,\mathrm {One}(USD)) \end{aligned}$$
  • A market-rate currency exchange: the owner sells €10 at market rate as reported by the gateway at addr.

    $$\begin{aligned} \mathrm {Scale}(10, \mathrm {And}(\mathrm {Give}(\mathrm {One}(EUR)), ScaleObs(addr,\mathrm {One}(USD)))) \end{aligned}$$
  • A zero-coupon bond: the owner receives $100 at \(t_0\).

    $$\begin{aligned} \mathrm {Timebound}(t_0-\delta , t_0+\delta , \mathrm {Scale}(100, \mathrm {One}(USD))) \end{aligned}$$
  • A bond with coupons: the owner receives $1000 (face value) in three years (maturity date) and two coupon payments of $50 at regular intervals before the maturity date.

    $$\begin{aligned} \mathrm {And}(\mathrm {At}(\text {now + 3 years},c_{face}),\mathrm {And}(\mathrm {At}(\text {now + 1 years}, c_{cpn}),\mathrm {At}(\text {now + 1 years},c_{cpn}))) \end{aligned}$$

    where

    $$\begin{aligned} c_{face} = \mathrm {Scale}(1000,\mathrm {One}(USD)), \quad c_{cpn} = \mathrm {Scale}(50,\mathrm {One}(USD)) \end{aligned}$$
  • A future (a forward Footnote 15): parties agree to execute the underlying contract \(c\) at \(t_0\).

    $$\begin{aligned} \mathrm {Timebound}(t_0-\delta , t_0+\delta , c) \end{aligned}$$
  • An option: the owner can choose at (European option) or before (American option) time \(t_0\) whether to execute the underlying contract \(c\).

    $$\begin{aligned} \mathrm {Timebound}(t_0-\delta , t_0+\delta , \mathrm {Or}(c, \mathrm {Zero})) \end{aligned}$$
    $$\begin{aligned} \mathrm {Timebound}(now, t_0+\delta , \mathrm {Or}(c, \mathrm {Zero})) \end{aligned}$$
  • A binary option: the owner receives $10 if a predefined event took place at \(t_0\) and nothing otherwise.

    $$\begin{aligned} \mathrm {If}(addr, \mathrm {Scale}(10, \mathrm {One}(USD)), \mathrm {Zero}) \end{aligned}$$

Rights and permissions

Reprints and permissions

Copyright information

© 2017 International Financial Cryptography Association

About this paper

Check for updates. Verify currency and authenticity via CrossMark

Cite this paper

Biryukov, A., Khovratovich, D., Tikhomirov, S. (2017). Findel: Secure Derivative Contracts for Ethereum. In: Brenner, M., et al. Financial Cryptography and Data Security. FC 2017. Lecture Notes in Computer Science(), vol 10323. Springer, Cham. https://doi.org/10.1007/978-3-319-70278-0_28

Download citation

  • DOI: https://doi.org/10.1007/978-3-319-70278-0_28

  • Published:

  • Publisher Name: Springer, Cham

  • Print ISBN: 978-3-319-70277-3

  • Online ISBN: 978-3-319-70278-0

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics