Abstract
We implement two versions of a simple but illustrative smart contract: one in Solidity on the Ethereum blockchain platform, and one in Plutus on the Cardano platform, with annotated code excerpts and with source code attached. We get a clearer view of the Cardano programming model in particular by introducing a novel mathematical abstraction which we call Idealised EUTxO. For each version of the contract, we trace how the architectures of the underlying platforms and their mathematics affects the natural programming styles and natural classes of errors. We prove some simple but novel results about alpha-conversion and observational equivalence for Cardano, and explain why Ethereum does not have them. We conclude with a wide-ranging and detailed discussion in the light of the examples, mathematical model, and mathematical results so far.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Similar content being viewed by others
Notes
- 1.
Plutus and Cardano are IOHK designs. The CEO and co-founder of IOHK, Charles Hoskinson, was also one of the co-founders of Ethereum.
- 2.
Think: central bank, manufacturer’s price, official exchange rate, etc.
- 3.
This use of ‘pointed’ is unrelated to the ‘points to’ of Notation 2.4.
- 4.
We write ‘a solution of’ because Fig. 1 does not specify a unique subset for \({\mathsf {Validator}}\). Computable subsets is one candidate, but our mathematical abstraction is agnostic to this choice. This is just the same as function-types not being modelled by all functions, or indeed as models of set theory can have different powersets (e.g. depending on whether a powerset includes the Axiom of Choice).
- 5.
Gödel encoding refers to the idea of enumerating a countable datatype (in some arbitrary way) so that each element is represented by a unique numerical index.
- 6.
The ‘crypto’ in ‘cryptocurrency’ lives here.
- 7.
We don’t necessarily know \(\mathcal {B};{ tx };{ tx }'\) is a blockchain, which is why we stated Definition 2.9 for sequences of transactions.
- 8.
Positions of unspent outputs (UTxOs) cannot be permuted. If we permute a UTxO position in \(\mathcal {B}\), we obtain a blockchain \(\mathcal {B}'\) with a symmetric equivalence to \(\mathcal {B}\) but not observationally equivalent to it (much as \(\text {-} i\) relates to i in \(\mathbb {C}\)). More on this in [3].
- 9.
We call it
because it directly corresponds with
in Fig. 9, whose name is fixed in Solidity. We add a dash to avoid name-clash with
, an existing function from the Plutus
library.
- 10.
This technique was developed by the IOHK Plutus team.
- 11.
Any data on the Ethereum blockchain is public in the external sense that it can be read off the binary data of the blockchain as a file on a machine running it. However, not all data is
in the internal sense that it can be accessed from any code running on the Ethereum virtual machine.
- 12.
It would be unheard of for such elementary mistakes to slip into production code; and even if it did happen, it is hardly conceivable that such errors would happen repeatedly across a wide variety of programming languages.
That was sarcasm, but the point may bear repeating: programmer error and programming language design are two sides of a single coin.
- 13.
—the need for
.
- 14.
This is distinct from a user inspecting the contents of UTxOs from outside the blockchain, i.e. by reading state off the hard drive of their node or Cardano wallet.
- 15.
How to reach distributed consensus in such an environment is another topic, with its own attack surface. Cardano uses Ouroboros consensus [7].
- 16.
The DAO hack stole approximately 70 million USD from Ethereum, which chose to revert the theft using a hard fork of the Ethereum blockchain [8].
References
Chakravarty, M.M.T., Chapman, J., MacKenzie, K., Melkonian, O., Peyton Jones, M., Wadler, P.: The extended UTXO model. In: Bernhard, M., et al. (eds.) FC 2020. LNCS, vol. 12063, pp. 525–539. Springer, Cham (2020). https://doi.org/10.1007/978-3-030-54455-3_37
Coutts, D., de Vries, E.: A formal specification of the Cardano wallet, Technical report, IOHK, Version 1.2, July 2018
Gabbay, M.: Equivariant ZFA and the foundations of nominal techniques. J. Log. Comput. 30(2), 525–48 (2020)
de Bruijn, N.G.: Lambda calculus notation with nameless dummies, a tool for automatic formula manipulation, with application to the Church-Rosser theorem. Indagationes Math. 5(34), 381–392 (1972)
Gabbay, M.J., Pitts, A.M.: A new approach to abstract syntax with variable binding. Formal Aspects Comput. 13, 341–363 (2001)
Allais, G., Atkey, R., Chapman, J., McBride, C., McKinna, J.: A type and scope safe universe of syntaxes with binding: their semantics and proofs. In: PACMPL, vol. 2, no. ICFP, pp. 90:1–90:30 (2018)
Kiayias, A., Russell, A., David, B., Oliynykov, R.: Ouroboros: a provably secure proof-of-stake blockchain protocol. In: Katz, J., Shacham, H. (eds.) CRYPTO 2017. LNCS, vol. 10401, pp. 357–388. Springer, Cham (2017). https://doi.org/10.1007/978-3-319-63688-7_12
Atzei, N., Bartoletti, M., Cimoli, T.: A survey of attacks on Ethereum smart contracts (SoK). In: Maffei, M., Ryan, M. (eds.) POST 2017. LNCS, vol. 10204, pp. 164–186. Springer, Heidelberg (2017). https://doi.org/10.1007/978-3-662-54455-6_8
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2020 Springer Nature Switzerland AG
About this paper
Cite this paper
Brünjes, L., Gabbay, M.J. (2020). UTxO- vs Account-Based Smart Contract Blockchain Programming Paradigms. In: Margaria, T., Steffen, B. (eds) Leveraging Applications of Formal Methods, Verification and Validation: Applications. ISoLA 2020. Lecture Notes in Computer Science(), vol 12478. Springer, Cham. https://doi.org/10.1007/978-3-030-61467-6_6
Download citation
DOI: https://doi.org/10.1007/978-3-030-61467-6_6
Published:
Publisher Name: Springer, Cham
Print ISBN: 978-3-030-61466-9
Online ISBN: 978-3-030-61467-6
eBook Packages: Computer ScienceComputer Science (R0)