Contractum: smart-contract language

Contractum is a functional declarative programming language designed for developing smart contracts which run on Bitcoin and Lightning network using RGB technology.

Declarative

Define contract state and operations in a simple declarative form, which is easy to write and understand

Strong-typed

State and contract operations take only known structured types

Abstract

Leverage interfaces, type libraries, schemata and schema hierarchy for code-reuse and reducing risks of mistakes

Contractum differs from other smart contract programming languages in a fact that as functional as Haskell and nearly as close to the bare metal as Rust at the same time, filling in the space which was not accessible for the smart contracts before:

Contractum on the landscape of other languages

RGB smart contracts

Contractum is the language to write RGB contracts. RGB is a technology which allows creation of arbitrary-complex ("Turing-complete") smart contracts that run on bitcoin and, most imporangly, Lightning network. RGB contracts are confidential, scalable (up to the speed of the Lightning transactions, with small data footprint) and robust.

Confidential

  • No blockchain footprint

  • No chainanalysis possible: contract breaks transaction graphs

  • Extensive use of zero-knowledge (confidential transactions, bulletproofs)

Scalable

  • No transaction size increase, no block space usage

  • Sharded: data kept by contract parties and not each node

  • Operate with the speed of Lightning Network

Turing-complete

  • Arbitrary complex business logic

  • #BiFi: bitcoin finance, which is much more robust and reliable than DeF

  • No tokens or gas required; bitcoin is the native currency

Contracts written with Contractum are verified with client-side-validation, which does not adds data to a bitcoin blockchain and may be thought as a sharding technology, enhanced with zero-knowledge. Client-side-validation also breaks transaction graphs, unlinking contract evolution from blockchain transactions, making chain analysis impossible.

Learn more about RGB smart contracts on the RGB FAQ website.

Work in progress

The contractum is a work in progress: the language design is under active development at the LNP/BP Association. Everyone is welcome to join the effort; a good starting point can be reading and writing to the language design discussions group in GitHub.

To understand and participate in contractum design it is important to learn more about technologies which are used by RGB smart contracts:

Single-use-seals

Client-side-validation relies on a deterministic commitment history named single-use-seals

AluVM

Contractum runs code on AluVM virtual machine: functional registry-based RISC machine

Strict encoding

RGB contracts uses special deterministic portable binary data type system and encoding

The feel of the language

If you'd like to get a feel of the language, here is a sample contract written in Contractum:

About

Contractum development is managed by a non-profit LNP/BP Standards Association. The language design and compiler implementation is lead by Dr Maxim Orlovsky.