@meshsdk/core 2.0.0

Mesh 2.0

Describe the transaction. Mesh builds it.

Mesh is the open-source TypeScript SDK for building apps on Cardano. Version 2.0 makes TxBuilder the standard way to build transactions: you list what should happen, and Mesh picks the coins, sets the fee and change, adds collateral and checks your scripts before anyone signs.

Install
npm install @meshsdk/core@2

Why it’s a big deal, in plain English

Mesh is a toolkit that app builders use to move money and digital assets on the Cardano blockchain. Version 2.0 changes how those transfers are put together. Here is what that means, without the jargon.

Name the destination, not every turn

Before, a developer gave Mesh turn-by-turn directions for every transfer. Now they say where to go ("send 5 ada to this person", "create this token") and Mesh works out the route: which coins to use, the fee and the change. Ada is Cardano's currency.

A clear warning before anything is sent

Instead of a "something went wrong" light, Mesh says exactly what is wrong, such as "you need 2.3 more ada", and whether pressing the button again is safe. It says so before anything is sent.

A checklist that survives a power cut

Some jobs take several transfers in a row. Mesh writes each step down as it goes, so if the server crashes the job picks up where it stopped, and trying again never pays twice.

A flight simulator for money

Developers can rehearse everything on a practice blockchain on their own computer: fast-forward time, crash safely, and only then go live with real funds.

What’s new for developers

One builder for payments, minting, scripts, staking and governance, with the same parts for one-off builds, multi-step plans, offline builds and the emulator.

TxBuilder: build from typed parts

Pass parts such as output(), mint.native() and spend.plutus() with a payer to build(). Mesh resolves inputs, selects coins, sets the fee and change, adds collateral and evaluates Plutus scripts locally by default (Scalus, pure JavaScript). Amounts are bigint, so 5 where 5n belongs is a compile error.

In plain words: You write down what you want; Mesh fills in the forms correctly.

TxBuilder basics

Typed errors you can act on

Every failure is a TxError with one of 59 codes, such as INSUFFICIENT_FUNDS or EVALUATION_FAILED. TxError.is(err, "CODE") narrows details to that code, and retryable says when repeating the call is safe.

In plain words: Not a warning light, but a dashboard that says "low on fuel: you need 2.3 more ada".

Error reference

Plans that resume and never double-pay

plan() builds several linked transactions once and never rebuilds them, so retries always send the same bytes. With a store, resume(id) continues a plan from any process after a restart, and replan() handles expired or rolled-back steps.

In plain words: Like recorded delivery: if the van breaks down, the parcel is not sent twice.

Plans need a provider that returns block heights. With BlockfrostProvider, use the BlockfrostWithHeights subclass from the docs for now. Blockfrost for plans

Transaction plans

A local Cardano ledger for tests

The new @meshsdk/tx-emulator is a provider, submitter and evaluator in one, with a controllable clock, fork(), simulate() and governance state. Test full flows, time locks and plans with no testnet, no faucet and no waiting.

In plain words: Practise every manoeuvre, fast-forward time and crash safely before you fly for real.

Testing with the emulator

Conway governance as first-class parts

certificate.*, vote() and proposal.* cover DRep and committee certificates, delegations, votes and every proposal type. For parameter-change and treasury-withdrawal proposals, the builder looks up the constitutional guardrail script for you.

In plain words: Voting on how Cardano is run becomes as easy to build as sending a payment.

Governance

Offline and multi-party signing

Build without network reads, import a transaction with fromCbor(), list exactly whose signatures are needed with requiredSigners() and merge witnesses. submit() refuses an under-signed transaction with MISSING_SIGNATURES.

In plain words: A cheque that needs three signatures: Mesh says whose are missing and will not cash it until all are there.

Offline signing

Before and after

The same jobs in Mesh 1.x with MeshTxBuilder and in Mesh 2.0 with TxBuilder. Every snippet type-checks against the released packages.

Shared setup for both versions(words, recipient, script and assetUtxo come from your app)
setup.ts
import { BlockfrostProvider, MeshWallet } from "@meshsdk/core";

