Mesh LogoMesh

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.

PreprodPreview
PurposeThe most mature test network, resembling mainnet; for testing a dApp before deploying to mainnetTesting release candidates of upcoming node and protocol releases
Mesh network name"preprod""preview"
Network id (addresses, wallets)00
Network magic12

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?

  1. 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.
  2. Open the Cardano testnet faucet.
  3. 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.
  4. 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.

ProviderHow the network is chosenExample
BlockfrostBy 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 prefixnew BlockfrostProvider("<YOUR_PREPROD_PROJECT_ID>")
KoiosBy the first argument: "preprod", "preview" or "api" (mainnet). The API key is optionalnew KoiosProvider("preprod", "<YOUR_API_KEY>")
MaestroBy the network option: "Preprod", "Preview" or "Mainnet", with a key for that networknew MaestroProvider({ network: "Preprod", apiKey: "<YOUR_API_KEY>" })
UTxO RPCBy the endpoint URL of the server you connect toSee 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.

On this page