Get Test ADA and Set Up Preprod or Preview
Get free test ada from the Cardano faucet, pick preprod or preview, and configure Mesh providers, keys and network ids for a Cardano testnet.
To get test ada, open the official Cardano testnet faucet, choose preprod or preview, and paste a testnet address (addr_test1...) from your wallet. Then point Mesh at the same network: network: "preprod" (or "preview") in TxBuilder, a provider key for that network, and network id 0 in your wallet.
Which testnet should I use: preprod or preview?
Cardano has two public test networks. Both use test ada with no real-world value and testnet addresses that start with addr_test1.
| Preprod | Preview | |
|---|---|---|
| Purpose | The most mature test network, resembling mainnet; for testing a dApp before deploying to mainnet | Testing release candidates of upcoming node and protocol releases |
Mesh network name | "preprod" | "preview" |
| Network id (addresses, wallets) | 0 | 0 |
| Network magic | 1 | 2 |
The descriptions follow the Cardano testnet environments page. Mainnet uses network id 1 and magic 764824073; the magic values come from networkConfig in @meshsdk/common. Most Mesh examples use preprod; if unsure, start there.
How do I get test ada from the faucet?
- Switch your wallet to the testnet you chose, in the wallet's network settings, and copy a receiving address that starts with
addr_test1. Check your wallet's documentation for which testnets it supports. - Open the Cardano testnet faucet.
- Select the network and the action to receive test ada, paste your address, and submit. If you have been issued a faucet API key, enter it as well.
- Wait for the transaction to confirm, then check the balance in your wallet.
When you have finished testing, the faucet asks you to return unused test ada to it.
For a server-side wallet, get its address from your code and paste that address into the faucet. See Headless wallet for creating a wallet from a mnemonic, and Mint an NFT collection for a full example that generates a wallet and funds it from the faucet.
How do I configure Mesh for a testnet?
Use the same network everywhere: in the builder, the provider and the wallet. A mismatch makes TxBuilder throw NETWORK_MISMATCH (see Providers and networks).
import { BlockfrostProvider, TxBuilder } from "@meshsdk/core";
// A Blockfrost project ID for preprod starts with "preprod"
const provider = new BlockfrostProvider("<YOUR_PREPROD_PROJECT_ID>");
const builder = new TxBuilder({ network: "preprod", provider });Create your wallet with network id 0 and the same provider. Wallet setup is covered in Wallets: browser wallets follow the network the user selected in the extension, and headless wallets take a networkId.
How do I get a provider key for each network?
Each hosted provider issues keys or endpoints per network. Use a testnet key with a testnet builder.
| Provider | How the network is chosen | Example |
|---|---|---|
| Blockfrost | By the project ID: create a separate project per network in the Blockfrost dashboard. The ID starts with preprod, preview or mainnet, and Mesh reads the network from that prefix | new BlockfrostProvider("<YOUR_PREPROD_PROJECT_ID>") |
| Koios | By the first argument: "preprod", "preview" or "api" (mainnet). The API key is optional | new KoiosProvider("preprod", "<YOUR_API_KEY>") |
| Maestro | By the network option: "Preprod", "Preview" or "Mainnet", with a key for that network | new MaestroProvider({ network: "Preprod", apiKey: "<YOUR_API_KEY>" }) |
| UTxO RPC | By the endpoint URL of the server you connect to | See the provider page |
Keep keys out of source control: read them from environment variables, as in Mint an NFT collection.
Can I test without a public testnet?
Yes. Yaci DevKit runs a local Cardano devnet in Docker that you can create, fund and reset in seconds, with no faucet and no rate limits. Mesh also hosts a Yaci devnet you can reach with new YaciProvider(). See Getting started with Yaci and Yaci transactions; on a devnet, give TxBuilder a customNetwork(...) instead of "preprod".
For unit tests with no network at all, use TxEmulator from @meshsdk/tx-emulator (Testing) or the Offline fetcher.
Troubleshooting
The faucet transaction never arrives
Check that your wallet is on the same network you selected in the faucet, and that you pasted an addr_test1 address.
NETWORK_MISMATCH when building
The builder's network, the provider and the wallet disagree. A preprod Blockfrost key with network: "preview" is a common cause.
403 or "Project not found" from Blockfrost
The project ID belongs to another network. Create a project for the network you use.
Related
Build Your First Cardano dApp with Next.js
Build a Cardano dApp with Next.js and Mesh: set up MeshProvider in the App Router, connect a CIP-30 wallet and display its assets.
Mint NFTs on Cardano with Node.js
Build a server-side NFT minting application using Mesh SDK. Mint tokens and distribute them to multiple recipients.