Developers
Deployment
Active testnet deployment, database migrations, and service configuration.
Release order
Migrate
Preserve existing grants
Configure
Chain, contract, registry
Developers
Active testnet deployment, database migrations, and service configuration.
Release order
Migrate
Preserve existing grants
Configure
Chain, contract, registry
Run
Web + continuous worker
CreditTopUp is deployed on BSC Testnet (97) at 0xcc5add7b04c5f4b58d8315d2ad1f1214819d71cb, block 140887163. It uses a separate treasury wallet. The first topup contract is paused. Mainnet is not deployed. See Addresses for dependencies and verified source.
Back up the application database. A new database needs apps/web/supabase.sql, then migrations 002, 003, and 004 in order. An existing installation with 002 and 003 applied needs 004-onchain-topups.sql. It preserves existing balances and expiry dates while enabling permanent grants and uniquely identified payments.
Set treasury, admin, USDT, oracle, and Agent ID registry addresses in the contracts environment. The current testnet deployment uses mock USDT and a mock identity registry with the Chainlink testnet BNB/USD feed.
Treasury is 0xfc8362f3AbDb97571E6D9945De231Fe40c3c4FEe; admin is 0x6186540A6F2a0B17A2dcAE2005A6C9C322be1A67. Use a treasury distinct from wallets that will pay with USDT. Treasury is immutable, so changing it requires a replacement deployment.
bun run --filter @agentpass/contracts deploy:topup:bscTestnet
The script prints the new contract address and an inclusive indexer start block. The contract is non-upgradeable. Verify its immutable values and admin roles before configuring the app.
Set NEXT_PUBLIC_TOPUP_ADDRESS in the web app. Configure the matching chain, RPC, and Agent ID registry on both browser and server. Set PONDER_TOPUP_ADDRESS and PONDER_TOPUP_START_BLOCK in the indexer. The worker and app must share PostgreSQL.
For the existing testnet deployment:
Set these variables in each hosting environment before rebuilding. NEXT_PUBLIC_ values are embedded at build time. Local environment files do not configure a hosted deployment. The indexer and settlement worker need a continuously running service.
The block above identifies the deployment; it is not a complete environment file. Set matching server CHAIN_ID, BSC_RPC_URL, and AGENT_ID_REGISTRY, plus shared DATABASE_URL, a server-only SESSION_SECRET, and AI provider credentials from the environment examples. Configure PONDER_RPC_URL for the indexer. Legacy indexing additionally needs its retained addresses and start block.
The completions route requires a host request duration of at least 120 seconds and unbuffered SSE delivery. The upstream inference deadline is 90 seconds. Store full user API keys only in the integrating server's environment. Model prices and availability live in the database catalog.
Start the indexer and credit worker together, then build and restart the web app. Verify payments in both assets, the treasury amount, the finalized event, and one non-expiring grant. Verify repeated settlement does not add credit twice.
Use bun run indexer:start for the supervised pair. A read-only indexer server does not settle payments. Confirm signed-in account reads, Chat, key creation, Models list, streaming, usage, and revocation against the deployed web origin. See Indexer and API.
The app redirects /mint to /topup. An operator must separately pause the old NFT mint contract when switching products. Preserve historical reward claims, grants, allocations, and indexer data. Legacy controls remain under /admin/legacy.
Testnet deployment, migration 004 on the configured shared database, and the legacy mint pause are complete. Payments of 25 USDT and BNB buying $0.123456 credit from the admin/payer wallet settled as exactly two permanent grants. Replay and restart checks preserved the balance. Existing credit and historical payments are retained. Hosted service configuration remains a separate deployment step. The current repository record is docs/30-testnet-treasury-redeployment.md; docs/29-testnet-topup-activation.md describes the first payment contract. Historical NFT transaction evidence is in Legacy deployment.
# Web
NEXT_PUBLIC_CHAIN_ID=97
NEXT_PUBLIC_TOPUP_ADDRESS=0xcc5add7b04c5f4b58d8315d2ad1f1214819d71cb
NEXT_PUBLIC_AGENT_ID_REGISTRY=0xe367f48f6f2c9c72659e5f4c4a028d711d62472b
DATABASE_SCHEMA=agentpass_testnet_topups_v2
# Indexer
PONDER_CHAIN_ID=97
PONDER_TOPUP_ADDRESS=0xcc5add7b04c5f4b58d8315d2ad1f1214819d71cb
PONDER_TOPUP_START_BLOCK=140887163
DATABASE_SCHEMA=agentpass_testnet_topups_v2