Learn about Marlowe

Marlowe offers financial contracts for blockchain that everyone can code. It is a domain-specific language (DSL) for writing and executing financial contracts that allows users to apply their domain expertise to write and manage contracts conveniently, without the steep learning curve associated with software development, blockchain, or smart contracts. With Marlowe, you can learn how to model financial products using this easy-to-learn language. It is a platform for decentralized finance (DeFi) that supports direct, peer-to-peer lending, contracts for difference (CFD), and other similar instruments. Marlowe contracts are straightforward as they are optimized for financial transactions, development platforms, and ensure a fast track for financial service providers to build expertise in smart contracts and blockchain technology.

As a special-purpose language, it is easier to read, write, and understand Marlowe contracts. It is also safer: some errors are impossible to write, and we can completely analyse contract behaviour without having to run a contract.

Who can use Marlowe?

Marlowe has been designed to be used by someone who is an expert in the field of financial contracts or business, but does not have programming skills and experience, because it allows you to build contracts visually and in more traditional code. Financial institutions can use it to develop and deploy custom instruments for their customers and clients, for example.

The Marlowe language itself is now embedded in both JavaScript and Haskell, offering you a choice of editors depending on your preference and skillset. Javascript offers flexibility and speed of use with a thriving ecosystem, while Haskell is a functional programming language with its own established ecosystem and solid testing framework.

Marlowe can interact with real-world data – such as oracles – and the participants in the contract make choices within the contract flow to determine what happens both on- and off- chain, such as in a wallet. Marlowe is blockchain-agnostic: it enables the expression of smart contacts on top of an account-based model, such as Ethereum, and on the extended unspent transaction output (EUTXO) model of Cardano.

Marlowe has been designed as an industry-scale solution and embodies examples from the ACTUS taxonomy and standard for financial contracts. Contracts written in Marlowe can be integrated on Cardano or an alternative blockchain.

What does the Marlowe language look like?

Marlowe is a small language, with a handful of different constructs that, for each contract, describe behaviour involving a fixed, finite set of roles. These roles are fulfilled by the contract participants.

Contracts can be built by putting together a small number of these constructs that in combination can be used to describe and model many different kinds of financial contracts. Some examples include a running contract that can make a payment to a role or to a public key, a contract that can wait for an action by one of the roles -such as a deposit of currency-, or a choice from a set of options. Crucially, a contract cannot wait indefinitely for an action: if no action has been initiated by a set time (the timeout), the contract will continue with an alternative behavior, for example, take a remedial action like refunding any funds in the contract.

Depending on the current state of a contract, it may make a choice between two alternative future courses of action, which are themselves contracts. When no further actions are required, the contract will close, and any remaining currency in the contract will be refunded.

When a contract is run, the roles involved are fulfilled by participants, which are identities on the blockchain. Each role is represented by a token on the chain, and roles can be transferred, or traded, during contract execution.

How can I use the Marlowe Playground?

The Marlowe Playground is available to develop, simulate, and test the process of writing smart contracts in a sandbox environment. Its purpose is to encourage all types of developers, even if you don’t have prior Haskell or Javascript experience, to build financial products on Cardano. A set of tutorials is available. These outline example contracts and overview information on Marlowe and how contracts should be modelled.

The Marlowe Playground is the medium for end-to-end financial smart contract development. It provides a means for developers to not only write smart contract code, but to also perform preliminary iterative design using simulations, ability to formally verify, and ability to test smart contracts. These capabilities, paired with a purpose-built DSL for finance, ensures that the contracts are easy and straightforward to build, and that they are secure, verifiable, and rigorously tested.

What is next for Marlowe?

As a part of the Goguen rollout, we will be completing the implementation of Marlowe on Cardano, giving users and organizations the opportunity to execute DeFi contracts they have written themselves or downloaded from a contract repository, transferring crypto assets according to the contract terms. Marlowe will first run on the Cardano blockchain, but it is not tied to Cardano; it could run on other blockchains in the future.

Smart contracts running on Cardano will be able to access external data values, such as the exchange rate between ada and bitcoin, through oracles. In some ways, an oracle is just like a participant that makes a choice, and we plan to support oracle values as part of the implementation, allowing contracts to access values directly from a stock market ‘ticker’ or a popular data feed such as Coinbase.

Related Topics

© IOHK 2015 - 2021


Cardano Logo

Cardano is an open-source project.

Cardano is a software platform ONLY and does not conduct any independent diligence on, or substantive review of, any blockchain asset, digital currency, cryptocurrency or associated funds. You are fully and solely responsible for evaluating your investments, for determining whether you will exchange blockchain assets based on your own judgement, and for all your decisions as to whether to exchange blockchain assets with Cardano. In many cases, blockchain assets you exchange on the basis of your research may not increase in value, and may decrease in value. Similarly, blockchain assets you exchange on the basis of your research may fall or rise in value after your exchange.

Past performance is not indicative of future results. Any investment in blockchain assets involves the risk of loss of part or all of your investment. The value of the blockchain assets you exchange is subject to market and other investment risks