Marlowe will allow anyone to write a smart contract for Cardano

Published 31.5.2023

Marlowe is one of the hidden gems of the Cardano platform. The team has been working on this project for a relatively long time. About a year ago, a pioneer program was held for the first interested parties who provided valuable feedback. Marlowe has been externally audited by Tweag and now it is making its way to the mainnet for early adopters. Marlowe expands the possibilities of how to write a smart contract for Cardano. This addition to the family is especially welcome, as it opens up the possibility of writing smart contracts to literally anyone who does not have extensive programming experience.

TLDR

Every finance professional is now able to create a smart contract instead of a paper contract. A visual tool will help him to put together the steps of the contract like a puzzle. A rich gallery of templates allows you to use Marlowe too.

What is Marlowe

Marlowe is a domain-specific language aimed at writing financial contracts. Anyone who understands the processes involved in common financial operations should be able to use Marlowe and define a similar process through a smart contract. What is preserved are the individual steps in a given financial operation. The form is what changes. Instead of a paper contract that the participants sign, a smart contract is deployed on the blockchain. Instead of a physical signature, participants will digitally sign blockchain transactions.

Marlowe is a set of all the tools needed to write a contract, validate it and deploy it on the Cardano blockchain. The goal is to isolate the user from the technical details. It is expected that the community will continue to develop more simplifying tools.

Marlowe allows you to write a smart contract through a visual tool (Blockly) in which users select components of the contract and add information to it. There are blocks such as OBSERVATIONS, ACTIONS, VALUES, TOKEN, etc. Programmers will immediately recognize that these blocks represent conditions, functions, and variables. However, Marlowe users do not need to know programming lingo. They just pick individual blocks and put them together like a puzzle. The individual blocks only fit together if they belong together, just like individual puzzle pieces. It is then necessary to complete the data in the blocks.

A paper contract contains names, home addresses, IDs, roles of the parties, date, and a textual description of the contract. Marlowe allows the use of blocks that are essentially the equivalent of a paper contract. The result of a smart contract is essentially just a conditional transfer of assets from one address to another. This is essentially the same as what is expected in the case of a paper contract. If someone understands a given domain, like finance, they are able to quickly understand Marlowe and piece together the blocks in Blockly.

A smart contract for exchanging 2 tokens between two users apparently requires both participants to submit a transaction and send the token to a specific address. To do this, it is just needed to select two DEPOSIT blocks and describe the participants, tokens, and number of units. If both participants send tokens to the specified address, two PAY blocks are used to perform the swap.

Users can use templates from the gallery where they can find examples of contracts for common financial operations, such as token swaps, token sales with royalties, airdrops, NFT shared ownership, token sales with Oracle, NFT auctions, loans, and so on.

The image below is an example of part of a smart contract for swapping two tokens between two users.

Users can build a customized smart contract through Blockly and then send it to the simulator to try all possible development alternatives. For example, the development of events after one participant fails to send a deposit on time.

Marlowe displays warnings for flawed business logic. It offers users the power and security of Plutus along with additional security features unique to Marlowe.

If the contract is ready, it can be easily deployed on the Cardano mainnet.

What is the power of Marlowe?

Marlowe's options are deliberately limited through the existing blocks that users use to build a contract. If users needed to create something more complex, they would have to use other tools. Marlowe is sufficient for common financial operations. There is an advantage in simplicity, as it prevents users from making stupid programming mistakes.

Developers can start writing a smart contract right in the browser and don't have to install anything on their computer. It is possible to install your own Docker containers locally for the Marlowe Runtime.

The advantage is that all operations are peer-to-peer and users do not need a third party. As long as both parties agree to the steps defined in the contract, they do not need a third party even for potential disputes. For example, for a swap of two tokens, there can be no dispute as if both participants send a deposit, the swap will automatically occur under clearly stated terms.

It is very easy for banks and financial institutions to adopt Marlowe and integrate it into their processes due to its simplicity, easy verifiability of the correct functioning of the contracts, and yet sufficient capabilities for common financial operations. They can create custom templates and tools for employees and mobile apps for customers. The more often they use a given template, the more confident they will be that it works as it should.

This is a great opportunity, especially for FinTech companies that are not afraid of innovation and blockchain. However, people can start writing their own contracts without the help of a third party. If someone, for whatever reason, doesn't trust DEXs and wants to exchange larger amounts of money with someone (like ADA for stablecoin) in a peer-to-peer fashion, they can use Marlowe. If the lending platform charges high fees, you can also consider using a custom contract that will work without a third party directly between the lender and the borrower.

Conclusion

Writing your own smart contract has never been easier than with Marlowe. An online editor is all you need to write, validate and deploy a smart contract. A rich gallery of templates and documentation is available. Users should definitely read the documentation and don't underestimate testing the contract before running it on the Cardano mainnet.

Featured:

Related articles

Did you enjoy this article? Other great articles by the same author