Skip to main content

Cardano Contracts Library

Reference contracts from across Cardano, indexed by use case.

40 contracts, 4 collections

40 contracts

Basics

3 contracts

First contracts to read: lock and unlock, a transfer, a wallet.

  • Hello World

    Lock and unlock assets, a hands-on intro to validation and transaction building.

  • Simple transfer

    Deposit assets at a script and name a receiver who can later withdraw them.

  • Simple wallet

    An on-chain ADA wallet where the owner creates payment intents, executes them to pay recipients, and can withdraw the full balance.

Payments

7 contracts

Hold, split, schedule and release funds between parties.

  • Atomic transaction

    Spend from a script and mint a token in one transaction to show how Cardano transactions succeed or fail as a single unit.

  • Escrow

    Hold assets from two parties until both sign off, then complete or cancel the exchange.

  • HTLC

    Lock funds behind a secret and an expiry so anyone can claim them by guessing the secret before the deadline, after which the owner reclaims them.

  • Payment splitter

    Distribute locked funds equally among a fixed list of known payees.

  • Payment subscription

    Automated recurring payments between subscribers and merchants.

  • Token transfer

    Lock a specific native asset that only a designated receiver can withdraw by signing the spending transaction.

  • Vesting

    Lock funds for a period and let the beneficiary withdraw them once the lockup elapses.

Tokens & NFTs

8 contracts

Mint, sell and manage native tokens and NFTs.

  • Editable NFT

    Mint an NFT whose owner can update its data, transfer it, and permanently seal it against further edits.

  • Giftcard

    Lock assets into a card that anyone can redeem.

  • Marketplace

    Buy and sell native assets such as NFTs.

  • NFT minting machine

    Mint NFTs with an automatically incremented index.

  • Royalties

    Enforce creator royalty payments on NFT sales using the CIP-102 royalty datum standard.

  • Jpg Store

    dApp

    An NFT marketplace.

  • Nebula

    dApp

    An NFT marketplace contract with a chain indexer and event listener for individual projects.

  • Projected NFT Whirlpool

    dApp

    A protocol that lets NFTs from other ecosystems be used in games while keeping custody.

DeFi

11 contracts

Swaps, pools, auctions, bets and crowdfunding.

  • Auction

    Run an on-chain English auction where bids are locked in the contract, outbid bidders reclaim their funds, and the highest bid settles when the deadline passes.

  • Bet

    Let two players stake an equal amount and have a restricted oracle announce the winner, who then claims the whole pot.

  • Constant product AMM

    Run an automated market maker that prices swaps with the constant product formula and lets anyone provide liquidity.

  • Crowdfund

    Collect donations toward a funding goal where the beneficiary withdraws only if the goal is met by the deadline, and contributors otherwise reclaim their funds.

  • Lottery

    Run a fair two-player lottery using a commit-reveal-punish protocol that needs no external randomness or oracle.

  • Price bet

    Let two players bet on whether an oracle exchange rate reaches a target before a deadline, with the pot going to the winning side.

  • Swap

    Exchange assets between two parties.

  • Minswap Stableswap

    dApp

    A stableswap exchange for price-pegged assets.

  • Minswap V2

    dApp

    An automated market maker decentralized exchange.

  • SundaeSwap V3

    dApp

    An automated market maker decentralized exchange.

  • SundaeSwap Yield Farming v2

    dApp

    Yield farming reward-distribution contracts.

Identity

2 contracts

Tie an on-chain action to an identity or an existing login.

  • Decentralized identity

    Manage self-sovereign identities where an address controls ownership through signatures and can authorize time-limited delegates.

  • zkLogin

    Authenticate with an existing OpenID account and control funds through zero-knowledge proofs verified on-chain, without seed phrases.

Privacy

2 contracts

Private payments on a public ledger.

  • ENCOINS

    dApp

    An NFT-based private transactions protocol.

  • Seedelf

    dApp

    A stealth wallet that hides the recipient of a payment.

Data

3 contracts

Commit data on-chain and prove who owns it or that it is unchanged.

  • Anonymous data

    Commit data on-chain under an identifier derived from a wallet and a secret nonce, then prove ownership later by revealing the nonce.

  • Content ownership

    A registry where users create and own content.

  • Storage

    Anchor SHA-256 commitments of off-chain data on-chain so anyone can re-hash the data and verify its integrity and existence.

Access & upgrades

4 contracts

Control who can spend, and create or replace contracts.

  • Factory

    Deterministically create and track many product contracts from a single factory instance using a marker NFT and on-chain registry.

  • Upgradable multisig

    Collective fund management requiring multiple approvals.

  • Upgradable proxy

    Point a stable proxy address at a logic script hash stored in its datum, so the logic version can be swapped by updating the datum.

  • Vault

    Protect funds with time-delayed withdrawals and a separate recovery key that can cancel a pending withdrawal during the wait period.

Sources

Where the contracts on this page come from. Every link goes to the contract's own repository, and the portal hosts none of the code.

Know a contract or a collection that belongs here?

Add a contract, or propose a collection for the page to index.