const provider = new BlockfrostProvider("<YOUR_API_KEY>");
const wallet = new MeshWallet({
  networkId: 0,
  fetcher: provider,
  submitter: provider,
  key: { type: "mnemonic", words },
});
await wallet.init();

No input list, change address or call order to get right. The payer signs, and you can wait for the block.

Before: Mesh 1.x, MeshTxBuilder
import { MeshTxBuilder } from "@meshsdk/core";

const utxos = await wallet.getUtxos();
const changeAddress = await wallet.getChangeAddress();
const txBuilder = new MeshTxBuilder({ fetcher: provider });

const unsignedTx = await txBuilder
  .txOut(recipient, [{ unit: "lovelace", quantity: "5000000" }])
  .changeAddress(changeAddress)
  .selectUtxosFrom(utxos)
  .complete();
const signedTx = await wallet.signTx(unsignedTx);
const txHash = await wallet.submitTx(signedTx);
After: Mesh 2.0, TxBuilder
import { output, TxBuilder } from "@meshsdk/core";

const builder = new TxBuilder({ network: "preprod", provider });

const built = await builder.build(
  output({ address: recipient, value: { lovelace: 5_000_000n } }), // 5 ada
  { payer: wallet },
);
await built.sign(); // the payer signs
await built.submit(); // sent through the provider
await built.awaitInclusion(); // found in a block
console.log(built.txHash);

Minting and CIP-25 metadata are two parts in a list; inputs, change and fee are worked out for you.

Before: Mesh 1.x, MeshTxBuilder
import { ForgeScript, MeshTxBuilder, resolveScriptHash, stringToHex } from "@meshsdk/core";

const utxos = await wallet.getUtxos();
const changeAddress = await wallet.getChangeAddress();
const txBuilder = new MeshTxBuilder({ fetcher: provider });

const forgingScript = ForgeScript.withOneSignature(changeAddress);
const policyId = resolveScriptHash(forgingScript);
const tokenNameHex = stringToHex("MeshToken");
const nft = { [policyId]: { MeshToken: { name: "Mesh Token", image: "ipfs://..." } } };

const unsignedTx = await txBuilder
  .mint("1", policyId, tokenNameHex)
  .mintingScript(forgingScript)
  .metadataValue(721, nft)
  .changeAddress(changeAddress)
  .selectUtxosFrom(utxos)
  .complete();
const signedTx = await wallet.signTx(unsignedTx);
const txHash = await wallet.submitTx(signedTx);
After: Mesh 2.0, TxBuilder
import { ForgeScript, metadata, mint, resolveScriptHash, stringToHex, TxBuilder } from "@meshsdk/core";

const builder = new TxBuilder({ network: "preprod", provider });
const changeAddress = await wallet.getChangeAddress();

const forgingScript = ForgeScript.withOneSignature(changeAddress);
const policyId = resolveScriptHash(forgingScript);
const tokenNameHex = stringToHex("MeshToken");
const nft = { [policyId]: { MeshToken: { name: "Mesh Token", image: "ipfs://..." } } };

const built = await builder.build(
  [
    mint.native({ script: forgingScript, assets: { [tokenNameHex]: 1n } }),
    metadata({ metadataLabel: 721n, value: nft }),
  ],
  { payer: wallet },
);
await built.sign();
await built.submit();

Collateral, execution units and the datum are handled, and the script runs locally before signing.

Before: Mesh 1.x, MeshTxBuilder
import { mConStr0, MeshTxBuilder } from "@meshsdk/core";

const utxos = await wallet.getUtxos();
const changeAddress = await wallet.getChangeAddress();
const collateral = (await wallet.getCollateral())[0]!;
const txBuilder = new MeshTxBuilder({ fetcher: provider, evaluator: provider });

const unsignedTx = await txBuilder
  .spendingPlutusScript(script.version)
  .txIn(assetUtxo.input.txHash, assetUtxo.input.outputIndex, assetUtxo.output.amount, assetUtxo.output.address)
  .txInInlineDatumPresent()
  .txInRedeemerValue(mConStr0([]))
  .txInScript(script.code)
  .txInCollateral(collateral.input.txHash, collateral.input.outputIndex, collateral.output.amount, collateral.output.address)
  .changeAddress(changeAddress)
  .selectUtxosFrom(utxos)
  .complete();
