A minimal Express server that uses the Mesh SDK to work with a Cardano wallet on the backend. Use it as a starting point for APIs that derive addresses, build transactions or sign server-side.
src/index.ts starts an Express server on port 3000. When you request GET /, it creates a headless MeshWallet from a mnemonic and responds with the wallet's change address on the testnet (networkId: 0).
const wallet = new MeshWallet({
networkId: 0,
key: { type: "mnemonic", words: [/* 24 words */] },
});
const address = await wallet.getChangeAddress();No blockchain provider is needed, because deriving an address happens locally.
npm install
npm run devOpen http://localhost:3000.
| Script | What it does |
|---|---|
npm run dev |
Start the server with ts-node |
npm run clean |
Remove dist, node_modules and package-lock.json |
- Replace the test mnemonic with your own. The
solution× 24 mnemonic is public; never use it on mainnet. - Add a provider such as
BlockfrostProviderto fetch UTxOs and submit transactions. See MeshWallet. - Build transactions with MeshTxBuilder.
Express 4, TypeScript, ts-node, @meshsdk/core.