Smart Contracts
Production-ready smart contracts for Cardano with complete documentation, TypeScript SDK, and live demos
Mesh provides a suite of open-source, audited smart contracts that you can deploy to Cardano mainnet or testnet. Each contract includes TypeScript bindings, comprehensive documentation, and working examples.
Available Contracts
Content Ownership
Manage ownership of digital content and assets
Escrow
Secure exchange of assets between two parties
Giftcard
Create a giftcard with native tokens
Hello World
Simple lock and unlock assets contract
Marketplace
Build a NFT marketplace to buy and sell NFTs
NFT Minting Machine
Mint NFT that ensure the token name is incremented by a counter
Payment Splitter
Split payouts equally among a list of specified payees
Swap
Swap contract facilitates the exchange of assets between two parties
Vesting
Locks up funds and allows the beneficiary to withdraw the funds after the lockup period
Quick Start
Install the contracts package to get started:
npm install @meshsdk/contract @meshsdk/coreEvery contract follows the same initialization pattern:
import { BlockfrostProvider, MeshTxBuilder } from "@meshsdk/core";
// 1. Set up your provider
const provider = new BlockfrostProvider("<Your-API-Key>");
// 2. Create a transaction builder
const meshTxBuilder = new MeshTxBuilder({
fetcher: provider,
submitter: provider,
});
// 3. Initialize any contract with the same config
const contract = new MeshContractName({
mesh: meshTxBuilder,
fetcher: provider,
wallet: wallet, // Your connected wallet
networkId: 0, // 0 for testnet, 1 for mainnet
});Contract Categories
| Category | Contracts | Use Cases |
|---|---|---|
| Asset Management | Hello World, Vesting, Giftcard | Lock and unlock assets with conditions |
| Trading | Marketplace, Swap, Escrow | Buy, sell, and exchange assets |
| Payments | Payment Splitter | Split payments among multiple recipients |
| NFTs | Plutus NFT, Content Ownership | Mint NFTs with on-chain logic |
Network Support
All contracts work on:
- Preprod Testnet (networkId: 0) - For development and testing
- Mainnet (networkId: 1) - For production deployments
Source Code
All on-chain (Aiken) and off-chain (TypeScript) code is open-source and available on GitHub.