const signedTx = await wallet.signTx(unsignedTx);
const txHash = await wallet.submitTx(signedTx);
After: Mesh 2.0, TxBuilder
import { mConStr0, spend, TxBuilder } from "@meshsdk/core";

const builder = new TxBuilder({ network: "preprod", provider });

const built = await builder.build(
  spend.plutus({
    utxo: assetUtxo,
    script, // { code, version }
    redeemer: { data: mConStr0([]) },
    label: "unlock", // named in any error
  }),
  { payer: wallet },
);
await built.sign();
await built.submit();

Branch on typed codes instead of message text; a mistyped code is a compile error.

Before: Mesh 1.x, MeshTxBuilder
try {
  const unsignedTx = await txBuilder
    .txOut(recipient, [{ unit: "lovelace", quantity: "5000000" }])
    .changeAddress(await wallet.getChangeAddress())
    .selectUtxosFrom(await wallet.getUtxos())
    .complete();
  await wallet.submitTx(await wallet.signTx(unsignedTx));
} catch (error) {
  // untyped errors, matched on message text
  if (error instanceof Error && error.message.startsWith("Evaluate redeemers failed")) {
    console.log(error.message);
  } else throw error;
}
After: Mesh 2.0, TxBuilder
import { output, TxBuilder, TxError } from "@meshsdk/core";

const builder = new TxBuilder({ network: "preprod", provider });

try {
  const built = await builder.build(
    output({ address: recipient, value: { lovelace: 5_000_000n } }),
    { payer: wallet },
  );
  await built.sign();
  await built.submit();
} catch (error) {
  if (TxError.is(error, "INSUFFICIENT_FUNDS")) {
    console.log(error.details.unit, error.details.missing); // typed by the code
  } else if (TxError.is(error, "EVALUATION_FAILED")) {
    console.log(error.label, error.details.failures); // which script part failed
  } else if (TxError.is(error) && error.retryable) {
    // SUBMIT_FAILED / CONFIRM_TIMEOUT: repeat the same call, never rebuild
  } else throw error;
}

By the numbers

commits between the 1.9.0 and 2.0.0 releases
498
test files
101 → 274
typed error codes
59
npm downloads of @meshsdk/core, Nov 3 to Dec 2, 2026
35,175

Measured from the MeshJS/mesh repository at tags 1.9.0 and v2.0.0, and from the npm registry on December 3, 2026.

Upgrading from 1.x

Your existing MeshTxBuilder code keeps compiling and running. In 2.0 it is deprecated and builds through the new TxBuilder engine, so you can move one transaction flow at a time. Review the migration notes first, because some behaviour changed.

The engine was replaced, but the steering wheel and pedals are where you left them.

Read the migration guide

What changed

  • @meshsdk/core-csl (the CSL/WASM serializer path) is removed. CardanoSDKSerializer from @meshsdk/core-cst is the only serializer.
  • MeshTxBuilder output can differ: serialized CBOR may change, and builds that used to produce ledger-invalid transactions now throw typed errors such as OUTPUT_BELOW_MIN_COIN, FEE_TOO_LOW and NETWORK_MISMATCH. Match on code, not message text.
  • Custom serializers and selectors are rejected with INVALID_OPTION; move custom selection to the coinSelection option. txEvaluationMultiplier now does nothing, and members such as selectUtxos and evaluateRedeemers are removed.
  • registerStakeCertificate and deregisterStakeCertificate now emit Conway certificates that carry a deposit and need the stake credential's witness. certificate.legacyStakeRegistration and legacyStakeDeregistration still give the old ones.
  • @meshsdk/contract contracts take builder: TxBuilder (the mesh option is a deprecated fallback), and ScalusEmulator is created with await ScalusEmulator.create(utxos, cardanoInfo).

Transaction plans with a plain BlockfrostProvider throw CANNOT_OBSERVE before anything is signed, because the provider version that @meshsdk/core 2.0.0 pins does not return block heights yet. The docs ship a short BlockfrostWithHeights subclass that fixes it; build() is unaffected. Use Blockfrost for plans

Migration notes by topic