top of page

Understanding Marlowe: A Simplified Guide to Smart Contracts on Cardano

marlowe logo

Smart contracts, the backbone of decentralized applications, are powerful tools that automate processes once certain conditions are met. While most blockchains operate with smart contracts in a similar manner, Cardano takes a unique approach, executing them through transactions submitted externally to its node.

In this blog post, we'll explore the world of smart contracts on Cardano, focusing on a simplified guide to Marlowe—a suite of tools and languages designed for financial and transactional smart contracts.

The Basics of Smart Contract Auditing

Smart contract auditing is crucial to ensure the security and consistency of their execution. This process involves a thorough examination of the code and conditions before deployment, aiming to identify and address potential flaws or malicious code.

Auditing Methods:

Auditing can be done manually or through automated tools. A combination of both methods is often employed for a comprehensive review. Before initiating the audit, relevant project documentation, including technical documents and codebase, is gathered.

Advantages of Smart Contract Auditing:

Smart contract auditing offers proactive risk identification, error prevention, a better development environment, and insights into vulnerabilities. Given the immutable nature of blockchain, auditing becomes especially vital for smart contracts running on decentralized ledgers.

Smart Contract-Based Attacks and Cardano's Resilience

Re-entrancy Attacks:

These attacks involve making recursive withdrawal calls to a contract, draining its funds. Cardano's EUTXO model renders re-entrancy attacks impossible, ensuring atomic and non-calling smart contracts.

Front-running Invasions:

Cardano's design minimizes the risk of front-running invasions, where pending transactions are exploited for personal gain. Marlowe, operating on Cardano, stands resilient against such threats.

Oracle Manipulation and Other Vulnerabilities:

External dependencies, such as oracles, can pose security risks. Cardano's approach emphasizes robustness against various vulnerabilities like arithmetic errors, integer overflow, and smart contract visibility settings.


Tweag Audit and Marlowe's Response

Key Findings:

Tweag conducted a comprehensive audit of Marlowe, identifying high-severity issues. The Marlowe team responded diligently, addressing each concern to enhance security.

Handling of Negative Deposits:

A potential exploit related to negative deposits was resolved by adding a guard in Marlowe's semantics validator.

Prevention of Double Satisfaction:

Double satisfaction issues were mitigated by ensuring the exclusivity of the Marlowe validator during transactions.

Enforcement of State Invariants:

The Marlowe team enforced rigorous invariants for initial and final states, enhancing the validator's correctness.

Implementation Differences:

Differences between formal specifications and Plutus implementation were addressed through code analysis and property-based testing.

Proof of Money Preservation Theorem:

Refinements in Isabelle code addressed limitations in the money preservation theorem, ensuring accurate asset preservation.

Marlowe's Security-Enhancing Functional Limitations

Built-in Limitations:

Marlowe incorporates several limitations to eliminate security risks, ensuring contracts are finite, terminate, have a definite lifetime, and conserve value.

Programming Constructs:

Certain programming constructs like recursion, looping, and defining functions or macros are intentionally absent in Marlowe for enhanced safety.

Security Analysis Tools:

Marlowe introduces marlowe-cli run analyze, a tool verifying contract compatibility with Cardano ledger rules. This ensures contracts adhere to ledger restrictions and can run securely on-chain.


Transaction Validation in Marlowe

Semantics Validator and Payout Validator:

Transaction validation involves two Plutus validator scripts: semantics validator and payout validator. Verification ensures the proper functioning of Marlowe contracts and associated roles.

Security Considerations:

Transactions should only be signed after a thorough understanding of the Marlowe contract, its input, state, role minting policy, and validator scripts.

Monetary Policies and Role Tokens

Monetary Policies in Marlowe:

Monetary policies in Marlowe Runtime support a single minting event and single tokens for each role, ensuring non-fungible tokens and verifiable role ownership.

Role Tokens in Marlowe:

Role tokens authorize deposits and choices in Marlowe transactions, offering flexibility and transferability. Security considerations include scrutinizing monetary policies before participating in a Marlowe contract.

From auditing practices to vulnerability prevention and detailed insights into transaction validation, we've navigated the essential aspects of creating secure and reliable smart contracts on the Cardano blockchain. As blockchain technology evolves, Marlowe stands as a testament to Cardano's commitment to security and innovation in decentralized finance.

Please note that the information in this Marlowe Security article is provided as-is, from personal perspective and knowledge without any guarantees, only for general informational purposes. This document does not offer professional advice, including financial, investment, legal, or tax guidance. Clover Nodes is not liable for any actions taken or reliance placed on the information presented in this document.


  • cardanologo-alone
  • Telegram-white
  • Twitter
  • Youtube
Subscribe to Our Mailing List

Thanks for subscribing!

© 2023 Clover Nodes LLC. All Rights Reserved.

Connect With Us

  • Discord
  • telegram-icon-512x512-1s8w0tx0
  • X
  • Youtube
  • cardano logo
  • World Mobile Home
  • Discord
  • Telegram
  • X
  • Youtube
  • Cardano Home
  • World Mobile Home
bottom of page