Use this page to move a working service from your laptop to a public network. Build on LocalNet, check it against real transactions on TestNet, then follow Go to MainNet. The SDKs work the same on all of them; mostly the network name and the endpoints change.

Networks at a glance

MainNet and TestNet default to the public AlgoNode endpoints, which need no API key. USDC has 6 decimals: 1000000 base units is 1 USDC. In Python, MAINNET and TESTNET are the CAIP-2 id strings; in JavaScript they are presets that also carry genesisHash, genesisId, algodUrl, indexerUrl and usdc.

Network ids

Wherever an API takes a network, you can pass a short name or a CAIP-2 id. Ids follow the Algorand CAIP-2 profile: algorand: plus the first 32 characters of the genesis hash in URL-safe base64 (+ becomes -, / becomes _, no padding). The official x402 SDK validates ids against ^[-a-z0-9]{3,8}:[-_a-zA-Z0-9]{1,32}$, which is why the reference is 32 characters long. Older releases used the full 44-character genesis hash (algorand:wGHE2Pwdvd7S12BL5FaOP20EGYesN73ktiC1qzkkit8=). These legacy ids are still accepted as input everywhere and converted to the short form; do not write them in new code. These names work in ai-economy-sdk and x402-avm-js. The lower-level x402-algorand functions, such as normalize_network, take CAIP-2 ids and the x402 v1 names (algorand-mainnet, algorand-testnet, algorand), not "mainnet" or "localnet". In JavaScript, resolveNetwork("localnet") throws, because a LocalNet id must be read from a node.
localnet/networks.py prints this table for all three networks; its LocalNet row differs on your machine. A payment is bound to its network by the genesis hash in every transaction, and both client and facilitator check it (details).

LocalNet

LocalNet is a private Algorand network that runs in Docker on your machine, from AlgoKit. Transactions confirm in seconds, accounts are funded from a built-in dispenser, and nothing costs money. Every example that settles payments runs on it.
LocalNet’s genesis hash is created with the network, so its id differs on every machine and changes after a reset. Never hard-code it. PaymentGate, AIEconomySDK and paid_mcp_session read it from the signer’s (or session’s) algod when given network="localnet", and register the network. In JavaScript, algodClient('localnet') connects to the defaults in LOCALNET_ENDPOINTS (x402-avm-js before 0.4.1 connected to port 80; upgrade), and payForRequirement reads the network from the algod you pass.
After algokit localnet reset, restart your servers and clients. A running server keeps the old network id and rejects payments signed for the new chain with invalid_exact_avm_payload_genesis_hash_mismatch. Old accounts and assets are gone; the examples create fresh ones each run.

Fund test accounts

LocalNet’s KMD holds a funded wallet named unencrypted-default-wallet. The examples use this helper:
localnet/_localnet.py
Source: examples/localnet/_localnet.py new_funded_account(algos=10) returns (private_key, address) for a new account holding 10 ALGO. The JavaScript examples do the same with algosdk.Kmd in localnet/_localnet.mjs.

Assets on LocalNet

LocalNet has no USDC. Price in ALGO (asset_id=0) while developing, or create your own ASA. A custom ASA is not one of the client’s default assets, so allow it explicitly, and opt both pay_to and the buyer in to it:

Examples that run on LocalNet

From the root of the examples repository, after pip install -r requirements.txt and npm install, bash scripts/run_all_localnet.sh runs them all in order and starts and stops the servers they need.

TestNet

TestNet is a public network whose ALGO has no value. Payments are real transactions that anyone can see in an explorer, so it is where you check a deployment before MainNet.
1

Create two accounts

A server account (it receives payments and pays the group fees) and a buyer:
Keep the mnemonics in a secret store or environment variables. mnemonic.to_private_key(...) turns one back into the base64 key the SDKs take.
2

Fund them with free TestNet ALGO

Use the dispenser at lora.algokit.io/testnet/fund. A few ALGO each is plenty: the server pays 2,000 microALGO per settled call (1 ALGO covers 500 calls), and every account keeps a minimum balance of 0.1 ALGO.
3

Run the server

Compared with the Quickstart server, only the network, the algod client and the key source change:
server_testnet.py
4

Pay from the client

paid_mcp_session uses the public TestNet algod when network="testnet":
client_testnet.py
Look up either address in the Lora explorer to see the settled group.
These two scripts are the Quickstart scripts with TestNet settings. For a tested TestNet payment, run testnet/live_payment.py. It makes one real 1,000 microALGO payment with the client and facilitator schemes, with the server account as fee payer, and prints the confirmed transaction id and an explorer link. Without both mnemonics set it prints instructions and exits with status 0.
To charge TestNet USDC (asset 10458941), follow Accept USDC with the TestNet asset id.

Check payments without funds

You can validate payment groups against live TestNet state with no keys or funds: build the group with a signer that signs nothing, then ask algod to simulate it with empty signatures allowed. These scripts find funded accounts through the public indexer and simulate four cases: ALGO and USDC, each with and without a fee payer. The package test suites run the same kind of checks with PUBLIC_NETS=1.
testnet/simulate.py
Source: examples/testnet/simulate.py

Use your own nodes

Environment variables replace the default endpoints. Python reads them when x402_algorand and ai_economy_sdk are imported. Or pass endpoints directly: paid_mcp_session(..., algod_url=..., algod_token=...), DefaultAvmSigner(key, algod_client=...) and ChainReader(indexer_url) in Python, algodClient(network, url, token) in JavaScript.

Private networks

Register a private or consortium network once at start-up. Registration needs the full genesis hash, because a 32-character id cannot be turned back into a hash; the simplest way is to read it from the network’s algod.
network_from_algod registers the network with the default LocalNet URLs, and x402_algorand.register_network without URLs uses http://localhost:4001 and http://localhost:8980. So pass your node explicitly where the SDK takes one: DefaultAvmSigner(key, algod_client=node) on the server, paid_mcp_session(..., algod_url=..., algod_token=...) on the client. In JavaScript nothing needs registering: create a client with algodClient(networkId, url, token) and payForRequirement reads the network from that node.

x402-algorand network utilities

All are exported from x402_algorand and x402_algorand.utils:
normalize_network raises NetworkError (a ValueError) for anything else, including "mainnet" and "localnet". More, such as get_network_config and network_from_genesis_hash: x402-algorand reference.

Next

When TestNet works, follow Go to MainNet.