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 it is a special-purpose language, it is easier to read, write and understand Marlowe contracts. It is also safer: some sorts of 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 so that it can 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 as well as in more traditional code. Financial institutions can use it to develop and deploy custom instruments for their customers and clients, for example.
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 on the chain and off the 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, as well as 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 participants in the contract.
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 given time (the timeout), then 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 it involves 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 during contract execution, meaning that they can essentially be traded.
How can I use the Marlowe Playground?¶
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, 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 run first of all on the Cardano blockchain, but it is not tied to Cardano, and 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.