Mesh: the TypeScript SDK for Cardano
Build Cardano dApps in TypeScript: transactions, wallets, smart contracts and blockchain data in one open-source SDK.
Website & live demos · API docs · Guides · Examples · Discord
Mesh is an open-source TypeScript and JavaScript SDK for building applications on the Cardano blockchain. It handles the hard parts of Cardano development, such as coin selection, fee calculation, CBOR serialization and script evaluation, so you can focus on your app.
With Mesh you can:
- Build transactions with
MeshTxBuilder: send ADA and native tokens, mint and burn NFTs, stake, vote in governance, and spend from Plutus and Aiken scripts. - Connect wallets in the browser through CIP-30 (such as Eternl) with
BrowserWallet, or sign server-side from a mnemonic or private key withMeshWallet. - Use ready-made smart contracts for escrow, marketplaces, vesting, swaps and more, each with on-chain code and off-chain TypeScript.
- Query and submit through Blockfrost, Koios, Maestro, Ogmios, Yaci and other blockchain providers.
- Test offline against a local ledger with the Scalus emulator.
Mesh runs in Node.js, the browser, Next.js and other modern frameworks.
Create a new Cardano dApp from a template with the Mesh CLI:
npx meshjs your-app-nameOr add Mesh to an existing project:
npm install @meshsdk/coreimport { BlockfrostProvider, BrowserWallet, MeshTxBuilder } from "@meshsdk/core";
const provider = new BlockfrostProvider("<BLOCKFROST_PROJECT_ID>");
const wallet = await BrowserWallet.enable("eternl");
const txBuilder = new MeshTxBuilder({ fetcher: provider, submitter: provider });
const unsignedTx = await txBuilder
.txOut("addr_test1...", [{ unit: "lovelace", quantity: "5000000" }])
.changeAddress(await wallet.getChangeAddress())
.selectUtxosFrom(await wallet.getUtxos())
.complete();
const signedTx = await wallet.signTx(unsignedTx);
const txHash = await provider.submitTx(signedTx);Try this and many more transactions interactively in the Mesh playground.
This monorepo publishes the core Mesh packages to npm under the @meshsdk scope. Most apps only need @meshsdk/core, which re-exports transactions, wallets, providers and common utilities.
| Package | Description | Docs |
|---|---|---|
| @meshsdk/core | The main entry point. Re-exports transactions, wallets, providers and common utilities. | Playground |
| @meshsdk/transaction | MeshTxBuilder for sending assets, minting tokens and interacting with smart contracts |
Docs · Playground |
| @meshsdk/contract | Open-source smart contracts with off-chain transaction code | Docs · Playground |
| @meshsdk/common | Shared constants, types and interfaces used across the SDK | Docs |
| @meshsdk/core-cst | Serialization and utilities built on cardano-js-sdk and Harmonic Labs libraries | Docs |
| @meshsdk/core-csl | Serialization and utilities built on Whisky (cardano-serialization-lib) | Docs |
| @meshsdk/scalus-emulator | Local Cardano ledger emulator built on Scalus, for testing transactions offline |
These @meshsdk packages are developed in their own repositories:
| Package | Description | Repository |
|---|---|---|
| @meshsdk/wallet | Browser (CIP-30) and headless wallets for managing keys, signing and submitting | MeshJS/wallet |
| @meshsdk/provider | Blockchain data providers (Blockfrost, Koios, Maestro, Ogmios and more) | MeshJS/providers |
| @meshsdk/react | React components and hooks for Cardano wallet connection | MeshJS/react |
| @meshsdk/hydra | Hydra Head protocol client for layer-2 scaling | MeshJS/hydra |
| @meshsdk/midnight-setup | Development setup for Midnight Network dApps | MeshJS/midnight-setup |
| @meshsdk/midnight-contracts-wizard | CLI wizard for new Midnight contract projects | MeshJS/midnight-contracts-wizard |
graph TD
core["@meshsdk/core"]
common["@meshsdk/common"]
core_csl["@meshsdk/core-csl"]
core_cst["@meshsdk/core-cst"]
provider["@meshsdk/provider"]
transaction["@meshsdk/transaction"]
wallet["@meshsdk/wallet"]
contract["@meshsdk/contract"]
emulator["@meshsdk/scalus-emulator"]
whisky["@sidan-lab/whisky-js"]
cardano_sdk["@cardano-sdk/*"]
harmoniclabs["@harmoniclabs/*"]
contract --> core
core --> provider
core --> transaction
core --> wallet
core --> core_cst
wallet --> transaction
transaction --> core_cst
emulator --> core_cst
subgraph serializers
core_csl --> whisky
core_cst --> cardano_sdk
core_cst --> harmoniclabs
end
core_cst --> common
core_csl --> common
click core_csl "https://docs.meshjs.dev/core-csl" _parent
click core_cst "https://docs.meshjs.dev/core-cst" _parent
click provider "https://github.com/MeshJS/providers" _parent
click transaction "https://docs.meshjs.dev/transactions" _parent
click wallet "https://github.com/MeshJS/wallet" _parent
click contract "https://docs.meshjs.dev/contracts" _parent
@meshsdk/contract includes open-source Cardano smart contracts, each with on-chain Aiken code, off-chain TypeScript, documentation and a live demo.
| Contract | What it does | Links |
|---|---|---|
| Content Ownership | A registry where users create content that is recorded on-chain | Demo · Source · Docs |
| Escrow | Holds assets between two parties until both agree to complete the exchange | Demo · Source · Docs |
| Giftcard | Locks assets behind a newly minted gift card token; redeeming burns the token and releases the assets | Demo · Source · Docs |
| Hello World | A simple lock-and-unlock contract to learn end-to-end validation and transaction building | Demo · Source · Docs |
| Marketplace | An NFT marketplace where anyone can list, buy and sell native assets | Demo · Source · Docs |
| NFT Minting Machine | Mints NFTs with an index that increments by one for each new token | Demo · Source · Docs |
| Payment Splitter | Splits incoming payments among a group of addresses | Demo · Source · Docs |
| Swap | Exchanges assets between two parties | Demo · Source · Docs |
| Vesting | Locks tokens until a set time, after which the beneficiary can withdraw them | Demo · Source · Docs |
| Asteria (work in progress) | A bot challenge where ships race across a 2D grid to showcase the eUTxO model | Source |
| Royalties (work in progress) | CIP-102 royalties for NFTs | Source · Docs |
Mesh is a Turborepo monorepo using npm workspaces. You need Node.js 18 or later.
git clone https://github.com/MeshJS/mesh.git
cd mesh
npm install
npm run build| Command | What it does |
|---|---|
npm run build |
Build all packages |
npm run dev |
Build packages in watch mode |
npm test |
Run the test suites |
npm run lint |
Lint all packages |
npm run format |
Check formatting with Prettier (format:fix to apply) |
Contributions of all kinds are welcome: bug fixes, new features, documentation, tests, and help triaging issues and pull requests.
- Read the contributing guide and Code of Conduct.
- See the developer docs for coding and pull request guidelines.
- Report bugs and request features in GitHub issues, or ask questions on Discord.
Using an AI coding assistant? MeshJS/skills gives Claude Code, Cursor, Codex and other tools deep knowledge of the Mesh SDK.
Mesh is released under the Apache 2.0 License.