2020_06_09_a-dune-love-story-from-liquidity-to-love.md 6.19 KB
Newer Older
David Declerck's avatar
David Declerck committed
1 2 3 4 5 6
title=A Dune Love story: From Liquidity to Love
authors=Steven De Oliveira
date=2020-06-09
category=Blockchains
tags=

7 8 9
<!-- [![Liquidity & Love](assets/img/liq-love-1.png "A Dune Love story: From Liquidity to Love")](https://www.ocamlpro.com/2020/06/09/a-dune-love-story-from-liquidity-to-love/) -->
<div align="center">
<a href="https://www.ocamlpro.com/2020/06/09/a-dune-love-story-from-liquidity-to-love/">
10
<img width="900" height="900" alt="Liquidity & Love" title="A Dune Love story: From Liquidity to Love" src="assets/img/liq-love-1.png">
11 12
</a>
</div>
David Declerck's avatar
David Declerck committed
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27

*By OCamlPro & Origin Labs*

Writing smart contacts may often be a burdensome task, as you need to learn a new language for each blockchain you target. In the Dune Network team, we are willing to provide as many possibilities as possible for developers to thrive in an accessible and secure framework.

There are two kinds of languages on a blockchain: “native” languages that are directly understood by the blockchain, but with some difficulty by the developers, and “compiled” languages that are more transparent to developers, but need to be translated to a native language to run on the blockchain. For example, Solidity is a developer-friendly language, compiled to the native EVM language on the Ethereum blockchain.

Dune Network supports multiple native languages:
- [**Love**](https://medium.com/dune-network/love-a-new-smart-contract-language-for-the-dune-network-a217ab2255be), a type-safe language with a ML syntax and suited for formal verification
- [**Michelson**](https://dune.network/docs/dune-node-mainnet/whitedoc/michelson.html), inherited from [Tezos](https://tezos.com), also type-safe, much more difficult to read
- [**Solidity**](https://en.wikipedia.org/wiki/Solidity), the Ethereum language, of which we are currently implementing the interpreter after releasing [its parser in OCaml](https://medium.com/dune-network/a-solidity-parser-in-ocaml-with-menhir-e1064f94e76b) a few weeks ago

On the side of compiled languages, Dune Network supports:
- [**Liquidity**](https://www.liquidity-lang.org/), a type-safe ML language suited for formal verification, that compiles to Michelson (and allows developers to decompile Michelson for auditing)
- [**ReasonML**](https://reasonml.github.io/), a JavaScript language designed by Facebook that compiles down to Michelson through Liquidity
28
- All other Tezos languages that compile to Michelson (for example [**Ligo**](https://ligolang.org/), [**SmartPy**](https://smartpy.io/), [**Albert**](https://albert-lang.io/)...)
David Declerck's avatar
David Declerck committed
29 30 31 32 33

Though Liquidity and Love are both part of the ML family, Liquidity is much more developer-friendly: types are inferred, whereas in Love they have to be explicit, and Liquidity supports the ReasonML JavaScript syntax while Love is bound to its ML syntax.

For all these reasons, we are pleased to announce a wedding: Liquidity now supports the Love language!

34 35
![Liquidity & Love](assets/img/liq-love-2.png)

36
*Liquidity now supports generating Love smart contracts*
David Declerck's avatar
David Declerck committed
37 38 39

This is great news for Love, as Liquidity is easier to use, and comes with an online web editor, [Try-Liquidity](https://www.liquidity-lang.org/edit/). Liquidity is also being targeted by the [ConCert project](https://arxiv.org/pdf/1907.10674.pdf), aiming at **verifying smart contracts** with the formal verification framework Coq.

40
![Dune Languages](assets/img/dune-compilers.png)
41

42
*The Smart Contract Framework on the Dune Network*
David Declerck's avatar
David Declerck committed
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57

Compiling contracts from Liquidity to Love has several benefits compared to Michelson. First, Love contracts are about 60% smaller than Michelson contracts, hence they are **60% cheaper** to deploy. Also, the compiler outputs a Love contract that can be easily read and audited.

The Love compiler is part of the [Liquidity project](https://github.com/OCamlPro/liquidity). It works as follows:

- **The Liquidity contract is type-checked by the Liquidity compiler.** The strong type system of liquidity enforces structural & semantic properties on data.
- **The typed Liquidity contract is compiled to a typed Love contract.** During this step, the Liquidity contract is scanned to check if it complies with the Love requirements (correct use of operators, no reentrancy, etc.).
- **The Love contract is type-checked.** Once this step is completed, the contract is ready to be deployed on the chain!

Want to try it out? Check the [Try-Liquidity](https://www.liquidity-lang.org/edit/) website: you can now compile and deploy your Liquidity contracts in Love from the online editor directly to the Mainnet and Testnet using [Dune Metal](https://metal.dune.network)!

---

These are some of the resources you might find interesting when building your own smart contracts:

58 59 60 61
- **The Love Language Documentation**: https://dune.network/docs/dune-dev-docs/love-doc/introduction.html
- **Try-Liquidity:** https://www.liquidity-lang.org/edit/
- **The Liquidity Website:** https://www.liquidity-lang.org/
- **The Dune Network Website:** https://dune.network
David Declerck's avatar
David Declerck committed
62 63

> ## About OCamlPro
64
> OCamlPro  is a company founded in 2011, with the mission to help industrial users  benefit from state-of-the art programming languages like OCaml and  Rust. We design, create and implement custom ad-hoc software for our  clients. We also have a long experience in developing and maintaining  open-source tooling for OCaml, such as Opam, TryOCaml, ocp-indent etc.  and we contribute to the core-development of OCaml, notably with our  work on the Flambda optimizer branch with Jane Street. Another area of  expertise is that of Formal Methods, with tools such as our SMT Solver  Alt-Ergo (check our Alt-Ergo Users’ Club). We provide consulting and  vocational trainings in OCaml and Rust, and we can build courses on  formal methods on-demand. Feel free to reach out by email: contact@ocamlpro.com.
David Declerck's avatar
David Declerck committed
65 66

> ## About Origin Labs
67
> Origin Labs is a company founded in 2019 by the former blockchain team at  OCamlPro. At Origin Labs, they have been developing Dune Network, a fork of the Tezos blockchain, its ecosystem, and applications over the Dune  Network platform. At OCamlPro, they developed TzScan, the most popular  block explorer at the time, Liquidity, a smart contract language, and  were involved in the development of the core protocol and node. Feel free to reach out by email: contact@origin-labs.com.