Liquidity is a high-level typed smart-contract language for Tezos that strictly complies with Michelson security restrictions. A formal verification framework for it is under development.

Try on Betanet Try on Zeronet

About Liquidity

Liquidity is a high-level language to program Smart Contracts for Tezos. It is a fully typed functional language, it uses the syntax of OCaml, and strictly complies with Michelson security restrictions.

A formal-method framework for Liquidity is under development, to prove the correctness of smart-contracts written in Liquidity.

The Liquidity language provides the following features:

  • full coverage of the Michelson language: Anything that can be written in Michelson can be written in Liquidity,
  • local variables instead of stack manipulations: values can be stored in local variables.
  • high-level types: types like sum-types and record-types can be defined and used in Liquidity programs.

Liquidity already covers 100% of the Michelson features, and contracts generated with Liquidity can be submitted on the current betanet and zeronet.

Liquidity Online

Liquidity editors will soon be available to program online and submit contracts on Tezos testnet. For now, you can use our Try Liquidity Site to get a taste of the upcoming environment.

Documentation & Examples

Liquidity Documentation is available Here. Examples are also available in the Github project, or in the online editor.

A typical example is:

[%%version 0.3]

let%init storage (myname : string) =
  Map.add myname 0 (Map ["ocaml", 0; "pro", 0])

let%entry main
  (parameter : string)
  (storage : (string, int) map) =

  let amount = Current.amount() in

  if amount < 5.00tz then
    Current.failwith "Not enough money, at least 5tz to vote"
    match Map.find parameter storage with
    | None -> Current.failwith "Bad vote"
    | Some x ->
       let storage = Map.add parameter (x+1) storage in
       ( ([] : operation list), storage )

Liquidity Team

Çağdaş Bozman
Mohamed Iguernlala
Michael Laporte
Fabrice Le Fessant
Alain Mebsout

Liquidity Roadmap

The current roadmap is:

  • Development of an online editor for Liquidity
  • Development of a verification framework for Liquidity contracts


0.32  2018-07-11
    * Compatibility with Tezos's Betanet
    * New calling convention, Contract.transfer returns an operations
      which has to be returned
    * Current.failwith : 'a -> 'b, instead of fail
    * Type bytes, and 0xab... bytes constants
    * Bytes.pack, Bytes.unpack
    * Type address
    * Contract and address constants (KT1..., tz...)
    * Type big_map, and constants BigMap [...], and BigMap.find,
      BigMap.add, BigMap.remove, BigMap.update
    * New compilation of Map/Set/
    * New instruction Map/Set/List.map_fold
    * Current.self renamed to Contract.self
    * New functions Crypto.blake2b/sha256/sha512 instead of Crypto.hash
    * Current.sender
    * Remove Contract.manager
    * ( <addr> : p contract option)

    * Better locations reporting
    * Show runtime failures source locations
    * Light type inferrence in specific places
    * Unary negation on int and tez
    * Somewhat better error messages
    * Compile with OCaml 4.06.1
    * Better decompilation naming heuristic

    * Fix issue with decompiling multiple nested failing branches
    * Fix issue with decompilation of ITER
    * Fix some incorrect peephole optimizations
    * Reject maps and sets with non comparable keys

0.14  2018-01-23
    * Support for decompilation of ITER
    * New instructions Map.iter, Set.iter, List.iter
    * Storage initializer
    * Run Liquidity contracts on Tezos node directly (--run)
    * Deploy Liquidity contracts on Tezos node directly (--deploy)
    * Call Liquidity contracts on Tezos node directly (--call)
    * Retrieve Tezos contract storage in Liquidity syntax (--get-storage)

    * Define type abbreviations when decompiling
    * Support timestamp date with Z timezone
    * Encode reduce with closures using ITER
    * Constant of type signature start with backquote and are hex encoded
    * Ready for javascript compilation

    * int and nat are not comparable
    * bool is comparable
    * Division on type tez

0.13  2017-11-30
    * match%nat construct for int -> nat coercion
    * abs is now int -> int
    * Command line options --parse-only, --type-only
    * Command line options --single-line, --compact to output
      Michelson on a single line
    * Support &&, || Boolean connectors
    * Support Map.add, Map.remove, Set.add, Set.remove
    * Lambda types are now written as t1 -> t2 instead of
      (t1, t2) lambda
    * Constant amounts written as litterals: 1.00tz
    * Constant keys and key_hashes as litterals: edpk... tz1...
    * Timestamps as litterals in ISO-8601 format

    * Split typechecking and encoding phases
    * Allow transfers in conditions (for if-then-else and match)
    * Encode to constants when possible
    * Better error messages
    * Accept any name for result of
    * Recover variable names when decompiling

    * Fix bug in encoding of closures
    * Fix bug in compilation of branches with transfers

0.11  2017-10-16
    * Compilation of Liquidity contracts to OCaml bytecode
    * Deconstruct tuples in let, fun and pattern matching
    * Support _ for pattern
    * OCaml syntax for return type of contract's entry point
    * Support for type key_hash

    * Allow compilation without Tezos
    * Better error messages
    * Error location in Michelson source when decompiling
    * Declare type storage when decompiling
    * More efficient encoding of closures

0.1   2017-10-05
    Initial release 
This website uses the creative template of
The background image is licensed under CC0
© 2017 OCamlPro SAS, All rights reserved.
Get it touch with us