# Tempo Docs
Build stablecoin products with Accounts, Earn, Routes, Zones, and Machine Payments, or build on Tempo EVM. Find API references, SDKs, CLI tools, and partner integrations.
Start with the product guide for your task, then use the API reference, SDKs, and CLI for exact methods and schemas. Use Tempo EVM for chain behavior and protocol details.
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
[Docs skill](https://tempo.com/developers/SKILL.md) · [Full documentation](https://tempo.com/developers/llms-full.txt)
### Quick reference
Common values, each linked to the page that owns it. Read that page before writing code.
- Networks: Tempo Mainnet uses chain ID `4217` and RPC `https://rpc.tempo.xyz`. Tempo Testnet (Moderato) uses chain ID `42431` and RPC `https://rpc.moderato.tempo.xyz`. See [Network details](https://tempo.com/developers/docs/quickstart/connection-details.md).
- Fees: Tempo has no native gas token. Transactions pay fees in a USD TIP-20 stablecoin, chosen per transaction with `feeToken`. See [Fee tokens](https://tempo.com/developers/docs/accounts/fees/fee-tokens.md).
- Testnet funds: send `POST https://tempo.com/developers/api/faucet` with `{"address": "
"}`, or call the `tempo_fundAddress` RPC method on Testnet. See [Faucet](https://tempo.com/developers/docs/quickstart/faucet.md).
- Stablecoins: TIP-20 tokens use 6 decimals. On Mainnet, OUSD is `0x20c0000000000000000000006a37da5c996874be` and pathUSD is `0x20c0000000000000000000000000000000000000`. On Testnet, AlphaUSD is `0x20c0000000000000000000000000000000000001`. See [Stablecoins](https://tempo.com/developers/get-started/stablecoins.md), [OUSD](https://tempo.com/developers/docs/guide/ousd.md), [Faucet tokens](https://tempo.com/developers/docs/quickstart/faucet.md).
- SDKs: TypeScript uses `viem` (`viem/tempo`) and `wagmi` (`wagmi/tempo`). The Tempo API client is `tapimo` and the MPP SDK is `mppx`. Python uses `pytempo`, Go `github.com/tempoxyz/tempo-go`, Rust `tempo-alloy`, and Foundry `tempo-std`. See [SDKs](https://tempo.com/developers/docs/sdk.md).
- Tempo API: `https://api.tempo.xyz/v1`. Many reads need no key. Send a key as `tempo-api-key: tempo:sk:...` or `Authorization: Bearer tempo:sk:...`. See [Authentication](https://tempo.com/developers/docs/api/authentication.md).
- CLI: install with `curl -fsSL https://tempo.com/install | bash`. See [Tempo CLI](https://tempo.com/developers/docs/cli.md).
## Get Started
Choose a starting point, send a test payment, get testnet funds, connect a coding agent, find the SDKs and CLI, and use the resource guides to plan payment workflows, liquidity, provider selection, and partner integrations.
- [Build on Tempo](https://tempo.com/developers/get-started.md): Build stablecoin accounts, transfer funds onchain, offer earning balances, and charge for API access on Tempo.
- [Quickstart](https://tempo.com/developers/get-started/quickstart.md): Create a test account, fund it with AlphaUSD, and verify a stablecoin payment on Moderato testnet.
- [Tempo faucet: get testnet funds](https://tempo.com/developers/docs/quickstart/faucet.md): Get free test stablecoins on Tempo Testnet. Connect your wallet or enter any address to receive OUSD, pathUSD, AlphaUSD, BetaUSD, and ThetaUSD.
- [Build with AI](https://tempo.com/developers/docs/guide/using-tempo-with-ai.md): Connect your coding agent to Tempo documentation with the Docs plugin, MCP server, and Markdown references.
- [Stablecoins on Tempo](https://tempo.com/developers/get-started/stablecoins.md): Understand TIP-20 Tokens, identify stablecoins by network and contract address, and work with token amounts, fees, and payment references.
- [Use cases](https://tempo.com/developers/get-started/use-cases.md): Build global financial accounts, cross-border payouts, institutional settlement, agentic payments, and tokenized deposit products on Tempo.
- [Tempo CLI](https://tempo.com/developers/docs/cli.md): Install the Tempo CLI to call the Tempo API, use Tempo Wallet, make paid HTTP requests with MPP, and run Tempo nodes from your terminal.
- [tempo api](https://tempo.com/developers/docs/cli/api.md): Sign in to the Tempo API from your terminal, create API keys, and call any Tempo API endpoint as a command.
- [tempo wallet](https://tempo.com/developers/docs/cli/wallet.md): Use Tempo Wallet from the terminal for sign-in, balances, access keys, MPP service discovery, funding, payment sessions, and agent workflows.
- [tempo wallet recipes](https://tempo.com/developers/docs/wallet/recipes.md): Let an agent pay for services, reconcile payment sessions, and recover a wallet connection.
- [tempo request](https://tempo.com/developers/docs/cli/request.md): Make curl-compatible HTTP requests that automatically negotiate MPP payments.
- [tempo download](https://tempo.com/developers/docs/cli/download.md): Download chain snapshots for faster initial sync of a Tempo node.
- [tempo node](https://tempo.com/developers/docs/cli/node.md): Run and configure a Tempo RPC or validator node from the command line.
- [Tempo SDKs: available languages and tools](https://tempo.com/developers/docs/sdk.md): Integrate Tempo into your applications with SDKs for TypeScript, Go, Python, Rust, and Foundry. Build blockchain apps in your preferred language.
- [TypeScript SDKs: Viem extension and Account SDK](https://tempo.com/developers/docs/sdk/typescript.md): Build blockchain apps with Tempo using Viem and Wagmi. Send transactions, manage tokens, and use the stablecoin exchange with TypeScript.
- [Tempo API client for TypeScript](https://tempo.com/developers/docs/sdk/typescript/api-client.md): Use the Tempo API Typed Client to call REST and JSON-RPC endpoints with autocomplete, API key headers, status narrowing, and error handling in TypeScript.
- [Prool setup: local Tempo test environment](https://tempo.com/developers/docs/sdk/typescript/prool/setup.md): Set up pooled Tempo node instances in TypeScript with Prool for testing and local development of blockchain applications.
- [Tempo Rust SDK: installing and using it](https://tempo.com/developers/docs/sdk/rust.md): Build blockchain apps with the Tempo Rust SDK using Alloy. Query chains, send transactions, and manage tokens with type-safe Rust code.
- [Tempo Go SDK: installing and using it](https://tempo.com/developers/docs/sdk/go.md): Build blockchain apps with the Tempo Go SDK. Send transactions, batch calls, and handle fee sponsorship with idiomatic Go code.
- [Tempo Python SDK: installing and using it](https://tempo.com/developers/docs/sdk/python.md): Build blockchain apps with the Tempo Python SDK. Send transactions, batch calls, and handle fee sponsorship using web3.py.
- [Using Foundry with Tempo](https://tempo.com/developers/docs/sdk/foundry.md): Build, test, and deploy smart contracts on Tempo using Foundry. Access Tempo protocol features with forge, cast, anvil, and chisel.
- [Using MPP with Foundry](https://tempo.com/developers/docs/sdk/foundry/mpp.md): Authorize a Tempo account and use Foundry tools with MPP-gated RPC endpoints, including automatic payments and reusable payment channels.
- [Signature Verification in Foundry](https://tempo.com/developers/docs/sdk/foundry/signature-verifier.md): Verify secp256k1, P256, and WebAuthn signatures in smart contracts using the SignatureVerifier precompile with Foundry.
- [Payment and integration guides](https://tempo.com/developers/docs/resources/guides.md): Plan stablecoin payment workflows, compare providers and payment rails, and design funding, reconciliation, and operating controls.
- [Get stablecoins on Tempo](https://tempo.com/developers/docs/resources/guides/get-stablecoins-on-tempo.md): Deposit USDC, USDT, or ETH from Base, Ethereum, Arbitrum, Solana, and other chains into Tempo Wallet, withdraw from Coinbase or Kraken on Tempo, or bridge.
- [Add Tempo to MetaMask](https://tempo.com/developers/docs/resources/guides/add-tempo-to-metamask.md): Add Tempo mainnet to MetaMask, Rabby, or another EVM wallet with chain ID 4217 and the official RPC, then see stablecoin balances and pay fees in stablecoins.
- [Connect Tempo Wallet to an app](https://tempo.com/developers/docs/resources/guides/connect-tempo-wallet-to-an-app.md): Sign in to an app with Tempo Wallet, connect Claude Code, Codex, Amp, or Cursor to your wallet, and disconnect apps you no longer use.
- [Set an agent spending limit](https://tempo.com/developers/docs/resources/guides/set-an-agent-spending-limit.md): Approve an AI agent or app with a daily spending limit and an expiry in Tempo Wallet, lower its permissions before approving, and revoke it at any time.
- [Pay fees in stablecoins](https://tempo.com/developers/docs/resources/guides/pay-network-fees-in-stablecoins.md): Tempo charges network fees in USD stablecoins, not a gas token. See which stablecoin pays, why a transaction fails for fees, and how sponsored fees work.
- [Move funds off Tempo](https://tempo.com/developers/docs/resources/guides/move-funds-off-tempo.md): Cash out stablecoins from Tempo through Coinbase or Kraken, bridge them to Base, Ethereum, or Solana, or send them to another wallet.
- [Blockchain payment workflows](https://tempo.com/developers/docs/resources/guides/blockchain-payments.md): Map funding, signing, onchain delivery, and reconciliation responsibilities before integrating a stablecoin payment workflow on Tempo.
- [Evaluate stablecoins for business](https://tempo.com/developers/docs/resources/guides/stablecoins-for-business.md): Choose a bounded business payment pilot and evaluate funding, custody, recipient access, costs, integration, and operating risks.
- [Evaluate enterprise payment infrastructure](https://tempo.com/developers/docs/resources/guides/stablecoin-payment-infrastructure-enterprise-scale.md): Evaluate settlement, accounts, liquidity, policy controls, fees, and reconciliation before operating stablecoin payments at scale.
- [Evaluate stablecoin settlement](https://tempo.com/developers/docs/resources/guides/stablecoin-settlement.md): Compare stablecoin assets, finality signals, delivered transfers, actual fees, liquidity, and reconciliation before selecting a settlement rail.
- [Compare payment rails](https://tempo.com/developers/docs/resources/guides/payment-rails.md): Compare funding, settlement, recipient delivery, costs, and exception handling before adding a stablecoin payment route.
- [Stablecoin fee operations](https://tempo.com/developers/docs/resources/guides/stablecoin-fees.md): Choose a Tempo fee token, check conversion liquidity, separate sponsorship from payment amounts, and reconcile actual network expenses.
- [Plan stablecoin payment acceptance](https://tempo.com/developers/docs/resources/guides/how-to-accept-stablecoin-payments.md): Plan B2B payment requests, verify stablecoin delivery, connect invoices to transfer events, and handle refunds and exceptions.
- [Create payment links](https://tempo.com/developers/docs/resources/guides/payment-links.md): Create stablecoin payment links and QR codes, load trusted payment terms, preserve invoice references, and verify delivery before marking a request paid.
- [Handle stablecoin refunds](https://tempo.com/developers/docs/resources/guides/refunds.md): Verify the original payment, reserve refundable amounts, approve a safe destination, and confirm each stablecoin refund without duplicate transfers.
- [Reconcile payments](https://tempo.com/developers/docs/resources/guides/payment-reconciliation.md): Match confirmed stablecoin transfers to invoices, prevent duplicate credits, and choose Tempo API, Goldsky pipelines, or Allium reports for reconciliation.
- [Plan batch and scheduled payouts](https://tempo.com/developers/docs/resources/guides/batch-payments.md): Choose atomic batches or independent payments, schedule submission, validate payout runs, and reconcile each delivered transfer.
- [Plan global payouts](https://tempo.com/developers/docs/resources/guides/global-payouts.md): Design contractor, merchant, and partner payouts around recipient access, complete costs, verified delivery, and reconciliation.
- [Plan stablecoin payroll](https://tempo.com/developers/docs/resources/guides/stablecoin-payroll-for-global-teams.md): Connect approved payroll and contractor obligations to verified stablecoin payouts, recipient preferences, and finance records.
- [Plan cross-border payments](https://tempo.com/developers/docs/resources/guides/cross-border-payments.md): Verify funding, asset support, conversion, recipient delivery, complete costs, and payment status for a cross-border route.
- [Plan Latin America payment routes](https://tempo.com/developers/docs/resources/guides/cross-border-payments-latin-america.md): Verify country-specific stablecoin funding, conversion, Pix or SPEI delivery, recipient access, and reconciliation in Latin America.
- [Remittance payment operations](https://tempo.com/developers/docs/resources/guides/remittances.md): Map a remittance corridor from sender funding to recipient payout, verify provider responsibilities, and reconcile a stablecoin settlement pilot.
- [Subscription billing with access keys](https://tempo.com/developers/docs/resources/guides/subscriptions-on-tempo.md): Design recurring stablecoin billing with periodic spending limits, scoped access keys, charge scheduling, delivery checks, and cancellation records.
- [Corporate treasury operations](https://tempo.com/developers/docs/resources/guides/corporate-treasury.md): Design a treasury pilot with entity-owned accounts, payment approvals, liquidity controls, and ERP or TMS reconciliation on Tempo.
- [Nostro and vostro accounts](https://tempo.com/developers/docs/resources/guides/nostro-vostro-accounts.md): Understand nostro and vostro accounts, how correspondent payments use them, and what stablecoin settlement changes for payment operations.
- [Prefunding in payment operations](https://tempo.com/developers/docs/resources/guides/prefunding.md): Evaluate why payment providers prefund accounts, how to estimate the cost of liquidity buffers, and where stablecoin settlement can help.
- [FBO accounts in payment operations](https://tempo.com/developers/docs/resources/guides/fbo-accounts.md): Understand for-benefit-of accounts, beneficial-owner records, deposit insurance conditions, and how bank balances differ from stablecoin balances.
- [The GENIUS Act and stablecoin payments](https://tempo.com/developers/docs/resources/guides/genius-act.md): Evaluate issuer authorization, reserves, redemption, yield restrictions, and effective dates under the U.S. payment stablecoin law.
- [HTTP 402 Payment Required](https://tempo.com/developers/docs/resources/guides/402-payment-required.md): Understand how HTTP 402 payment challenges work, choose an MPP payment flow, and handle authorization, retries, and receipts.
- [Microtransactions and metered billing](https://tempo.com/developers/docs/resources/guides/microtransactions.md): Choose direct charges, payment sessions, or recurring billing for small purchases, then meter usage and reconcile delivery on Tempo.
- [Choose embedded wallets](https://tempo.com/developers/docs/resources/guides/embedded-wallets.md): Choose a wallet integration for customer payments, backend signing, or custody, with provider-specific Tempo SDK and fee-sponsorship requirements.
- [Funding and payout infrastructure](https://tempo.com/developers/docs/resources/guides/funding-and-payouts.md): Connect bank deposits and payouts to Tempo through supported routes, customer onboarding, Bridge APIs, and payment completion records.
- [Screen blockchain payments](https://tempo.com/developers/docs/resources/guides/payment-screening.md): Choose address screening, transaction monitoring, or transaction simulation for Tempo payments, then connect provider results to payment controls.
- [Token and receive controls](https://tempo.com/developers/docs/resources/guides/compliance-controls.md): Map TIP-20 roles, TIP-403 token policies, receive-policy holds, and payment references to your application's operating controls.
- [Tempo developer tools and infrastructure](https://tempo.com/developers/docs/quickstart/developer-tools.md): Find Tempo APIs, SDKs, and command-line tools, or browse ecosystem infrastructure providers.
## Accounts
Create accounts, set up signing methods, policies, access keys, key rotation, and fees, and follow guides for users, automations, agents, and teams.
- [Tempo Accounts](https://tempo.com/developers/docs/accounts.md): Give every customer and business a stablecoin account with its security rules built in. Users hold their keys, backends and agents pay within limits, and Tempo enforces every rule onchain.
- [How It Works](https://tempo.com/developers/docs/accounts/how-it-works.md): Only a Tempo account's own keys can move its stablecoins. Signers approve together, access keys pay alone within limits, and Tempo has no override.
- [Use Cases](https://tempo.com/developers/docs/accounts/use-cases.md): Find the Tempo account setup for a consumer app, a backend or agent that pays on its own, a custodian or treasury, or a wallet adding Tempo.
- [Security](https://tempo.com/developers/docs/accounts/security.md): Tempo's validators enforce each account's signers, thresholds, and access key limits on every transaction. See what your app secures, and what to do when a key or service is compromised.
- [Create an Account](https://tempo.com/developers/docs/accounts/create.md): Create a single-key Tempo account with a passkey on testnet, with no API call or transaction, then try configurable accounts with several signers on testnet.
- [Add Funds](https://tempo.com/developers/docs/accounts/fund.md): Fund a Tempo account from another Tempo account, Tempo Wallet, a card or bank, or another chain, then check the balance.
- [Signing Methods](https://tempo.com/developers/docs/accounts/authentication.md): Choose a private key, device key, or passkey for each key on a Tempo account by who should hold it, and set weights so no outside party can approve alone.
- [Passkeys](https://tempo.com/developers/docs/accounts/authentication/passkeys.md): Let customers approve payments and configuration updates with Face ID, Touch ID, Windows Hello, an Android screen lock, or a security key, using a key only they control.
- [Device Keys](https://tempo.com/developers/docs/accounts/authentication/device-keys.md): Create a key the customer's phone, computer, or browser can't export, and authorize it once to pay from a Tempo account within a spending limit and expiry.
- [Private Keys](https://tempo.com/developers/docs/accounts/authentication/private-keys.md): Sign for a Tempo account with a key you already hold in a wallet, KMS, or HSM, as a weighted signer or as an access key with spending limits.
- [Account Policies](https://tempo.com/developers/docs/accounts/policies.md): A signing threshold decides who can move a Tempo account's funds, and a receive policy decides which stablecoins and senders can pay it. Tempo enforces both onchain.
- [Signing Thresholds](https://tempo.com/developers/docs/accounts/policies/signing-thresholds.md): Give each signer a weight and set the total weight a transaction needs, so no outside party can pay alone and losing one signer doesn't lock the account.
- [Receive Policies](https://tempo.com/developers/docs/accounts/policies/receive-policies.md): Choose which stablecoins and senders a Tempo address accepts. Blocked payments don't fail; Tempo holds them for the recovery authority you name.
- [Access Keys](https://tempo.com/developers/docs/accounts/access-keys.md): Let a customer's device, your backend, or an AI agent pay from a Tempo account without the signers approving each payment, within a spending limit, expiry, and scopes that Tempo enforces.
- [Spending Limits](https://tempo.com/developers/docs/accounts/access-keys/spending-limits.md): Cap how much of each TIP-20 token an access key can spend, once or per period, then read what's left or change the limit without revoking the key.
- [Scopes](https://tempo.com/developers/docs/accounts/access-keys/scopes.md): Restrict an access key to the contracts, functions, and recipients its task needs, so a leaked key can't send funds anywhere else.
- [Expiry](https://tempo.com/developers/docs/accounts/access-keys/expiry.md): Make an access key stop working at a set time, so a forgotten or leaked key ends on its own, and authorize its replacement before then.
- [Revocation](https://tempo.com/developers/docs/accounts/access-keys/revocation.md): Shut off an access key for good when a device is lost, a backend key leaks, or an account changes hands, then clean up what the key left behind.
- [Account Configuration](https://tempo.com/developers/docs/accounts/account-configuration.md): Change a configurable Tempo account's signers, weights, and threshold in one configuration update that keeps its address, and choose weights so losing any one key doesn't lock the account.
- [Configuration Updates](https://tempo.com/developers/docs/accounts/account-configuration/configuration-updates.md): Add a backup or recovery signer, remove a departing or compromised one, or rotate a key, in one configuration update that keeps the account's address, balance, and access keys.
- [Account Upgrade](https://tempo.com/developers/docs/accounts/account-configuration/account-upgrade.md): Add backup signers to a single-key (EOA) Tempo account at the same address, so a lost key no longer means a lost account or lost balances.
- [Fee Management](https://tempo.com/developers/docs/accounts/fees.md): Pay network fees from the USD stablecoins an account already holds, or sponsor them with a fee payer that can't move the account's funds.
- [Fee Tokens](https://tempo.com/developers/docs/accounts/fees/fee-tokens.md): Set the USD stablecoin an account pays network fees in once, and override it on any transaction that should pay in a different one.
- [Fee Sponsorship](https://tempo.com/developers/docs/accounts/fees/fee-sponsorship.md): Pay your customers' network fees from a fee payer that Tempo hosts or you run. The fee payer signs only for the fee, so it can't move their funds.
- [Virtual Addresses](https://tempo.com/developers/docs/accounts/virtual-addresses.md): Give every customer their own deposit address while all stablecoins land in one Tempo account, with no sweeps and no per-customer balances.
- [Apps](https://tempo.com/developers/docs/accounts/apps.md): Give each user of your consumer app a Tempo account that your wallet provider signs for alongside the user, and that the user can recover or leave without you.
- [Set Up a Self-Custodial Wallet With a Provider](https://tempo.com/developers/docs/accounts/apps/self-custodial-wallets.md): Give each user a Tempo account where your wallet provider's key and the user's passkey approve payments together, and only the user can recover or leave without your app or the provider.
- [Recover a User's Account](https://tempo.com/developers/docs/accounts/apps/recover-an-account.md): Replace a user's lost passkey or backup key with the two signers they still have, then revoke the lost phone's device key. The account keeps its address and balance.
- [Automations](https://tempo.com/developers/docs/accounts/automations.md): Let a backend, a card program, or an AI agent pay from an account with its own access key, within limits, recipients, and an expiry that Tempo enforces.
- [Pay Out From a Backend](https://tempo.com/developers/docs/accounts/automations/pay-out-from-a-backend.md): Pay contractors, vendors, or sellers from a Tempo account with a KMS-held access key that pays only approved payees, up to a daily limit.
- [Pay From a User's Embedded Wallet](https://tempo.com/developers/docs/accounts/automations/pay-from-an-embedded-wallet.md): Have a user's Privy or Turnkey wallet authorize a limited access key once, so your card program or subscription backend pays from it without holding the user's key.
- [Give an Agent a Wallet](https://tempo.com/developers/docs/accounts/automations/give-an-agent-a-wallet.md): Authorize an AI agent's own access key with a budget, an expiry, and only the calls it needs, let it pay for APIs with MPP, and revoke it when the task ends.
- [Custodians](https://tempo.com/developers/docs/accounts/custodians.md): Run an omnibus account for customer deposits, use Tempo through Fireblocks or another custodian, or keep a team's stablecoins in a multisig.
- [Hold Customer Funds in an Omnibus Account](https://tempo.com/developers/docs/accounts/custodians/omnibus-accounts.md): Give each customer a virtual deposit address that pays into one Tempo account, accept only the stablecoins you list, and credit each deposit to the right customer once.
- [Set Up a Team Multisig](https://tempo.com/developers/docs/accounts/custodians/team-multisig.md): Create one Tempo account that three approvers control, where any two approve each payment and no single key can move funds.
- [Wallets](https://tempo.com/developers/docs/accounts/wallets.md): Add Tempo networks, stablecoin balances, and Tempo Transactions to a wallet, or let your app's users pay with MetaMask, Rabby, or another wallet they already have.
- [Add Tempo to Your Wallet](https://tempo.com/developers/docs/accounts/wallets/add-tempo-to-your-wallet.md): Add Tempo mainnet and testnet to a wallet, show stablecoin balances without a native gas token, let users pay fees in stablecoins, and send Tempo Transactions.
## Earn
Choose a vault, deposit stablecoins, read positions, and withdraw. Earn is in beta; see the introduction for access.
- [Tempo Earn](https://tempo.com/developers/docs/earn.md): Add an earning balance to your app. Choose a vault, deposit stablecoins, display earnings, and handle withdrawals.
- [Vaults](https://tempo.com/developers/docs/earn/vaults.md): Select an Earn vault by asset, strategy, access rules, and supported deposit and withdrawal operations.
- [Deposit](https://tempo.com/developers/docs/earn/integrate.md): Deposit stablecoins into a selected Earn vault and confirm the resulting share balance.
- [Balances and earnings](https://tempo.com/developers/docs/earn/balances.md): Read Earn positions, show their asset value, and distinguish earnings from deposits and withdrawals.
- [Withdraw](https://tempo.com/developers/docs/earn/withdraw.md): Request an Earn withdrawal, distinguish immediate and queued redemption, and confirm funds reach the account.
- [How Earn works](https://tempo.com/developers/docs/earn/how-it-works.md): Understand how deposits become vault shares, how shares are valued, how fees share returns, and what is available to withdraw.
- [Connect a strategy](https://tempo.com/developers/docs/earn/providers.md): Define an Earn engine's asset, valuation, access rules, and deposit and redemption behavior with Tempo.
- [Earn testnet example](https://tempo.com/developers/docs/earn/example.md): Run a complete pathUSD deposit, position read, and redemption against a verified Earn vault on Moderato.
## Routes
Move stablecoins between Tempo and other networks: try a route, set up API access, choose a supported route, quote it, accept deposits or make a transfer, and track delivery. Routes is in beta; see the introduction for access.
- [Tempo Routes](https://tempo.com/developers/docs/routes.md): Move stablecoins between Tempo and supported networks. Accept deposits, make transfers, and track delivery.
- [Try a route](https://tempo.com/developers/docs/routes/test.md): Pick a source and destination, then quote, create, fund, and track a live route while the demo logs each Routes API call.
- [Set up Routes](https://tempo.com/developers/docs/routes/api-setup.md): Create a Routes API key, get your first quote, and create a transfer or deposit address from your backend.
- [Supported routes](https://tempo.com/developers/docs/routes/networks.md): Discover valid chain and token pairs, funding methods, and amount modes before quoting a route.
- [Quotes and fees](https://tempo.com/developers/docs/routes/quotes.md): Choose the fixed amount, read destination amounts, fees, and expiry, and offer 1:1 delivery before a transfer or deposit.
- [Accept deposits](https://tempo.com/developers/docs/routes/deposits.md): Create a route-specific deposit address and track each incoming deposit through delivery to Tempo.
- [Make a transfer](https://tempo.com/developers/docs/routes/transfers.md): Quote a transfer, sign the source transactions, and confirm delivery to the recipient.
- [Track delivery](https://tempo.com/developers/docs/routes/delivery.md): Distinguish source submission, destination delivery, and refunds when reconciling Routes payments.
- [Swap currencies](https://tempo.com/developers/docs/routes/fx.md): Swap a stablecoin in one currency for a stablecoin in another on Tempo, such as OUSD for EURC.e, with a Routes transfer.
- [Deposit address example](https://tempo.com/developers/docs/routes/examples/deposits.md): Run the full deposit-address flow from a terminal with curl and jq, from quote to tracking each deposit.
- [Transfer example](https://tempo.com/developers/docs/routes/examples/transfers.md): Run the full transfer flow from a terminal with curl and jq, from quote to registering source transactions and confirming delivery.
- [FX swap example](https://tempo.com/developers/docs/routes/examples/fx.md): Run an FX swap on Tempo from a terminal with curl and jq, from the account check to the completed transfer.
## Zones
Connect to a Zone and work with private balances, deposits, and withdrawals. Zones is live on Mainnet; see the introduction to set up a Zone. Earlier testnet sandbox guides describe a separate integration.
- [Tempo Zones](https://tempo.com/developers/docs/zones.md): Connect to a private stablecoin ledger, deposit from Tempo, read account activity, and track withdrawals.
- [Privacy](https://tempo.com/developers/docs/zones/privacy.md): Understand what account holders, operators, and public observers can see when using a Zone.
- [Connect to a Zone](https://tempo.com/developers/docs/zones/connect.md): Get deployment details, authenticate private account access, and keep public Tempo and Zone clients separate.
- [Client Setup](https://tempo.com/developers/docs/zones/examples.md): Configure the Wagmi core client used in authenticated Zone RPC examples.
- [Deposit Into a Zone](https://tempo.com/developers/docs/zones/deposit.md): Lock stablecoins in a Zone portal and verify that the intended private account receives its credit.
- [Balances and Activity](https://tempo.com/developers/docs/zones/balances.md): Read token balances and filtered activity through an authenticated Zone RPC connection.
- [Withdraw From a Zone](https://tempo.com/developers/docs/zones/withdraw.md): Submit a Zone withdrawal, track public settlement, and distinguish delivered funds from pending refunds.
- [How Zones Work](https://tempo.com/developers/docs/protocol/zones.md): Learn how Tempo Zones keep stablecoin balances and account activity private while connecting to Tempo for deposits, withdrawals, settlement, and liquidity.
- [Architecture](https://tempo.com/developers/docs/protocol/zones/architecture.md): Architecture of Tempo Zones, including contract layout, sequencer management, chain IDs, and the trust model.
- [Accounts and Privacy](https://tempo.com/developers/docs/protocol/zones/accounts.md): Account-scoped access control on Tempo Zones, including private balances, private allowances, and the two-layer privacy model.
- [Bridging](https://tempo.com/developers/docs/protocol/zones/bridging.md): Deposit and withdraw TIP-20 tokens between Tempo and a Zone, including encrypted deposits and composable withdrawal callbacks.
- [RPC Reference](https://tempo.com/developers/docs/protocol/zones/rpc.md): Authenticated JSON-RPC interface for Tempo Zones with per-account scoping, response redaction, and event filtering.
- [Execution and Gas](https://tempo.com/developers/docs/protocol/zones/execution.md): Specification for gas accounting, fee tokens, fixed TIP-20 gas costs, contract creation limits, and token management on Tempo Zones.
- [Proving and Settlement](https://tempo.com/developers/docs/protocol/zones/proving.md): Understand Tempo Zone settlement certificates, stateless execution validation, the Nitro enclave service, and the current onchain verification limits.
### Earlier testnet sandbox
These guides use the earlier Zone A / Zone B sandbox. They do not establish which operations are available in current Mainnet deployments.
- [Testnet Sandbox](https://tempo.com/developers/docs/guide/private-zones.md): Try deposits, private transfers, swaps, and withdrawals on the earlier Zone A and Zone B testnet deployments.
- [Connect to the Sandbox](https://tempo.com/developers/docs/guide/private-zones/connect-to-a-zone.md): Connect to Tempo Zones on testnet using Zone A and Zone B RPC URLs, chain IDs, and a minimal viem client setup for private flows.
- [Deposit OUSD](https://tempo.com/developers/docs/guide/private-zones/deposit-to-a-zone.md): Deposit OUSD from your Tempo balance into Zone A and confirm the resulting Zone balance.
- [Send Within a Zone](https://tempo.com/developers/docs/guide/private-zones/send-tokens-within-a-zone.md): Send OUSD inside Zone A with a signed Zone transfer and confirm the updated Zone balance.
- [Send Across Zones](https://tempo.com/developers/docs/guide/private-zones/send-tokens-across-zones.md): Send OUSD from Zone A into Zone B by routing a same-token withdrawal through the router on Tempo and confirming the target deposit.
- [Swap Across Zones](https://tempo.com/developers/docs/guide/private-zones/swap-across-zones.md): Swap OUSD from Zone A into betaUSD on Zone B by routing a Zone withdrawal through the router on Tempo and confirming the target deposit.
- [Withdraw OUSD](https://tempo.com/developers/docs/guide/private-zones/withdraw-from-a-zone.md): Withdraw OUSD from Zone A back to your Tempo balance with a direct withdrawal through the Zone outbox.
## Machine Payments
Pay for APIs, accept API payments over MPP or x402, find services, and use MPP (https://mpp.dev).
- [Machine payments](https://tempo.com/developers/docs/agents.md): Pay for APIs from an application or agent, accept payments for your service, and meter usage with payment sessions.
- [Pay for services](https://tempo.com/developers/docs/guide/machine-payments/client.md): Set up an MPP client on Tempo. Polyfill fetch to automatically pay for 402 responses with TIP-20 stablecoins.
- [Accept payments for an API](https://tempo.com/developers/docs/guide/machine-payments/server.md): Add payment gating to any HTTP endpoint on Tempo with mppx middleware for Next.js, Hono, Express, and the Fetch API.
- [Tempo x402 facilitator](https://tempo.com/developers/docs/guide/machine-payments/x402-facilitator.md): Keep selling over x402 and receive each payment as OUSD on Tempo, with no change for buyers.
- [Pay with the CLI](https://tempo.com/developers/docs/guide/machine-payments/agent.md): Find a service, inspect its request format, preview the price, and pay for an API request with the Tempo CLI.
- [Find services](https://tempo.com/developers/docs/guide/machine-payments/discover-services.md): Find paid APIs your agents can call with MPP using the mpp.dev directory, public catalog API, and read-only MCP server.
- [Mercator](https://tempo.com/developers/docs/guide/mercator.md): Give your agent access to web research, data enrichment, and other paid services through Mercator. Discover tools, check prices, and run tasks within a budget.
- [How MPP works](https://tempo.com/developers/docs/guide/machine-payments.md): Follow an MPP request from payment challenge through authorization, verification, and response.
- [Accept One-Time Payments](https://tempo.com/developers/docs/guide/machine-payments/one-time-payments.md): Charge per request on Tempo using the mppx charge intent. Configure a price and recipient, verify payment, and return a receipt.
- [Accept Pay-As-You-Go Payments](https://tempo.com/developers/docs/guide/machine-payments/pay-as-you-go.md): Session-based billing on Tempo with MPP payment channels. Clients fund a channel and authorize metered usage with offchain vouchers.
- [Accept Streamed Payments](https://tempo.com/developers/docs/guide/machine-payments/streamed-payments.md): Charge per word over Server-Sent Events on Tempo using MPP payment sessions and signed vouchers.
## Tempo EVM
Build on Tempo EVM: wallets and keys, payments, transactions and fees, TIP-20 Tokens, contracts, exchange, network details, nodes, protocol specifications, and changelog.
- [Tempo EVM](https://tempo.com/developers/docs/development.md): Build stablecoin payments with dedicated payment capacity, stablecoin fees, fast finality, and native account and token controls.
- [Account Model](https://tempo.com/developers/docs/accounts/keys.md): Tempo EVM accounts are approved by one key or by weighted owners, can hand limited signing power to access keys, and use five signature formats.
- [Single-key accounts](https://tempo.com/developers/docs/development/single-key-accounts.md): Derive a Tempo address from one secp256k1, P-256, or WebAuthn key, sign and authorize access keys with it, and upgrade to weighted owners at the same address.
- [Configurable accounts](https://tempo.com/developers/docs/development/configurable-accounts.md): Control one Tempo address with weighted owner keys and a threshold, approve with 0x05 multisig signatures, change owners without moving funds, and verify approvals onchain.
- [Account Keychain](https://tempo.com/developers/docs/development/account-keychain.md): The rules Tempo enforces on access keys, covering key types, TIP-20 spending limits, expiry, call scopes, authorization, the 0x04 signature, and revocation.
- [Integrating wallet support for Tempo](https://tempo.com/developers/docs/quickstart/wallet-developers.md): Integrate Tempo into your wallet. Use Tempo Transactions for fee token selection, fee sponsorship, batching, and concurrent execution.
- [Account Keychain Precompile](https://tempo.com/developers/docs/protocol/transactions/AccountKeychain.md): Technical specification for the Account Keychain precompile managing access keys with expiry timestamps, spending limits, and call-scope restrictions.
- [Integrate stablecoin payments](https://tempo.com/developers/docs/guide/payments.md): Find the guides for sending, receiving, and reconciling stablecoin payments in your application.
- [Choose a fee token](https://tempo.com/developers/docs/guide/payments/pay-fees-in-any-stablecoin.md): Choose a supported USD-denominated TIP-20 token for transaction fees or set an account default fee token.
- [Fund an account](https://tempo.com/developers/docs/guide/getting-funds.md): Get testnet stablecoins, deposit into Tempo Wallet from other chains, or add wallet funding and cross-network deposits to your app.
- [Send payments](https://tempo.com/developers/docs/guide/payments/send-a-payment.md): Send stablecoins, batch payments, choose how to pay fees, and verify delivery to the recipient.
- [Browser payments](https://tempo.com/developers/docs/guide/payments/send-a-payment/browser.md): Add a wallet-authorized stablecoin payment form, test funding, and receipt handling to a React application.
- [Send payments in parallel](https://tempo.com/developers/docs/guide/payments/send-parallel-transactions.md): Submit independent payment transactions concurrently and track each transaction's receipt.
- [Payment examples](https://tempo.com/developers/docs/guide/payments/send-a-payment/examples.md): Send stablecoins, attach payment references, and batch transfers with Viem, Wagmi, Rust, Python, Go, Cast, and Solidity, and configure each client.
- [Receive payments](https://tempo.com/developers/docs/guide/payments/accept-a-payment.md): Verify incoming stablecoin transfers, read balances and activity, confirm delivery to your account, and match payments to customers and invoices.
- [Customer deposit addresses](https://tempo.com/developers/docs/guide/payments/virtual-addresses.md): Give each customer a virtual deposit address, receive TIP-20 payments in one account, and attribute deposits through transfer events.
- [Payment references](https://tempo.com/developers/docs/guide/payments/transfer-memos.md): Attach a 32-byte memo to a TIP-20 payment and use transfer events to match it to a customer, invoice, or order.
- [Payment verification examples](https://tempo.com/developers/docs/guide/payments/accept-a-payment/examples.md): Read transfer events in multiple languages and verify invoice payments before recording delivery.
- [Virtual addresses for TIP-20 deposits](https://tempo.com/developers/docs/protocol/tip20/virtual-addresses.md): Understand how TIP-20 virtual addresses work, why they remove sweep transactions, and how to attribute forwarded deposits on Tempo.
- [TIP-403 receive policies](https://tempo.com/developers/docs/protocol/tip403/receive-policies.md): Technical overview of address-level receive policies, token filters, sender policies, blocked receipts, claim paths, and ReceivePolicyGuard events.
- [Transactions](https://tempo.com/developers/docs/network/transactions.md): Build a Tempo transaction, sign and submit it, and check its receipt with an SDK or JSON-RPC.
- [Use Tempo Transactions](https://tempo.com/developers/docs/guide/tempo-transaction.md): Sign and submit Tempo Transactions with fee tokens, sponsorship, atomic calls, access keys, and independent nonces.
- [Network examples](https://tempo.com/developers/docs/network/examples.md): Configure CLI, Viem, Wagmi, Python, and JSON-RPC examples for Tempo's main network guides.
- [Tempo Transactions: protocol overview](https://tempo.com/developers/docs/protocol/transactions.md): Understand Tempo transaction signing, fee payment, atomic calls, access keys, and nonce handling.
- [Tempo Transactions Specification](https://tempo.com/developers/docs/protocol/transactions/spec-tempo-transaction.md): Technical specification for Tempo Transactions (EIP-2718) with WebAuthn signatures, parallelizable nonces, gas sponsorship, and batching.
- [Comparing Tempo Transactions and EIP-4337](https://tempo.com/developers/docs/protocol/transactions/eip-4337.md): How Tempo Transactions achieve EIP-4337 goals without bundlers, paymasters, or EntryPoint contracts.
- [Comparing Tempo Transactions and EIP-7702](https://tempo.com/developers/docs/protocol/transactions/eip-7702.md): How Tempo Transactions extend EIP-7702 delegation with additional signature schemes and native features.
- [Fees](https://tempo.com/developers/docs/network/fees.md): Choose a stablecoin for transaction fees, sponsor fees for customers, and estimate costs before submitting a transaction.
- [Provide fee liquidity](https://tempo.com/developers/docs/guide/stablecoin-dex/managing-fee-liquidity.md): Add and remove liquidity in the Fee AMM to enable stablecoin fee conversions. Monitor pools, check LP balances, and rebalance reserves.
- [Understanding transaction fees on Tempo](https://tempo.com/developers/docs/protocol/fees.md): Choose a supported USD-denominated TIP-20 token for transaction fees, configure sponsorship, and understand fee conversion.
- [Fee specification: the canonical reference](https://tempo.com/developers/docs/protocol/fees/spec-fee.md): Technical specification for Tempo's fee system covering multi-token fee payment, fee sponsorship, token preferences, and validator payouts.
- [Fee AMM overview: converting stablecoin fees](https://tempo.com/developers/docs/protocol/fees/fee-amm.md): Understand how the Fee AMM automatically converts transaction fees between stablecoins, enabling users to pay in any supported token.
- [Fee AMM specification: how fee conversion works](https://tempo.com/developers/docs/protocol/fees/spec-fee-amm.md): Technical specification for the Fee AMM enabling automatic stablecoin conversion for transaction fees with fixed-rate swaps and liquidity accounting.
- [TIP-20 Tokens](https://tempo.com/developers/docs/network/tokens.md): Integrate TIP-20 stablecoin payments, understand token interfaces, or create a token and manage its supply.
- [Tempo Token List Registry](https://tempo.com/developers/docs/quickstart/tokenlist.md): Query token metadata, icons, and prices on Tempo using the Uniswap Token Lists-compatible API, and submit new tokens via PR to the registry.
- [How to create a TIP-20 stablecoin](https://tempo.com/developers/docs/guide/issuance/create-a-stablecoin.md): Create your own stablecoin on Tempo using TIP-20 tokens. Deploy tokens with built-in compliance features and role-based permissions.
- [How to mint TIP-20 stablecoins](https://tempo.com/developers/docs/guide/issuance/mint-stablecoins.md): Mint new tokens to increase your stablecoin's total supply. Grant the issuer role and create tokens with optional memos for tracking.
- [Managing your TIP-20 stablecoin](https://tempo.com/developers/docs/guide/issuance/manage-stablecoin.md): Configure stablecoin permissions, supply limits, and compliance policies. Grant roles, set transfer policies, and control pause/unpause functionality.
- [Migrate an ERC-20 to TIP-20](https://tempo.com/developers/docs/guide/issuance/migrate-erc20-to-tip20.md): Map an existing OpenZeppelin ERC-20 architecture to native TIP-20 issuance, bridging, lifecycle management, roles, burns, decimals, and TIP-403 policies.
- [Use your stablecoin for fees](https://tempo.com/developers/docs/guide/issuance/use-for-fees.md): Enable users to pay transaction fees using your stablecoin. Add fee pool liquidity and integrate with Tempo's flexible fee payment system.
- [Stablecoin issuance using the TIP-20 standard](https://tempo.com/developers/docs/guide/issuance.md): Create and manage your own stablecoin on Tempo. Issue tokens, manage supply, and integrate with Tempo's payment infrastructure.
- [TIP-20 tokens: A stablecoin-native standard](https://tempo.com/developers/docs/protocol/tip20/overview.md): TIP-20 tokens are Tempo's native token standard for stablecoins with built-in fee payment, payment lanes, transfer memos, and compliance policies.
- [TIP-20 Tokens Specification](https://tempo.com/developers/docs/protocol/tip20/spec.md): Technical specification for TIP-20 tokens, the optimized token standard extending ERC-20 with memos and policy integration.
- [Tempo Policy Registry (TIP-403)](https://tempo.com/developers/docs/protocol/tip403/overview.md): Learn how TIP-403 enables TIP-20 tokens to enforce access control through a shared policy registry with whitelist and blacklist support.
- [Tempo Policy Registry (TIP-403) Specification](https://tempo.com/developers/docs/protocol/tip403/spec.md): Technical specification for the Tempo Policy Registry (TIP-403), enabling whitelist and blacklist access control for TIP-20 tokens on Tempo.
- [Smart contracts](https://tempo.com/developers/docs/network/contracts.md): Deploy a Solidity contract to Tempo testnet with Foundry, verify its source, and review EVM differences.
- [Contract verification using Foundry](https://tempo.com/developers/docs/quickstart/verify-contracts.md): Verify your smart contracts on Tempo using contracts.tempo.xyz. Sourcify-compatible verification with Foundry integration.
- [Predeployed contracts on Tempo](https://tempo.com/developers/docs/quickstart/predeployed-contracts.md): Discover Tempo's predeployed system contracts including TIP-20 Factory, Fee Manager, Stablecoin DEX, and standard utilities like Multicall3.
- [Stablecoin DEX](https://tempo.com/developers/docs/guide/stablecoin-dex.md): Swap stablecoins on Tempo and provide liquidity through the onchain orderbook.
- [Swap stablecoins](https://tempo.com/developers/docs/guide/stablecoin-dex/executing-swaps.md): Quote a Stablecoin DEX swap, set slippage protection, and submit the transaction on Tempo.
- [Provide liquidity](https://tempo.com/developers/docs/guide/stablecoin-dex/providing-liquidity.md): Place limit and flip orders to provide liquidity on the Stablecoin DEX orderbook. Learn to manage orders and set prices using ticks.
- [Exchanging stablecoins: DEX vs. Fee AMM](https://tempo.com/developers/docs/protocol/exchange.md): Tempo's enshrined decentralized exchange for trading between stablecoins with optimal pricing, limit orders, and flip orders for liquidity provision.
- [pathUSD on Tempo Mainnet and quote tokens](https://tempo.com/developers/docs/protocol/exchange/quote-tokens.md): Understand live mainnet pathUSD, its role as an optional quote token on Tempo's DEX, and how it differs from testnet faucet tokens.
- [Executing swaps | Protocol reference](https://tempo.com/developers/docs/protocol/exchange/executing-swaps.md): Learn how to execute swaps and quote prices on Tempo's Stablecoin DEX with exact-in and exact-out swap functions and slippage protection.
- [Providing liquidity | Protocol reference](https://tempo.com/developers/docs/protocol/exchange/providing-liquidity.md): Provide liquidity on Tempo's DEX using limit orders and flip orders. Earn spreads while facilitating stablecoin trades with price-time priority.
- [Understanding DEX balances on Tempo](https://tempo.com/developers/docs/protocol/exchange/exchange-balance.md): Read balances recorded by the Stablecoin DEX, use them for trades, and withdraw tokens to your account.
- [Stablecoin DEX Specification](https://tempo.com/developers/docs/protocol/exchange/spec.md): Reference for Tempo's enshrined DEX, its onchain orderbook, price-time priority, flip orders, and multi-hop routing.
- [Network](https://tempo.com/developers/docs/network.md): Connect to Tempo mainnet or testnet, check EVM differences, and find RPC and node resources.
- [Network details](https://tempo.com/developers/docs/quickstart/connection-details.md): Connect to Tempo mainnet or Moderato testnet with RPC endpoints, chain IDs, explorers, and browser wallets.
- [EVM differences](https://tempo.com/developers/docs/quickstart/evm-compatibility.md): Learn how Tempo differs from Ethereum. Understand wallet behavior, fee token selection, VM layer changes, and fast finality consensus.
- [Integrate Tempo](https://tempo.com/developers/docs/quickstart/integrate-tempo.md): Connect applications and wallets to Tempo, review EVM and transaction behavior, deploy contracts, and integrate bridges and token discovery.
- [Tempo RPC reference: the tempo_ namespace](https://tempo.com/developers/docs/protocol/rpc.md): Reference for Tempo-specific JSON-RPC methods in the tempo, consensus, and admin namespaces, plus modified eth_ behavior.
- [Blockspace overview: understanding payment lanes](https://tempo.com/developers/docs/protocol/blockspace/overview.md): Technical specification for Tempo block structure including header fields, payment lanes, and system transaction ordering.
- [Payment Lane Specification](https://tempo.com/developers/docs/protocol/blockspace/payment-lane-specification.md): Technical specification for Tempo payment lanes ensuring dedicated blockspace for payment transactions with predictable fees during congestion.
- [Consensus and finality using Simplex BFT](https://tempo.com/developers/docs/protocol/blockspace/consensus.md): Tempo uses Simplex BFT via Commonware for deterministic sub-second finality with Byzantine fault tolerance.
- [Run a node](https://tempo.com/developers/docs/guide/node.md): Choose a Tempo node type, run RPC infrastructure, and maintain it through monitoring and network upgrades.
- [Tempo Node System Requirements](https://tempo.com/developers/docs/guide/node/system-requirements.md): Minimum and recommended hardware specs for running Tempo RPC and validator nodes. CPU, RAM, storage, network, and port requirements.
- [Install and configure a Tempo node](https://tempo.com/developers/docs/guide/node/installation.md): Install Tempo node using pre-built binaries, build from source with Rust, or run with Docker. Get started in minutes with tempoup.
- [Running RPC and Standby Nodes](https://tempo.com/developers/docs/guide/node/rpc.md): Set up and run Tempo RPC and standby nodes. Download snapshots, configure systemd services, and monitor node health and sync status.
- [Consensus, DKG, and network identity](https://tempo.com/developers/docs/guide/node/consensus-and-dkg.md): Learn how Tempo validators share a threshold signing key through DKG, how nodes verify finalizations with the network identity, and what to do when the identity rotates.
- [Running a Validator Node](https://tempo.com/developers/docs/guide/node/validator.md): Overview of running a Tempo validator node.
- [Validator onboarding](https://tempo.com/developers/docs/guide/node/validator-setup.md): Generate signing keys and run your Tempo validator node for the first time.
- [Validator network topology](https://tempo.com/developers/docs/guide/node/validator-topology.md): Isolate a Tempo validator behind RPC nodes and restrict its consensus and execution peer connectivity.
- [Checking validator status](https://tempo.com/developers/docs/guide/node/validator-status.md): Understand validator state transitions, check your validator's participation status, and query on-chain status.
- [Controlling validator lifecycle](https://tempo.com/developers/docs/guide/node/validator-lifecycle.md): Start, stop, register, rotate, deactivate, and transfer ownership of your Tempo validator.
- [Managing validator keys](https://tempo.com/developers/docs/guide/node/validator-keys.md): Generate, rotate, and recover validator signing keys and shares.
- [Validator rotation](https://tempo.com/developers/docs/guide/node/validator-rotation.md): Change an existing Tempo validator's public key or network addresses, prepare a replacement follower, and verify the transition.
- [Validator failover](https://tempo.com/developers/docs/guide/node/validator-failover.md): Recover a Tempo validator from disk, transfer cloud consensus storage to a replacement node, or promote a synced follower.
- [Monitoring a validator](https://tempo.com/developers/docs/guide/node/validator-monitoring.md): Monitor validator health with metrics, Grafana dashboards, and log management.
- [Tempo validator troubleshooting and FAQ](https://tempo.com/developers/docs/guide/node/validator-troubleshooting.md): Common issues and solutions for Tempo validator operators.
- [Node security: best practices for operators](https://tempo.com/developers/docs/guide/node/security.md): Security best practices for Tempo node operators, covering key management, network configuration, release verification, and data integrity.
- [Upgrade cadence and rollout timeline](https://tempo.com/developers/docs/guide/node/upgrade-cadence.md): How Tempo schedules and communicates network upgrades, including timelines, notification windows, and what to expect as a node operator.
- [Specifications](https://tempo.com/developers/docs/protocol.md): Read Tempo protocol references for tokens, policies, fees, transactions, blockspace, exchange, zones, network upgrades, TIP specs, and implementation details.
- [Changelog](https://tempo.com/developers/docs/protocol/upgrades.md): Follow Tempo protocol changes from TIP specifications to testnet and mainnet activation, and find node release notes and operator guidance.
- [T15 Network Upgrade](https://tempo.com/developers/docs/protocol/upgrades/t15.md): T15 lets configurable accounts sign their own payment-channel vouchers, checked against the account configuration fixed when the channel opens.
- [T14 Network Upgrade](https://tempo.com/developers/docs/protocol/upgrades/t14.md): T14 upgrades the Account Keychain so accounts on Tempo support multiple signers, with approval thresholds, key rotation, and recovery at the same address. It also ends admin access keys' key management and tightens validator, consensus, and Zone Portal rules.
- [T13 Network Upgrade](https://tempo.com/developers/docs/protocol/upgrades/t13.md): T13 ships the Zone prover with Nitro-backed settlement verification, multi-block Tempo imports for Zones, explicit block system calls, and an OUSD fee-token fallback.
- [T12 Network Upgrade](https://tempo.com/developers/docs/protocol/upgrades/t12.md): T12 adds configurable nonces for parallel expiring transactions, enables MPP sessions with closed-loop stablecoins, restores compatibility with calldata suffixes, aligns quote and swap calculations, and adds authorized burns for TIP-20 tokens.
- [T11 Network Upgrade](https://tempo.com/developers/docs/protocol/upgrades/t11.md): T11 extends expiring-nonce validity to five minutes and changes precompile gas pricing and ABI validation.
- [T10 Network Upgrade](https://tempo.com/developers/docs/protocol/upgrades/t10.md): T10 enshrines ZoneFactory and installs canonical ZonePortal runtimes for native zone creation.
- [T9 Network Upgrade](https://tempo.com/developers/docs/protocol/upgrades/t9.md): T9 records TIP-20 token policy bindings in TIP-403 and adds a migration path for existing tokens.
- [T8 Network Upgrade](https://tempo.com/developers/docs/protocol/upgrades/t8.md): T8 network upgrade overview covering current committee state, FeeAMM policy behavior, DEX order storage, and the final TIP-20 rewards shutdown.
- [T7 Network Upgrade](https://tempo.com/developers/docs/protocol/upgrades/t7.md): Partner-focused overview and activation status for the T7 network upgrade, including storage savings, payment-channel savings, dynamic base fee behavior, and TIP-20 rewards deprecation.
- [T6 Network Upgrade](https://tempo.com/developers/docs/protocol/upgrades/t6.md): Partner-focused overview and integration notes for the T6 network upgrade, including account-level receive policies and admin access keys.
- [T5 Network Upgrade](https://tempo.com/developers/docs/protocol/upgrades/t5.md): Details and timeline for the T5 network upgrade, including the enshrined TIP-20 reserve channel precompile, DEX improvements, multihop FeeAMM routing, and more.
- [T4 Network Upgrade](https://tempo.com/developers/docs/protocol/upgrades/t4.md): Details and timeline for the T4 network upgrade, including consensus context in the block header and bundled bug fixes.
- [T3 Network Upgrade](https://tempo.com/developers/docs/protocol/upgrades/t3.md): Details and timeline for the T3 network upgrade, including enhanced access keys, signature verification, and virtual addresses.
- [T2 Network Upgrade](https://tempo.com/developers/docs/protocol/upgrades/t2.md): Details and timeline for the T2 network upgrade including compound transfer policies, Validator Config V2, permit support for TIP-20, and audit-driven bug fixes.
- [Node releases](https://tempo.com/developers/docs/changelog.md): Read Tempo node release notes and find binaries, fixes, and changes for each version.
- [Network Upgrades and Releases](https://tempo.com/developers/docs/guide/node/network-upgrades.md): Timeline and details for Tempo network upgrades and important releases for node operators.
- [Stablecoins](https://tempo.com/developers/docs/build.md): Learn about Tempo stablecoins and find guides for accounts, payments, and exchange.
- [Payments](https://tempo.com/developers/docs/payments.md): Send and receive stablecoins, reconcile customer payments, and let applications pay for services on Tempo.
- [TIP Process](https://tempo.com/developers/docs/protocol/tips/tip-0000.md): Defines the Tempo Improvement Proposal lifecycle from draft to production.
- [State Creation Cost Increase](https://tempo.com/developers/docs/protocol/tips/tip-1000.md): Increased gas costs for state creation operations to protect Tempo from adversarial state growth attacks.
- [Place-only mode for next quote token](https://tempo.com/developers/docs/protocol/tips/tip-1001.md): A new DEX function for creating trading pairs against a token's staged next quote token, to allow orders to be placed on it.
- [Prevent crossed orders and allow same-tick flip orders](https://tempo.com/developers/docs/protocol/tips/tip-1002.md): Changes to the Stablecoin DEX that prevent placing orders that would cross existing orders on the opposite side of the book, and allow flip orders to flip to the same tick.
- [Client order IDs](https://tempo.com/developers/docs/protocol/tips/tip-1003.md): Addition of client order IDs to the Stablecoin DEX, allowing users to specify their own order identifiers for idempotency and easier order tracking.
- [Permit for TIP-20](https://tempo.com/developers/docs/protocol/tips/tip-1004.md): Addition of EIP-2612 permit functionality to TIP-20 tokens, enabling gasless approvals via off-chain signatures.
- [Fix ask swap rounding loss](https://tempo.com/developers/docs/protocol/tips/tip-1005.md): A fix for a rounding bug in the Stablecoin DEX where partial fills on ask orders can cause small amounts of quote tokens to be lost.
- [Burn At for TIP-20 Tokens](https://tempo.com/developers/docs/protocol/tips/tip-1006.md): The burnAt function for TIP-20 tokens, enabling authorized administrators to burn tokens from any address.
- [Fee Token Introspection](https://tempo.com/developers/docs/protocol/tips/tip-1007.md): Addition of fee token introspection functionality to the FeeManager precompile, enabling smart contracts to query the fee token being used for the current transaction.
- [Expiring Nonces](https://tempo.com/developers/docs/protocol/tips/tip-1009.md): Time-bounded replay protection using transaction hashes instead of sequential nonce management.
- [Mainnet Gas Parameters](https://tempo.com/developers/docs/protocol/tips/tip-1010.md): Initial gas parameters for Tempo mainnet launch including base fee pricing, payment lane capacity, and transaction gas limits.
- [Enhanced Access Key Permissions](https://tempo.com/developers/docs/protocol/tips/tip-1011.md): Extends Access Keys with periodic spending limits, destination/function scoping, and limited calldata recipient scoping.
- [Compound Transfer Policies](https://tempo.com/developers/docs/protocol/tips/tip-1015.md): Extends TIP-403 with compound policies that specify different authorization rules for senders and recipients.
- [Exempt Storage Creation from Gas Limits](https://tempo.com/developers/docs/protocol/tips/tip-1016.md): Storage creation gas costs are charged but don't count against transaction or block gas limits, using a reservoir model aligned with EIP-8037 for correct GAS opcode semantics and EVM compatibility.
- [Validator Config V2 precompile](https://tempo.com/developers/docs/protocol/tips/tip-1017.md): Validator Config V2 precompile for improved management of consensus participants
- [Signature Verification Precompile](https://tempo.com/developers/docs/protocol/tips/tip-1020.md): A precompile for verifying Tempo signatures onchain.
- [Virtual Addresses for TIP-20 Deposit Forwarding](https://tempo.com/developers/docs/protocol/tips/tip-1022.md): Precompile-native virtual addresses that auto-forward TIP-20 deposits to a registered master wallet, eliminating sweep transactions.
- [Allow same-tick flip orders](https://tempo.com/developers/docs/protocol/tips/tip-1030.md): Relaxes the placeFlip validation to allow flipTick to equal tick, enabling flip orders that flip to the same price.
- [Embed consensus context in the block Header](https://tempo.com/developers/docs/protocol/tips/tip-1031.md): Embed consensus context into the block header
- [T2 Hardfork Bug Fixes](https://tempo.com/developers/docs/protocol/tips/tip-1036.md): Meta TIP collecting all audit-driven bug fixes and hardening changes gated behind the T2 hardfork.
- [T3 Hardfork Meta TIP](https://tempo.com/developers/docs/protocol/tips/tip-1038.md): Meta TIP collecting all bug fixes, security hardening, and gas correctness changes gated behind the T3 hardfork.
- [Revert code creation and set code at addresses with TIP-20 prefix](https://tempo.com/developers/docs/protocol/tips/tip-1047.md): Reject contract creation and EIP-7702 delegations that produce addresses in the TIP-20 reserved prefix range
## API reference
Tempo API reference: authentication, conventions, endpoints grouped by product, Console management endpoints, JSON-RPC, and the indexer. An API key authenticates API requests; an account signing key authorizes transactions.
- [Tempo API](https://tempo.com/developers/docs/api.md): REST API for reading and interacting with Tempo
- [Sponsor your users' fees](https://tempo.com/developers/docs/api/fee-payer.md): Pay network fees for your users with Tempo's hosted fee payer. Try the demo, create an API key, and send a sponsored transaction in three steps.
- [Activities](https://tempo.com/developers/docs/api/activities.md): A readable feed of what an account did onchain.
- [API keys](https://tempo.com/developers/docs/api/api-keys.md): Credentials for accessing the Tempo API.
- [Apps](https://tempo.com/developers/docs/api/apps.md): Tempo ID apps whose users sign in for a project.
- [Authentication](https://tempo.com/developers/docs/api/authentication.md): Authenticate requests to the Tempo blockchain API with public access, production or sandbox API keys, or MPP pay-per-request credentials.
- [Balances](https://tempo.com/developers/docs/api/balances.md): How much of each token an account holds.
- [Billing and usage](https://tempo.com/developers/docs/api/billing.md): Organization billing backed by Stripe.
- [Blocks](https://tempo.com/developers/docs/api/blocks.md): The ordered batches of transactions making up the chain.
- [CoinGecko](https://tempo.com/developers/docs/api/coingecko.md): Exchange data in CoinGecko's GeckoTerminal format.
- [Tempo Console](https://tempo.com/developers/docs/api/console.md): Use Tempo Console to create projects and API keys, switch environments, monitor usage, configure billing, and manage organization access in one place.
- [Tempo API conventions and base URL](https://tempo.com/developers/docs/api/conventions.md): Formatting standards and shared patterns used across the Tempo API — base URL, chains, identifiers, amounts, timestamps, request IDs, errors, and rate limits.
- [Earn API](https://tempo.com/developers/docs/api/earn.md): Vaults that earn yield from assets deposited on Tempo.
- [Tempo API errors and response format](https://tempo.com/developers/docs/api/errors.md): How the Tempo API signals errors, including HTTP status codes, the error envelope, and the full catalog of machine-readable error codes.
- [Exchange](https://tempo.com/developers/docs/api/exchange.md): Tempo's built-in stablecoin exchange: pairs, swaps, orders, prices.
- [Tempo API FAQ](https://tempo.com/developers/docs/api/faq.md): Answers to common Tempo API questions about hosted services, RPC, authentication, webhooks, asset routes, exchange quotes, and API endpoints.
- [Faucet](https://tempo.com/developers/docs/api/faucet.md): Test token routes for Tempo testnet accounts.
- [Fee AMM](https://tempo.com/developers/docs/api/fee-amm.md): Pools that convert stablecoins to pay fees.
- [Fee payer](https://tempo.com/developers/docs/api/fee-payer-usage.md)
- [Indexer](https://tempo.com/developers/docs/api/indexer.md): Run read-only SQL queries against Tempo's indexed data.
- [Tempo Indexer API: Query Blockchain Data with SQL](https://tempo.com/developers/docs/api/indexer-api.md): Query indexed Tempo blockchain data with read-only SQL over HTTP, including blocks, transactions, logs, receipts, balances, and DEX analytics.
- [Tempo JSON-RPC API: Endpoints & Methods](https://tempo.com/developers/docs/api/json-rpc.md): Connect to Tempo JSON-RPC from Viem, Wagmi, Foundry, or Rust for standard Ethereum methods and Tempo-specific blockchain access.
- [MCP](https://tempo.com/developers/docs/api/mcp.md): A hosted Model Context Protocol server: the data domain and Tempo docs exposed as tools.
- [MPP](https://tempo.com/developers/docs/api/mpp.md): Submit completed MPP credentials to Tempo. Validate checks a credential without settling it; Broadcast validates, screens, and submits it. Both require `mpp:write`.
- [Organization](https://tempo.com/developers/docs/api/organizations.md)
- [Tempo API pagination: two modes explained](https://tempo.com/developers/docs/api/pagination.md): Page through Tempo API list endpoints with cursors, page numbers, and optional total counts.
- [Policies](https://tempo.com/developers/docs/api/policies.md): Allow and block lists that control who can send or receive a token.
- [Projects](https://tempo.com/developers/docs/api/projects.md): Application workspaces within an organization.
- [PropAMMs](https://tempo.com/developers/docs/api/propamms.md): Named markets, sponsor lists, and caller-signed access changes.
- [Tempo API rate limits and quota structure](https://tempo.com/developers/docs/api/rate-limits.md): How the Tempo API rate limits requests, the headers it returns, and best practices for staying within quota.
- [Tempo API Reference](https://tempo.com/developers/docs/api/reference.md): Browse every Tempo API endpoint for blockchain data, asset routes, exchange, webhooks, organizations, billing, MPP, MCP, and JSON-RPC requests and responses.
- [Routes API](https://tempo.com/developers/docs/api/routes.md): Quote, create, and track cross-chain stablecoin transfers and reusable deposit addresses into and out of Tempo with the Routes API.
- [Routes Access Requests](https://tempo.com/developers/docs/api/routes-access-requests.md): Project requests for Routes transfer access.
- [JSON-RPC](https://tempo.com/developers/docs/api/rpc.md): Direct access to the chain over Ethereum JSON-RPC. Not part of the stable API contract; best-effort support only. No compatibility, latency, availability, or data-freshness guarantees. Breaking changes may happen with limited notice.
- [Team](https://tempo.com/developers/docs/api/team.md)
- [Tokens](https://tempo.com/developers/docs/api/tokens.md): TIP-20 token details, supply, and holders.
- [Transactions](https://tempo.com/developers/docs/api/transactions.md): Transactions submitted to Tempo, and their receipts.
- [Transactions and transfers](https://tempo.com/developers/docs/api/transactions-and-transfers.md): Choose the Tempo API records you need to inspect transaction execution or reconcile token movements.
- [Transfers](https://tempo.com/developers/docs/api/transfers.md): Token movements from executing transactions.
- [Token requests](https://tempo.com/developers/docs/api/verified-token-requests.md): Organization requests to add tokens to the curated verified list.
- [Verified tokens](https://tempo.com/developers/docs/api/verified-tokens.md): A curated, trusted list of TIP-20 tokens.
- [Tempo API versioning policy](https://tempo.com/developers/docs/api/versioning-policy.md): Learn how Tempo API versions, breaking changes, deprecations, and sunset notices work.
- [Webhooks](https://tempo.com/developers/docs/api/webhooks.md): Organization webhook subscriptions.
- [x402](https://tempo.com/developers/docs/api/x402.md): Tempo x402 facilitator: verify and settle x402 payments on Base into one deposit address, each paid out once on Tempo to the seller named in `extra.tempoSettlement`, for the same amount. `GET /v1/x402/supported` is public; every other route requires `mpp:write`.
- [Zone Delegations](https://tempo.com/developers/docs/api/zone-delegations.md): Zones Tempo has delegated to the organization.
- [Zones API](https://tempo.com/developers/docs/api/zones.md): Private chain operations anchored to Tempo.
- [How to create and manage API keys](https://tempo.com/developers/docs/api/console/api-keys.md): Create project-scoped Tempo API keys, select permissions, store tokens securely, authenticate requests, and safely rotate or revoke credentials when needed.
- [Sign-in](https://tempo.com/developers/docs/api/console/authentication.md): Authenticate into the Tempo Platform.
- [Managing projects and environments in the API Console](https://tempo.com/developers/docs/api/console/projects-and-environments.md): Organize Tempo API integrations into projects and keep production credentials, usage, billing, and sponsored transactions separate from sandbox activity.
- [Managing teams and access in the API Console](https://tempo.com/developers/docs/api/console/team.md): Invite people to a Tempo API organization, assign owner, admin, or member roles, review pending invitations, and safely remove organization access when needed.
- [Monitoring your API usage and billing](https://tempo.com/developers/docs/api/console/usage-and-billing.md): Monitor Tempo API requests and sponsored transactions, add payment methods, and configure organization spend limits and per-transaction sponsorship caps.
- [Deposits](https://tempo.com/developers/docs/api/routes/deposit-addresses.md): Reusable route addresses and deposits detected at those addresses.
- [Supported routes](https://tempo.com/developers/docs/api/routes/routes.md): Supported routes between chains and tokens, and how to create each.
- [Transfers](https://tempo.com/developers/docs/api/routes/transfers.md): Transfers routed between supported chains.
## Partners
Find wallet providers, bridges, RPC infrastructure, data services, and other third-party integrations.
- [Partners](https://tempo.com/developers/docs/partners.md): Find assets, wallets, exchanges, bridges, payment providers, and infrastructure for your Tempo application.
- [Stablecoins](https://tempo.com/developers/docs/partners/stablecoins.md): Find stablecoin assets and issuers on Tempo, then connect token metadata, funding, and payments to your application.
- [OUSD on Tempo](https://tempo.com/developers/docs/guide/ousd.md): Use Open USD (OUSD), the recommended stablecoin on Tempo, for balances, payments, and settlement, and move over from USDC.e or pathUSD.
- [RWAs](https://tempo.com/developers/docs/partners/rwas.md): Find tokenized Treasuries and yield-bearing assets on Tempo, with issuer information and mainnet contract addresses.
- [Wallets](https://tempo.com/developers/docs/partners/wallets.md): Integrate embedded, custodial, and institutional wallet infrastructure into your Tempo application.
- [Smart accounts](https://tempo.com/developers/docs/partners/smart-accounts.md): Build with account abstraction and programmable smart contract wallets on Tempo.
- [Exchanges](https://tempo.com/developers/docs/partners/exchanges.md): Connect exchange liquidity and move supported stablecoins between exchange accounts and Tempo.
- [Bridges](https://tempo.com/developers/docs/partners/bridges.md): Move stablecoins between Tempo and other networks with cross-chain bridge integrations.
- [Payments & ramps](https://tempo.com/developers/docs/partners/payments-and-ramps.md): Find providers for stablecoin issuance, fiat funding, payouts, foreign exchange, and payment operations on Tempo.
- [Cards](https://tempo.com/developers/docs/partners/cards.md): Integrate stablecoin-backed card programs through Bridge, Wirex, or UR, with product documentation and Tempo support links.
- [Partner with Tempo](https://tempo.com/developers/docs/partners/join.md): Contact Tempo to discuss an integration or find a partner for your application.
- [Node providers](https://tempo.com/developers/docs/partners/rpc-and-nodes.md): Connect your application to hosted Tempo RPC endpoints, verify the network, and choose a managed node service for your workload.
- [Data](https://tempo.com/developers/docs/partners/data-and-oracles.md): Query blockchain data on Tempo with indexers, analytics platforms, oracles, and monitoring tools.
- [Block explorers: using the Tempo Explorer](https://tempo.com/developers/docs/partners/explorers-and-debugging.md): View transactions, blocks, accounts, and token activity on the Tempo network with block explorers.
- [Security and compliance](https://tempo.com/developers/docs/partners/security-and-compliance.md): Transaction scanning, threat detection, and compliance infrastructure for Tempo applications.
- [Bridging stablecoins with Bungee](https://tempo.com/developers/docs/guide/bridge-bungee.md): Migrate Bungee integrations to the Socket Swap V3 API. Quote a deposit route, activate it when required, send funds, and track delivery on Tempo.
- [Bridging stablecoins and USDT0 via LayerZero](https://tempo.com/developers/docs/guide/bridge-layerzero.md): Bridge tokens to and from Tempo using LayerZero. Covers Stargate pools and standard OFT adapters with cast commands and TypeScript examples.
- [Bridging stablecoins with Relay](https://tempo.com/developers/docs/guide/bridge-relay.md): Bridge tokens to and from Tempo using Relay. Includes supported token discovery, curl commands, TypeScript examples with viem, and status tracking.
- [Developer tools](https://tempo.com/developers/docs/partners/developer-tools.md): Inspect Tempo transactions, debug smart contracts, and find account libraries for your application.
## Other pages
Pages outside the product and reference navigation.
- [Documentation](https://tempo.com/developers/index.md): Build with Tempo Accounts, Earn, Routes, and Zones. Try developer walkthroughs, build machine payments, and explore the network and API reference.
> Source: [/get-started](https://tempo.com/developers/get-started.md)
> Section: [Get Started](https://tempo.com/developers/get-started.md). Choose a starting point, send a test payment, get testnet funds, connect a coding agent, find the SDKs and CLI, and use the resource guides to plan payment workflows, liquidity, provider selection, and partner integrations.
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
# Build on Tempo
Tempo is a blockchain for stablecoin financial products. Give customers accounts to hold and move money, let them earn on stablecoins, or accept payments for your API.
Send your first test payment with the [interactive quickstart](https://tempo.com/developers/get-started/quickstart).
## Choose what to build
[Embed stablecoins in your app](https://tempo.com/developers/docs/accounts): Give customers a stablecoin balance where they receive payments and send money, with Tempo Accounts.
[Route stablecoins across chains](https://tempo.com/developers/docs/routes): Move stablecoins between Tempo and other supported chains with Tempo Routes.
[Earn on stablecoins](https://tempo.com/developers/docs/earn): Let customers deposit stablecoins into vaults, track earnings, and withdraw through your app with Tempo Earn.
[Charge for APIs](https://tempo.com/developers/docs/guide/machine-payments/server): Accept payments from agents and applications for API requests, tools, or content with MPP.
## Set up your project
### Connect to Tempo
Find RPC endpoints and chain IDs, then fund a test account on Moderato.
[RPC and chain IDs](https://tempo.com/developers/docs/quickstart/connection-details)
[Testnet faucet](https://tempo.com/developers/docs/quickstart/faucet)
### Choose your tools
Use Viem or Wagmi for TypeScript and React, or choose another SDK or the CLI.
[SDKs](https://tempo.com/developers/docs/sdk)
[CLI](https://tempo.com/developers/docs/cli)
[Explore Tempo EVM](https://tempo.com/developers/docs/development)
### Work with the API
Explore endpoints for balances and activity, and manage your project's API keys.
[API reference](https://tempo.com/developers/docs/api/reference)
[API keys](https://tempo.com/developers/docs/api/console/api-keys)
### Set up your coding agent
Connect your agent to Tempo documentation with MCP, or install the Tempo skills.
[Build with AI](https://tempo.com/developers/docs/guide/using-tempo-with-ai)
> Source: [/get-started/quickstart](https://tempo.com/developers/get-started/quickstart.md)
> Section: [Get Started](https://tempo.com/developers/get-started.md). Choose a starting point, send a test payment, get testnet funds, connect a coding agent, find the SDKs and CLI, and use the resource guides to plan payment workflows, liquidity, provider selection, and partner integrations.
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
# Quickstart
Create an account, get test stablecoins, and send your first payment on Moderato testnet. Try it in your browser, then build it with CLI, Viem, or Wagmi.
## Try a payment
Connect Tempo Wallet or create an account when prompted. Add test funds, enter a recipient you control, and send 100 AlphaUSD. The demo links to the transaction receipt when the payment completes.
**Interactive demo: Your first payment**
1. Connect
2. Add funds
3. Send payment
Source: [tempoxyz/examples/tree/main/examples/payments](https://github.com/tempoxyz/examples/tree/main/examples/payments)
## Build the payment
Choose the [CLI, Viem, and Wagmi setup](https://tempo.com/developers/docs/guide/payments/send-a-payment/examples#choose-your-tools). It defines the Moderato network, AlphaUSD, signer, and recipient. The [complete first-payment script](https://tempo.com/developers/docs/guide/payments/send-a-payment/examples#first-payment-script) runs the Viem path end to end. Wagmi hooks belong inside a React component; call the named handlers from buttons and show their pending and error states.
::::steps
### Create an account
CLI and Viem create a local key; Wagmi opens Tempo Wallet to create or select an account. For local signing, keep the key in your signing environment and set `TEMPO_PRIVATE_KEY` and `TEMPO_ACCOUNT_ADDRESS` in the [client setup](https://tempo.com/developers/docs/guide/payments/send-a-payment/examples#choose-your-tools). Account creation does not call a hosted API.
:::code-group
```ts [Viem]
import { generatePrivateKey } from 'viem/accounts'
import { Account } from 'viem/tempo'
const privateKey = generatePrivateKey()
const account = Account.fromSecp256k1(privateKey)
console.log(account.address)
```
```bash [CLI]
cast wallet new
```
```tsx [Wagmi]
import { useConnect, useConnectors } from 'wagmi'
const { mutate: connect } = useConnect()
const connector = useConnectors().find((item) => item.id === 'xyz.tempo')
const connectWallet = () => connector && connect({ connector })
```
```python [Python]
from eth_account import Account
account = Account.create()
print(account.address)
```
:::
### Get test funds
Fund this account on Moderato. Use the account created or connected above; Python uses `w3` from the linked setup.
:::code-group
```ts [Viem]
await client.faucet.fundSync({ account })
```
```bash [CLI]
cast rpc tempo_fundAddress "$TEMPO_ACCOUNT_ADDRESS" --rpc-url "$TEMPO_RPC_URL"
```
```tsx [Wagmi]
import { useConnection } from 'wagmi'
import { Hooks } from 'wagmi/tempo'
const { address } = useConnection()
const { mutate: fund } = Hooks.faucet.useFundSync()
const getTestFunds = () => address && fund({ account: address })
```
```python [Python]
result = w3.provider.make_request("tempo_fundAddress", [account.address])
if "error" in result:
raise RuntimeError(result["error"])
print(result["result"])
```
```bash [cURL (RPC)]
curl --fail-with-body https://rpc.moderato.tempo.xyz \
-H "Content-Type: application/json" \
--data '{"jsonrpc":"2.0","id":1,"method":"tempo_fundAddress","params":["'"$TEMPO_ACCOUNT_ADDRESS"'"]}'
```
:::
### Send a payment
Send one AlphaUSD. Every example uses `1_000_000` base units for this six-decimal token. Viem and Wagmi wait for a receipt. Python builds and signs the same transfer with the [typed SDK](https://tempo.com/developers/docs/guide/payments/send-a-payment/examples#python-client).
:::code-group
```ts [Viem]
const { receipt } = await client.token.transferSync({
token: alphaUsd, to: recipient, amount: 1_000_000n,
})
```
```bash [CLI]
cast erc20 transfer "$ALPHA_USD" "$TEMPO_RECIPIENT" 1000000 \
--tempo.fee-token "$ALPHA_USD" \
--rpc-url "$TEMPO_RPC_URL" --private-key "$TEMPO_PRIVATE_KEY"
```
```tsx [Wagmi]
import { Hooks } from 'wagmi/tempo'
const { mutate: transfer, data, isPending, error } = Hooks.token.useTransferSync()
const sendPayment = () => transfer({
token: alphaUsd, to: recipient, amount: 1_000_000n,
})
```
```python [Python]
tx = TempoTransaction.create(
**transaction_options(),
calls=(TIP20(alpha_usd).transfer(to=recipient, amount=1_000_000),),
)
signed_tx = tx.sign(private_key)
tx_hash = w3.eth.send_raw_transaction(signed_tx.encode())
```
:::
HTTP cannot sign for an account. To submit transaction bytes signed by your application, use the [cURL RPC example](https://tempo.com/developers/docs/guide/payments/send-a-payment#send-a-payment).
### Check the receipt
Check execution status, then verify the transfer's token, recipient, and amount before recording delivery. The [complete script](https://tempo.com/developers/docs/guide/payments/send-a-payment/examples#first-payment-script) includes that verification. Use the returned transaction hash as `PAYMENT_TX_HASH` (CLI) or `paymentHash` (Wagmi). The Wagmi transfer also exposes it as `data?.receipt.transactionHash`.
:::code-group
```ts [Viem]
if (receipt.status !== 'success') throw new Error('Transaction failed')
console.log(receipt.transactionHash)
```
```bash [CLI]
cast receipt "$PAYMENT_TX_HASH" --rpc-url "$TEMPO_RPC_URL"
```
```tsx [Wagmi]
import { useWaitForTransactionReceipt } from 'wagmi'
const { data: receipt, isPending, error } = useWaitForTransactionReceipt({
hash: paymentHash,
})
const succeeded = receipt?.status === 'success'
```
```python [Python]
receipt = w3.eth.wait_for_transaction_receipt(tx_hash)
if receipt["status"] != 1:
raise RuntimeError("Transaction failed")
print(receipt["transactionHash"].hex())
```
```bash [cURL (RPC)]
curl --fail-with-body https://rpc.moderato.tempo.xyz \
-H "Content-Type: application/json" \
--data '{"jsonrpc":"2.0","id":1,"method":"eth_getTransactionReceipt","params":["'"$PAYMENT_TX_HASH"'"]}'
```
:::
The RPC receipt is `null` until the transaction is included; poll until a receipt is available.
::::
Add [payment references and batches](https://tempo.com/developers/docs/guide/payments/send-a-payment), or [connect confirmed transfers to customer records](https://tempo.com/developers/docs/guide/payments/accept-a-payment).
> Source: [/docs/quickstart/faucet](https://tempo.com/developers/docs/quickstart/faucet.md)
> Section: [Get Started](https://tempo.com/developers/get-started.md). Choose a starting point, send a test payment, get testnet funds, connect a coding agent, find the SDKs and CLI, and use the resource guides to plan payment workflows, liquidity, provider selection, and partner integrations.
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
# Tempo faucet: get testnet funds
Get test OUSD, pathUSD, and other stablecoins on Tempo testnet.
### Fund an address
Send test stablecoins to any address.
**Interactive demo: Fund an address**
1. Add funds to others
### Fund your wallet
Connect your wallet to receive test stablecoins directly.
**Interactive demo: Connect and fund your wallet**
1. Connect wallet
2. Add funds to wallet
3. Add tokens to wallet
4. Set fee token
### cURL request
Request tokens programmatically via the faucet API.
```bash
curl -X POST https://tempo.com/developers/api/faucet \
-H "Content-Type: application/json" \
-d '{"address": ""}'
```
Replace `` with your wallet address.
### Cast RPC
Request tokens using the `tempo_fundAddress` RPC method.
```bash
cast rpc tempo_fundAddress \
--rpc-url https://rpc.moderato.tempo.xyz
```
Replace `` with your wallet address.
The faucet funds the following test assets. Check the resulting balances after funding; allocations can change.
| Asset | Address |
|-------|---------|
| [OUSD](https://explore.testnet.tempo.xyz/address/0x20c0000000000000000000006a37da5c996874be) | `0x20c0000000000000000000006a37da5c996874be` |
| [pathUSD](https://explore.testnet.tempo.xyz/address/0x20c0000000000000000000000000000000000000) | `0x20c0000000000000000000000000000000000000` |
| [AlphaUSD](https://explore.testnet.tempo.xyz/address/0x20c0000000000000000000000000000000000001) | `0x20c0000000000000000000000000000000000001` |
| [BetaUSD](https://explore.testnet.tempo.xyz/address/0x20c0000000000000000000000000000000000002) | `0x20c0000000000000000000000000000000000002` |
| [ThetaUSD](https://explore.testnet.tempo.xyz/address/0x20c0000000000000000000000000000000000003) | `0x20c0000000000000000000000000000000000003` |
> Source: [/docs/guide/using-tempo-with-ai](https://tempo.com/developers/docs/guide/using-tempo-with-ai.md)
> Section: [Get Started](https://tempo.com/developers/get-started.md). Choose a starting point, send a test payment, get testnet funds, connect a coding agent, find the SDKs and CLI, and use the resource guides to plan payment workflows, liquidity, provider selection, and partner integrations.
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
# Build with AI
Give your coding agent access to Tempo documentation. Install the Tempo Docs plugin in Codex or Claude Code, or connect another editor to the MCP server.
## Connect your coding agent
The Tempo Docs plugin connects your agent to the read-only Tempo MCP server and installs a documentation skill and editor metadata. Tempo publishes plugins from the public [`tempoxyz/plugins`](https://github.com/tempoxyz/plugins) repository.
Run both commands for your client in your computer's terminal:
:::code-group
```bash [Codex]
codex plugin marketplace add tempoxyz/plugins --ref main
codex plugin add docs@tempo
```
```bash [Claude Code]
claude plugin marketplace add tempoxyz/plugins
claude plugin install docs@tempo
```
:::
Already using the old Tempo plugin marketplace?
If you previously installed Tempo plugins from `tempoxyz/docs`, remove the existing `tempo`
marketplace once, then add `tempoxyz/plugins`:
```bash
codex plugin marketplace remove tempo
codex plugin marketplace add tempoxyz/plugins --ref main
codex plugin add docs@tempo
```
For Cursor, Amp, and other clients, connect to the MCP server below. If your agent supports skills, you can also [install the Docs skill](https://tempo.com/developers/docs/guide/using-tempo-with-ai#docs-skill).
### Connect to Tempo's MCP server
Use this option if your editor does not support the Tempo Docs plugin. The MCP server lets your agent search documentation and read complete pages at `https://mcp.tempo.xyz`. Choose your client below.
### Claude
```bash
claude mcp add --transport http tempo https://mcp.tempo.xyz
```
### Codex
```bash
codex mcp add tempo --url https://mcp.tempo.xyz
```
### Cursor
[Install in Cursor](cursor://anysphere.cursor-deeplink/mcp/install?name=tempo\&config=eyJ1cmwiOiJodHRwczovL21jcC50ZW1wby54eXoifQ%3D%3D)
To open Cursor and automatically add the Tempo MCP server, click install. Alternatively, add the following to your `~/.cursor/mcp.json` file. To learn more, see the Cursor [documentation](https://docs.cursor.com/context/model-context-protocol).
```json
{
"mcpServers": {
"tempo": {
"url": "https://mcp.tempo.xyz"
}
}
}
```
### Amp
```bash
amp mcp add tempo https://mcp.tempo.xyz
```
### Other
```json
{
"mcpServers": {
"tempo": {
"url": "https://mcp.tempo.xyz"
}
}
}
```
## Start a project
After installation, start a new conversation in your project and give the agent a concrete task. For example:
```text
Use Tempo's docs to build a TypeScript example that sends a stablecoin payment on Moderato testnet with a memo. Include wallet funding and verify delivery to the intended recipient.
```
Use the [testnet faucet](https://tempo.com/developers/docs/quickstart/faucet) for test funds and [Quickstart](https://tempo.com/developers/get-started/quickstart) to review the implementation.
### Choose a starting page
Ask your agent to read the guide for the integration you are building before writing code:
| Task | Start with |
| --- | --- |
| Choose a product or send a first test payment | [Get Started](https://tempo.com/developers/get-started) |
| Create accounts, read balances, send or receive payments | [Accounts](https://tempo.com/developers/docs/accounts) |
| Find a vault, deposit, or withdraw | [Earn](https://tempo.com/developers/docs/earn) |
| Move funds between Tempo and other networks | [Routes](https://tempo.com/developers/docs/routes) |
| Work with private balances, deposits, and withdrawals | [Zones](https://tempo.com/developers/docs/zones) |
| Pay for an API or charge for your service | [Machine Payments](https://tempo.com/developers/docs/agents) |
| Work with transactions, tokens, contracts, or nodes | [Tempo EVM](https://tempo.com/developers/docs/development) |
| Choose a client, CLI, or API reference | [SDKs](https://tempo.com/developers/docs/sdk), [CLI](https://tempo.com/developers/docs/cli), [API reference](https://tempo.com/developers/docs/api) |
| Find wallet, bridge, data, or infrastructure providers | [Partners](https://tempo.com/developers/docs/partners) |
Read each product's overview for its current availability and access requirements. Earn and Routes are in beta; Zones is live on Mainnet.
The hosted MCP reads published documentation. It cannot see your local edits or preview deployment. For a preview, give your agent that preview's Markdown URL. If MCP results use older page names or omit a section, read `/llms.txt` and `/SKILL.md` from the docs site you are using, then fetch the relevant page directly.
### MCP tools
The MCP endpoint exposes these tools to connected agents:
| Tool | Purpose | Required arguments |
| --- | --- | --- |
| `search` | Search docs. | `query` |
| `find_pages` | Find matching page URLs from a source index. | `source`, `query` |
| `read_page` | Read one cleaned documentation page. | `source` plus `path` or `url` |
| `code` | Run multi-step documentation lookups. | `code` |
#### MCP feedback
MCP clients can also post feedback directly to `https://tempo.com/developers/api/feedback`:
```json
{
"source": "mcp",
"sentiment": "negative",
"message": "The read_page result for /docs/guide/payments/send-a-payment is missing fee-token setup.",
"toolName": "read_page",
"relatedResource": "/docs/guide/payments/send-a-payment",
"client": "codex"
}
```
#### Try the MCP server
Use the interactive web page to try the Tempo MCP server.
### Add paid tools
Mercator adds paid API discovery and execution to your agent. Follow the [Mercator guide](https://tempo.com/developers/docs/guide/mercator) to authorize your client and verify the connection after installation:
```bash
curl -fsSL https://mercator.sh/install.sh | sh
```
To install the plugin directly from the Tempo marketplace, add the public `tempoxyz/plugins` source and select `mercator@tempo`:
:::code-group
```bash [Codex]
codex plugin marketplace add tempoxyz/plugins --ref main
codex plugin add mercator@tempo
```
```bash [Claude]
claude plugin marketplace add tempoxyz/plugins
claude plugin install mercator@tempo --scope user --yes
```
:::
### Use skills and Markdown
#### Docs skill
Install the Tempo Docs skill to give AI coding agents access to Tempo documentation, related documentation sources, and examples:
```bash
npx skills add tempoxyz/plugins --skill docs
```
Ask your agent to use the Docs skill for Tempo integration tasks. The [published docs skill](https://tempo.com/developers/SKILL.md) contains the current documentation map; the plugin's copy is generated from it by the [`tempoxyz/plugins`](https://github.com/tempoxyz/plugins) skill sync.
#### Read docs as Markdown
Append `.md` to a documentation page URL to read its Markdown:
```text
https://tempo.com/developers/get-started.md
```
For broader context, use the [`llms.txt`](https://llmstxt.org/) files at the documentation root:
| URL | Contents |
| --- | --- |
| [`/llms.txt`](https://tempo.com/developers/llms.txt) | Concise index of all pages with titles and descriptions |
| [`/llms-full.txt`](https://tempo.com/developers/llms-full.txt) | Complete documentation in a single file |
> Source: [/get-started/stablecoins](https://tempo.com/developers/get-started/stablecoins.md)
> Section: [Get Started](https://tempo.com/developers/get-started.md). Choose a starting point, send a test payment, get testnet funds, connect a coding agent, find the SDKs and CLI, and use the resource guides to plan payment workflows, liquidity, provider selection, and partner integrations.
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
# Stablecoins on Tempo
Tempo’s native stablecoins use the TIP-20 token standard. An account can hold balances in multiple tokens, and your application uses the same interface to read balances and send payments for each one.
## Identify the stablecoin
Identify each asset by **its network and contract address**. Keep both alongside amounts in your application and payment records; use the name and symbol for display.
Use the [token list](https://tempo.com/developers/docs/quickstart/tokenlist) for addresses and display metadata. The [Assets directory](https://tempo.com/developers/docs/partners/stablecoins) introduces stablecoin issuers, and the [OUSD guide](https://tempo.com/developers/docs/guide/ousd) covers OUSD addresses and funding paths.
For development, use [Moderato testnet](https://tempo.com/developers/docs/quickstart/connection-details) and [faucet tokens](https://tempo.com/developers/docs/quickstart/faucet). The token list provides separate addresses for testnet and mainnet assets.
## Understand TIP-20 Tokens
TIP-20 extends ERC-20 with payment features built into Tempo. If you already work with ERC-20 tokens, the core operations are familiar:
| Operation | Use |
| --- | --- |
| Read an account’s balance | `balanceOf` |
| Send tokens from an account | `transfer` |
| Allow another address to spend tokens | `approve` |
| Spend an approved allowance | `transferFrom` |
TIP-20 also provides transfer memos, stablecoin fee payment, and policies that control token movement.
## Work with token amounts
TIP-20 tokens use **6 decimal places**. A balance of `1000000` base units represents `1` token; `12500000` represents `12.5` tokens.
Use integer base units when preparing transactions and convert them for display. With the TypeScript SDK, use Viem’s `parseUnits` and `formatUnits`:
```ts
import { formatUnits, parseUnits } from 'viem'
const amount = parseUnits('12.5', 6) // 12500000n
const displayAmount = formatUnits(amount, 6) // '12.5'
```
## Add references to payments
A TIP-20 transfer can include a **32-byte memo**. Use it to identify an invoice, order, or other record when reconciling payments. The memo appears in transfer events alongside the payment details.
See [Payment references](https://tempo.com/developers/docs/guide/payments/transfer-memos) for encoding memos and reading them from transfer events.
## Pay fees in stablecoins
Tempo has no native gas token. Transaction fees use supported USD-denominated TIP-20 tokens with sufficient fee liquidity. The payment token and fee token can differ, and your application can [sponsor fees](https://tempo.com/developers/docs/api/fee-payer) for its users.
See [Choose a fee token](https://tempo.com/developers/docs/guide/payments/pay-fees-in-any-stablecoin) for client configuration and [transaction fees](https://tempo.com/developers/docs/protocol/fees) for eligibility and conversion rules.
## Token and account policies
A token’s transfer policy controls which addresses can send and receive it. Account owners can also choose which tokens and senders they accept. See [Control incoming payments](https://tempo.com/developers/docs/accounts/policies/receive-policies) to configure a receive policy and handle blocked payments.
[Send your first payment →](https://tempo.com/developers/docs/guide/payments/send-a-payment)
For contract interfaces and exact token behavior, read the [TIP-20 Specification](https://tempo.com/developers/docs/protocol/tip20/spec).
> Source: [/get-started/use-cases](https://tempo.com/developers/get-started/use-cases.md)
> Section: [Get Started](https://tempo.com/developers/get-started.md). Choose a starting point, send a test payment, get testnet funds, connect a coding agent, find the SDKs and CLI, and use the resource guides to plan payment workflows, liquidity, provider selection, and partner integrations.
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
# Use cases
Help customers hold funds, move money, and pay for services with stablecoins. Explore Tempo's core use cases below, then follow a guide to build the experience into your product.
## Embedded finance
Give customers a financial account inside your app, where they can receive payments, keep a stablecoin balance, and send money. Connect the account to the currencies and payment methods your customers already use through Tempo's partner ecosystem.
[Stablecoin accounts](https://tempo.com/developers/docs/accounts): Let customers receive money, keep funds in your app, and pay others from the same balance. Start by choosing how your application manages accounts.
[Pay-ins and payouts](https://tempo.com/developers/docs/partners/join): Help customers move money into and out of your app. Find partners that connect stablecoins to bank accounts and local payment methods.
[Explore embedded finance on Tempo](https://tempo.com/solutions/embedded-finance/).
## Cross-border payments
Pay employees, contractors, suppliers, and customers across countries using stablecoins. A contractor can receive a dollar stablecoin payout and use an offramp partner to withdraw to a bank account in a supported local currency.
[Global payroll and payouts](https://tempo.com/developers/docs/guide/payments/send-a-payment): Send stablecoin payouts to employees, contractors, or marketplace sellers. Start by sending a payment to a recipient's account.
[Payment reconciliation](https://tempo.com/developers/docs/guide/payments/transfer-memos): Link each transfer to an invoice, payroll run, or customer record with a memo your backend can reconcile.
[Explore cross-border payments on Tempo](https://tempo.com/solutions/cross-border-payments/).
## Institutional settlement
Move funds between financial institutions for treasury operations, counterparty payments, and card settlement. Use transfer policies to control who can transact and memos to match payments to your records. Tempo Zones keep balances and account activity inside a Zone private from the public.
[Treasury and counterparty payments](https://tempo.com/developers/docs/payments): Transfer stablecoins between institutional accounts and track payments in your existing systems. Start with the payment integration guide.
[Private account activity](https://tempo.com/developers/docs/zones/privacy): Give users access to their own balances and activity while the Zone operator can see the full ledger. Review what stays private and what becomes public when funds enter or leave.
[Explore institutional settlement on Tempo](https://tempo.com/solutions/institutional-money-movement/).
## Agentic payments
Let agents pay for APIs, tools, and digital content as they work. The [Machine Payments Protocol](https://mpp.dev) (MPP) lets services request payment and clients pay as part of an HTTP request.
[Agents that buy services](https://tempo.com/developers/docs/guide/machine-payments/agent): Give an agent a way to discover paid services and pay for the requests it needs. Start with the agent quickstart.
[Paid APIs and tools](https://tempo.com/developers/docs/guide/machine-payments/server): Charge for API requests, MCP tools, or access to content. Add payment verification to your service with MPP.
[Explore agentic payments on Tempo](https://tempo.com/solutions/agentic-payments/).
## Tokenized deposits
Build products that let bank customers hold and move tokenized deposits for commercial payments, intragroup funding, and cash management. Define who can participate, which assets accounts can receive, and who can see balances and transactions.
[Issuer and transfer controls](https://tempo.com/developers/docs/protocol/tip20/overview): Use TIP-20 Tokens to manage supply, assign administrative roles, and define which accounts can send and receive tokens.
[Private deposit infrastructure](https://tempo.com/developers/docs/protocol/zones/architecture): Design how customer balances stay in a private ledger and connect to Tempo for deposits, withdrawals, and settlement. Review the Zone architecture.
[Explore tokenized deposits on Tempo](https://tempo.com/solutions/tokenized-deposits/).
> Source: [/docs/cli](https://tempo.com/developers/docs/cli.md)
> Section: [Get Started](https://tempo.com/developers/get-started.md). Choose a starting point, send a test payment, get testnet funds, connect a coding agent, find the SDKs and CLI, and use the resource guides to plan payment workflows, liquidity, provider selection, and partner integrations.
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
# Tempo CLI
The `tempo` binary works with the Tempo API, Tempo Wallet, paid HTTP requests, and Tempo nodes from your terminal.
## Install
```bash [Terminal]
curl -fsSL https://tempo.com/install | bash
```
The launcher installs each command's extension the first time you run it. Run `tempoup` to update, and `tempo --version` to check the installed version.
## Commands
| Command | Use it for |
| --- | --- |
| [`tempo api`](https://tempo.com/developers/docs/cli/api) | Signing in to the Tempo API, creating API keys, and calling any endpoint. |
| [`tempo wallet`](https://tempo.com/developers/docs/cli/wallet) | Using Tempo Wallet: balances, funding, access keys, service discovery, and payment sessions. |
| [`tempo request`](https://tempo.com/developers/docs/cli/request) | Making HTTP requests that pay automatically with [MPP](https://mpp.dev/overview). |
| [`tempo download`](https://tempo.com/developers/docs/cli/download) | Downloading chain snapshots for a faster initial node sync. |
| [`tempo node`](https://tempo.com/developers/docs/cli/node) | Running a Tempo RPC or validator node. |
## Set up your agent
Paste this into your AI agent to set up Tempo Wallet CLI and start making paid requests:
:::code-group
```bash [Claude Code]
claude -p "Read https://tempo.com/skills/wallet/SKILL.md and set up tempo"
```
```bash [Amp]
amp --execute "Read https://tempo.com/skills/wallet/SKILL.md and set up tempo"
```
```bash [Codex CLI]
codex exec "Read https://tempo.com/skills/wallet/SKILL.md and set up tempo"
```
:::
See [Let an agent pay for services](https://tempo.com/developers/docs/wallet/recipes#let-an-agent-pay-for-services) for the installed skills and spending limits.
## Common flags
Run any command with `--help` to see its flags. Wallet and request extensions also provide `--schema` for JSON command schemas and `--format toon` for compact output. Preview paid requests with `--dry-run` and cap them with `--max-spend`; these payment flags do not apply to node commands.
> Source: [/docs/cli/api](https://tempo.com/developers/docs/cli/api.md)
> Section: [Get Started](https://tempo.com/developers/get-started.md). Choose a starting point, send a test payment, get testnet funds, connect a coding agent, find the SDKs and CLI, and use the resource guides to plan payment workflows, liquidity, provider selection, and partner integrations.
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
# `tempo api`
`tempo api` signs in with [Tempo Console](https://tempo.com/developers/docs/api/console) and turns every `/v1/` endpoint in the [API reference](https://tempo.com/developers/docs/api) into a command. [Install the Tempo CLI](https://tempo.com/developers/docs/cli#install) first; the launcher installs `tempo api` the first time you run it.
## Usage
```bash [Terminal]
tempo api [FLAGS]
```
```bash [Terminal]
tempo api login
tempo api keys create --name "my-app"
tempo api v1 tokens get --format json
```
## Sign in
```bash [Terminal]
tempo api login
tempo api whoami
```
`login` prints a code and a `console.tempo.xyz` link, and opens the browser when it can. Check that the code matches, then click **Authorize CLI**. The request expires after 10 minutes.
* On a remote host, run `tempo api login --no-browser` and open the link on another device.
* The session lasts 30 days and acts as you in Tempo Console. Run `tempo api logout` to revoke it.
* The approval page defaults to the `data:read`, `routes:read`, `routes:write`, and `rpc-relay:read` scopes. Select only what the device needs. Routes writes still require a Tempo-approved project key.
## Create an API key
```bash [Terminal]
tempo api keys create --name "my-app"
tempo api keys create --name "staging" --env sandbox --scopes data:read --scopes management:read
```
The token is shown once. Store it in your secret manager, for example as `TEMPO_API_KEY`, and never in source files. See [API keys](https://tempo.com/developers/docs/api/console/api-keys) for scopes and environments.
## Call endpoints
Every `/v1/` endpoint is a command, generated from the live API document. Command names follow the endpoint path:
```bash [Terminal]
tempo api v1 --help
tempo api v1 tokens get --format json
tempo api v1 orgs get --format json
tempo api v1 routes transfers get --format json
```
## Credentials
The CLI picks a credential for each call:
* **Management commands** (organizations, projects, keys, members, webhooks) use your session.
* **Data commands** use `TEMPO_API_KEY` when it is set. Otherwise they use a scoped project key from your session, falling back to anonymous, rate-limited access.
* **API-key-only commands** use a scoped project key from your session when `TEMPO_API_KEY` is not set. These keys expire with the session and are revoked on logout.
* **Routes writes** derive from an existing approved key in the project and environment. If several match, choose one with `TEMPO_API_SOURCE_KEY`.
The CLI picks the organization and project only when each is unique. Otherwise, set `TEMPO_API_ORG` and `TEMPO_API_PROJECT`.
## Use with agents
`tempo api --mcp` serves the same commands to MCP clients. `tempo api docs` searches the Tempo documentation.
## Commands
| Command | Description |
| --- | --- |
| `tempo api login` | Sign in by approving this device in Tempo Console. |
| `tempo api whoami` | Show the signed-in account. |
| `tempo api logout` | Sign out and revoke the stored CLI session. |
| `tempo api keys create` | Create an API key for a project. The key is shown once. |
| `tempo api v1 ` | Call any Tempo API endpoint. Run `tempo api v1 --help` for the list. |
| `tempo api docs` | Search the Tempo documentation. |
| `tempo update api` | Install the latest release. The launcher also checks for updates on its own. |
## Flags
### All commands
| Flag | Description |
| --- | --- |
| `--format json` | Print machine-readable output. |
| `--help` | Show the command's flags. |
| `--update` | Install the latest release of `tempo api`. Same as `tempo update api`. |
### `tempo api login`
| Flag | Description |
| --- | --- |
| `--no-browser` | Print the approval link instead of opening a browser, for remote hosts. |
### `tempo api keys create`
| Flag | Description |
| --- | --- |
| `--name ` | Key name shown in Tempo Console. Prompted for when omitted. |
| `--env ` | `production` works on every chain; `sandbox` works only on testnets. Defaults to `production`. |
| `--scopes ` | Scope to grant. Defaults to `data:read`. Repeat for more. |
| `--allowed-ips ` | Client IP address or CIDR range allowed to use the key. Repeat for more. |
| `--org ` | Organization ID (`org_…`). Defaults to the only one; prompted for when there are several. |
| `--project ` | Project ID (`prj_…`). Defaults to the only one; prompted for when there are several. |
### `tempo api v1 `
| Flag | Description |
| --- | --- |
| `--cursor ` | Read the next page of a list. List responses return `nextCursor`. |
| `--tempo-api-key ` | Use this API key for one call. |
| `--authorization "Bearer "` | Use this credential for one call. |
## Environment variables
| Variable | Description |
| --- | --- |
| `TEMPO_API_KEY` | API key for data commands. |
| `TEMPO_API_URL` | API origin. Defaults to `https://api.tempo.xyz`. |
| `TEMPO_API_ORG` | Organization for session credentials. Defaults to the only organization. |
| `TEMPO_API_PROJECT` | Project for session credentials. Defaults to the only project. |
| `TEMPO_API_ENV` | `production` or `sandbox` for testnet-only credentials. Defaults to `production`. |
| `TEMPO_API_SOURCE_KEY` | Approved project key that Routes write credentials derive from. |
| `TEMPO_HOME` | CLI home directory. Defaults to `~/.tempo`. |
## Errors
| Error | Fix |
| --- | --- |
| `not_signed_in` | Run `tempo api login`. |
| `login_expired` | The code wasn't approved within 10 minutes. Run `tempo api login` again. |
| `login_denied` | The request was denied in Tempo Console. Run `tempo api login` again. |
| `scope_not_approved` | Sign in again and select the required scopes on the approval page. |
| `api_key_required` | Create a Tempo-approved key for the project, or set `TEMPO_API_KEY`. |
| `403` "CLI sessions cannot call this route" | Set `TEMPO_API_KEY`, or create a key with `tempo api keys create`. |
## Related
[Tempo API](https://tempo.com/developers/docs/api): Access methods, endpoint reference, and request examples
[API keys](https://tempo.com/developers/docs/api/console/api-keys): Scopes, environments, and key management
[Tempo Console](https://tempo.com/developers/docs/api/console): Projects, keys, billing, and team access
> Source: [/docs/cli/wallet](https://tempo.com/developers/docs/cli/wallet.md)
> Section: [Get Started](https://tempo.com/developers/get-started.md). Choose a starting point, send a test payment, get testnet funds, connect a coding agent, find the SDKs and CLI, and use the resource guides to plan payment workflows, liquidity, provider selection, and partner integrations.
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
# `tempo wallet`
`tempo wallet` is the command-line way to use [Tempo Wallet](https://wallet.tempo.xyz) from scripts, terminals, and AI agents. Use it to sign in, manage balances and access keys, discover [MPP](https://mpp.dev/overview) services, fund token balances, and manage payment sessions. Use [`tempo request`](https://tempo.com/developers/docs/cli/request) when you want the CLI to make the paid HTTP call.
[Install the Tempo CLI](https://tempo.com/developers/docs/cli#install) first. The launcher installs the wallet and request extensions the first time you run them.
## Usage
```bash [Terminal]
tempo wallet [FLAGS]
```
## Sign in
```bash [Terminal]
tempo wallet login
tempo wallet whoami
```
`login` opens a browser flow to connect your [Tempo Wallet](https://wallet.tempo.xyz). If you don't have one, the flow creates it. When `whoami` reports `ready=true`, the wallet is configured for [`tempo request`](https://tempo.com/developers/docs/cli/request). Check the balance and preview the request to confirm it can cover the payment.
* On a remote host where the browser is on another device, run `tempo wallet login --no-browser`.
* Run `tempo wallet refresh` to refresh a stale access key without signing out.
* Run `tempo wallet logout --yes` to disconnect.
## Balances
```bash [Terminal]
tempo wallet whoami
tempo wallet whoami --mach
```
`whoami` shows your address, token balances, and key state. Use `--mach` to show your onchain MACH balance.
## Access keys
```bash [Terminal]
tempo wallet keys
tempo wallet revoke --dry-run
tempo wallet revoke
```
Each wallet can have multiple access keys with independent spending limits. Use access-key limits to constrain account spending, and revoke keys that are no longer needed. These keys authorize transactions; they are separate from [Tempo API keys](https://tempo.com/developers/docs/api/authentication).
## Add funds
```bash [Terminal]
tempo wallet fund
tempo wallet fund --mach
tempo wallet fund --crypto
```
On testnet, the default flow opens the faucet. On mainnet, it opens available funding options. `--crypto` opens direct crypto funding. `--mach` opens [MACH](https://wallet.tempo.xyz/agent#mach) checkout on mainnet.
Transfer tokens to another address:
```bash [Terminal]
tempo wallet transfer --dry-run
tempo wallet transfer
```
Check the network and balance with `tempo wallet whoami` before funding. For more options, see [Fund an account](https://tempo.com/developers/docs/guide/getting-funds).
## Discover services
```bash [Terminal]
tempo wallet services
tempo wallet services --search
tempo wallet services
```
The [Machine Payments Protocol](https://mpp.dev/overview) (MPP) lets HTTP endpoints accept payments inline. The service directory indexes MPP-registered providers. Each entry shows endpoint URLs, HTTP methods, pricing, and request schemas. Use it to find the exact URL and payload for [`tempo request`](https://tempo.com/developers/docs/cli/request).
Agents that support MCP can also use the read-only services MCP server at `https://mpp.dev/mcp/services`. See [Find services](https://tempo.com/developers/docs/guide/machine-payments/discover-services) for MCP setup, JSON-RPC examples, and the public catalog API.
## Payment sessions
When you use [pay-as-you-go](https://tempo.com/developers/docs/guide/machine-payments/pay-as-you-go) services, MPP opens a [session](https://mpp.dev/payment-methods/tempo/session): a payment channel where your wallet deposits funds into a reserve contract, then pays per request with signed [vouchers](https://mpp.dev/protocol/credentials). Vouchers are exchanged offchain; opening, funding, settling, and closing a channel are onchain operations.
`tempo wallet` tracks session state locally:
```bash [Terminal]
tempo wallet sessions list
tempo wallet sessions sync
tempo wallet sessions close --all
tempo wallet sessions close --orphaned
tempo wallet sessions close --finalize
```
`sync` reconciles local records with onchain state. `close --orphaned` targets orphaned onchain channels. `close --finalize` finalizes channels already pending close. Add `--dry-run` to any close command to preview it first.
## Agent and script mode
Add `-t` for compact, machine-readable [TOON](https://toonformat.dev/) output. Preview paid requests with `--dry-run` and cap them with `--max-spend`:
```bash [Terminal]
tempo wallet -t whoami
tempo wallet -t services --search
tempo wallet -t services
tempo request -t --dry-run -X POST --json '{"input":"hello"}' /
tempo request -t --max-spend 1.00 -X POST --json '{"input":"hello"}' /
```
See [Recipes](https://tempo.com/developers/docs/wallet/recipes) for complete flows, including agent setup.
## Commands
| Command | Description |
| --- | --- |
| `tempo wallet login` | Connect or create a wallet through browser sign-in. |
| `tempo wallet logout` | Disconnect and clear local credentials. |
| `tempo wallet refresh` | Refresh the current access key. |
| `tempo wallet whoami` | Print readiness, address, balances, and key state. |
| `tempo wallet keys` | List access keys and their spending limits. |
| `tempo wallet revoke ` | Revoke an access key. |
| `tempo wallet fund` | Fund the wallet: the faucet on testnet, funding options on mainnet. |
| `tempo wallet transfer ` | Transfer tokens to another address. |
| `tempo wallet services []` | List registered services, or show one service's endpoints, methods, and request schemas. |
| `tempo wallet sessions list` | List active payment sessions. |
| `tempo wallet sessions sync` | Reconcile local sessions with onchain state. |
| `tempo wallet sessions close` | Close payment sessions. |
| `tempo wallet debug` | Collect debug info for support. |
| `tempo wallet completions ` | Generate shell completions. |
## Flags
### All commands
| Flag | Description |
| --- | --- |
| `-t` | Print compact, machine-readable [TOON](https://toonformat.dev/) output. |
| `--help` | Show the command's flags. |
### `tempo wallet login`
| Flag | Description |
| --- | --- |
| `--no-browser` | Print the sign-in URL instead of opening a browser, for remote hosts. |
### `tempo wallet logout`
| Flag | Description |
| --- | --- |
| `--yes` | Skip the confirmation prompt. |
### `tempo wallet whoami`
| Flag | Description |
| --- | --- |
| `--mach` | Show the onchain MACH balance. |
### `tempo wallet revoke`
| Flag | Description |
| --- | --- |
| `--dry-run` | Preview the revocation without submitting it. |
### `tempo wallet fund`
| Flag | Description |
| --- | --- |
| `--crypto` | Open direct crypto funding. |
| `--mach` | Buy MACH for supported services. |
### `tempo wallet transfer`
| Flag | Description |
| --- | --- |
| `--dry-run` | Preview the transfer without submitting it. |
| `--mpp-challenge-file ` | Pay the MPP challenge in this headers file, captured with `tempo request -D`. |
### `tempo wallet services`
| Flag | Description |
| --- | --- |
| `--search ` | Filter services by keyword. |
### `tempo wallet sessions close`
| Flag | Description |
| --- | --- |
| `--all` | Close all sessions. |
| `--orphaned` | Close orphaned onchain channels. |
| `--finalize` | Finalize channels already pending close. |
| `--cooperative ` | Request a cooperative close from the service. |
| `--dry-run` | Preview the close without submitting it. |
## Related
[tempo request](https://tempo.com/developers/docs/cli/request): Make paid HTTP requests from the terminal
[Tempo Wallet](https://wallet.tempo.xyz): Open the web wallet to manage your account
[MPP overview](https://mpp.dev/overview): How services request and verify payment
[Source code](https://github.com/tempoxyz/wallet-cli): tempoxyz/wallet-cli on GitHub
> Source: [/docs/wallet/recipes](https://tempo.com/developers/docs/wallet/recipes.md)
> Section: [Get Started](https://tempo.com/developers/get-started.md). Choose a starting point, send a test payment, get testnet funds, connect a coding agent, find the SDKs and CLI, and use the resource guides to plan payment workflows, liquidity, provider selection, and partner integrations.
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
# `tempo wallet` recipes
Use these recipes after [signing in to Tempo Wallet](https://tempo.com/developers/docs/cli/wallet#sign-in). For the first paid request, follow [Pay with the CLI](https://tempo.com/developers/docs/guide/machine-payments/agent).
## Let an agent pay for services
Set up your agent with the [prompt on the CLI overview](https://tempo.com/developers/docs/cli#set-up-your-agent). It installs two skills in skill-enabled agents such as Claude Code, Amp, and Codex:
| Skill | Description |
| --- | --- |
| `tempo-wallet` | Readiness checks, balances, service discovery, and session and funding actions. |
| `tempo-request` | Paid HTTP requests with payment preview (`--dry-run`) and execution. |
Tempo Wallet uses mainnet for live payments. Check the network and balance before authorizing spending, and set both limits:
* **Per command:** `tempo request --max-spend` caps one command's payment spending.
* **Per account:** access-key limits apply separately to the signing key. See [Give an agent a wallet](https://tempo.com/developers/docs/accounts/automations/give-an-agent-a-wallet) for authorization and revocation.
Service discovery returns endpoint metadata, and `--dry-run` reads the current payment terms without paying. Neither replaces handling the service's result or errors. For the commands, see [agent and script mode](https://tempo.com/developers/docs/cli/wallet#agent-and-script-mode).
## Find and pay for a service
Search with `tempo wallet services --search ` and inspect the chosen service with `tempo wallet services `. Use its endpoint and schema in [`tempo request`](https://tempo.com/developers/docs/cli/request); preview with `--dry-run` and set `--max-spend` when paying.
## Reconcile and close payment sessions
```bash [Terminal]
tempo wallet sessions list
tempo wallet sessions sync
tempo wallet sessions close --dry-run --all
tempo wallet sessions close --orphaned
tempo wallet sessions close --finalize
```
`sync` reconciles local records with onchain state. Inspect the close preview before closing sessions. `--orphaned` targets orphaned onchain channels; `--finalize` completes channels already pending close.
## Recover the wallet connection
Run `tempo wallet whoami` to inspect readiness and balances. If the access key is stale, run `tempo wallet refresh`. If you're signed out, run `tempo wallet login`.
For a request schema error, inspect `tempo wallet services `. For insufficient funds, [add funds](https://tempo.com/developers/docs/cli/wallet#add-funds). Add `-t` for machine-readable output in scripts.
## Related
[tempo wallet](https://tempo.com/developers/docs/cli/wallet#commands): Every wallet command and its options
[tempo request](https://tempo.com/developers/docs/cli/request#flags): Request flags for paid HTTP calls
[Give an agent access](https://tempo.com/developers/docs/accounts/automations/give-an-agent-a-wallet): Authorize and revoke an agent's access key
> Source: [/docs/cli/request](https://tempo.com/developers/docs/cli/request.md)
> Section: [Get Started](https://tempo.com/developers/get-started.md). Choose a starting point, send a test payment, get testnet funds, connect a coding agent, find the SDKs and CLI, and use the resource guides to plan payment workflows, liquidity, provider selection, and partner integrations.
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
# `tempo request`
A curl-compatible HTTP client that handles [Machine Payments Protocol](https://mpp.dev/overview) negotiation transparently. When a server responds with [`402 Payment Required`](https://mpp.dev/protocol/http-402), `tempo request` reads the [challenge](https://mpp.dev/protocol/challenges), authorizes payment using the configured method, then retries with the [credential](https://mpp.dev/protocol/credentials) in one command.
For the wallet-backed flow, run [`tempo wallet login`](https://tempo.com/developers/docs/cli/wallet#sign-in) first. A `--dry-run` preview can read payment terms without logging in. Use [`tempo wallet services`](https://tempo.com/developers/docs/cli/wallet#discover-services) before calling paid endpoints so agents and scripts use registered URLs, methods, pricing, and request schemas instead of guessing.
## Usage
```bash [Terminal]
tempo request [FLAGS]
```
```bash [Terminal]
tempo request --dry-run
tempo request --max-spend
tempo request -X POST --json ''
tempo request -H ': '
```
## Examples
Preview the cost before paying:
```bash [Terminal]
tempo request --dry-run -X POST \
--json '{"prompt":"a sunset over the ocean"}' \
https://fal.mpp.tempo.xyz/fal-ai/flux/dev
```
Make the paid request:
```bash [Terminal]
tempo request -X POST \
--json '{"prompt":"a sunset over the ocean"}' \
https://fal.mpp.tempo.xyz/fal-ai/flux/dev
```
## Flags
| Flag | Description |
| --- | --- |
| `-X ` | HTTP method, such as `GET` or `POST`. |
| `--json ` | Send a JSON body. Implies `-X POST`. |
| `-H ` | Add a custom header. |
| `--dry-run` | Request payment terms without paying. |
| `--max-spend ` | Set a hard cap on cumulative payment spend. |
| `-D, --dump-header ` | Write response headers to a file, useful for inspecting MPP challenges. |
| `-t, --toon-output` | Print compact, machine-readable output for scripts and agents. |
## Related
[tempo wallet](https://tempo.com/developers/docs/cli/wallet): Sign in and discover services
[MPP protocol](https://mpp.dev/protocol): Challenges, credentials, and receipts
[MPP SDKs](https://mpp.dev/sdk): Choose a client or server SDK
[Accept payments](https://tempo.com/developers/docs/guide/machine-payments/server): Add MPP to your own API
> Source: [/docs/cli/download](https://tempo.com/developers/docs/cli/download.md)
> Section: [Get Started](https://tempo.com/developers/get-started.md). Choose a starting point, send a test payment, get testnet funds, connect a coding agent, find the SDKs and CLI, and use the resource guides to plan payment workflows, liquidity, provider selection, and partner integrations.
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
# `tempo download`
Download chain snapshots for faster initial sync. `tempo download` fetches execution state, static files, and consensus data, and generates a `reth.toml` prune config for the target data directory. Current releases resolve the default data directory and snapshot manifest from the selected chain.
Running `tempo download` without a snapshot profile opens an interactive component selector. A profile flag such as `--minimal` or `--archive` skips the selector. Validators should use `--minimal`. RPC providers, indexers, and other workloads that need complete historical data should use `--archive`.
## Usage
```bash [Terminal]
tempo download [FLAGS]
```
## Examples
Preview a validator snapshot download before making changes:
```bash [Terminal]
tempo download --chain mainnet --minimal --print-plan-json
```
The JSON plan includes archive URLs, sizes, and checksums when the manifest supplies them. It includes the consensus archive from `v1.12.0` onward. Planning still fetches snapshot metadata.
Open the interactive selector for mainnet:
```bash [Terminal]
tempo download --chain mainnet
```
Download an archive snapshot for an RPC node:
```bash [Terminal]
tempo download --chain mainnet --archive
```
List available snapshots, optionally for one chain:
```bash [Terminal]
tempo download --list
tempo download --list --chain moderato
```
If the data directory has limited free disk space, disable resumable downloads and stream the snapshot directly into extraction:
```bash [Terminal]
tempo download --chain mainnet --minimal --resumable=false
```
Use the [snapshots viewer](https://snapshots.tempo.xyz/) to compare snapshot profiles and copy generated commands. Then start your node with [`tempo node`](https://tempo.com/developers/docs/cli/node).
## Validator migration
Validators should use the minimal snapshot profile, even if the previous validator data directory used a different profile.
Migrating from archive v1 to minimal v2 reduces validator node size approximately as follows:
| Network | Before | After | Reduction |
| --- | ---: | ---: | ---: |
| Mainnet | 27 GB | 10 GB | 2.7x |
| Moderato testnet | 1 TB | 100 GB | 10x |
### What is minimal mode?
Minimal mode is a Reth storage profile for nodes that need to follow the chain and serve recent state, such as validators. It keeps disk usage low by pruning older historical data. If the node serves historical RPC, indexing, archive, or tracing workloads, use `--archive` instead.
See Reth's [Minimal Storage Mode](https://reth.rs/run/storage/minimal/) docs for the storage trade-offs.
### Am I running a minimal node?
Inspect the node startup logs for the `Loaded storage settings` line and its `pruning_mode` field. If `pruning_mode` is `minimal`, no migration is needed unless you are replacing the node.
To migrate or replace a validator snapshot, run the command for your network:
```bash [Terminal]
# Mainnet
tempo download --chain mainnet --minimal --force
# Moderato testnet
tempo download --chain moderato --minimal --force
```
`--force` removes the execution databases, static files, `reth.toml`, and the entire consensus directory before installing the new snapshot. It preserves `discovery-secret` and `known-peers.json`.
:::note[Unsure which profile to use?]
If you are unsure which pruning configuration your validator is running, reach out to the Tempo team before replacing snapshot data.
:::
## Flags
| Flag | Description |
| --- | --- |
| `--chain ` | Target network: `mainnet` or `moderato`. |
| `--datadir ` | Data directory for downloaded state. |
| `--consensus.datadir ` | Destination for consensus snapshot data. Defaults to `/consensus`. Match the node's `--consensus.datadir` when using a separate volume. |
| `-u, --url ` | Download a single legacy snapshot archive URL. |
| `--manifest-url ` | Download a specific modular snapshot manifest URL. |
| `--list` | List available snapshots. |
| `--print-plan-json` | Print the selected execution and consensus archive plan without downloading archives or modifying the data directory. Select a profile such as `--minimal`. |
| `--resumable[=]` | Download to disk before extraction so interrupted downloads can resume. Defaults to `true`. |
| `--minimal` | Download the minimal component set without opening the selector. Validators should use this profile. |
| `--full` | Download the full node component set. |
| `--archive, --all` | Download all available components without opening the selector. Recommended for RPC providers and indexers. |
| `-y, --non-interactive` | Skip the selector and download the minimal component set unless component flags are set. |
| `--force` | Replace existing snapshot state, including the entire consensus directory. Preserves `discovery-secret` and `known-peers.json`. |
## Related
[tempo node](https://tempo.com/developers/docs/cli/node): Start a node from the downloaded snapshot
[Run a Tempo node](https://tempo.com/developers/docs/guide/node): System requirements, systemd, monitoring
[Snapshots viewer](https://snapshots.tempo.xyz/): Compare profiles and copy download commands
> Source: [/docs/cli/node](https://tempo.com/developers/docs/cli/node.md)
> Section: [Get Started](https://tempo.com/developers/get-started.md). Choose a starting point, send a test payment, get testnet funds, connect a coding agent, find the SDKs and CLI, and use the resource guides to plan payment workflows, liquidity, provider selection, and partner integrations.
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
# `tempo node`
Run a Tempo node. For faster initial sync, first download a snapshot with [`tempo download`](https://tempo.com/developers/docs/cli/download). For system requirements, systemd configs, monitoring, and validator onboarding, see [Run a Tempo node](https://tempo.com/developers/docs/guide/node).
## Usage
```bash [Terminal]
tempo node [FLAGS]
```
## Examples
After downloading a snapshot, start an RPC node:
```bash [Terminal]
tempo node \
--follow \
--http --http.port 8545 \
--http.api eth,net,web3,txpool,trace
```
Start a validator:
```bash [Terminal]
tempo node --datadir /data/tempo \
--chain mainnet \
--consensus.signing-key /etc/tempo/key \
--consensus.secret /run/tempo/consensus-secret
```
## Flags
### Network
| Flag | Description |
| --- | --- |
| `--follow` | Run as a full node following a trusted RPC endpoint. |
| `--chain ` | Target network: `mainnet` or `moderato`. |
| `--datadir ` | Data directory for chain state. |
| `--trusted-peers ` | Comma-separated enode URLs or ENRs to add as trusted execution P2P peers. |
| `--trusted-only` | Connect to and accept execution P2P connections from trusted peers only. |
| `--disable-discovery` | Disable DNS, discv4, and discv5 peer discovery. |
### RPC server
| Flag | Description |
| --- | --- |
| `--http` | Enable the JSON-RPC HTTP server. |
| `--http.port ` | JSON-RPC port. Defaults to `8545`. |
| `--http.addr ` | JSON-RPC bind address. |
| `--http.api ` | Enabled API namespaces, such as `eth,net,web3,txpool,trace`. |
### Consensus (validators)
| Flag | Description |
| --- | --- |
| `--consensus.signing-key ` | Path to the validator signing key. |
| `--consensus.secret ` | Path to the secret that decrypts an encrypted validator signing key. Prefer a named pipe (FIFO) or shell process substitution. |
| `--consensus.datadir ` | Separate volume for consensus data. |
:::warning
`--consensus.fee-recipient` was removed in `v1.7.0`. Remove it from startup commands and [update the fee recipient onchain](https://tempo.com/developers/docs/guide/node/validator-lifecycle#update-the-fee-recipient).
:::
### Transaction pool
| Flag | Description |
| --- | --- |
| `--txpool.filter ` | Optional address filter, available since `v1.14.0`. Accepts comma-separated addresses or a plain-text file with comma- or newline-separated addresses. Rejects transactions whose sender or direct call target matches, at pool admission. |
See [Transaction address filtering](https://tempo.com/developers/docs/guide/node/validator-setup#transaction-address-filtering) for examples, file reload behavior, and the limits of this local policy.
### Observability
| Flag | Description |
| --- | --- |
| `--telemetry-url ` | Unified metrics and logs export endpoint. |
| `--telemetry-metrics-interval ` | Metrics push interval. Defaults to `10s`. |
| `--metrics ` | Enable Prometheus metrics on this port. |
## Related
[tempo download](https://tempo.com/developers/docs/cli/download): Download snapshots for faster initial sync
[Run a Tempo node](https://tempo.com/developers/docs/guide/node): System requirements, systemd, monitoring
[Become a validator](https://tempo.com/developers/docs/guide/node/validator): Apply to join the validator set and operate a node
[Source code](https://github.com/tempoxyz/tempo): tempoxyz/tempo on GitHub
> Source: [/docs/sdk](https://tempo.com/developers/docs/sdk.md)
> Section: [Get Started](https://tempo.com/developers/get-started.md). Choose a starting point, send a test payment, get testnet funds, connect a coding agent, find the SDKs and CLI, and use the resource guides to plan payment workflows, liquidity, provider selection, and partner integrations.
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
# Tempo SDKs: available languages and tools
Use the TypeScript SDK with Viem or Wagmi, or choose a client for your application’s language.
| Language | Package | Install | Use it for |
| --- | --- | --- | --- |
| TypeScript | `viem`, imported from `viem/tempo` | `npm install viem` | Reads, transactions, and Tempo actions in scripts and servers |
| TypeScript (React) | `wagmi`, imported from `wagmi/tempo` | [Wagmi setup](https://wagmi.sh/tempo) | Wallet-connected React apps |
| TypeScript | `tapimo` | `pnpm add tapimo` | Typed client for the [Tempo API](https://tempo.com/developers/docs/api) |
| TypeScript | `mppx` | `npm install mppx viem` | Paying for and charging for APIs with [Machine Payments](https://tempo.com/developers/docs/agents) |
| Python | `pytempo` | `pip install pytempo` | web3.py extension for Tempo Transactions |
| Go | `github.com/tempoxyz/tempo-go` | `go get github.com/tempoxyz/tempo-go` | RPC client, signer, and Tempo Transactions |
| Rust | `tempo-alloy` | [Rust setup](https://tempo.com/developers/docs/sdk/rust) | Alloy network type and Tempo actions |
| Solidity | Foundry with `tempo-std` | `foundryup`, then `forge install tempoxyz/tempo-std` | Building, testing, and deploying contracts |
Each language page pins tested versions and shows a first transaction.
[TypeScript](https://tempo.com/developers/docs/sdk/typescript): Build on Tempo using TypeScript
[Go](https://tempo.com/developers/docs/sdk/go): Build on Tempo using Go
[Python](https://tempo.com/developers/docs/sdk/python): Build on Tempo using Python
[Foundry](https://tempo.com/developers/docs/sdk/foundry): Build on Tempo using Foundry
[Rust](https://tempo.com/developers/docs/sdk/rust): Build on Tempo using Rust
> Source: [/docs/sdk/typescript](https://tempo.com/developers/docs/sdk/typescript.md)
> Section: [Get Started](https://tempo.com/developers/get-started.md). Choose a starting point, send a test payment, get testnet funds, connect a coding agent, find the SDKs and CLI, and use the resource guides to plan payment workflows, liquidity, provider selection, and partner integrations.
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
# TypeScript SDKs: Viem extension and Account SDK
Tempo distributes TypeScript SDKs for:
* [Viem](https://viem.sh): TypeScript interface for EVM blockchains
* [Wagmi](https://wagmi.sh): React Hooks (and reactive primitives) for EVM blockchains
Use `viem/tempo` for onchain reads and transactions, Wagmi for wallet-connected React applications, and the [Tempo API client](https://tempo.com/developers/docs/sdk/typescript/api-client) for indexed data and hosted services.
[Viem Setup](https://viem.sh/tempo): Set up a Viem client to interact with Tempo
[Wagmi Setup](https://wagmi.sh/tempo): Set up a Wagmi configuration with Tempo
:::tip
**When should I use Wagmi vs. Viem?**
* **Viem** is best suited for **libraries, tooling, servers, scripting, etc** – a low-level and stateless interface for the EVM
* **Wagmi** is best suited for **applications & wallets** – a high-level and stateful interface for the EVM (React Hooks, Vanilla JS, etc)
:::
## Viem SDK for Tempo
Use Viem for Node.js scripts, servers, and other headless applications.
### Connect to Tempo Testnet and send a stablecoin
Install Viem:
```bash
npm install viem
```
Connect to Tempo Testnet, fund an account, read its alphaUSD balance, and send a confirmed transfer.
```ts twoslash [testnet.ts] filename="testnet.ts"
import { Account, createClient } from 'viem/tempo'
const privateKey = process.env.TEMPO_PRIVATE_KEY
if (!privateKey || !/^0x[0-9a-fA-F]{64}$/.test(privateKey)) {
throw new Error('Set TEMPO_PRIVATE_KEY to your test account private key')
}
const account = Account.fromSecp256k1(privateKey as `0x${string}`)
const token = '0x20c0000000000000000000000000000000000001' // alphaUSD on Moderato
const client = createClient({ account, testnet: true, feeToken: token })
await client.faucet.fundSync({ account })
const balance = await client.token.getBalance({ token })
console.log('Balance:', balance.formatted)
const { receipt } = await client.token.transferSync({
amount: { formatted: '1' },
to: '0x742d35cc6634c0532925a3b844bc9e7595f0bebb',
token,
})
console.log('Transaction hash:', receipt.transactionHash)
```
:::warning
This example is testnet-only. For mainnet, use a funded mainnet account and token, omit `testnet: true`, and remove the faucet call.
:::
`balance` includes the amount in base units, the token's decimals, and a formatted value. `transferSync` waits for the transaction to be included; `receipt.transactionHash` identifies the transaction.
The same client includes standard Viem methods such as `getBlockNumber`, `getTransaction`, `getTransactionReceipt`, `getLogs`, `readContract`, and `simulateContract`.
### Tempo Transactions
| Goal | Viem input | Guide |
| --- | --- | --- |
| Send multiple calls together | `calls` | [Batch calls](https://tempo.com/developers/docs/guide/tempo-transaction#batch-calls) |
| Pay fees with a chosen token | `feeToken` | [Configurable fee tokens](https://tempo.com/developers/docs/guide/tempo-transaction#configurable-fee-tokens) |
| Let another account pay the fees | `feePayer` | [Fee sponsorship](https://tempo.com/developers/docs/guide/tempo-transaction#fee-sponsorship) |
| Send independent transaction sequences | `nonceKey` | [Concurrent transactions](https://tempo.com/developers/docs/guide/tempo-transaction#concurrent-transactions) |
| Limit when a transaction can run | `validAfter` and `validBefore` | [Scheduled transactions](https://tempo.com/developers/docs/guide/tempo-transaction#scheduled-transactions) |
### Tempo guides and API reference
[Payments](https://tempo.com/developers/docs/guide/payments): Send and accept stablecoins, attach memos, and configure payment controls
[Stablecoin Issuance](https://tempo.com/developers/docs/guide/issuance): Launch and operate a TIP-20 stablecoin
[Stablecoin Exchange](https://tempo.com/developers/docs/guide/stablecoin-dex): Trade stablecoins and provide liquidity
[Tempo Transactions](https://tempo.com/developers/docs/guide/tempo-transaction): Use fee tokens, sponsorship, batching, access keys, and concurrent transactions
[Actions](https://viem.sh/tempo/actions): Viem Actions for querying data, sending transactions, managing tokens and exchange orders, and more
## Wagmi SDK for Tempo
[Hooks](https://wagmi.sh/tempo/hooks): Wagmi React Hooks for building apps on Tempo
[Connectors](https://wagmi.sh/tempo/connectors): Wagmi Connectors for connecting between wallets, apps, and Tempo
[Actions](https://wagmi.sh/tempo/actions): Wagmi Actions for querying data, sending transactions, managing tokens and exchange orders, and more
> Source: [/docs/sdk/typescript/api-client](https://tempo.com/developers/docs/sdk/typescript/api-client.md)
> Section: [Get Started](https://tempo.com/developers/get-started.md). Choose a starting point, send a test payment, get testnet funds, connect a coding agent, find the SDKs and CLI, and use the resource guides to plan payment workflows, liquidity, provider selection, and partner integrations.
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
# Tempo API client for TypeScript
Use the Tempo API Typed Client for endpoint autocomplete and full end-to-end type-safety across API parameters, response bodies, statuses, and errors.
## Install Tempo API package
Install [`tapimo`](https://www.npmjs.com/package/tapimo), the typed client. Its only dependency is [Hono](https://hono.dev).
```bash
pnpm add tapimo
```
## Create typed Tempo API client
Create a Tempo API client with `Client.create`.
```ts twoslash [client.ts]
import { Client } from 'tapimo'
const client = Client.create({
apiKey: process.env.TEMPO_API_KEY,
})
```
`Client.create()` also accepts Hono client options such as a custom `fetch` implementation. If you pass `apiKey`, the client merges it into the request headers as `tempo-api-key`.
## Make type-safe Tempo API requests
Requests are end-to-end type-safe across parameters, response bodies, statuses, and errors. For example, `GET /v1/tokens/:token` narrows the response body from the HTTP status:
```ts twoslash [tokens.ts]
import { Client } from 'tapimo'
const client = Client.create()
const response = await client.v1.tokens[':token'].$get({
param: { token: '0x20c0000000000000000000006a37da5c996874be' },
})
// Narrow responses by status.
if (response.status !== 200) {
response.status // status is now typed to non-200 series
// ^?
if (response.status === 404) {
// Handle 404 status specifically
const json = await response.json()
// ^?
json.error.code // which narrows to "token_not_found"
// ^?
} else if (response.status === 402) {
// Handle the payment challenge from `WWW-Authenticate`
const challenge = response.headers.get('WWW-Authenticate')
// ^?
} else {
// Handle validation, auth, rate-limit, or upstream errors
const json = await response.json()
// ^?
}
throw new Error('Request failed')
}
// Request succeeded
response.status // Response is narrowed to 200
// ^?
// Get typed response body
const token = await response.json()
// ^?
token.symbol
// ^?
```
## Tempo API endpoint autocomplete
Routes autocomplete directly on the client, so you can discover endpoints without leaving your editor:
```ts twoslash [endpoints.ts]
// @noErrors
import { Client } from 'tapimo'
const client = Client.create()
const response1 = await client.v1.
// ^|
const response2 = await client.v1.transactions.
// ^|
```
## Call Tempo JSON-RPC through Typed Client
The Typed Client exposes the raw JSON-RPC passthrough as a typed route under `client.rpc`. The route key includes Hono's path pattern. Select `mainnet`, `testnet`, or a numeric chain ID:
```ts twoslash [rpc.ts]
// @noErrors
import { Client } from 'tapimo'
const client = Client.create()
const response = await client.rpc[':chain{(mainnet|testnet|[0-9]+)}'].$post({
param: { chain: 'testnet' },
json: {
jsonrpc: '2.0',
id: 1,
method: 'eth_blockNumber',
params: [],
},
})
if (response.status !== 200) {
throw new Error(`RPC request failed: HTTP ${response.status}`)
}
const body = await response.json()
if (body === null || Array.isArray(body))
throw new Error('Expected one JSON-RPC response')
if ('error' in body) throw new Error(body.error.message)
const blockNumber = body.result
```
Chain selectors map to these hosted endpoints:
| `chain` value | Hosted RPC path |
| --- | --- |
| No selector (`client.rpc.$post`) | `https://api.tempo.xyz/rpc` |
| `'mainnet'` | `https://api.tempo.xyz/rpc/mainnet` |
| `'testnet'` | `https://api.tempo.xyz/rpc/testnet` |
| `'4217'` | `https://api.tempo.xyz/rpc/4217` |
### Send batch JSON-RPC requests
The JSON-RPC body type accepts one request or an array of requests. The client narrows the success body to the same single-or-batch response union:
```ts twoslash [batch-rpc.ts]
// @noErrors
import { Client } from 'tapimo'
const client = Client.create()
const response = await client.rpc[':chain{(mainnet|testnet|[0-9]+)}'].$post({
param: { chain: 'mainnet' },
json: [
{ jsonrpc: '2.0', id: 1, method: 'eth_chainId', params: [] },
{ jsonrpc: '2.0', id: 2, method: 'eth_blockNumber', params: [] },
],
})
if (response.status === 200) {
const results = await response.json()
// results is typed as one JSON-RPC response or an array of JSON-RPC responses.
}
```
> Source: [/docs/sdk/typescript/prool/setup](https://tempo.com/developers/docs/sdk/typescript/prool/setup.md)
> Section: [Get Started](https://tempo.com/developers/get-started.md). Choose a starting point, send a test payment, get testnet funds, connect a coding agent, find the SDKs and CLI, and use the resource guides to plan payment workflows, liquidity, provider selection, and partner integrations.
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
# Prool setup: local Tempo test environment
Set up pooled Tempo node instances in TypeScript using [`prool`](https://github.com/wevm/prool) by following the steps below.
::::steps
## Install Prool for Tempo
:::code-group
```bash [npm]
npm i prool
```
```bash [pnpm]
pnpm i prool
```
```bash [bun]
bun i prool
```
:::
Install the [Tempo CLI](https://tempo.com/developers/docs/cli) and ensure `tempo` is on your `PATH`. Prool starts that binary; the JavaScript package doesn't include a node. Each pooled instance consumes local CPU, memory, and disk space.
## Create a Prool instance
You can programmatically start a Tempo node instance in TypeScript using `Instance.tempo`:
```ts
import { Instance, Server } from 'prool'
const server = Server.create({
instance: Instance.tempo(),
});
// Start the node
await server.start()
// Instances available at:
// - http://localhost:8545/1
// - http://localhost:8545/2
// - http://localhost:8545/3
// - http://localhost:8545/4
// - http://localhost:8545/n
```
:::tip
You can also set up the Tempo instance using `Instance.tempo` directly if you
do not need pooling.
```ts
import { Instance } from 'prool';
const instance = Instance.tempo()
// Start the node
await instance.start()
// Instance available at: http://localhost:8545
```
:::
## Next steps for Prool
After you have set up Tempo with Prool, you can now:
* Easily use Tempo in your test suite with Vitest
* Run Tempo locally alongside your Vite or Next.js development server
::::
> Source: [/docs/sdk/rust](https://tempo.com/developers/docs/sdk/rust.md)
> Section: [Get Started](https://tempo.com/developers/get-started.md). Choose a starting point, send a test payment, get testnet funds, connect a coding agent, find the SDKs and CLI, and use the resource guides to plan payment workflows, liquidity, provider selection, and partner integrations.
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
# Tempo Rust SDK: installing and using it
Tempo distributes a Rust SDK in the form of an [Alloy](https://alloy.rs) crate. Alloy is a popular Rust crate for interacting with EVM-compatible blockchains.
The Tempo Alloy crate can be used to perform common operations with the chain, such as: querying the chain, sending Tempo Transactions, managing tokens and interacting with the stablecoin exchange, and more.
::::steps
## Install the Rust SDK
Use Rust 1.95 or later for `tempo-alloy` 1.10.1. Install [Alloy](https://alloy.rs), the async runtime, and the Tempo extension:
```bash [cargo]
cargo add alloy@2.1.1
cargo add tokio --features macros,rt-multi-thread
cargo add tempo-alloy --git https://github.com/tempoxyz/tempo --tag tempo-alloy@1.10.1
```
:::tip
We use [`tokio`](https://tokio.rs) in this example, but you can use any async runtime.
:::
## Configure a Rust provider
To use the Tempo extension crate, you will need to create a [`Provider`] using the [`TempoNetwork`](https://tempoxyz.github.io/tempo/tempo_alloy/struct.TempoNetwork.html). This will enable the usage of Tempo specific types on the [`Provider`] instance.
Set `RPC_URL=https://rpc.moderato.tempo.xyz` to use Moderato testnet.
For more information about network types, see the Alloy [documentation](https://alloy.rs/guides/interacting-with-multiple-networks#interacting-with-multiple-networks).
```rs [main.rs]
use alloy::providers::{Provider, ProviderBuilder}; // [!code focus]
use tempo_alloy::TempoNetwork; // [!code focus]
#[tokio::main]
async fn main() -> Result<(), Box> {
let provider = ProviderBuilder::new_with_network::() // [!code focus]
.connect(&std::env::var("RPC_URL").expect("No RPC URL set")) // [!code focus]
.await?; // [!code focus]
println!("Provider connected successfully"); // [!code focus]
println!("Chain ID: {}", provider.get_chain_id().await?); // [!code focus]
Ok(())
}
```
## Use Tempo actions in Rust
Now we are ready to use the provider to interact with the network. We can use the provider to send transactions, read data, and more.
```rs [main.rs]
use alloy::providers::{Provider, ProviderBuilder};
use tempo_alloy::TempoNetwork;
#[tokio::main]
async fn main() -> Result<(), Box> {
let provider = ProviderBuilder::new_with_network::()
.connect(&std::env::var("RPC_URL").expect("No RPC URL set"))
.await?;
// [!code focus:2]
println!("{}", provider.get_block_number().await?);
// @log: 421045
Ok(())
}
```
See the Alloy [documentation](https://alloy.rs) or the [`Provider`] docs for more examples.
[`Provider`]: https://docs.rs/alloy/latest/alloy/providers/trait.Provider.html
::::
> Source: [/docs/sdk/go](https://tempo.com/developers/docs/sdk/go.md)
> Section: [Get Started](https://tempo.com/developers/get-started.md). Choose a starting point, send a test payment, get testnet funds, connect a coding agent, find the SDKs and CLI, and use the resource guides to plan payment workflows, liquidity, provider selection, and partner integrations.
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
# Tempo Go SDK: installing and using it
Tempo distributes a Go SDK for building application clients. The SDK provides packages for RPC communication, transaction signing, and key management.
The Tempo Go SDK can be used to perform common operations with the chain, such as: sending Tempo Transactions, batching multiple calls, fee sponsorship, and more.
::::steps
## Install the Go SDK
To install the Tempo Go SDK:
```bash [go]
go get github.com/tempoxyz/tempo-go@v0.5.0
```
:::tip
The SDK requires Go 1.25.9 or higher.
:::
## Create a Go RPC client
To interact with Tempo, first create an RPC client connected to a Tempo node:
```go [main.go]
package main
import (
"context"
"fmt"
"github.com/tempoxyz/tempo-go/pkg/client"
)
func main() {
c := client.New("https://rpc.moderato.tempo.xyz")
ctx := context.Background()
blockNum, _ := c.GetBlockNumber(ctx)
fmt.Printf("Connected to Tempo at block %d\n", blockNum)
}
```
For authenticated RPC endpoints:
```go [main.go]
c := client.New("https://rpc.moderato.tempo.xyz",
client.WithAuth("username", "password"),
)
```
## Create a Go transaction signer
Create a signer to sign transactions. The signer manages your private key and generates signatures:
```go [main.go]
package main
import (
"fmt"
"github.com/tempoxyz/tempo-go/pkg/signer"
)
func main() {
s, err := signer.NewSigner("0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80")
if err != nil {
panic(err)
}
fmt.Printf("Address: %s\n", s.Address().Hex())
}
```
## Send a Tempo transaction with Go
These examples use Moderato testnet (`42431`). Fund a test account with the [faucet](https://tempo.com/developers/docs/quickstart/faucet) and use its private key. The displayed Anvil key is public and must not hold real funds. Estimate gas for your actual calls; the limits below are example caps.
Build and send a transaction using the builder pattern:
```go [main.go]
package main
import (
"context"
"log"
"math/big"
"github.com/ethereum/go-ethereum/common"
"github.com/tempoxyz/tempo-go/pkg/client"
"github.com/tempoxyz/tempo-go/pkg/signer"
"github.com/tempoxyz/tempo-go/pkg/transaction"
)
func main() {
c := client.New("https://rpc.moderato.tempo.xyz")
s, _ := signer.NewSigner("0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80")
ctx := context.Background()
nonce, _ := c.GetTransactionCount(ctx, s.Address().Hex()) // [!code hl]
recipient := common.HexToAddress("0x70997970C51812dc3A010C7d01b50e0d17dc79C8")
// [!code hl:10]
tx := transaction.NewBuilder(big.NewInt(42431)). // Moderato testnet
SetNonce(nonce).
SetGas(100000).
SetMaxFeePerGas(big.NewInt(20000000000)). // Example maximum fee per gas
SetMaxPriorityFeePerGas(big.NewInt(1000000000)).
AddCall(recipient, big.NewInt(0), []byte{}).
Build()
transaction.SignTransaction(tx, s)
serialized, _ := transaction.Serialize(tx, nil)
hash, _ := c.SendRawTransaction(ctx, serialized) // [!code hl]
log.Printf("Transaction hash: %s", hash)
}
```
::::
## Go SDK examples
### Read chain data with Go
Query the blockchain for basic information:
```go [read.go]
ctx := context.Background()
blockNum, _ := c.GetBlockNumber(ctx)
chainID, _ := c.GetChainID(ctx)
nonce, _ := c.GetTransactionCount(ctx, "0x742d35Cc6634C0532925a3b844Bc9e7595f0bEbb")
fmt.Printf("Block: %d, Chain: %d, Nonce: %d\n", blockNum, chainID, nonce)
```
### Send a token transfer with Go
Send a TIP-20 token transfer using go-ethereum's ABI encoding:
```go [transfer.go]
import (
"strings"
"github.com/ethereum/go-ethereum/accounts/abi"
)
erc20ABI, _ := abi.JSON(strings.NewReader(`[{"name":"transfer","type":"function","inputs":[{"name":"to","type":"address"},{"name":"amount","type":"uint256"}]}]`))
recipient := common.HexToAddress("0x70997970C51812dc3A010C7d01b50e0d17dc79C8")
amount := big.NewInt(100_000_000) // 100 tokens (6 decimals)
transferData, _ := erc20ABI.Pack("transfer", recipient, amount)
tx := transaction.NewBuilder(big.NewInt(42431)).
SetNonce(nonce).
SetGas(100000).
SetMaxFeePerGas(big.NewInt(10000000000)).
SetMaxPriorityFeePerGas(big.NewInt(1000000000)).
AddCall(transaction.AlphaUSDAddress, big.NewInt(0), transferData).
Build()
```
### Send a memo transfer with Go
Include a memo for payment reconciliation:
```go [memo.go]
tip20ABI, _ := abi.JSON(strings.NewReader(`[{"name":"transferWithMemo","type":"function","inputs":[{"name":"to","type":"address"},{"name":"amount","type":"uint256"},{"name":"memo","type":"bytes32"}]}]`))
recipient := common.HexToAddress("0x70997970C51812dc3A010C7d01b50e0d17dc79C8")
amount := big.NewInt(100_000_000)
memo := [32]byte{}
copy(memo[:], "INV-12345")
memoData, _ := tip20ABI.Pack("transferWithMemo", recipient, amount, memo)
tx := transaction.NewBuilder(big.NewInt(42431)).
SetNonce(nonce).
SetGas(100000).
SetMaxFeePerGas(big.NewInt(10000000000)).
SetMaxPriorityFeePerGas(big.NewInt(1000000000)).
AddCall(transaction.AlphaUSDAddress, big.NewInt(0), memoData).
Build()
```
### Batch multiple calls with Go
Execute multiple operations atomically in a single transaction:
```go [batch.go]
tx := transaction.NewBuilder(big.NewInt(42431)).
SetNonce(nonce).
SetGas(200000).
SetMaxFeePerGas(big.NewInt(10000000000)).
SetMaxPriorityFeePerGas(big.NewInt(1000000000)).
AddCall(addr1, big.NewInt(0), transfer1Data). // [!code hl]
AddCall(addr2, big.NewInt(0), transfer2Data). // [!code hl]
AddCall(addr3, big.NewInt(0), contractCallData). // [!code hl]
Build()
transaction.SignTransaction(tx, s)
```
### Parallel Transactions (2D Nonces)
Send multiple transactions concurrently using different nonce keys:
```go [parallel.go]
tx1 := transaction.NewBuilder(big.NewInt(42431)).
SetNonceKey(big.NewInt(1)). // Sequence A // [!code hl]
SetNonce(0).
SetGas(100000).
SetMaxFeePerGas(big.NewInt(10000000000)).
SetMaxPriorityFeePerGas(big.NewInt(1000000000)).
AddCall(recipient1, big.NewInt(0), data1).
Build()
tx2 := transaction.NewBuilder(big.NewInt(42431)).
SetNonceKey(big.NewInt(2)). // Sequence B (parallel) // [!code hl]
SetNonce(0).
SetGas(100000).
SetMaxFeePerGas(big.NewInt(10000000000)).
SetMaxPriorityFeePerGas(big.NewInt(1000000000)).
AddCall(recipient2, big.NewInt(0), data2).
Build()
transaction.SignTransaction(tx1, s)
transaction.SignTransaction(tx2, s)
// Submit both and wait for each submission result.
results := make(chan error, 2)
for _, tx := range []*transaction.Tx{tx1, tx2} {
raw, err := transaction.Serialize(tx, nil)
if err != nil { panic(err) }
go func(raw string) {
_, err := c.SendRawTransaction(ctx, raw)
results <- err
}(raw)
}
for range 2 {
if err := <-results; err != nil { panic(err) }
}
```
### Fee sponsorship with Go
Have another account pay for transaction fees:
```go [feepayer.go]
tx := transaction.NewBuilder(big.NewInt(42431)).
SetNonce(nonce).
SetGas(100000).
SetMaxFeePerGas(big.NewInt(10000000000)).
SetMaxPriorityFeePerGas(big.NewInt(1000000000)).
SetSponsored(true). // Mark as awaiting fee payer // [!code hl]
AddCall(recipient, big.NewInt(0), data).
Build()
transaction.SignTransaction(tx, userSigner)
transaction.AddFeePayerSignature(tx, feePayerSigner)
```
### Transaction validity windows in Go
Set a time window during which the transaction is valid:
```go [validity.go]
now := time.Now()
tx := transaction.NewBuilder(big.NewInt(42431)).
SetNonce(nonce).
SetGas(100000).
SetMaxFeePerGas(big.NewInt(10000000000)).
SetMaxPriorityFeePerGas(big.NewInt(1000000000)).
SetValidAfter(uint64(now.Unix())). // [!code hl]
SetValidBefore(uint64(now.Add(1 * time.Hour).Unix())). // [!code hl]
AddCall(recipient, big.NewInt(0), data).
Build()
```
### Batch RPC requests with Go
Send multiple RPC calls efficiently in a single HTTP request. `eth_getBalance` returns a compatibility value on Tempo, not the account’s spendable stablecoins; read TIP-20 `balanceOf` for token balances:
```go [batch_rpc.go]
batch := client.NewBatchRequest()
batch.Add("eth_blockNumber").
Add("eth_chainId").
Add("eth_getBalance", "0x742d35Cc6634C0532925a3b844Bc9e7595f0bEbb", "latest")
responses, _ := c.SendBatch(ctx, batch)
for _, resp := range responses {
fmt.Printf("Result: %v\n", resp.Result)
}
```
## Account Keychain in the Go SDK
For a non-expiring key, pass `^uint64(0)` (the maximum uint64 timestamp) to `NewKeyRestrictions`; `0` is already expired. Keychain helpers return unsigned calls: choose one, include it in a transaction, sign, submit, and wait for its receipt.
The `keychain` package provides typed helpers for Tempo's [Account Keychain precompile](https://tempo.com/developers/docs/protocol/transactions/AccountKeychain), enabling access key management and signing directly from Go.
:::info
Enhanced access key features — periodic spending limits and call scoping — require the [T3 network upgrade](https://tempo.com/developers/docs/protocol/upgrades/t3).
:::
```go [keychain_manage.go]
package main
import (
"context"
"math/big"
"time"
"github.com/ethereum/go-ethereum/common"
"github.com/tempoxyz/tempo-go/pkg/client"
"github.com/tempoxyz/tempo-go/pkg/keychain"
"github.com/tempoxyz/tempo-go/pkg/signer"
"github.com/tempoxyz/tempo-go/pkg/transaction"
)
func main() {
c := client.New("https://rpc.moderato.tempo.xyz")
s, _ := signer.NewSigner("0xYOUR_PRIVATE_KEY")
ctx := context.Background()
nonce, _ := c.GetTransactionCount(ctx, s.Address().Hex())
accessKeyAddr := common.HexToAddress("")
// Authorize a new access key (secp256k1, no expiry):
restrictions := keychain.NewKeyRestrictions(^uint64(0))
call, _ := keychain.AuthorizeKey(accessKeyAddr, keychain.SignatureTypeSecp256k1, restrictions)
tx := transaction.NewBuilder(big.NewInt(42431)).
SetNonce(nonce).
SetGas(200000).
SetMaxFeePerGas(big.NewInt(20000000000)).
SetMaxPriorityFeePerGas(big.NewInt(1000000000)).
AddCall(call.To, big.NewInt(0), call.Data).
Build()
// Authorize with a spending limit:
token := common.HexToAddress("")
restrictions = keychain.NewKeyRestrictions(^uint64(0)).
WithLimits([]keychain.TokenLimit{{Token: token, Amount: big.NewInt(1_000_000)}})
call, _ = keychain.AuthorizeKey(accessKeyAddr, keychain.SignatureTypeSecp256k1, restrictions)
// Authorize with call scopes (restrict to specific contracts/functions):
scope := keychain.NewCallScopeBuilder(token).
Transfer(nil).
Approve(nil).
Build()
restrictions = keychain.NewKeyRestrictions(^uint64(0)).
WithAllowedCalls([]keychain.CallScope{scope})
call, _ = keychain.AuthorizeKey(accessKeyAddr, keychain.SignatureTypeSecp256k1, restrictions)
// Full example: 24h expiry + spending limit + call scope:
expiry := uint64(time.Now().Add(24 * time.Hour).Unix())
restrictions = keychain.NewKeyRestrictions(expiry).
WithLimits([]keychain.TokenLimit{{Token: token, Amount: big.NewInt(1_000_000)}}).
WithAllowedCalls([]keychain.CallScope{
keychain.NewCallScopeBuilder(token).Transfer(nil).Build(),
})
call, _ = keychain.AuthorizeKey(accessKeyAddr, keychain.SignatureTypeSecp256k1, restrictions)
// Revoke an access key (permanent, cannot be re-authorized):
call, _ = keychain.RevokeKey(accessKeyAddr)
// Update spending limit for a key-token pair:
call, _ = keychain.UpdateSpendingLimit(accessKeyAddr, token, big.NewInt(2_000_000))
// Replace all call scopes for a key:
call, _ = keychain.SetAllowedCalls(accessKeyAddr, []keychain.CallScope{
keychain.NewCallScopeBuilder(token).Transfer(nil).Build(),
})
// Remove a target contract from allowed call list:
call, _ = keychain.RemoveAllowedCalls(accessKeyAddr, token)
_ = ctx
_ = tx
_ = call
}
```
### Sign with an access key in Go
Use `keychain.SignWithAccessKey` to sign a transaction as an access key holder:
```go [access_key_sign.go]
accessKeySigner, _ := signer.NewSigner("")
rootAccount := common.HexToAddress("")
tx := transaction.NewBuilder(big.NewInt(42431)).
SetNonce(nonce).
SetGas(100000).
SetMaxFeePerGas(big.NewInt(20000000000)).
SetMaxPriorityFeePerGas(big.NewInt(1000000000)).
AddCall(recipient, big.NewInt(0), data).
Build()
keychain.SignWithAccessKey(tx, accessKeySigner, rootAccount) // [!code hl]
serialized, _ := transaction.Serialize(tx, nil)
hash, _ := c.SendRawTransaction(ctx, serialized)
```
### Query remaining spending limits with Go
```go [query_limit.go]
calldata := keychain.EncodeGetRemainingLimitCalldata(
common.HexToAddress(""),
common.HexToAddress(""),
common.HexToAddress(""),
)
response, err := c.SendRequest(ctx, "eth_call", map[string]string{
"to": keychain.GetKeychainAddress().Hex(), "data": calldata,
}, "latest")
if err != nil { panic(err) }
if err := response.CheckError(); err != nil { panic(err) }
result, ok := response.Result.(string)
if !ok { panic("Expected a hex RPC result") }
remaining := keychain.ParseRemainingLimitResult(common.FromHex(result))
fmt.Printf("Remaining: %s\n", remaining.String())
```
## Go SDK packages
| Package | Description |
| --- | --- |
| `transaction` | TempoTransaction encoding, signing, and validation |
| `client` | RPC client for interacting with Tempo nodes |
| `signer` | Key management and signature generation |
| `keychain` | Account Keychain precompile: access key management and signing |
## Next steps for the Go SDK
After setting up the Go SDK, you can:
* Follow a guide on how to [make payments](https://tempo.com/developers/docs/guide/payments), [issue stablecoins](https://tempo.com/developers/docs/guide/issuance), [exchange stablecoins](https://tempo.com/developers/docs/guide/stablecoin-dex), and [more](https://tempo.com/developers).
* View the [examples on GitHub](https://github.com/tempoxyz/tempo-go/tree/main/examples)
> Source: [/docs/sdk/python](https://tempo.com/developers/docs/sdk/python.md)
> Section: [Get Started](https://tempo.com/developers/get-started.md). Choose a starting point, send a test payment, get testnet funds, connect a coding agent, find the SDKs and CLI, and use the resource guides to plan payment workflows, liquidity, provider selection, and partner integrations.
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
# Tempo Python SDK: installing and using it
Tempo distributes a Python SDK as a [web3.py](https://web3py.readthedocs.io/) extension. The SDK adds native support for Tempo Transactions, including call batching, fee sponsorship, and access key management.
The Tempo Python SDK can be used to perform common operations with the chain, such as: sending Tempo Transactions, batching multiple calls, fee sponsorship, and more.
::::steps
## Install the Python SDK
To install the Tempo Python SDK:
```bash [pip]
python -m pip install pytempo==0.7.0
```
:::tip
The SDK requires Python 3.10 or higher and web3.py 7.0+.
:::
## Create a Python client
To interact with Tempo, create a web3.py client connected to a Tempo node:
```python [main.py]
from web3 import Web3
w3 = Web3(Web3.HTTPProvider("https://rpc.moderato.tempo.xyz")) # [!code hl]
block_number = w3.eth.block_number
print(f"Connected to Tempo at block {block_number}")
```
## Send a Tempo transaction with Python
These examples use Moderato testnet (`42431`). The script below sends 1 AlphaUSD, a TIP-20 test stablecoin, to a newly generated address. It funds the sender from the testnet [faucet](https://tempo.com/developers/docs/quickstart/faucet) first, so any new key works. Create a test key and set `PRIVATE_KEY`:
```bash [Terminal]
export PRIVATE_KEY=$(python -c "from eth_account import Account; print(Account.create().key.to_0x_hex())")
```
Estimate gas for every transaction instead of hard-coding a limit. A new account's first transaction pays to create the account, and a transfer to a new address pays to create its balance, so a first transfer needs more than 500,000 gas. See [state creation costs](https://tempo.com/developers/docs/quickstart/evm-compatibility#state-creation-costs).
Build and send a transaction using the `TempoTransaction` class:
```python [main.py]
import os
from eth_account import Account
from web3 import Web3
from pytempo import TempoTransaction # [!code hl]
from pytempo.contracts import ALPHA_USD, TIP20
w3 = Web3(Web3.HTTPProvider("https://rpc.moderato.tempo.xyz"))
private_key = os.environ["PRIVATE_KEY"]
account = Account.from_key(private_key)
recipient = Account.create().address # replace with your recipient's address
# Testnet only: fund the sender with test stablecoins from the faucet.
funding = w3.provider.make_request("tempo_fundAddress", [account.address])
for funding_tx in funding.get("result", []):
w3.eth.wait_for_transaction_receipt(funding_tx)
transfer = TIP20(ALPHA_USD).transfer(to=recipient, amount=1_000_000) # 1 AlphaUSD
# Estimate gas for the calls the transaction makes.
draft = TempoTransaction.create(calls=(transfer,))
gas_limit = w3.eth.estimate_gas(draft.to_estimate_gas_request(account.address)) # [!code hl]
# [!code hl:8]
tx = TempoTransaction.create(
chain_id=w3.eth.chain_id,
gas_limit=gas_limit,
max_fee_per_gas=w3.eth.gas_price * 2,
max_priority_fee_per_gas=w3.eth.gas_price,
nonce=w3.eth.get_transaction_count(account.address),
calls=(transfer,),
)
signed_tx = tx.sign(private_key) # [!code hl]
tx_hash = w3.eth.send_raw_transaction(signed_tx.encode()) # [!code hl]
receipt = w3.eth.wait_for_transaction_receipt(tx_hash)
balance = TIP20(ALPHA_USD).balance_of(w3, account=recipient)
print(f"Transaction hash: {tx_hash.to_0x_hex()} (status {receipt.status})")
print(f"Recipient balance: {balance / 10**6} AlphaUSD")
```
::::
## Python SDK examples
These examples reuse `w3`, `account`, `private_key`, and `recipient` from `main.py`, and estimate gas the same way.
### Send a token transfer with Python
Send a TIP-20 token transfer using pytempo's typed contract helpers:
```python [transfer.py]
from pytempo import TempoTransaction
from pytempo.contracts import TIP20, ALPHA_USD
transfer = TIP20(ALPHA_USD).transfer( # [!code hl]
to=recipient, # [!code hl]
amount=100_000_000, # 100 tokens (6 decimals) # [!code hl]
) # [!code hl]
draft = TempoTransaction.create(calls=(transfer,))
tx = TempoTransaction.create(
chain_id=42431,
gas_limit=w3.eth.estimate_gas(draft.to_estimate_gas_request(account.address)),
max_fee_per_gas=w3.eth.gas_price * 2,
max_priority_fee_per_gas=w3.eth.gas_price,
nonce=w3.eth.get_transaction_count(account.address),
calls=(transfer,),
)
```
### Pay fees in a stablecoin with Python
Choose a supported USD-denominated TIP-20 token for transaction fees. Tempo has no native gas token:
```python [fee_token.py]
from pytempo import TempoTransaction, Call
from pytempo.contracts import ALPHA_USD
call = Call.create(to=recipient)
draft = TempoTransaction.create(calls=(call,))
tx = TempoTransaction.create(
chain_id=42431,
gas_limit=w3.eth.estimate_gas(draft.to_estimate_gas_request(account.address)),
max_fee_per_gas=w3.eth.gas_price * 2,
max_priority_fee_per_gas=w3.eth.gas_price,
nonce=w3.eth.get_transaction_count(account.address),
fee_token=ALPHA_USD, # [!code hl]
calls=(call,),
)
```
### Batch multiple calls with Python
Execute multiple operations atomically in a single transaction. `to_estimate_gas_request` covers only the first call, so estimate a batch with every call in the request:
```python [batch.py]
from eth_account import Account
from web3 import Web3
from pytempo import TempoTransaction
from pytempo.contracts import TIP20, ALPHA_USD
token = TIP20(ALPHA_USD)
calls = (
token.transfer(to=recipient, amount=100_000_000), # [!code hl]
token.transfer(to=Account.create().address, amount=50_000_000), # [!code hl]
token.transfer(to=Account.create().address, amount=25_000_000), # [!code hl]
)
gas_limit = w3.eth.estimate_gas({
"from": account.address,
"calls": [
{"to": Web3.to_checksum_address(bytes(c.to)), "data": "0x" + c.data.hex(), "value": hex(c.value)}
for c in calls
],
})
tx = TempoTransaction.create(
chain_id=42431,
gas_limit=gas_limit,
max_fee_per_gas=w3.eth.gas_price * 2,
max_priority_fee_per_gas=w3.eth.gas_price,
nonce=w3.eth.get_transaction_count(account.address),
calls=calls,
)
signed_tx = tx.sign(private_key)
tx_hash = w3.eth.send_raw_transaction(signed_tx.encode())
```
### Parallel Transactions (2D Nonces)
Send multiple transactions concurrently using different nonce keys:
```python [parallel.py]
from pytempo import TempoTransaction
from pytempo.contracts import TIP20, ALPHA_USD
call1 = TIP20(ALPHA_USD).transfer(to=recipient, amount=1_000_000)
call2 = TIP20(ALPHA_USD).transfer(to=recipient, amount=2_000_000)
# The first transaction on a new nonce key pays to create it: include the key.
def estimate_gas(call, nonce_key):
request = TempoTransaction.create(calls=(call,)).to_estimate_gas_request(account.address)
return w3.eth.estimate_gas({**request, "nonceKey": hex(nonce_key)})
tx1 = TempoTransaction.create(
chain_id=42431,
gas_limit=estimate_gas(call1, nonce_key=1),
max_fee_per_gas=w3.eth.gas_price * 2,
max_priority_fee_per_gas=w3.eth.gas_price,
nonce_key=1, # Sequence A // [!code hl]
nonce=0,
calls=(call1,),
)
tx2 = TempoTransaction.create(
chain_id=42431,
gas_limit=estimate_gas(call2, nonce_key=2),
max_fee_per_gas=w3.eth.gas_price * 2,
max_priority_fee_per_gas=w3.eth.gas_price,
nonce_key=2, # Sequence B (parallel) // [!code hl]
nonce=0,
calls=(call2,),
)
# Submit independent nonce sequences; each has its own result
signed_tx1 = tx1.sign(private_key)
signed_tx2 = tx2.sign(private_key)
w3.eth.send_raw_transaction(signed_tx1.encode())
w3.eth.send_raw_transaction(signed_tx2.encode())
```
### Fee sponsorship with Python
Have another account pay for transaction fees:
```python [fee_payer.py]
from eth_account import Account
from pytempo import TempoTransaction, Call
# A user with no stablecoins signs; the account from main.py pays the fees.
user = Account.create()
call = Call.create(to=recipient)
draft = TempoTransaction.create(calls=(call,))
tx = TempoTransaction.create(
chain_id=42431,
gas_limit=w3.eth.estimate_gas(draft.to_estimate_gas_request(user.address)),
max_fee_per_gas=w3.eth.gas_price * 2,
max_priority_fee_per_gas=w3.eth.gas_price,
nonce=w3.eth.get_transaction_count(user.address),
awaiting_fee_payer=True, # [!code hl]
calls=(call,),
)
signed_by_user = tx.sign(user.key.to_0x_hex())
final_tx = signed_by_user.sign(private_key, for_fee_payer=True) # [!code hl]
w3.eth.send_raw_transaction(final_tx.encode())
```
### Transaction validity windows in Python
Set a time window during which the transaction is valid:
```python [validity.py]
import time
from pytempo import TempoTransaction, Call
now = int(time.time())
call = Call.create(to=recipient)
draft = TempoTransaction.create(calls=(call,))
tx = TempoTransaction.create(
chain_id=42431,
gas_limit=w3.eth.estimate_gas(draft.to_estimate_gas_request(account.address)),
max_fee_per_gas=w3.eth.gas_price * 2,
max_priority_fee_per_gas=w3.eth.gas_price,
nonce=w3.eth.get_transaction_count(account.address),
valid_after=now, # [!code hl]
valid_before=now + 3600, # 1 hour from now // [!code hl]
calls=(call,),
)
```
## Account Keychain in the Python SDK
`expiry=None` maps to the maximum uint64 timestamp for a non-expiring key. Passing `0` expires the key immediately and is rejected by authorization. The call builders below return unsigned calls: choose one, include it in a transaction, sign, submit, and wait for its receipt.
The `AccountKeychain` class provides typed helpers for Tempo's [Account Keychain precompile](https://tempo.com/developers/docs/protocol/transactions/AccountKeychain), enabling access key management directly from Python.
:::info
Enhanced access key features — periodic spending limits and call scoping — require the [T3 network upgrade](https://tempo.com/developers/docs/protocol/upgrades/t3).
:::
```python [keychain.py]
from pytempo import (
TempoTransaction, Call,
KeyRestrictions, SignatureType, TokenLimit, CallScope,
)
from pytempo.contracts import AccountKeychain, ALPHA_USD
from web3 import Web3
w3 = Web3(Web3.HTTPProvider("https://rpc.moderato.tempo.xyz"))
# Authorize a new access key (secp256k1, no expiry):
call = AccountKeychain.authorize_key(
key_id="",
signature_type=SignatureType.SECP256K1,
restrictions=KeyRestrictions(expiry=None),
)
draft = TempoTransaction.create(calls=(call,))
tx = TempoTransaction.create(
chain_id=w3.eth.chain_id,
gas_limit=w3.eth.estimate_gas(draft.to_estimate_gas_request(account.address)),
max_fee_per_gas=w3.eth.gas_price * 2,
max_priority_fee_per_gas=w3.eth.gas_price,
nonce=w3.eth.get_transaction_count(account.address),
calls=(call,),
)
# Authorize with a spending limit:
call = AccountKeychain.authorize_key(
key_id="",
signature_type=SignatureType.SECP256K1,
restrictions=KeyRestrictions(
expiry=None,
limits=[TokenLimit(token=ALPHA_USD, limit=1_000_000)],
),
)
# Authorize with call scopes (restrict to specific contracts/functions):
call = AccountKeychain.authorize_key(
key_id="",
signature_type=SignatureType.SECP256K1,
restrictions=KeyRestrictions(
expiry=None,
allowed_calls=[
CallScope.transfer(target=ALPHA_USD),
CallScope.approve(target=ALPHA_USD),
],
),
)
# Full example: 24h expiry + spending limit + call scope:
import time
expiry = int(time.time()) + 86400
call = AccountKeychain.authorize_key(
key_id="",
signature_type=SignatureType.SECP256K1,
restrictions=KeyRestrictions(
expiry=expiry,
limits=[TokenLimit(token=ALPHA_USD, limit=1_000_000)],
allowed_calls=[CallScope.transfer(target=ALPHA_USD)],
),
)
# Revoke an access key (permanent, cannot be re-authorized):
call = AccountKeychain.revoke_key(key_id="")
# Update spending limit for a key-token pair:
call = AccountKeychain.update_spending_limit(
key_id="",
token=str(ALPHA_USD),
new_limit=2_000_000,
)
# Replace all call scopes for a key:
call = AccountKeychain.set_allowed_calls(
key_id="",
scopes=[
CallScope.transfer(target=ALPHA_USD),
CallScope.unrestricted(target=""),
],
)
# Remove a target contract from allowed call list:
call = AccountKeychain.remove_allowed_calls(
key_id="",
target="",
)
# Query key info (read-only):
key_info = AccountKeychain.get_key(
w3,
account_address="",
key_id="",
)
print(key_info)
# {'signature_type': 0, 'key_id': '0x...', 'expiry': 1893456000, ...}
# Query remaining spending limit and when the current period ends:
remaining = AccountKeychain.get_remaining_limit_with_period(
w3,
account_address="",
key_id="",
token_address=str(ALPHA_USD),
)
print(f"Remaining: {remaining['remaining']}, period ends: {remaining['period_end']}")
```
### Sign with an access key in Python
Use `sign_access_key` to sign a transaction as an access key holder:
```python [access_key_sign.py]
from pytempo import TempoTransaction, Call
call = Call.create(to="")
draft = TempoTransaction.create(calls=(call,))
gas_request = draft.to_estimate_gas_request( # [!code hl]
"", key_id="", # [!code hl]
) # [!code hl]
tx = TempoTransaction.create(
chain_id=w3.eth.chain_id,
gas_limit=w3.eth.estimate_gas(gas_request),
max_fee_per_gas=w3.eth.gas_price * 2,
max_priority_fee_per_gas=w3.eth.gas_price,
nonce=w3.eth.get_transaction_count(""),
calls=(call,),
)
signed_tx = tx.sign_access_key( # [!code hl]
access_key_private_key="", # [!code hl]
root_account="", # [!code hl]
) # [!code hl]
tx_hash = w3.eth.send_raw_transaction(signed_tx.encode())
```
## Next steps for the Python SDK
After setting up the Python SDK, you can:
* Follow a guide on how to [make payments](https://tempo.com/developers/docs/guide/payments), [issue stablecoins](https://tempo.com/developers/docs/guide/issuance), [exchange stablecoins](https://tempo.com/developers/docs/guide/stablecoin-dex), and [more](https://tempo.com/developers).
* View the [source on GitHub](https://github.com/tempoxyz/pytempo)
* View the [package on PyPI](https://pypi.org/project/pytempo/)
> Source: [/docs/sdk/foundry](https://tempo.com/developers/docs/sdk/foundry.md)
> Section: [Get Started](https://tempo.com/developers/get-started.md). Choose a starting point, send a test payment, get testnet funds, connect a coding agent, find the SDKs and CLI, and use the resource guides to plan payment workflows, liquidity, provider selection, and partner integrations.
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
# Using Foundry with Tempo
Tempo is supported as a first-class citizen in [Foundry](https://github.com/foundry-rs/foundry): the leading Ethereum development toolkit.
Install the latest Foundry release to access Tempo's [protocol-level features](https://tempo.com/developers/docs/protocol) in `forge`, `cast`, `anvil`, and `chisel`, and to build, test, and deploy contracts that go [beyond the limits of standard EVM chains](https://tempo.com/developers/docs/quickstart/evm-compatibility).
:::warning[`tempo-foundry` is deprecated]
`tempo-foundry` and `foundryup -n tempo` are deprecated. Switch to the latest upstream Foundry release with `foundryup`.
:::
For general information about Foundry, see the [Foundry documentation](https://getfoundry.sh/).
## Get started with Foundry
Install the latest Foundry release to get Tempo support.
::::steps
### Install `foundryup` for Tempo
If you don't have `foundryup` installed yet:
```bash
curl -L https://foundry.paradigm.xyz | bash
```
### Install or update Foundry
```bash
foundryup
```
This installs the latest versioned release of [`forge`](https://getfoundry.sh/forge/overview#forge), [`cast`](https://getfoundry.sh/cast/overview#cast), [`anvil`](https://getfoundry.sh/anvil/overview#anvil), and [`chisel`](https://getfoundry.sh/chisel/overview#chisel).
:::tip
To install a specific version, replace `` with the desired release tag:
```bash
foundryup --install
```
:::
### Create a new Foundry project
Initialize a new Foundry project with the Tempo template:
```bash
forge init -n tempo my-project && cd my-project
```
This gives you a Tempo-ready starter project, including the Tempo `Mail` example template.
If you're adding Tempo support to an existing Foundry project, install [`tempo-std`](https://github.com/tempoxyz/tempo-std) manually:
```bash
forge install tempoxyz/tempo-std
```
::::
## Configure `foundry.toml` for Tempo
The Tempo template gives you a working starting point, but it is often useful to make Tempo explicit in `foundry.toml`.
### Configure Tempo RPC aliases
Set a default Tempo RPC alias and keep a separate alias for Moderato testnet:
```toml
[profile.default]
eth_rpc_url = "tempo"
[rpc_endpoints]
tempo = "${TEMPO_RPC_URL}"
moderato = "${TEMPO_TESTNET_RPC_URL}"
```
With this config, commands that use the default RPC pick up `tempo` automatically, and you can still switch explicitly with `--rpc-url moderato`.
### Activate Tempo features explicitly
For most projects, the most flexible option is to enable Tempo network features directly:
```toml
[profile.default]
tempo = true
```
This network flag enables Tempo-specific network behavior while still letting Foundry resolve the right semantics from the chain you are targeting.
If you need advanced testing against historical network behavior, pin a specific Tempo hardfork explicitly in `foundry.toml` or via inline config. Most projects should avoid hardfork pinning so local tests track the current Tempo rules for the network they target.
### Configure Tempo contract verification
Tempo's contract verifier is Sourcify-compatible. Configure verification with `VERIFIER_URL=https://contracts.tempo.xyz` or `--verifier-url https://contracts.tempo.xyz`.
The `[etherscan]` table in `foundry.toml` is for Etherscan-style verifiers, not Tempo's verifier.
### Use `foundry-toolchain` in Tempo CI
Use the [`foundry-toolchain`](https://github.com/foundry-rs/foundry-toolchain) GitHub Action to install Foundry in your CI.
Tempo support is included in the latest Foundry release, so no special configuration is needed.
```yaml
- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
```
## Use Foundry for Tempo workflows
All standard Foundry commands are supported out of the box.
### Test and deploy Tempo contracts locally with `forge`
```bash
# Build your contracts
forge build
# Run all tests locally
forge test
# Run deployment scripts locally
forge script script/Mail.s.sol
```
### Test and deploy with `forge` on Tempo Testnet
```bash
# Set environment variables
export TEMPO_RPC_URL=https://rpc.moderato.tempo.xyz
export VERIFIER_URL=https://contracts.tempo.xyz
# Optional: create a new keypair and request some testnet tokens from the faucet.
cast wallet new
cast rpc tempo_fundAddress --rpc-url https://rpc.moderato.tempo.xyz
# Run tests against a fork of Tempo testnet
forge test --fork-url "$TEMPO_RPC_URL"
# Deploy and verify a simple contract
forge create src/Mail.sol:Mail \
--rpc-url $TEMPO_RPC_URL \
--interactive \
--broadcast \
--verify \
--constructor-args 0x20c0000000000000000000000000000000000001
# Deploy a simple contract with custom fee token
forge create src/Mail.sol:Mail \
--tempo.fee-token \
--rpc-url $TEMPO_RPC_URL \
--interactive \
--broadcast \
--verify \
--constructor-args 0x20c0000000000000000000000000000000000001
# Set a salt for deterministic contract address derivation
# The salt is passed to TIP20_FACTORY.createToken() which uses it with the sender
# address to compute a deterministic deployment address via getTokenAddress(sender, salt)
export SALT="my-unique-salt"
# Run a deployment script and verify
forge script script/Mail.s.sol \
--sig "run(string)" $SALT \
--rpc-url $TEMPO_RPC_URL \
--interactive \
--sender \
--broadcast \
--verify
# Run a deployment script with custom fee token and verify
forge script script/Mail.s.sol \
--sig "run(string)" $SALT \
--tempo.fee-token \
--rpc-url $TEMPO_RPC_URL \
--interactive \
--sender \
--broadcast \
--verify
# Batch multiple calls into a single atomic transaction
forge script script/Deploy.s.sol \
--broadcast --batch \
--rpc-url $TEMPO_RPC_URL \
--private-key $PRIVATE_KEY
```
Use a root key for `forge create`. Access keys cannot sign a top-level contract-creation call.
For more verification options including verifying existing contracts and API verification, see [Contract Verification](https://tempo.com/developers/docs/quickstart/verify-contracts).
:::warning[Batch Transaction Rules]
* **Atomic execution**: If any call reverts, the entire batch reverts
* **Single CREATE allowed**: At most one top-level contract-creation call per batch
* **CREATE must be first**: A top-level contract-creation call must be the first operation
* **Value must be zero**: Since Tempo has no native token, value must be 0
* **Check the destination**: A low-level call to an address with no code can succeed without doing anything. An unknown function on a deployed Solidity contract reverts unless its fallback accepts the call.
:::
### Interact and debug Tempo contracts with `cast`
```bash
# Check that your contract is deployed:
cast code \
--rpc-url $TEMPO_RPC_URL
# Interact with the contract, retrieving the token address:
cast call "token()" \
--rpc-url $TEMPO_RPC_URL
# Get the name of an ERC20 token:
cast erc20 name \
--rpc-url $TEMPO_RPC_URL
# Check the ERC20 token balance of your address:
cast erc20 balance \
--rpc-url $TEMPO_RPC_URL
# Transfer some of your ERC20 tokens:
cast erc20 transfer \
--rpc-url $TEMPO_RPC_URL \
--interactive
# Transfer some of your ERC20 tokens with custom fee token:
cast erc20 transfer \
--tempo.fee-token \
--rpc-url $TEMPO_RPC_URL \
--interactive
# Send a transaction with custom fee token:
cast send \
--tempo.fee-token \
--rpc-url $TEMPO_RPC_URL \
--interactive
# Replay a transaction by hash:
cast run \
--rpc-url $TEMPO_RPC_URL
# Send a batch transaction with multiple calls:
cast batch-send \
--call "::increment()" \
--call "::setNumber(uint256):500" \
--rpc-url $TEMPO_RPC_URL \
--private-key $PRIVATE_KEY
# Batch with pre-encoded calldata:
ENCODED=$(cast calldata "setNumber(uint256)" 200)
cast batch-send \
--call "::$ENCODED" \
--call "::setNumber(uint256):101" \
--rpc-url $TEMPO_RPC_URL \
--private-key $PRIVATE_KEY
# Sponsored transaction using a local fee-payer signer (Foundry v1.8.5):
# SPONSOR_KEY is the funded sponsor private key in your environment.
SPONSOR_ADDRESS=$(cast wallet address --private-key "$SPONSOR_KEY")
cast send 'increment()' \
--rpc-url "$TEMPO_RPC_URL" --private-key "$SENDER_KEY" \
--tempo.sponsor "$SPONSOR_ADDRESS" --tempo.sponsor-signer env://SPONSOR_KEY
# Send with 2D nonce (parallel tx submission):
cast send 'increment()' \
--rpc-url $TEMPO_RPC_URL \
--private-key $PRIVATE_KEY \
--nonce 0 --tempo.nonce-key 1
# Send with an expiring nonce and a 25-second validity window:
VALID_BEFORE=$(($(date +%s) + 25))
cast send 'increment()' \
--rpc-url $TEMPO_RPC_URL \
--private-key $PRIVATE_KEY \
--tempo.expiring-nonce --tempo.valid-before $VALID_BEFORE
# Send with access key (delegated signing):
# First authorize the key via Account Keychain precompile
cast send 0xAAAAAAAA00000000000000000000000000000000 \
'authorizeKey(address,uint8,(uint64,bool,(address,uint256,uint64)[],bool,(address,(bytes4,address[])[])[]))' \
$ACCESS_KEY_ADDR 0 '(1893456000,false,[],true,[])' \
--rpc-url $TEMPO_RPC_URL \
--private-key $ROOT_PRIVATE_KEY
# Then send using the access key
cast send 'increment()' \
--rpc-url $TEMPO_RPC_URL \
--tempo.access-key $ACCESS_KEY_PRIVATE_KEY \
--tempo.root-account $ROOT_ADDRESS
```
If the access key will be used with passkey or WebAuthn signatures, pass `2` for `SignatureType`. `1` is only for raw P256 signatures.
Access keys cannot sign top-level contract creation. They can call a factory that creates contracts internally when their call scopes permit that factory call.
### Local Tempo development with Anvil
Anvil supports Tempo mode for local testing and forking Tempo networks:
```bash
# Start anvil in Tempo mode
anvil --tempo
# Fork a live Tempo network for local testing
anvil --tempo --fork-url $TEMPO_RPC_URL
# Test transactions on local anvil fork
cast send 'increment()' \
--tempo.fee-token \
--rpc-url http://127.0.0.1:8545 \
--private-key $PRIVATE_KEY
# 2D nonce on anvil fork
cast send 'increment()' \
--tempo.fee-token \
--rpc-url http://127.0.0.1:8545 \
--private-key $PRIVATE_KEY \
--nonce 0 --tempo.nonce-key 100
# Expiring nonce on anvil fork
cast send 'increment()' \
--tempo.fee-token \
--rpc-url http://127.0.0.1:8545 \
--private-key $PRIVATE_KEY \
--tempo.expiring-nonce --tempo.valid-before $(($(date +%s) + 25))
# Batch transactions on anvil fork
cast batch-send \
--tempo.fee-token \
--rpc-url http://127.0.0.1:8545 \
--call "::increment()" \
--call "::increment()" \
--private-key $PRIVATE_KEY
```
## Tempo-specific Foundry CLI flags
The following flags are available for `cast` and `forge script` for Tempo-specific features:
| Flag | Description | Example |
|------|-------------|---------|
| `--tempo.fee-token ` | Specify the TIP-20 token to pay transaction fees | `--tempo.fee-token 0x20c0...0001` |
| `--tempo.nonce-key ` | 2D nonce key for parallel transaction submission | `--tempo.nonce-key 1` |
| `--tempo.expiring-nonce` | Enable expiring nonce for time-bounded transactions | `--tempo.expiring-nonce` |
| `--tempo.valid-before ` | Unix timestamp before which the transaction must execute; expiring-nonce windows depend on the network hardfork | `--tempo.valid-before 1704067200` |
| `--tempo.valid-after ` | Unix timestamp after which tx can execute | `--tempo.valid-after 1704067100` |
| `--tempo.sponsor ` | Sponsor address, required with a sponsor signer or signature | `--tempo.sponsor $SPONSOR_ADDRESS` |
| `--tempo.sponsor-signer ` | Sign the exact sponsored transaction using a signer URI | `--tempo.sponsor-signer env://SPONSOR_KEY` |
| `--tempo.sponsor-signature ` | Pre-signed sponsor signature; requires `--tempo.sponsor` | `--tempo.sponsor-signature 0x...` |
| `--tempo.print-sponsor-hash` | Print fee payer signature hash and exit (for sponsor to sign) | `--tempo.print-sponsor-hash` |
| `--tempo.access-key ` | Private key for delegated signing via access key | `--tempo.access-key $ACCESS_KEY_PRIVATE_KEY` |
| `--tempo.root-account ` | Root account address when using an access key | `--tempo.root-account $ROOT_ADDRESS` |
Signer support depends on the transaction role and Foundry release. In v1.8.5, `--tempo.sponsor-signer` accepts Ledger and Trezor signer URIs.
## `cast keychain` for Tempo access keys
`cast keychain` provides a CLI interface to Tempo's [Account Keychain precompile](https://tempo.com/developers/docs/protocol/transactions/AccountKeychain).
Prefer this over hand-encoding `authorizeKey(...)` calldata when you are working from the CLI.
:::info
`cast keychain` only works on Tempo networks.
:::
`cast keychain` authorization takes a future expiry timestamp, `webauthn` for passkey-backed access keys, optional `TOKEN:AMOUNT:PERIOD_SECONDS` limits for recurring budgets, and `--scope` for target, selector, and recipient restrictions.
`cast keychain` sends the Account Keychain ABI directly, so a non-expiring key uses `18446744073709551615` (`type(uint64).max`) as the expiry value. This differs from tx-level `key_authorization`, where a non-expiring key is represented by omitting `expiry`. Do not pass `0`.
```bash
# Access keys must be authorized with a future expiry timestamp.
EXPIRY=$(($(date +%s) + 86400))
# For a non-expiring key via direct precompile ABI / cast keychain, use:
NEVER_EXPIRES=18446744073709551615
# Authorize a new access key (signature types: secp256k1, p256, webauthn):
cast keychain authorize secp256k1 $EXPIRY \
--rpc-url $TEMPO_RPC_URL \
--private-key $PRIVATE_KEY
# Authorize with a spending limit (TOKEN:AMOUNT or TOKEN:AMOUNT:PERIOD_SECONDS):
cast keychain authorize secp256k1 $EXPIRY \
--limit :1000000 \
--rpc-url $TEMPO_RPC_URL \
--private-key $PRIVATE_KEY
# Authorize with call scopes (restrict to specific contracts/functions):
cast keychain authorize secp256k1 $EXPIRY \
--scope :transfer,approve \
--rpc-url $TEMPO_RPC_URL \
--private-key $PRIVATE_KEY
# Authorize with call scope restricted to a specific recipient:
cast keychain authorize secp256k1 $EXPIRY \
--scope :transfer@ \
--rpc-url $TEMPO_RPC_URL \
--private-key $PRIVATE_KEY
# Full example: 24h expiry + spending limit + call scope:
cast keychain authorize secp256k1 $EXPIRY \
--limit :1000000 \
--scope :transfer \
--rpc-url $TEMPO_RPC_URL \
--private-key $PRIVATE_KEY
# Revoke an access key (permanent, cannot be re-authorized):
cast keychain revoke \
--rpc-url $TEMPO_RPC_URL \
--private-key $PRIVATE_KEY
# Update spending limit for a key-token pair:
cast keychain update-limit \
--rpc-url $TEMPO_RPC_URL \
--private-key $PRIVATE_KEY
# Replace all call scopes for a key:
cast keychain set-scope \
--scope :transfer \
--scope \
--rpc-url $TEMPO_RPC_URL \
--private-key $PRIVATE_KEY
# Remove a target contract from allowed call list:
cast keychain remove-scope \
--rpc-url $TEMPO_RPC_URL \
--private-key $PRIVATE_KEY
# Query key provisioning status (read-only):
cast keychain check \
--rpc-url $TEMPO_RPC_URL
# Query remaining spending limit via the precompile directly:
cast call 0xAAAAAAAA00000000000000000000000000000000 \
'getRemainingLimitWithPeriod(address,address,address)(uint256,uint64)' \
\
--rpc-url $TEMPO_RPC_URL
```
> Source: [/docs/sdk/foundry/mpp](https://tempo.com/developers/docs/sdk/foundry/mpp.md)
> Section: [Get Started](https://tempo.com/developers/get-started.md). Choose a starting point, send a test payment, get testnet funds, connect a coding agent, find the SDKs and CLI, and use the resource guides to plan payment workflows, liquidity, provider selection, and partner integrations.
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
# Using MPP with Foundry
Foundry includes native MPP support on Tempo. Authorize a Tempo account, then use `cast`, `forge`, `anvil`, or `chisel` with a paid RPC URL. When the endpoint returns `402 Payment Required`, Foundry handles the payment challenge. These instructions target [Foundry v1.8.5](https://github.com/foundry-rs/foundry/releases/tag/v1.8.5).
:::warning[`tempo-foundry` is deprecated]
`tempo-foundry` and `foundryup -n tempo` are deprecated. Install the latest Foundry release with `foundryup`.
:::
Every Foundry tool works transparently with MPP-gated endpoints:
* **`cast`** — queries and transactions
* **`forge`** — scripts and forked tests
* **`anvil`** — local forks of paid endpoints
* **`chisel`** — interactive REPL sessions
## How MPP works with Foundry
When you point any Foundry tool at an MPP-gated RPC URL, the built-in transport intercepts `402` responses and resolves them using MPP's [session flow](https://tempo.com/developers/docs/guide/machine-payments/pay-as-you-go):
1. **First request** — Foundry sends a normal JSON-RPC request to the endpoint.
2. **402 challenge** — The server responds with `402 Payment Required` and a `WWW-Authenticate: Payment` header describing the price.
3. **Account discovery** — Foundry reads an authorized access key from the Tempo Accounts store at `$TEMPO_HOME/wallet/store.json` (default `~/.tempo/wallet/store.json`) for the challenge's chain.
4. **Channel open** — For a session challenge, Foundry opens a payment channel. When the server does not suggest a deposit, the fallback is `20,000` base units (`0.02` of a six-decimal token). Unused funds remain in the channel until it closes.
5. **Voucher payment** — Foundry signs an off-chain voucher and retries the request with an `Authorization: Payment` header.
6. **Channel reuse** — Later requests reuse the channel. Foundry persists channel state in a local SQLite store, separated by RPC origin, and tops up sessions within its automatic deposit limit.
Opening or topping up a channel requires an on-chain transaction. Requests paid with vouchers reuse the channel without a new on-chain payment each time.
## Foundry MPP setup
:::note
Some endpoints use a one-shot `charge` intent instead of session-based channels. Foundry handles both — charge payments sign a single TIP-20 transfer without opening a channel.
:::
:::steps
### Install the Tempo CLI
```bash
curl -fsSL https://tempo.com/install | bash
```
### Install Foundry
Tempo support now ships in the latest Foundry releases:
```bash
foundryup
```
All standard Foundry commands work as before — MPP activates only when an endpoint returns `402`.
### Authorize your account
Authorize an access key for Tempo mainnet:
```bash
cast tempo login
```
Use `cast tempo login --no-browser` on a headless machine. The login stores the access-key private key in `~/.tempo/wallet/store.json`; it does not store your account's root key. Authorize the account and fund it for the network and currency requested by the endpoint before making paid requests.
### Use MPP endpoints
Point any Foundry tool at an MPP-gated RPC URL. No additional flags or config needed.
```bash
cast block-number --rpc-url https://rpc.mpp.tempo.xyz
```
:::
## Foundry MPP examples
### MPP requests with `cast`
Query chain state through a paid endpoint:
```bash
# Get latest block number
cast block-number --rpc-url https://rpc.mpp.tempo.xyz
# Read a contract
cast call 0x20c0000000000000000000006a37da5c996874be \
"balanceOf(address)(uint256)" 0xYourAddress \
--rpc-url https://rpc.mpp.tempo.xyz
```
### MPP requests in `forge script`
Run deployment or read scripts against a paid endpoint:
```solidity
// script/ReadBlock.s.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "forge-std/Script.sol";
contract ReadBlock is Script {
function run() public view {
console.log("block", block.number);
console.log("chain", block.chainid);
}
}
```
```bash
forge script script/ReadBlock.s.sol --rpc-url https://rpc.mpp.tempo.xyz
```
### MPP requests in forked `forge test`
Fork a paid endpoint in tests using `vm.createSelectFork`:
```solidity
// test/MppFork.t.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "forge-std/Test.sol";
contract MppForkTest is Test {
function test_fork_via_mpp() public {
vm.createSelectFork("https://rpc.mpp.tempo.xyz");
assertGt(block.number, 0);
assertEq(block.chainid, 4217);
}
}
```
```bash
forge test --match-test test_fork_via_mpp -vvv
```
### MPP requests with Anvil
Fork a paid endpoint locally. Local RPC calls stay local, but any upstream fetches Anvil makes to the fork URL go through MPP:
```bash
anvil --fork-url https://rpc.mpp.tempo.xyz
```
### MPP requests with Chisel
Interactive REPL against a paid endpoint:
```bash
chisel --fork-url https://rpc.mpp.tempo.xyz
```
```
➜ block.number
Type: uint256
├ Hex: 0x...
└ Decimal: 1234567
```
## Foundry MPP configuration
### MPP deposit amount
Foundry v1.8.5 uses a fallback deposit and top-up amount of `20,000` base units, with an automatic session deposit limit of `1,000,000` base units. For a six-decimal token, these are `0.02` and `1` token. The server can suggest a deposit within the client limit. This limits the channel reserve, not cumulative spending across requests.
### MPP key discovery
Foundry reads the Tempo Accounts store at `$TEMPO_HOME/wallet/store.json` (default `~/.tempo/wallet/store.json`). Use `cast tempo login --chain-id ` to authorize an access key on the network requested by the challenge.
### MPP channel persistence
Foundry reuses open channels across process invocations through a local SQLite channel store. Channel state is namespaced by RPC origin, so different services do not share the same local session state.
## Tempo MPP testnet workflow
Authorize an access key for Moderato, then use its testnet MPP endpoint:
```bash
cast tempo login --chain-id 42431
cast block-number --rpc-url https://rpc.mpp.moderato.tempo.xyz
# Mainnet
cast block-number --rpc-url https://rpc.mpp.tempo.xyz
```
Fund the authorized account on Moderato before making requests. Follow the [testnet faucet instructions](https://tempo.com/developers/docs/quickstart/faucet); mainnet and testnet balances are separate.
### MPP gas sponsorship
Some MPP endpoints sponsor the payment transaction's gas fees. When the challenge supports sponsorship, the server pays those fees. You still need funds for the service charge or channel deposit. Without sponsorship, Tempo transaction fees also require a supported fee token.
## Troubleshoot MPP with Foundry
| Error | Cause | Fix |
|---|---|---|
| `tempo: command not found` | Tempo CLI not installed | Run `curl -fsSL https://tempo.com/install \| bash` |
| Tempo Accounts store cannot provide a wallet | No usable access key for the payment challenge | Run `cast tempo login --chain-id `; use `--no-browser` on a headless machine |
| Insufficient balance | The authorized account cannot fund the payment | Follow the funding command printed by Foundry and check the network and currency |
| Access key authorization fails | The key is missing, expired, or lacks permission | Authorize a suitable key with `cast tempo login --chain-id ` and retry |
## Next steps for MPP with Foundry
[Client quickstart](https://tempo.com/developers/docs/guide/machine-payments/client): Handle payment-gated resources with the TypeScript SDK
[Agent quickstart](https://tempo.com/developers/docs/guide/machine-payments/agent): Make paid requests from a terminal or AI agent
[Pay-as-you-go](https://tempo.com/developers/docs/guide/machine-payments/pay-as-you-go): Session-based billing with off-chain vouchers
> Source: [/docs/sdk/foundry/signature-verifier](https://tempo.com/developers/docs/sdk/foundry/signature-verifier.md)
> Section: [Get Started](https://tempo.com/developers/get-started.md). Choose a starting point, send a test payment, get testnet funds, connect a coding agent, find the SDKs and CLI, and use the resource guides to plan payment workflows, liquidity, provider selection, and partner integrations.
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
# Signature Verification with Foundry
The [`SignatureVerifier` precompile](https://github.com/tempoxyz/tempo/blob/main/tips/tip-1020.md) is available on Tempo. It provides signature verification for secp256k1, P256, and WebAuthn through a single interface — no custom verifier contracts needed.
The Foundry project template for Tempo ships with a working example that demonstrates signature verification in a relayed mail contract. Initialize it with:
```bash
forge init --template tempo my-project && cd my-project
```
## How signature verification works in Foundry
The template's `Mail` contract supports two modes:
1. **Direct** — call `sendMail()` yourself (`msg.sender` is the sender).
2. **Relayed** — sign a mail off-chain and let anyone deliver it on-chain.
Relayed mode uses the `SignatureVerifier` precompile to verify the sender's signature. Unlike Ethereum's `ecrecover`, the precompile:
* Supports secp256k1, P256, and WebAuthn signature types
* Reverts on malformed or cryptographically invalid signatures; `verify` returns `false` when a valid signature belongs to a different signer
* Maintains forward compatibility with future Tempo account types
:::info[T6 keychain verification]
On T6 networks, `verifyKeychain(account, digest, signature)` checks an active access-key signature. `verifyKeychainAdmin(account, digest, signature)` checks a root-key or admin-key signature. Both require the V2 keychain signature encoding; neither checks token budgets or call scopes. Include chain ID, contract address, and account address in the digest you ask users or keys to sign.
:::
## Contract example
The key pattern is a single `verify()` or `recover()` call on the precompile:
```solidity
import {StdPrecompiles} from "tempo-std/StdPrecompiles.sol";
// Option 1: verify — returns true/false, reverts on malformed signatures
require(
StdPrecompiles.SIGNATURE_VERIFIER.verify(from, hash, signature),
"invalid signature"
);
// Option 2: recover — returns the signer address, reverts on malformed signatures
require(
StdPrecompiles.SIGNATURE_VERIFIER.recover(hash, signature) == from,
"invalid signature"
);
```
This excerpt from the template’s `Mail` contract combines verification with a per-sender nonce to prevent replay. The template defines the token, attachment type, and events:
```solidity
contract Mail {
ITIP20 public token;
mapping(address => uint256) public nonces;
/// @notice Send mail on behalf of `from` using their off-chain Tempo signature.
function sendMail(
address from,
address to,
string memory message,
Attachment memory attachment,
bytes calldata signature
) external {
bytes32 hash = getDigest(from, to, message, attachment);
require(
StdPrecompiles.SIGNATURE_VERIFIER.verify(from, hash, signature),
"invalid signature"
);
nonces[from]++;
token.transferFromWithMemo(from, to, attachment.amount, attachment.memo);
emit MailSent(from, to, message, attachment);
}
function getDigest(address from, address to, string memory message, Attachment memory attachment)
public view returns (bytes32)
{
return keccak256(
abi.encode(address(this), block.chainid, from, to, message, attachment, nonces[from])
);
}
}
```
## Test signature verification in Foundry
The template includes tests for both signature types. Tempo support is enabled by the template's Foundry config. If you copy this pattern into an existing project, make sure `foundry.toml` enables Tempo mode:
```toml
[profile.default]
tempo = true
```
### secp256k1
```solidity
contract MailRelayTest is MailTest {
uint256 internal constant ALICE_PK = 0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80;
function test_SendMailWithSecp256k1Signature() public {
bytes32 digest = mail.getDigest(ALICE, BOB, message, attachment);
(uint8 v, bytes32 r, bytes32 s) = vm.sign(ALICE_PK, digest);
mail.sendMail(ALICE, BOB, message, attachment, abi.encodePacked(r, s, v));
assertEq(mail.nonces(ALICE), 1);
}
}
```
### P256
```solidity
uint256 internal constant CAROL_P256_PK = 0x1;
function setUp() public override {
super.setUp();
(uint256 x, uint256 y) = vm.publicKeyP256(CAROL_P256_PK);
carolPubX = bytes32(x);
carolPubY = bytes32(y);
CAROL = address(uint160(uint256(keccak256(abi.encodePacked(x, y)))));
}
function test_SendMailWithP256Signature() public {
bytes32 digest = mail.getDigest(CAROL, BOB, message, attachment);
(bytes32 r, bytes32 s) = vm.signP256(CAROL_P256_PK, digest);
s = _normalizeP256S(s); // low-s normalization required by the precompile
bytes memory sig = abi.encodePacked(carolPubX, carolPubY, r, s);
mail.sendMail(CAROL, BOB, message, attachment, sig);
assertEq(mail.nonces(CAROL), 1);
}
```
## Run the tests
```bash
forge test -vvv
```
The secp256k1 and P256 relay tests use Tempo mode through the template's Foundry config.
## Related signature verification docs
* [Signature verification specification](https://github.com/tempoxyz/tempo/blob/main/tips/tip-1020.md)
* [T6 Network Upgrade](https://tempo.com/developers/docs/protocol/upgrades/t6)
* [Foundry for Tempo](https://tempo.com/developers/docs/sdk/foundry)
> Source: [/docs/resources/guides](https://tempo.com/developers/docs/resources/guides.md)
> Section: [Get Started](https://tempo.com/developers/get-started.md). Choose a starting point, send a test payment, get testnet funds, connect a coding agent, find the SDKs and CLI, and use the resource guides to plan payment workflows, liquidity, provider selection, and partner integrations.
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
[Tempo Docs](https://tempo.com/developers/get-started) / Guides
# Payment and integration guides
Choose the task your application needs to complete. Each guide explains the workflow, the Tempo features and onchain controls involved, and the providers that can supply a missing part.
For a first test payment, use the [quickstart](https://tempo.com/developers/get-started/quickstart). [Partners](https://tempo.com/developers/docs/partners) lists the third-party providers these guides mention, such as wallet, funding, and RPC providers.
## Use Tempo
* [Get stablecoins on Tempo](https://tempo.com/developers/docs/resources/guides/get-stablecoins-on-tempo)
* [Add Tempo to MetaMask](https://tempo.com/developers/docs/resources/guides/add-tempo-to-metamask)
* [Connect Tempo Wallet to an app](https://tempo.com/developers/docs/resources/guides/connect-tempo-wallet-to-an-app)
* [Set an agent spending limit](https://tempo.com/developers/docs/resources/guides/set-an-agent-spending-limit)
* [Pay fees in stablecoins](https://tempo.com/developers/docs/resources/guides/pay-network-fees-in-stablecoins)
* [Move funds off Tempo](https://tempo.com/developers/docs/resources/guides/move-funds-off-tempo)
## Payment infrastructure
* [Blockchain payment flows](https://tempo.com/developers/docs/resources/guides/blockchain-payments)
* [Stablecoins for business](https://tempo.com/developers/docs/resources/guides/stablecoins-for-business)
* [Plan a payment stack](https://tempo.com/developers/docs/resources/guides/stablecoin-payment-infrastructure-enterprise-scale)
* [Stablecoin settlement](https://tempo.com/developers/docs/resources/guides/stablecoin-settlement)
* [Compare payment rails](https://tempo.com/developers/docs/resources/guides/payment-rails)
* [Estimate payment fees](https://tempo.com/developers/docs/resources/guides/stablecoin-fees)
## Payment workflows
* [Accept stablecoin payments](https://tempo.com/developers/docs/resources/guides/how-to-accept-stablecoin-payments)
* [Create payment links](https://tempo.com/developers/docs/resources/guides/payment-links)
* [Handle refunds](https://tempo.com/developers/docs/resources/guides/refunds)
* [Reconcile payments](https://tempo.com/developers/docs/resources/guides/payment-reconciliation)
* [Plan batch payments](https://tempo.com/developers/docs/resources/guides/batch-payments)
* [Global payouts](https://tempo.com/developers/docs/resources/guides/global-payouts)
* [Global payroll](https://tempo.com/developers/docs/resources/guides/stablecoin-payroll-for-global-teams)
* [Cross-border payments](https://tempo.com/developers/docs/resources/guides/cross-border-payments)
* [Latin America payment routes](https://tempo.com/developers/docs/resources/guides/cross-border-payments-latin-america)
* [Remittance operations](https://tempo.com/developers/docs/resources/guides/remittances)
* [Recurring payments](https://tempo.com/developers/docs/resources/guides/subscriptions-on-tempo)
## Liquidity and issuance
* [Corporate treasury](https://tempo.com/developers/docs/resources/guides/corporate-treasury)
* [Nostro and vostro accounts](https://tempo.com/developers/docs/resources/guides/nostro-vostro-accounts): how correspondent banks hold balances for each other, and what stablecoin settlement changes.
* [Plan prefunding](https://tempo.com/developers/docs/resources/guides/prefunding)
* [FBO accounts](https://tempo.com/developers/docs/resources/guides/fbo-accounts): for-benefit-of bank accounts that hold customer funds, and how they differ from stablecoin balances.
* [The GENIUS Act](https://tempo.com/developers/docs/resources/guides/genius-act): the U.S. law that regulates payment stablecoin issuers, reserves, and redemption.
## Machine payment models
* [HTTP 402 payment flows](https://tempo.com/developers/docs/resources/guides/402-payment-required): a server answers with HTTP `402 Payment Required`, and the client retries with payment through the [Machine Payments Protocol](https://tempo.com/developers/docs/agents) (MPP).
* [Microtransactions and sessions](https://tempo.com/developers/docs/resources/guides/microtransactions)
## Choose wallets and funding
* [Add embedded wallets](https://tempo.com/developers/docs/resources/guides/embedded-wallets): compare the wallet providers Privy, Dynamic, Turnkey, and Fireblocks by signing and payment requirements.
* [Fund accounts and pay out](https://tempo.com/developers/docs/resources/guides/funding-and-payouts): choose the funding rail and follow the setup path for Bridge, a stablecoin funding and payout provider.
* [Connect an RPC provider](https://tempo.com/developers/docs/partners/rpc-and-nodes): choose hosted network access and verify that its chain ID matches Tempo's.
## Compliance and security
* [Screen blockchain payments](https://tempo.com/developers/docs/resources/guides/payment-screening): choose address checks, monitoring, or transaction simulation and see which providers support each.
* [Configure token and receive controls](https://tempo.com/developers/docs/resources/guides/compliance-controls): enforce token policies and [receive policies](https://tempo.com/developers/docs/protocol/tip403/receive-policies), which let an address choose the tokens and senders it accepts. Handle funds a receive policy holds for later claim, and keep case records.
## Implement native payment features
These features are built into [TIP-20 tokens](https://tempo.com/developers/docs/protocol/tip20/overview), Tempo's native token standard for stablecoins. Each guide shows how to implement one:
* [Sponsor user fees](https://tempo.com/developers/docs/api/fee-payer): let a fee payer, such as your backend, pay the network fee for a user's transaction, and authorize that sponsorship.
* [Payment references](https://tempo.com/developers/docs/guide/payments/transfer-memos): attach a 32-byte memo, such as an invoice ID, and match a confirmed transfer to your ledger.
* [Mint and burn TIP-20 tokens](https://tempo.com/developers/docs/guide/issuance/mint-stablecoins): manage your stablecoin's supply and distinguish token events from issuer funding and redemption.
> Source: [/docs/resources/guides/get-stablecoins-on-tempo](https://tempo.com/developers/docs/resources/guides/get-stablecoins-on-tempo.md)
> Section: [Get Started](https://tempo.com/developers/get-started.md). Choose a starting point, send a test payment, get testnet funds, connect a coding agent, find the SDKs and CLI, and use the resource guides to plan payment workflows, liquidity, provider selection, and partner integrations.
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
[Guides](https://tempo.com/developers/docs/resources/guides) / [Use Tempo](https://tempo.com/developers/docs/resources/guides#use-tempo) / Get stablecoins on Tempo
# Get stablecoins on Tempo
Move stablecoins onto Tempo from another chain, an exchange, or another Tempo account.
## Overview
Tempo has no native token. Your balance is held in stablecoins, such as OUSD, USDC.e, and USDT0. Anyone can send stablecoins to a Tempo address, with nothing to set up first.
Pick a path by where your money is now:
* **On another chain.** Deposit it into [Tempo Wallet](https://wallet.tempo.xyz), or use a bridge.
* **On an exchange.** Withdraw it and choose Tempo as the network.
* **In another Tempo account.** Share your address and receive it.
## Deposit from another chain
Tempo Wallet gives you a deposit address on the chain your funds are on. It converts what you send and adds OUSD to your Tempo balance.
:::steps
### Open the deposit screen
Sign in at [wallet.tempo.xyz](https://wallet.tempo.xyz) with your email or a passkey. A new email creates a wallet. Select **Deposit**, then **Deposit crypto**.
### Choose the network and token
Pick the **Network** and **Token** you're sending from.
| Network | Tokens |
| --- | --- |
| Base | USDC, OUSD, ETH, WETH, cbBTC, SOL, WBTC |
| Ethereum | USDC, USDT, OUSD, ETH, WETH, WBTC |
| Arbitrum | USDC, USDT, ETH |
| Optimism | USDC, USDT, ETH, WETH |
| Solana | USDC, SOL |
| Unichain | USDC, ETH |
| Abstract | USDC, ETH |
### Send to the deposit address
Copy the **Deposit address** or scan its QR code. Send only the token and network you selected. Select **Done**. The wallet shows **Deposit complete** when the OUSD arrives.
:::
Deposits from other chains go to Tempo mainnet only. [Relay](https://tempo.com/developers/docs/guide/bridge-relay) routes them.
## Withdraw from an exchange
Some exchanges send stablecoins on Tempo directly:
* **Coinbase.** Select Tempo as the network when you send a supported stablecoin.
* **Kraken.** Withdraw USDT0 on Tempo.
Paste your Tempo address as the destination. Check that the exchange shows Tempo as the network before you confirm.
## Bridge from another chain
A bridge moves stablecoins from another chain to any Tempo address, including one in MetaMask or Rabby. To use [Relay](https://relay.link/bridge), choose your source chain and token, then set **Tempo** as the destination.
Other bridges, such as LayerZero, Bungee, and Across, are in the [bridge directory](https://tempo.com/developers/docs/partners/bridges).
## Receive from another Tempo account
In Tempo Wallet, select **Receive**, then copy your **Wallet address** or show its QR code. Only send supported stablecoins on Tempo to it.
## Get test stablecoins
The [Moderato testnet faucet](https://tempo.com/developers/docs/quickstart/faucet) gives you free test stablecoins. They have no value and work only on testnet.
## Related
[Add Tempo to MetaMask](https://tempo.com/developers/docs/resources/guides/add-tempo-to-metamask): Use Tempo in a wallet you already have.
[Move funds off Tempo](https://tempo.com/developers/docs/resources/guides/move-funds-off-tempo): Send stablecoins to an exchange, another chain, or a bank.
[Fund an account](https://tempo.com/developers/docs/guide/getting-funds): Add funding and deposits to your own app.
> Source: [/docs/resources/guides/add-tempo-to-metamask](https://tempo.com/developers/docs/resources/guides/add-tempo-to-metamask.md)
> Section: [Get Started](https://tempo.com/developers/get-started.md). Choose a starting point, send a test payment, get testnet funds, connect a coding agent, find the SDKs and CLI, and use the resource guides to plan payment workflows, liquidity, provider selection, and partner integrations.
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
[Guides](https://tempo.com/developers/docs/resources/guides) / [Use Tempo](https://tempo.com/developers/docs/resources/guides#use-tempo) / Add Tempo to MetaMask
# Add Tempo to MetaMask
Add Tempo mainnet to MetaMask or any EVM wallet in under a minute.
## Overview
Tempo works with EVM wallets, such as MetaMask, Rabby, and Ledger. Your wallet's address is the same on Tempo as on Ethereum. Some wallets, such as Gem Wallet and OKX Wallet, support Tempo already.
## Add Tempo automatically
Connect your browser wallet and approve the network request.
Connect a wallet in the interactive web page.
## Add Tempo manually
:::steps
### Open the network settings
In MetaMask, open the network menu and select **Add a custom network**. In Rabby or another wallet, add a custom network from its settings.
### Enter the network details
| Field | Value |
| --- | --- |
| Network name | Tempo Mainnet |
| RPC URL | `https://rpc.tempo.xyz` |
| Chain ID | `4217` |
| Currency symbol | `USD` |
| Block explorer URL | `https://explore.tempo.xyz` |
### Save and switch
Save the network and switch to it.
:::
For the testnet, use chain ID `42431`, RPC URL `https://rpc.moderato.tempo.xyz`, and explorer `https://explore.testnet.tempo.xyz`.
## Show your stablecoins
Tempo has no native token, so your wallet's native balance is a placeholder. Ignore the large `USD` number it shows. Import each stablecoin you hold by its address from the [token list](https://tempo.com/developers/docs/quickstart/tokenlist), such as OUSD or USDC.e.
## Pay fees
Each transaction pays its network fee in a stablecoin. You don't need ETH or any other token. By default, a transfer pays its fee in the stablecoin it sends. Most other transactions fall back to pathUSD. [Pay fees in stablecoins](https://tempo.com/developers/docs/resources/guides/pay-network-fees-in-stablecoins) explains the rules.
## Related
[Get stablecoins on Tempo](https://tempo.com/developers/docs/resources/guides/get-stablecoins-on-tempo): Fund your new Tempo address.
[Pay fees in stablecoins](https://tempo.com/developers/docs/resources/guides/pay-network-fees-in-stablecoins): How Tempo charges network fees without a gas token.
[Add Tempo to your wallet](https://tempo.com/developers/docs/accounts/wallets/add-tempo-to-your-wallet): For wallet teams adding Tempo support.
> Source: [/docs/resources/guides/connect-tempo-wallet-to-an-app](https://tempo.com/developers/docs/resources/guides/connect-tempo-wallet-to-an-app.md)
> Section: [Get Started](https://tempo.com/developers/get-started.md). Choose a starting point, send a test payment, get testnet funds, connect a coding agent, find the SDKs and CLI, and use the resource guides to plan payment workflows, liquidity, provider selection, and partner integrations.
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
[Guides](https://tempo.com/developers/docs/resources/guides) / [Use Tempo](https://tempo.com/developers/docs/resources/guides#use-tempo) / Connect Tempo Wallet to an app
# Connect Tempo Wallet to an app
Sign in to apps and agents with your Tempo Wallet, then disconnect them when you're done.
## Overview
[Tempo Wallet](https://wallet.tempo.xyz) is a web wallet you open with your email or a passkey. An app connects to it through a **Sign in with Tempo** window. If the app wants to pay from your account, you approve a spending limit first.
## Connect to an app
:::steps
### Select Sign in with Tempo
In the app, select **Sign in with Tempo**. A Tempo Wallet window opens.
### Sign in
Enter your email and the 6-digit code it receives, or select **Continue with passkey**. A new email creates a wallet.
### Review the request
If the app asks to spend, the window says it will be authorized to spend from your account. It lists the spending limit, network fees, and expiry. Select **Approve** to connect, or **Reject**.
:::
[Set a spending limit](https://tempo.com/developers/docs/resources/guides/set-an-agent-spending-limit) explains each line on the approval screen.
## Connect an AI agent
:::steps
### Open Agent payments
In Tempo Wallet, open the account menu and select **Agent payments**.
### Copy the command
Choose your agent: Claude, Codex, Amp, OpenCode, or Cursor. Copy the command and run it in the agent. For Claude Code:
```bash
claude "Read https://tempo.com/SKILL.md and connect to my Tempo wallet"
```
### Approve in the browser
The agent opens Tempo Wallet. Check that the device code matches your terminal, then approve the spending limit.
:::
From a terminal, `tempo wallet login` starts the same flow. The [`tempo wallet` reference](https://tempo.com/developers/docs/cli/wallet) lists its other commands.
## Disconnect an app
Sign in to Tempo Wallet with your passkey, then open [wallet.tempo.xyz/apps](https://wallet.tempo.xyz/apps). It lists connected apps and CLI keys with their spending limits. Select **Disconnect** on an app to revoke its keys. Revoked keys can't spend.
## Related
[Set a spending limit](https://tempo.com/developers/docs/resources/guides/set-an-agent-spending-limit): Choose how much an agent can spend and for how long.
[Get stablecoins on Tempo](https://tempo.com/developers/docs/resources/guides/get-stablecoins-on-tempo): Add money to your wallet before you connect.
[Give an agent a wallet](https://tempo.com/developers/docs/accounts/automations/give-an-agent-a-wallet): For developers building agent payments.
> Source: [/docs/resources/guides/set-an-agent-spending-limit](https://tempo.com/developers/docs/resources/guides/set-an-agent-spending-limit.md)
> Section: [Get Started](https://tempo.com/developers/get-started.md). Choose a starting point, send a test payment, get testnet funds, connect a coding agent, find the SDKs and CLI, and use the resource guides to plan payment workflows, liquidity, provider selection, and partner integrations.
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
[Guides](https://tempo.com/developers/docs/resources/guides) / [Use Tempo](https://tempo.com/developers/docs/resources/guides#use-tempo) / Set an agent spending limit
# Set an agent spending limit
Let an agent pay from your account, up to an amount you approve.
## Overview
When an app or agent asks to pay from your Tempo Wallet, you approve an access key for it. Tempo enforces the key's limits on every transaction. The agent can't spend past them, whatever it decides to do.
An access key has three limits:
* **Spending limit.** How much it can spend, such as $20 per day.
* **Expiry.** When it stops working, such as in 30 days.
* **Scopes.** Which actions it can take.
## Review the approval screen
The **Authorize App** screen shows what the app will be able to do:
| Line | Meaning |
| --- | --- |
| **Spend $X per day** | The most it can spend before the limit resets. |
| **Spend any amount** | No spending limit. Approve this only for apps you fully trust. |
| **Pay network fees up to $X** | A separate budget for transaction fees. |
| **Hold funds for services** | Money set aside for pay-as-you-go services. |
| **Expires in…** | When the key stops working. |
| **This app can take other actions** | It can make calls beyond payments. Select **Show** to see them. |
## Lower the limits
:::steps
### Edit the permissions
Select the pencil icon to open **Edit Permissions**.
### Change the amount or expiry
Lower the **Spend limit**, or pick an expiry: **7 days**, **30 days**, **365 days**, or **No expiry**. You can only reduce what the app asked for.
### Approve
Select **Save changes**, then **Approve**.
:::
## Raise or revoke a limit
An app can ask for a higher limit later. You see an **Update spend limit** screen and approve or reject it.
To stop an agent, sign in to Tempo Wallet with your passkey and open [wallet.tempo.xyz/apps](https://wallet.tempo.xyz/apps). Expand the app to see each key's remaining limit and expiry. Select **Revoke** on a key, or **Disconnect** to revoke all of the app's keys. A key also stops working when its expiry passes.
## Related
[Connect Tempo Wallet to an app](https://tempo.com/developers/docs/resources/guides/connect-tempo-wallet-to-an-app): Sign in to apps and agents.
[Spending limits](https://tempo.com/developers/docs/accounts/access-keys/spending-limits): How Tempo enforces access key limits.
[Give an agent a wallet](https://tempo.com/developers/docs/accounts/automations/give-an-agent-a-wallet): Build agent spending limits into your app.
> Source: [/docs/resources/guides/pay-network-fees-in-stablecoins](https://tempo.com/developers/docs/resources/guides/pay-network-fees-in-stablecoins.md)
> Section: [Get Started](https://tempo.com/developers/get-started.md). Choose a starting point, send a test payment, get testnet funds, connect a coding agent, find the SDKs and CLI, and use the resource guides to plan payment workflows, liquidity, provider selection, and partner integrations.
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
[Guides](https://tempo.com/developers/docs/resources/guides) / [Use Tempo](https://tempo.com/developers/docs/resources/guides#use-tempo) / Pay fees in stablecoins
# Pay fees in stablecoins
Tempo has no gas token. Every network fee is paid in a USD stablecoin.
## Overview
A network fee is what a transaction pays to be included in a block. On Tempo, it's priced in USD and paid in a USD stablecoin you already hold, such as OUSD, USDC.e, or USDT0. You never need to buy ETH or another token to pay it.
## Which stablecoin pays
Tempo picks the fee token in this order:
1. **Your choice for the transaction.** Some apps let you pick it.
2. **Your account's default.** You set it once.
3. **The stablecoin you send.** A transfer of USDC.e pays its fee in USDC.e.
4. **The stablecoin you swap from.** This applies to a single swap.
5. **pathUSD.** The fallback for every other transaction.
When an app or fee payer covers the fee, its own default applies instead of yours. The fee token must be a USD stablecoin. Tempo rejects a transaction when your account can't cover the maximum fee in that token. It doesn't try another token.
## Fees in Tempo Wallet
Tempo Wallet picks the fee token for you. Each review screen shows a **Fee** row in USD. When an app or Tempo covers the fee, the row says **Sponsored**, and you pay nothing.
## Fees in MetaMask and other wallets
Standard wallets follow the same order. Keep a small balance of the stablecoin you send. Wallets show a large placeholder in place of a native balance. It isn't money you hold.
## When a transaction fails for fees
Check that you hold enough of the fee token. If the fee falls back to pathUSD and you hold none, swap a little into pathUSD. In Tempo Wallet, select **Swap**. Or [set a default fee token](https://tempo.com/developers/docs/accounts/fees/fee-tokens#set-a-default-fee-token) you hold.
## Related
[Fee Tokens](https://tempo.com/developers/docs/accounts/fees/fee-tokens): Set and override an account's fee token in code.
[Fee Sponsorship](https://tempo.com/developers/docs/accounts/fees/fee-sponsorship): Pay your users' fees from your app.
[Add Tempo to MetaMask](https://tempo.com/developers/docs/resources/guides/add-tempo-to-metamask): Use Tempo in a wallet you already have.
> Source: [/docs/resources/guides/move-funds-off-tempo](https://tempo.com/developers/docs/resources/guides/move-funds-off-tempo.md)
> Section: [Get Started](https://tempo.com/developers/get-started.md). Choose a starting point, send a test payment, get testnet funds, connect a coding agent, find the SDKs and CLI, and use the resource guides to plan payment workflows, liquidity, provider selection, and partner integrations.
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
[Guides](https://tempo.com/developers/docs/resources/guides) / [Use Tempo](https://tempo.com/developers/docs/resources/guides#use-tempo) / Move funds off Tempo
# Move funds off Tempo
Send stablecoins from Tempo to an exchange, another chain, or another wallet.
## Overview
Tempo Wallet doesn't withdraw to a bank account. To cash out, send stablecoins to an exchange or ramp that supports Tempo, then withdraw to your bank there. To use them on another chain, bridge them.
## Cash out through an exchange
:::steps
### Get a Tempo deposit address
In Coinbase, receive a supported stablecoin and choose Tempo as the network. Kraken accepts USDT0 deposits on Tempo.
### Send from Tempo Wallet
In Tempo Wallet, select **Send**. Paste the exchange's address as the **Recipient**, choose the stablecoin, and enter the amount. Add a **Note** if the exchange asks for a memo. Select **Send**.
### Withdraw to your bank
When the deposit arrives, sell or withdraw it to your bank on the exchange.
:::
Send only stablecoins the exchange supports on Tempo. Stablecoins sent on the wrong network or in an unsupported token can be lost.
## Bridge to another chain
A bridge moves stablecoins from Tempo to chains such as Base, Ethereum, Arbitrum, and Solana. To use [Relay](https://relay.link/bridge), connect a wallet that holds your Tempo address, such as MetaMask or Rabby. Choose **Tempo** as the source chain and pick the destination. Other bridges are in the [bridge directory](https://tempo.com/developers/docs/partners/bridges).
## Use a wallet with a built-in off-ramp
Some wallets that support Tempo sell stablecoins for local currency. [Bridge Wallet by Mt Pelerin](https://www.mtpelerin.com/bridge-wallet) supports cashing out supported assets. Send your stablecoins to its Tempo address first.
## Related
[Get stablecoins on Tempo](https://tempo.com/developers/docs/resources/guides/get-stablecoins-on-tempo): Move money onto Tempo.
[Bridging with Relay](https://tempo.com/developers/docs/guide/bridge-relay): Bridge with the Relay API or app.
[Payments and ramps](https://tempo.com/developers/docs/partners/payments-and-ramps): Fiat ramp providers for apps.
> Source: [/docs/resources/guides/blockchain-payments](https://tempo.com/developers/docs/resources/guides/blockchain-payments.md)
> Section: [Get Started](https://tempo.com/developers/get-started.md). Choose a starting point, send a test payment, get testnet funds, connect a coding agent, find the SDKs and CLI, and use the resource guides to plan payment workflows, liquidity, provider selection, and partner integrations.
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
[Guides](https://tempo.com/developers/docs/resources/guides) / [Payment infrastructure](https://tempo.com/developers/docs/resources/guides#payment-infrastructure) / Blockchain payment workflows
# Blockchain payment workflows
A blockchain payment uses an onchain asset transfer as part of a payment workflow. The network records the transfer; your application and providers supply funding, signing, customer records, and any local-currency payout. Start with the asset and account your recipient needs, then map the components that deliver it.
## Define the recipient outcome
A supported token in a wallet, a provider account balance, and local currency in a bank account are different results. Specify the network, token contract, recipient account, and usable amount before selecting infrastructure.
Stablecoins are tokens designed to track a reference value, often the U.S. dollar. They still carry issuer, redemption, custody, and conversion risk. Identify a token by its contract and network, not its ticker. Use the [stablecoin registry](https://tempo.com/developers/docs/partners/stablecoins) when choosing an asset on Tempo.
## Map the payment lifecycle
| Stage | Integration responsibility |
| --- | --- |
| Funding | Make the supported payment asset and network fee funding available. |
| Authorization | Apply business approvals and the account's signing permissions. |
| Submission | Save the intended payment and transaction identifier before handling retries. |
| Onchain delivery | Verify the successful transaction and expected delivered token transfer. |
| Additional payout | Track provider credit, currency conversion, or bank delivery in the provider's records. |
| Reconciliation | Match the transfer and delivery records to the business operation once. |
A transaction hash only identifies a transaction. The receipt shows whether the call succeeded and which transfers it delivered; the provider reports any bank payout.
## Implement payment delivery checks
:::steps
### Validate the payment instruction
Record the network, token contract, recipient, amount in base units, and business reference. Apply your application's approvals and check the available token balance and fee funding. Follow [sending payments](https://tempo.com/developers/docs/guide/payments/send-a-payment).
### Submit and preserve the attempt
Store the transaction identifier against the payment record. If submission times out, investigate that attempt before creating another. A repeated application request should not create a duplicate payment.
### Verify the delivered transfer
Follow [receiving payments](https://tempo.com/developers/docs/guide/payments/accept-a-payment) to check the successful transaction and the expected transfer's network, contract, recipient, and amount. If a receive policy holds the funds, the call succeeds but the receiver isn't paid.
### Credit the business record once
Use the network, transaction hash, and transfer log index as a unique event key. Save the event and update the invoice or customer ledger atomically. Recover missed events after a service reconnects.
:::
## Assemble the account and operating model
Choose the wallet or custodian, key management, account recovery, and [signing policy](https://tempo.com/developers/docs/accounts/use-cases) for the flow. A platform API credential and an account signing key confer different authority.
Use [access keys](https://tempo.com/developers/docs/accounts/access-keys) when a device, service, or agent needs bounded signing authority. Apply token spending limits, allowed calls, and expiry.
Assign owners for identity checks, screening, monitoring, and exception handling. [Token and receive controls](https://tempo.com/developers/docs/resources/guides/compliance-controls) enforce the policies you configure.
## Use Tempo's payment capabilities
* **Stablecoin fees:** pay network fees in eligible USD-denominated TIP-20 tokens under the [fee rules](https://tempo.com/developers/docs/resources/guides/stablecoin-fees).
* **Fee sponsorship:** let an application [pay the network fee](https://tempo.com/developers/docs/api/fee-payer) while a customer authorizes the payment.
* **Payment references:** use [32-byte memos](https://tempo.com/developers/docs/guide/payments/transfer-memos) to connect transfers to separately stored business records.
* **Transfer controls:** use [TIP-20 roles and TIP-403 policies](https://tempo.com/developers/docs/resources/guides/compliance-controls) for issuer-defined token rules. Configure [account receive policies](https://tempo.com/developers/docs/accounts/policies/receive-policies) separately to control incoming payments.
* **Private account activity:** use [Tempo Zones](https://tempo.com/developers/docs/zones), live on Mainnet. A Zone's [operator can read its ledger](https://tempo.com/developers/docs/zones/privacy), and deposits and withdrawals leave public records.
Funding, conversion, and bank-delivery timing depend on your providers and route.
## Compare complete payment routes
Include funding, custody, network fees, conversion, recipient delivery, and exception handling in a route comparison. Bank systems include scheduled payments, wires, and around-the-clock services.
Use [payment rail comparisons](https://tempo.com/developers/docs/resources/guides/payment-rails) for evaluation, [corporate treasury operations](https://tempo.com/developers/docs/resources/guides/corporate-treasury) for intercompany funding, or [remittance operations](https://tempo.com/developers/docs/resources/guides/remittances) for recipient payouts.
## Blockchain payment questions
### Does a customer need to hold stablecoins directly?
A provider can handle stablecoins between fiat collection and delivery where its product supports the route. A direct onchain integration needs supported token balances and signing.
### Is blockchain payment data public?
Public-chain activity is visible. Don't put customer details in payment references. In a Zone, the operator can read the ledger, and deposits and withdrawals are public.
### Does successful execution prove payment delivery?
No. Verify the expected delivered transfer. A receive policy can redirect a successful inbound call to a guard-held receipt. Additional provider or bank delivery requires its own evidence.
> Source: [/docs/resources/guides/stablecoins-for-business](https://tempo.com/developers/docs/resources/guides/stablecoins-for-business.md)
> Section: [Get Started](https://tempo.com/developers/get-started.md). Choose a starting point, send a test payment, get testnet funds, connect a coding agent, find the SDKs and CLI, and use the resource guides to plan payment workflows, liquidity, provider selection, and partner integrations.
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
[Guides](https://tempo.com/developers/docs/resources/guides) / [Payment infrastructure](https://tempo.com/developers/docs/resources/guides#payment-infrastructure) / Evaluate stablecoins for business
# Evaluate stablecoins for business
Businesses can use stablecoins for treasury transfers, supplier payments, payroll, and platform payouts. Start with one supported payment flow and a measurable operating problem. Use the [payment guides](https://tempo.com/developers/docs/guide/payments) for a direct integration and [payments and ramps](https://tempo.com/developers/docs/partners/payments-and-ramps) for provider research.
A business can hold stablecoins directly or use a provider that converts between fiat and stablecoins. The right model depends on the recipient's needs, available funding and payout services, and your operating responsibilities.
## Match stablecoins to a business flow
### Treasury management
Global treasury teams manage cash across dozens of accounts, currencies, and banking relationships. Stablecoins support transfers of dollar-denominated value on networks that operate 24/7. Funding bank accounts, converting assets, and redeeming into fiat remain separate steps. Plan the balances required for each entity and provider; stablecoins don't eliminate prefunding. Learn more in our [corporate treasury guide](https://tempo.com/developers/docs/resources/guides/corporate-treasury).
### Vendor and supplier payments
Stablecoin transfers can connect an approved supplier payment with onchain delivery evidence. Agree on the asset and network, verify the recipient instructions, and attach an opaque invoice reference. For suppliers receiving fiat, confirm the payout provider's final delivery status as well as the onchain transfer.
### Cross-border transfers
Stablecoins can replace part of a correspondent banking route with an onchain transfer. Bank accounts, payout partners, and [prefunding](https://tempo.com/developers/docs/resources/guides/prefunding) can still be needed at the endpoints. Tempo provides near-instant onchain settlement and [sub-cent network fees](https://tempo.com/developers/docs/resources/guides/stablecoin-fees). See our [cross-border payments guide](https://tempo.com/developers/docs/resources/guides/cross-border-payments) for a detailed comparison.
### Payroll and contractor payments
Companies with distributed teams can offer stablecoin payments to eligible international contractors. Confirm the permitted payment method and terms before enabling it. Recipients can hold dollar-denominated value and convert through the services available to them. Read the [stablecoin payroll guide](https://tempo.com/developers/docs/resources/guides/stablecoin-payroll-for-global-teams).
### Marketplace and platform payouts
Multi-sided marketplaces, from gig economy platforms to creator economy apps, can offer stablecoin payouts to eligible merchants, drivers, and creators. Local currency delivery depends on the supported payout providers and payment methods.
## The stablecoin sandwich
A provider-mediated payment flow can let a business fund and receive payments in fiat while the provider uses stablecoins for the transfer between endpoints.
:::steps
### Fund the provider
The business sends USD or another supported currency through the provider's funding instructions.
### Execute the stablecoin leg
The provider converts to a supported stablecoin, transfers it onchain, and delivers it to the receiving provider.
### Deliver the recipient currency
The receiving provider converts or redeems as needed and uses a supported bank or local payout method.
:::
Before adopting this flow, confirm who owns the funds at each stage, when conversion happens, and what records the provider supplies. If a provider uses an [FBO account](https://tempo.com/developers/docs/resources/guides/fbo-accounts), understand how the pooled bank balance maps to your business's ledger balance.
## Measure the complete payment cost
Compare the amount your business spends with the amount the recipient receives. Include funding charges, conversion spreads, network fees, provider charges, payout fees, and the staff time required to resolve exceptions.
For a pilot, use comparable payments through the existing and proposed flows. Record:
* The source amount, quoted recipient amount, fees, and quote expiry.
* The time funding starts, the onchain transfer confirms, and the recipient can use the funds.
* Balances held with each provider and the time they remain unavailable elsewhere.
* Failed, returned, or manually reviewed payments and the work needed to resolve them.
Use those results to estimate savings and integration payback. See [payment reconciliation](https://tempo.com/developers/docs/resources/guides/payment-reconciliation) for the records to preserve.
## Assess a specific payment corridor
Before selecting a provider or integration approach, finance teams should evaluate three areas:
### Identify high-friction corridors
Identify your highest-cost or highest-friction payment corridors. Compare proposed routes against the specific funding currency, recipient country, payout method, and transaction size your business needs.
### Map the operating problem
Common pain points include cost, settlement speed, reconciliation overhead, trapped working capital, and payment failures. Each pain point may lead to a different starting use case.
### Assign the integration responsibilities
Decide which responsibilities your team will operate and which a provider will handle. A provider can shorten the integration work, but the supported services and contractual responsibilities vary.
## Choose a provider-led or direct integration
### Buy: orchestration providers
Payment and orchestration providers can connect funding, conversion, stablecoin transfers, and local payouts through an API. Confirm the supported assets, markets, custody model, controls, and approval requirements for the specific service. Explore [payment and ramp providers](https://tempo.com/developers/docs/partners/payments-and-ramps) as a starting point.
This model can fit a team that wants a provider to operate the agreed funding, settlement, and payout services.
### Build: direct integration
Building directly on stablecoin infrastructure gives you more control over payment logic and integration choices. Compare its operating and engineering costs with the provider model, and decide who operates accounts, key management, funding, payouts, and compliance processes.
This model can fit a team with the engineering and operating capacity to manage those responsibilities.
### Hybrid
A hybrid model can combine your own accounts and payment logic with providers for funding or local payouts. Document the handoff between systems so a confirmed onchain transfer is not mistaken for completed bank delivery.
## Evaluate asset and operating risks
### Counterparty risk
Evaluate the issuer's reserve composition, attestation frequency, regulatory status, and redemption terms. Our [GENIUS Act overview](https://tempo.com/developers/docs/resources/guides/genius-act) explains the U.S. framework and its scope. Direct issuance or redemption also requires the issuer's acceptance of your entity and the relevant funding or payout method. The protocol's [minting functions](https://tempo.com/developers/docs/guide/issuance/mint-stablecoins) don't grant that access.
### Operational risk
New payment rails introduce new operational considerations: wallet management, key security, provider uptime, and support processes. Start with a pilot to identify and address these before scaling.
### Regulatory risk
Document the permitted activities, customer eligibility, reporting, and other operating requirements for the specific jurisdictions and services involved. Issuer requirements and the obligations of a business using the asset are different questions.
## Implement the Tempo payment leg
Use [Send payments](https://tempo.com/developers/docs/guide/payments/send-a-payment) and [Receive payments](https://tempo.com/developers/docs/guide/payments/accept-a-payment) for supported stablecoin transfers. Check the [OUSD guide](https://tempo.com/developers/docs/guide/ousd) and [stablecoin registry](https://tempo.com/developers/docs/partners/stablecoins) for asset choices.
Tempo supplies near-instant onchain settlement and fees in eligible stablecoins, subject to fee-token and Fee AMM liquidity requirements. [Token policies](https://tempo.com/developers/docs/protocol/tip403/overview), [fee sponsorship](https://tempo.com/developers/docs/api/fee-payer), and [payment references](https://tempo.com/developers/docs/guide/payments/transfer-memos) are primitives for the application to integrate. The funding, approval, screening, payout, and accounting processes around them come from your application and providers.
For private balances, see [Zones](https://tempo.com/developers/docs/zones). It's live on Mainnet. The operator can read the ledger, deposit and withdrawal amounts remain public, and the current runtime disables general TIP-20 transfers.
## Start with a bounded pilot
Pick one payment flow with measurable friction and a supported recipient experience. Set funding limits, approvals, and a process for unresolved payments before sending funds. Compare the complete cost and delivery outcome with your existing process, then expand only the parts that meet the business case. Follow the [enterprise infrastructure checklist](https://tempo.com/developers/docs/resources/guides/stablecoin-payment-infrastructure-enterprise-scale) to define the pilot.
***
## Business adoption questions
Do we need to hold crypto on our balance sheet?
A provider may offer fiat funding and fiat delivery while using stablecoins between those endpoints. Confirm who owns and controls funds at each stage, the contractual model, and the records supplied.
Which banks support stablecoins?
Support varies by bank, product, asset, and customer. Ask your banking and payment providers whether they support the specific funding and payout flow you need, including eligibility, limits, timing, and reconciliation records.
How does using stablecoins affect our accounting?
Map the assets held, entity ownership, conversion events, fees, and payment obligations to your accounting process. Preserve provider records and onchain evidence. Dollar denomination doesn't remove accounting or foreign currency considerations.
What's the minimum volume to justify stablecoin adoption?
There is no universal threshold. Compare complete payment costs, implementation effort, operating work, and working capital needs for a specific flow. A pilot with representative payments shows whether the proposed model improves on your current process.
How do I pitch stablecoins to my CFO?
Present one measurable payment problem, the proposed operating model, and the results of a comparable pilot. Include source and recipient amounts, complete costs, delivery times, prefunded balances, and exception rates. A network fee saving isn't the saving on the complete payment.
Is this just for cross-border payments?
No. Businesses can also evaluate stablecoins for treasury transfers, domestic B2B payments, and platform payouts.
> Source: [/docs/resources/guides/stablecoin-payment-infrastructure-enterprise-scale](https://tempo.com/developers/docs/resources/guides/stablecoin-payment-infrastructure-enterprise-scale.md)
> Section: [Get Started](https://tempo.com/developers/get-started.md). Choose a starting point, send a test payment, get testnet funds, connect a coding agent, find the SDKs and CLI, and use the resource guides to plan payment workflows, liquidity, provider selection, and partner integrations.
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
[Guides](https://tempo.com/developers/docs/resources/guides) / [Payment infrastructure](https://tempo.com/developers/docs/resources/guides#payment-infrastructure) / Evaluate enterprise payment infrastructure
# Evaluate enterprise payment infrastructure
Enterprise stablecoin payment infrastructure combines settlement, accounts and signing, liquidity, controls, funding and payouts, and finance records. Assign each responsibility before selecting providers. Use the [payments implementation guides](https://tempo.com/developers/docs/guide/payments) for transaction submission and verification.
At production volume, payment costs, delivery evidence, exceptions, and finance integration become product requirements.
## Assign responsibility across the payment stack
| Layer | Decisions to make |
| --- | --- |
| Settlement | Network and asset, finality signal, capacity, fees, and observed delivery evidence. |
| Accounts and signing | Who controls funds, approves payments, manages keys, and recovers access. |
| Issuance and liquidity | Issuer terms, redemption access, supported assets, conversion, and required balances. |
| Risk controls | Onboarding, screening decisions, token policies, account permissions, monitoring, and reporting. |
| Fiat access | Funding and local delivery providers, coverage, limits, timing, and exceptions. |
| Reporting | Business references, event ingestion, ledger mapping, reconciliation, and support records. |
A provider may supply several layers. Its contract, not its fiat interface, determines who owns funds and which obligations remain with your business.
## Distinguish a gateway from the settlement network
A gateway connects checkout to payment processing. The settlement network records the onchain transfer. Identify which responsibilities the service supplies and which remain in your application.
| Responsibility | Evidence to request |
| --- | --- |
| Checkout | Supported wallets, networks, token contracts, request formats, and expiry behavior. |
| Confirmation | Actual receipt checks, missed-event recovery, and prevention of duplicate fulfillment. |
| Funds management | Signing authority, balance ownership, fee funding, custody, and conversion. |
| Exceptions | Underpayments, held transfers, refunds, delayed delivery, and failed bank payouts. |
| Finance integration | Stable identifiers, export or API fields, and ownership of the ERP mapping. |
For example, a correctly referenced transfer can arrive while the order system is unavailable. The integration must recover the event and fulfill once. Follow the [receiving guide](https://tempo.com/developers/docs/guide/payments/accept-a-payment) for verification and event identifiers, then use the [acceptance planning guide](https://tempo.com/developers/docs/resources/guides/how-to-accept-stablecoin-payments) for the wider workflow.
## Evaluate settlement reliability
Compare the documented finality signal with the stage the application actually observes. A request acknowledgment, included transaction, finalized block, and provider bank credit are different events.
Tempo's [consensus documentation](https://tempo.com/developers/docs/protocol/blockspace/consensus) specifies no re-orgs after a block is finalized and explains the conditions required for network progress.
Test representative payments and failure cases, including an unavailable provider, rejected recipient, expired quote, delayed response, and missed event stream. [Payment lanes](https://tempo.com/developers/docs/protocol/blockspace/overview) reserve blockspace for payment activity; they don't control a downstream provider's delivery time.
## Forecast actual payment costs
Tempo network fees are paid in eligible USD-denominated TIP-20 tokens when the fee-token requirements and sufficient Fee AMM liquidity are met. The network uses a bounded dynamic base fee; model the gas used by each operation and its applicable fee rather than assuming one flat fee.
A simple transfer, atomic batch, and contract call can consume different resources. Model the operations your application actually runs. Include custody, funding, conversion, provider charges, local payout, and operational work when evaluating unit economics.
Use [fee-token configuration](https://tempo.com/developers/docs/guide/payments/pay-fees-in-any-stablecoin) and [fee sponsorship](https://tempo.com/developers/docs/api/fee-payer) to define who pays. Monitor the payer's usable balances and handle unavailable fee tokens or depleted sponsorship before they interrupt a run.
## Separate policy primitives from business controls
[TIP-20 Tokens](https://tempo.com/developers/docs/protocol/tip20/overview) and the [TIP-403 Policy Registry](https://tempo.com/developers/docs/protocol/tip403/overview) supply token-level controls. Account [receive policies](https://tempo.com/developers/docs/accounts/policies/receive-policies) can hold receipts instead of delivering them. Onboarding, screening, payment approval, and reporting happen outside them.
Identify the application, issuer, custodian, and payment provider responsible for each control. Keep authentication, signing permissions, and business approval distinct. Verify the delivered transfers even after transaction success.
If private balances are required, [Zones](https://tempo.com/developers/docs/zones) is a separate integration, live on Mainnet. The operator can read the ledger, deposit and withdrawal amounts remain public, and general TIP-20 transfers are disabled in the current runtime. Confirm supported assets, access, and features for the deployment.
## Design reconciliation before scaling
Attach a short opaque [payment reference](https://tempo.com/developers/docs/guide/payments/transfer-memos) and keep invoice contents, customer records, and sensitive data offchain. A TIP-20 memo is 32 bytes of public transaction data, not a substitute for the finance database.
Verify the network, token contract, recipient, amount, and delivered events. Store the network, transaction hash, and transfer log index as a unique event key. Update the payment record and invoice together, then retain provider payout evidence for any fiat leg.
Follow historical pagination after interruptions, keep unresolved submissions visible, and inspect existing transaction identifiers before retrying. See [payment reconciliation](https://tempo.com/developers/docs/resources/guides/payment-reconciliation) for the AR and AP workflow.
## Establish a production pilot
:::steps
### Fix the scope
Choose one flow, recipient group, asset, and delivery outcome. Record which accounts, providers, custody model, and liquidity balances it needs.
### Define completion and exceptions
Name the evidence that closes each payment and the owner of delayed, blocked, refunded, or unmatched outcomes.
### Measure the complete result
Compare usable recipient funds, total cost, delivery time, prefunded balances, exception rates, and reconciliation work with the existing flow. Expand the parts that meet the operating case.
:::
## Enterprise payment infrastructure questions
### Does a payment gateway replace the settlement network?
No. A gateway can connect checkout, payment instructions, and provider services. The network records the onchain transfer. Identify which component verifies delivery, manages accounts, funds fees, resolves exceptions, and supplies finance records.
### What proves a stablecoin payment reached the recipient?
Verify the successful transaction and expected delivered transfer, including the network, token contract, recipient, and amount. Check the transfer, not only transaction success, because a receive policy can hold funds. A local-currency bank payout needs separate provider completion evidence.
### What should a provider cost comparison include?
Compare the same funding and recipient outcome using executable quotes. Include network fees, funding, custody, conversion, provider charges, payout fees, and exception-handling work. Record quote expiry and any prefunded balances separately so the comparison captures liquidity as well as payment charges.
> Source: [/docs/resources/guides/stablecoin-settlement](https://tempo.com/developers/docs/resources/guides/stablecoin-settlement.md)
> Section: [Get Started](https://tempo.com/developers/get-started.md). Choose a starting point, send a test payment, get testnet funds, connect a coding agent, find the SDKs and CLI, and use the resource guides to plan payment workflows, liquidity, provider selection, and partner integrations.
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
[Guides](https://tempo.com/developers/docs/resources/guides) / [Payment infrastructure](https://tempo.com/developers/docs/resources/guides#payment-infrastructure) / Evaluate stablecoin settlement
# Evaluate stablecoin settlement
Stablecoin settlement records a token transfer on a blockchain under that network's finality rules. A complete business payment can also require funding, conversion, provider credit, or bank delivery. Use the [receiving guide](https://tempo.com/developers/docs/guide/payments/accept-a-payment) to verify the onchain transfer, then evaluate the other legs before marking the payment complete.
Start with the payment you need to complete. A supplier retaining a stablecoin balance, a contractor requesting a bank deposit, and a transfer between treasury accounts have different requirements.
## Define what settlement must prove
Onchain settlement concerns the transfer recorded on the network. It is distinct from a request being submitted, an exchange crediting a customer account, or a payout provider delivering local currency.
Define the completion signal for every leg:
| Payment stage | Evidence your operation needs |
| ------------------------- | ------------------------------------------------------------------------------------------------------ |
| Funding | The required funds are available to the account or provider executing the payment. |
| Onchain delivery | Successful delivery of the intended token and amount to the intended recipient on the correct network. |
| Network finality | The network's documented settlement condition has been met. |
| Provider credit or payout | The provider has credited the intended customer or delivered the requested bank or other payout. |
| Business reconciliation | The payment is matched to its obligation and recorded once. |
For cross-network flows, follow the route's [delivery and refund status](https://tempo.com/developers/docs/routes/delivery) until the destination receives the funds.
## Compare networks using the same payment
When comparing Tempo with Ethereum, Base, Solana, Tron, or another network, keep the payment requirements constant. Published fees and block times can describe different transaction types and different stages of confirmation.
| Criterion | Evidence to collect |
| ----------------------- | ----------------------------------------------------------------------------------------------------------------------------- |
| Asset | Issuer, token contract, network, redemption terms, and whether a bridge or conversion is involved. |
| Recipient access | Current wallet, custodian, exchange, or payout support for that asset and network. |
| Settlement signal | The documented finality condition and how the application observes it, including failure or delayed-network behavior. |
| Total operating cost | Representative transfer and contract-call fees, fee funding, provider charges, conversion, and any payout costs. |
| Integration | Wallet signing, RPC and API support, contract compatibility, event handling, and the features your application actually uses. |
| Liquidity | A current quote for the required amount and direction, available funding, and exit or redemption conditions. |
| Controls and operations | Approvals, token policies, reconciliation, privacy, monitoring, support, and recovery ownership. |
Test a representative payment and the exceptions that matter to your business. Include a rejected recipient, insufficient funds, an expired quote, and a delayed response. Record observed results and their assumptions; fees change over time.
## Check finality and successful delivery together
Each network defines its own confirmation and finality stages. Compare the stage your application will rely on. A fast acknowledgment, an included transaction, a finalized block, and a bridged withdrawal can be different events.
[Tempo's consensus documentation](https://tempo.com/developers/docs/protocol/blockspace/consensus) specifies no re-orgs after a block is finalized. It also describes the network conditions required to keep making progress.
Finality doesn't tell you the correct payment succeeded. Check the network, token contract, recipient, and amount in successful transfer events, as the [Tempo receiving guide](https://tempo.com/developers/docs/guide/payments/accept-a-payment) describes. A receive policy can hold funds instead of delivering them. Match that evidence to the invoice before marking it paid.
## Model fees for the operations you will run
Budget for the actual transaction types in the application. A simple token transfer, a batch, and a contract call can consume different resources. Include any provider, custody, conversion, and payout charges when calculating the cost of the complete payment.
Tempo's [fee system](https://tempo.com/developers/docs/protocol/fees) charges fees in eligible stablecoins and uses a bounded dynamic base fee. No separate gas token is required. Standard stablecoin transfers have sub-cent fees; the actual fee varies with the operation and base fee.
[Fee sponsorship](https://tempo.com/developers/docs/api/fee-payer) can make the application responsible for network fees. Decide which account pays, which operations qualify, and how the application handles a depleted sponsor balance or an unavailable fee token.
## Confirm liquidity and the asset at both ends
A stablecoin symbol can appear on more than one network. Verify the contract and supported deposit route, not just the name. A wallet's ability to display an address is different from a custodian or exchange accepting that asset for credit.
Review issuer and reserve information, redemption access, custody, and any bridge dependency. [Minting and burning](https://tempo.com/developers/docs/guide/issuance/mint-stablecoins) cover the issuer-side lifecycle. A holder who received tokens on the secondary market may not have direct redemption access.
If conversion is required, quote the amount and direction you need. Two dollar-pegged tokens don't always exchange at par, and support for both doesn't mean the pair has enough liquidity. For Routes integrations, use the current [network and asset documentation](https://tempo.com/developers/docs/routes/networks) to find candidate paths, then request the actual route quote.
If the recipient needs local currency, add the provider's eligibility, FX, beneficiary details, and bank delivery to the evaluation. [Cross-border payments](https://tempo.com/developers/docs/resources/guides/cross-border-payments) covers that complete route.
## Assign control and reconciliation responsibilities
The settlement layer doesn't decide who may approve a company payment, manage wallet recovery, or resolve a customer dispute. Assign those responsibilities to the application, custodian, issuer, and payment providers involved.
Tempo's [TIP-403 Policy Registry](https://tempo.com/developers/docs/protocol/tip403/overview) lets TIP-20 tokens share access-control policies. Identity checks, screening, and other obligations stay with the application and its providers.
[Payment references](https://tempo.com/developers/docs/guide/payments/transfer-memos) connect transfers with business references. Keep the full invoice, customer details, and sensitive records offchain. Use a reference that your internal systems can resolve, and define who can access those records.
Record the network, transaction hash, and transfer log index as a unique event key. Connect it to the provider payment ID and invoice, and update the ledger once. Don't fulfill an order on a matching memo or a changed balance. See [payment reconciliation](https://tempo.com/developers/docs/resources/guides/payment-reconciliation) for the broader workflow.
## Move from evaluation to a payment pilot
Choose one flow with known counterparties and a clear recipient outcome. Document the expected amount, cost, completion evidence, and exception owner before executing it.
Measure time to usable funds, complete cost, failed or delayed payments, and reconciliation effort. Retain the bank and provider relationships the flow still needs.
## Stablecoin settlement questions
How quickly can a stablecoin payment be settled?
Timing depends on the network and the payment flow. Tempo provides near-instant onchain settlement. Funding, cross-network delivery, provider account credit, and local bank payout can be separate steps with separate completion signals.
What makes a settlement rail enterprise-ready?
Evaluate the supported assets, settlement signal, fee behavior, custody, permissions, reconciliation, liquidity, provider coverage, and recovery procedures. Test the complete payment flow with representative amounts and exceptions, rather than choosing from a headline speed or fee.
How is settlement finality different from confirmation?
A confirmation may mean that a system has accepted or observed a transaction. Finality is the network-specific point at which the recorded transaction is considered settled. Your application must also verify successful delivery of the intended asset and amount.
Can stablecoin settlement replace SWIFT or correspondent banking?
Stablecoins can provide another settlement path for supported flows. Funding, FX, and recipient delivery can still depend on banks and payment providers. Compare the complete route and its operating requirements before deciding which existing steps to retain.
How should I compare Tempo with another blockchain for payments?
Compare the same token or explicitly priced conversion, recipient endpoint, transaction type, and operating assumptions. Evaluate actual integration support, finality signals, total fees, liquidity, controls, and delivery evidence.
> Source: [/docs/resources/guides/payment-rails](https://tempo.com/developers/docs/resources/guides/payment-rails.md)
> Section: [Get Started](https://tempo.com/developers/get-started.md). Choose a starting point, send a test payment, get testnet funds, connect a coding agent, find the SDKs and CLI, and use the resource guides to plan payment workflows, liquidity, provider selection, and partner integrations.
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
[Guides](https://tempo.com/developers/docs/resources/guides) / [Payment infrastructure](https://tempo.com/developers/docs/resources/guides#payment-infrastructure) / Compare payment rails
# Compare payment rails
A payment rail is the infrastructure used to move or settle value between accounts. ACH, wires, instant bank payments, and blockchains supply different parts of that process; SWIFT supplies financial messaging. Compare the complete funding, settlement, and recipient-delivery flow for the outcome you need.
## Separate the legs of a payment
A business can use several rails for one payment. An ACH credit can fund an account, a stablecoin transfer can move value between providers, and a local bank payment can deliver the recipient's currency.
Record the source account and currency, the asset used between providers, and the recipient account and currency. Specify which organization confirms each stage. A message, network settlement, provider balance credit, and recipient bank deposit are different events.
## Compare the main rail types
| Option | Role | Integration checks |
| --- | --- | --- |
| ACH | U.S. bank-account credits and debits, including scheduled and recurring payments. | Account validation, debit authorization where applicable, deadlines, settlement windows, returns, and charges. |
| Domestic wire | A bank payment using a service such as Fedwire. | Participating banks, customer cutoffs, beneficiary details, fees, and evidence of recipient credit. |
| Domestic instant payment | Around-the-clock payments through participating institutions, such as FedNow. | Availability for both accounts, product limits, fraud controls, pricing, and recipient access. |
| SWIFT-enabled international payment | Financial messages coordinate a payment between institutions. | Currency route, banks and providers moving funds, deductions, FX, tracking, and beneficiary delivery. |
| Stablecoin payment | A specified token moves between supported accounts on a blockchain. | Network and token support, custody, signing, fee funding, delivery evidence, conversion, and recipient access. |
[Nacha documents Same Day ACH and scheduled processing](https://www.nacha.org/content/ach-payments-fact-sheet). [Fedwire provides real-time gross settlement](https://www.frbservices.org/financial-services/fedwire-funds-service/). [FedNow operates around the clock through participating institutions](https://www.frbservices.org/financial-services/fednow-service/about-fednow-service/). [SWIFT describes its financial messaging role](https://www.swift.com/about-us/who-we-are/what-swift).
These are system capabilities. Your bank or provider sets the access conditions, product limits, pricing, and operating procedures for your account.
## Read settlement timing and netting terms
### Real-time gross settlement and net settlement
Real-time gross settlement (RTGS) processes payments individually as they arrive, rather than settling only the difference between amounts owed. For example, the [Federal Reserve describes Fedwire](https://www.frbservices.org/wp-content/uploads/funds.pdf) as processing each payment order individually and, when accepted, settling to the receiving participant's Federal Reserve account in central bank money.
In [deferred net settlement](https://www.bis.org/publications/innovations-payments), obligations are combined and the net positions settle at scheduled times. A batch can contain many payment instructions while the settlement system moves a smaller set of net amounts. An application's batch of blockchain calls is a different concept.
### T+0, T+1, and T+2 settlement
`T` identifies the transaction or trade date. `T+1` means one business day later; `T+2` means two. A Friday `T+2` settlement normally falls on Tuesday if Monday is a business day. Check the relevant calendar and cutoff before promising a recipient date.
`T+0` means same-day settlement, which can still involve a processing window before the recipient has access.
## Match the rail to the payment workflow
ACH can fit predictable domestic credits or authorized recurring debits. Sending a credit and collecting a debit require different application and authorization flows. Same Day ACH uses banking-day settlement windows; it is different from an instant payment service.
A wire can fit a time-sensitive bank payment when the banks, deadlines, and beneficiary requirements fit. Interbank settlement and credit to the customer's account are separate events.
For an out-of-hours domestic payment, evaluate available instant bank services alongside stablecoins. Both accounts must support the service.
A stablecoin route can fit a recipient that accepts the token, or a provider that converts and delivers it. Receiving a dollar-denominated token and receiving local currency in a bank account are different outcomes.
## Compare the same amount and recipient outcome
Hold the funding method, source currency, recipient currency, and delivery method constant. Decide whether you are fixing the sender's total budget or the recipient's net amount.
| Comparison field | Record for each route |
| --- | --- |
| Sender funding | Total debit, including charges outside the payment amount. |
| Recipient outcome | Net amount, currency, account type, and delivery method. |
| FX terms | Executable rate, conversion charges, and quote expiry. |
| Delivery | Expected completion and evidence for each payment stage. |
| Exceptions | Failed-payment, return, investigation, support, and recovery costs. |
| Liquidity | Required balances, replenishment time, and withdrawal access. |
For example, if a supplier expects a local-currency bank deposit, compare a bank deposit for every route. The network fee is only one part of that cost. Use the [cross-border payment guide](https://tempo.com/developers/docs/resources/guides/cross-border-payments) to document the route.
## Compare services at the same layer
A payment service may bundle funding, recipient lookup, currency conversion, account records, support, and delivery. A blockchain network supplies a different part of the flow.
Before replacing a service, list the features your application needs: bank or wallet delivery, signing and recovery, identity checks, invoices, recurring collections, accounting records, refunds, and error handling. Then identify which component of the proposed route supplies each one.
A settlement network doesn't provide the complete customer product. Check a payment provider's current account and country support.
## Define returns and refunds separately from settlement
Settlement finality describes when a system considers a transfer settled. Provider policies and customer rights for the underlying purchase are separate.
For onchain payments, define the successful delivery event and the network's completion rule. Then specify how to handle a mistaken beneficiary, held receipt, refund, or disputed purchase. A refund can require a new payment and separate business approval.
For bank payments, follow the applicable return and investigation process. A single “reversible” label can hide differences between the rail, account product, and reason for a return.
## Add a Tempo settlement leg
Tempo supports near-instant onchain settlement, [stablecoin network fees](https://tempo.com/developers/docs/resources/guides/stablecoin-fees), [fee sponsorship](https://tempo.com/developers/docs/api/fee-payer), and [payment references](https://tempo.com/developers/docs/guide/payments/transfer-memos). Bank funding and payout come from separate providers.
Start with [sending payments](https://tempo.com/developers/docs/guide/payments/send-a-payment) and [verifying received payments](https://tempo.com/developers/docs/guide/payments/accept-a-payment).
## Payment rail questions
### Can stablecoins replace ACH?
The choice depends on the payment. ACH supports bank-account credits and debits. Stablecoins provide an onchain option when the asset, recipient, funding, and payout services are supported. Compare the complete workflow for the payment you need to make.
### Is SWIFT a settlement network?
SWIFT provides financial messaging between institutions. Banks and providers move and credit the funds. A SWIFT message, interbank settlement, and recipient account credit are separate events.
### Are stablecoin payments always cheaper?
No. Obtain quotes for the same funding, conversion, and recipient delivery. A small network fee can be one component of a larger payment cost.
> Source: [/docs/resources/guides/stablecoin-fees](https://tempo.com/developers/docs/resources/guides/stablecoin-fees.md)
> Section: [Get Started](https://tempo.com/developers/get-started.md). Choose a starting point, send a test payment, get testnet funds, connect a coding agent, find the SDKs and CLI, and use the resource guides to plan payment workflows, liquidity, provider selection, and partner integrations.
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
[Guides](https://tempo.com/developers/docs/resources/guides) / [Payment infrastructure](https://tempo.com/developers/docs/resources/guides#payment-infrastructure) / Stablecoin fee operations
# Stablecoin fee operations
Tempo network fees are paid in eligible USD-denominated TIP-20 tokens. Set an explicit fee token for the account or transaction, maintain its balance, and monitor any required fee-conversion liquidity.
For implementation, start with [choosing a fee token](https://tempo.com/developers/docs/guide/payments/pay-fees-in-any-stablecoin).
## Check fee-token eligibility
A fee token must be a USD-denominated TIP-20 token and satisfy the [fee system's requirements](https://tempo.com/developers/docs/protocol/fees). When the payer and validator use different tokens, the required conversion route needs sufficient Fee AMM liquidity.
A token name, custom issuance, or DEX pair doesn't make a token eligible. Check the contract's currency denomination, balance, permissions, and conversion liquidity.
## Choose a fee token deliberately
The [fee-token preference rules](https://tempo.com/developers/docs/protocol/fees/spec-fee#fee-token-preferences) check explicit transaction preferences, account preferences, qualifying token or DEX calls, and the documented fallback.
For an application, prefer an explicit transaction-level or persistent account setting. It makes the fee asset you need to fund and reconcile clear. Same-token selection for a payment is conditional on the transaction's calls and the applicable selection rules.
Once a preference selects a token, a failed eligibility, balance, or liquidity check doesn't make the protocol try every later preference. Holding another stablecoin doesn't rescue an invalid explicit selection.
Follow [the fee-token guide](https://tempo.com/developers/docs/guide/payments/pay-fees-in-any-stablecoin) to configure and inspect the selected asset. For a sponsored transaction, the fee payer chooses the fee token.
## Understand fee conversion
The [Fee AMM](https://tempo.com/developers/docs/protocol/fees/fee-amm) converts network fees when the payer's token differs from the validator's preferred token. It doesn't convert the payment principal. User-facing stablecoin trades use the separate [Stablecoin DEX](https://tempo.com/developers/docs/protocol/exchange).
Fee pools are directional. The protocol checks the direct pool and, when that pool lacks sufficient liquidity, tries the documented two-hop route through the selected token's quote token. Both hops must have sufficient liquidity.
Each fee-swap hop outputs `0.997` units of its output token per unit of its input token before integer rounding. A direct route converts the payer's token to the validator's token; a two-hop route passes through the quote token and applies the rate twice. No conversion is needed when payer and validator use the same fee token. Read the [Fee AMM specification](https://tempo.com/developers/docs/protocol/fees/spec-fee-amm) for routing and rounding.
## Separate invalid funding from reverted execution
Before execution, the protocol checks fee funding and conversion liquidity and collects the maximum fee. After execution, it refunds the unused amount and handles the actual fee under the [fee lifecycle](https://tempo.com/developers/docs/protocol/fees/spec-fee#fee-payment).
| Outcome | Operational meaning |
| --- | --- |
| Insufficient fee balance or liquidity | The transaction is invalid in that state and cannot be included. Investigate funding, configuration, and liquidity. |
| Included transaction whose application call reverts | The application operation failed, but the transaction still incurs fees. Record the failed payment separately from its network expense. |
| Successful payment | Verify the intended transfer and record the actual fee separately from the amount delivered. |
Tempo uses a bounded dynamic base fee. The actual network expense depends on gas used, applicable gas price, and fee-token conversion. Don't budget every operation as one fixed transfer fee; authorization, contract calls, and other operations can have different costs.
## Configure fee sponsorship separately
[Fee sponsorship](https://tempo.com/developers/docs/api/fee-payer) allows a distinct account to pay the network fee while the sender authorizes the application calls. Sponsorship doesn't fund the payment principal or make the transaction costless.
Set an application policy for which transactions to sponsor, then monitor the sponsor's balance and expense. Preserve the sender, sponsor, fee token, actual fee, and related business operation in your records.
If an access key signs the payment, fees paid from its account consume its token spending limit. A separate fee payer pays the sponsored fee. See [access-key spending limits](https://tempo.com/developers/docs/accounts/access-keys/spending-limits).
## Reconcile the network fee budget
Track fee funding and actual expenses independently of customer payment amounts. Include successful and reverted transactions, sponsored operations, and any fee-conversion effects. An unused-fee refund is part of the network fee lifecycle, not a refund of the underlying purchase.
For the complete payment cost, also include asset acquisition, custody, service-provider charges, currency conversion, and recipient delivery. Use [payment rail comparisons](https://tempo.com/developers/docs/resources/guides/payment-rails) when comparing a stablecoin route with another payment service.
## Stablecoin fee questions
### Can every stablecoin pay fees?
No. Check USD-denominated TIP-20 eligibility and the required conversion liquidity.
### Does the Fee AMM exchange the amount being paid?
No. It handles network fee conversion. Use a separate exchange or provider flow when the recipient needs another asset or currency.
### Does sponsoring a fee let the sponsor spend the customer's balance?
Sponsorship authorizes the sponsor to pay the transaction's network fee. The customer's signing authority still authorizes the transaction calls. Keep those roles separate in the integration.
> Source: [/docs/resources/guides/how-to-accept-stablecoin-payments](https://tempo.com/developers/docs/resources/guides/how-to-accept-stablecoin-payments.md)
> Section: [Get Started](https://tempo.com/developers/get-started.md). Choose a starting point, send a test payment, get testnet funds, connect a coding agent, find the SDKs and CLI, and use the resource guides to plan payment workflows, liquidity, provider selection, and partner integrations.
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
[Guides](https://tempo.com/developers/docs/resources/guides) / [Payment workflows](https://tempo.com/developers/docs/resources/guides#payment-workflows) / Plan stablecoin payment acceptance
# Plan stablecoin payment acceptance
To accept stablecoin payments, give the customer the correct network, token, receiving address, amount, and payment reference. Verify the delivered transfer before updating an invoice or fulfilling an order. Follow the [Receive payments guide](https://tempo.com/developers/docs/guide/payments/accept-a-payment) for implementation, then use this checklist to connect it to your B2B checkout and finance workflow.
Stablecoin payments can operate alongside ACH and wires. Tempo supplies the onchain settlement layer; your application or provider supplies checkout, customer records, custody controls, and any bank funding or payout steps.
## Define the payment and integration model
Choose one initial flow, such as invoice collection, marketplace deposits, or funding an embedded account. Decide whether your application receives stablecoins directly or relies on a provider for funding, custody, conversion, and reporting.
| Decision | Establish before accepting funds |
| --- | --- |
| Recipient outcome | Retain the stablecoin, convert to another supported token, or request a provider bank payout. |
| Asset | Specify the token contract and network. Use the [token guide](https://tempo.com/developers/docs/guide/ousd) and [token list](https://tempo.com/developers/docs/quickstart/tokenlist). |
| Custody and signing | Identify who controls the receiving account and authorizes withdrawals or refunds. |
| Payment controls | Decide which senders and tokens are eligible and how exceptions are reviewed. |
| Finance integration | Define the invoice, event, and ledger records that establish a completed payment. |
Direct integrations use the [Tempo SDK](https://tempo.com/developers/docs/sdk) and read onchain transfer events. A receiving account does not need to call an API to accept each ordinary transfer. Provider-led integrations can expose higher-level payment APIs or a hosted interface.
## Configure accounts, assets, and fees
[Token policies](https://tempo.com/developers/docs/protocol/tip403/overview) enforce issuer-defined transfer rules. [Account receive policies](https://tempo.com/developers/docs/accounts/policies/receive-policies) control which receipts an account accepts. Identity checks, screening decisions, and payment approvals stay in your application.
If you need customer-specific destinations, [customer deposit addresses](https://tempo.com/developers/docs/guide/payments/virtual-addresses) can attribute incoming funds while crediting a shared account. They don't create separate onchain customer balances; your application keeps that ledger.
Use the [Stablecoin DEX](https://tempo.com/developers/docs/guide/stablecoin-dex/executing-swaps) if you need to convert a delivered stablecoin. Quote the actual amount and verify the output. Two supported tokens don't always convert at par or have enough liquidity for the payment.
Tempo charges [network fees](https://tempo.com/developers/docs/protocol/fees) in eligible stablecoins, subject to fee-token and Fee AMM liquidity requirements. Your application does not need to acquire a separate gas token. [Fee sponsorship](https://tempo.com/developers/docs/api/fee-payer) lets your application pay transaction fees. Include provider, conversion, and bank-delivery charges when calculating the complete payment cost.
## Build a payment request that finance can reconcile
A payment link, QR code, or invoice should state which network and token to use, where to send it, how much is due, and which reference identifies the order. The checkout interface belongs to your application or provider. Test that customer wallets preserve the requested reference.
Follow [Create payment links](https://tempo.com/developers/docs/resources/guides/payment-links) to store trusted request terms, share a link or QR code, and recover an interrupted checkout.
| Request field | What to establish before sharing it |
| --- | --- |
| Network and asset | Specify Tempo and the accepted token contract, not only a ticker. |
| Recipient | Use an account you control or a supported customer deposit address. |
| Amount | Store the expected amount and token precision in the payment system. |
| Reference | Assign a short, unique ID that maps to an invoice or order in your database. |
| Payment terms | Define expiry, partial payments, overpayments, and the refund process. |
For an invoice requesting 1,000 USDC.e on Tempo, use `INV-2048` as the reference. Customer details, purchase orders, and billing information stay in your database. If the wallet cannot supply a memo, consider customer deposit addresses for attribution.
[Transfer memos](https://tempo.com/developers/docs/guide/payments/transfer-memos) hold a 32-byte reference. The limit is bytes, not characters, and memos are public transaction data. Use the same encoding when requesting a reference and matching incoming events.
## Verify delivery before fulfilling an order
Fulfill an order only after you verify the network, token contract, recipient, amount, successful receipt, and delivered transfer events, as the [receiving guide](https://tempo.com/developers/docs/guide/payments/accept-a-payment#match-payments-to-customers) describes. A receive policy can hold funds instead of delivering them to the intended recipient.
Store the network, transaction hash, and transfer log index as a unique event key. Record the event and update the invoice in one database transaction so a repeated notification cannot credit the customer twice. Recover missed activity after a connection interruption and follow pagination through historical records.
Route underpayments, overpayments, expired requests, and missing references to an exception queue. A shared transaction hash can contain several transfers; a balance increase doesn't identify an invoice.
## Treat refunds as a separate payment
A merchant refund is a new outbound transfer linked to the original payment. Verify the destination independently; an exchange or shared wallet's sending address may not credit a return to the customer.
Follow [Handle stablecoin refunds](https://tempo.com/developers/docs/resources/guides/refunds) to reserve partial amounts, prevent concurrent over-refunds, and resolve uncertain submissions. For Routes provider returns, follow the [delivery and refund states](https://tempo.com/developers/docs/routes/delivery).
## Test the complete acceptance flow
:::steps
### Verify the testnet payment path
Use the test token and network named in the implementation guide. Confirm the correct token, amount, recipient, memo, and receipt before marking a test invoice paid.
### Exercise payment exceptions
Test repeated notifications, missed events, wrong assets, partial payments, blocked receipts, refund requests, and unresolved submissions.
### Connect the finance close
Check that each delivered payment maps to one invoice and ERP record, with fees recorded separately. Define who investigates exceptions and what evidence closes them.
:::
## Payment acceptance questions
### Do stablecoin payments replace ACH and wires?
No. Keep those methods where they fit the workflow. Stablecoins add an onchain rail with separate funding, conversion, and delivery responsibilities.
### What does a B2B company need to accept stablecoin payments?
Define the payment flow, account model, asset, controls, finance integration, and exception process. Then build it directly or through a provider.
### Can an application sponsor network fees?
Yes. Configure fee sponsorship and monitor the sponsor's balance and fee-token availability. Sponsorship changes who pays network fees; it doesn't remove them.
> Source: [/docs/resources/guides/payment-links](https://tempo.com/developers/docs/resources/guides/payment-links.md)
> Section: [Get Started](https://tempo.com/developers/get-started.md). Choose a starting point, send a test payment, get testnet funds, connect a coding agent, find the SDKs and CLI, and use the resource guides to plan payment workflows, liquidity, provider selection, and partner integrations.
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
[Guides](https://tempo.com/developers/docs/resources/guides) / [Payment workflows](https://tempo.com/developers/docs/resources/guides#payment-workflows) / Create payment links
# Create payment links
Create a payment request in your application, then share a URL that loads it. Your checkout presents the network, token, recipient, amount, and reference for customer approval. Verify the delivered transfer before marking the request paid. The URL and checkout are application components; Tempo supplies the payment primitives.
## Store a request before sharing its link
Use an opaque request ID in a URL on a domain you control, such as `https://merchant.example/pay/req_2048`. Load the payment terms from your backend. A QR code can encode the same URL.
An example application record (not a Tempo API request):
| Field | Store and validate |
| --- | --- |
| Request ID | A unique ID connected to one invoice or purchase. |
| Network | The intended chain ID: `4217` for Tempo mainnet or `42431` for Moderato testnet. |
| Token | The contract address on that network and its decimals. |
| Recipient | An approved receiving account or supported customer deposit address. |
| Amount | A positive integer amount in base units, stored without floating-point conversion. |
| Reference | An opaque payment ID with a defined memo encoding. |
| Terms | Expiry, partial-payment rules, and handling for late or excess funds. |
| State | Open, submitted, paid, needs review, or closed, with associated attempts. |
Resolve assets through the [token registry](https://tempo.com/developers/docs/quickstart/tokenlist). Keep customer names, invoice contents, and other personal data out of URLs and public memos.
## Load trusted terms before requesting a signature
:::steps
### Reload and validate the request
Fetch the stored record when the customer opens the link and again before preparing the payment. Check expiry, current state, accepted asset, amount, and approved recipient. Do not accept an edited URL amount or recipient as authoritative. Return the existing receipt for an already paid request.
### Show the complete payment
Display the network, asset, readable amount, destination, and reference. Convert base units to a decimal string using the token's actual decimals. Show who pays network fees and check that the payment account or [fee sponsor](https://tempo.com/developers/docs/api/fee-payer) has sufficient funds.
### Prepare the customer-approved transfer
Create a durable attempt record before asking the wallet to submit. Follow the maintained [browser payment walkthrough](https://tempo.com/developers/docs/guide/payments/send-a-payment/browser), passing the stored amount and recipient. Include the [encoded memo](https://tempo.com/developers/docs/guide/payments/transfer-memos#encode-a-payment-reference) when the flow requires a reference; an ordinary `transfer` doesn't carry it.
### Preserve the attempt
Store the submitted transaction hash with the request and network. Show a pending state while inspecting its outcome. A timeout or page refresh must not automatically prompt a second payment.
:::
## Verify delivery before granting access
For a regular receiving account, use the [invoice verifier](https://tempo.com/developers/docs/guide/payments/accept-a-payment/examples#verify-an-invoice) to check the successful receipt and delivered transfer against the expected network, token, recipient, amount, and reference. Don't mark a request paid from a wallet success screen or a matching memo. A receive policy can hold funds instead of delivering them.
For customer deposit addresses, follow the [deposit verification rules](https://tempo.com/developers/docs/guide/payments/virtual-addresses#what-to-verify-in-virtual-address-deposits). Verify the complete two-hop transfer sequence and delivery to the resolved master account. A transfer to a guard is a held receipt, not a delivered payment.
Save the network, transaction hash, and transfer log index as a unique event key. Record that event and update the request or entitlement atomically. Repeated callbacks and page reloads should return the existing outcome. Recover missed events after an interruption.
Expiry closes the application request, but anyone can still send tokens to the address. Route late payments, unsupported assets, missing references, and underpayments to explicit matching rules or review. Process [refunds](https://tempo.com/developers/docs/resources/guides/refunds) as separate outbound payments.
## Test shared links and checkout recovery
Test altered URLs, an expired request, the wrong network, a wallet that omits the memo, repeated clicks, interrupted submission, and a held receipt. Verify that a QR code loads the same trusted request and that a previously paid invoice cannot grant a second credit.
> Source: [/docs/resources/guides/refunds](https://tempo.com/developers/docs/resources/guides/refunds.md)
> Section: [Get Started](https://tempo.com/developers/get-started.md). Choose a starting point, send a test payment, get testnet funds, connect a coding agent, find the SDKs and CLI, and use the resource guides to plan payment workflows, liquidity, provider selection, and partner integrations.
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
[Guides](https://tempo.com/developers/docs/resources/guides) / [Payment workflows](https://tempo.com/developers/docs/resources/guides#payment-workflows) / Handle stablecoin refunds
# Handle stablecoin refunds
A merchant refund for a direct stablecoin payment is a new outbound transfer. Verify the original delivered payment, approve the return destination and amount, then track the new transfer through delivery. A refund doesn't edit or reverse the original transaction.
Keep merchant refunds separate from provider returns. For a Routes payment being returned by the provider, follow its [delivery and refund states](https://tempo.com/developers/docs/routes/delivery#track-refunds) before initiating another movement.
## Identify the payment and refundable amount
Start with the verified receipt stored during [payment acceptance](https://tempo.com/developers/docs/guide/payments/accept-a-payment#reconcile-payments-with-memos). Identify the original transfer by network, token contract, transaction hash, and transfer log index. A transaction can contain several payments, so its hash doesn't identify a single payment.
Keep these records in your application, rather than in public transaction metadata:
| Record | Required details |
| --- | --- |
| Original payment | Business ID, verified transfer, delivered amount, and asset. |
| Refund authorization | Refund ID, approved amount, reason, destination, and approval evidence. |
| Amount reservation | Previous confirmed refunds and amounts reserved by pending or unresolved attempts. |
| Submission | Network, transaction identifier, attempt state, and payment reference. |
| Completion | Verified delivered amount and transfer event, with any exception. |
Use integer base units. Decide how fees and any conversion affect the commercial refund terms; don't silently subtract them from the approved amount. Refund in the original token; a different asset or local-currency refund needs a separately agreed conversion and delivery route.
## Approve the destination independently
Don't automatically return funds to the original transaction sender. An exchange, shared wallet, payment contract, or provider may have sent on the customer's behalf. That address may not credit a returned payment to the customer.
Use your authenticated customer or provider process to verify the refund destination, supported network and token, and any required deposit reference. Independently verify destination changes before release.
## Reserve, submit, and verify the refund
:::steps
### Reserve the approved amount once
Create a unique refund ID. In one database transaction, lock or otherwise serialize updates to the original payment and reserve the refund amount. Enforce that confirmed refunds plus all reserved amounts cannot exceed the eligible original payment. Reject duplicate refund IDs and concurrent requests that exceed the remainder.
### Submit the authorized transfer
Check signing permissions, payment funds, fee funding, and the approved destination. Persist the attempt before contacting the signer or provider, then attach its transaction identifier as soon as available. Follow [Send payments](https://tempo.com/developers/docs/guide/payments/send-a-payment) and attach an opaque [refund reference](https://tempo.com/developers/docs/guide/payments/transfer-memos#link-refunds-to-the-original-payment). Preserve the original payment ID and detailed reason offchain.
### Keep uncertain submissions pending
Persist the attempt and transaction identifier. If submission times out, inspect that attempt before rebuilding or resending. Keep its amount reserved while the outcome is unknown. A local error can still hide a delivered payment.
### Confirm the delivered refund
Verify the successful receipt and expected token, recipient, and amount in the delivered transfer event. A receive-policy hold is an exception, not a completed customer refund. Record the event's network, transaction hash, and log index, then move the reservation to confirmed and update the customer record atomically.
:::
## Resolve exceptions without paying twice
Release a reservation for another attempt only once the earlier attempt can no longer deliver the refund. Preserve failed, held, and unknown outcomes with their evidence. A guard-held receipt needs its authorized recovery process; sending another refund can create a second obligation or loss.
Test two simultaneous partial refunds, duplicate jobs, an interrupted submission, an unsupported destination, and a held receipt. Confirm that replaying events cannot increase the refunded total. Link the completed refund and its fees to the original invoice in [payment reconciliation](https://tempo.com/developers/docs/resources/guides/payment-reconciliation).
> Source: [/docs/resources/guides/payment-reconciliation](https://tempo.com/developers/docs/resources/guides/payment-reconciliation.md)
> Section: [Get Started](https://tempo.com/developers/get-started.md). Choose a starting point, send a test payment, get testnet funds, connect a coding agent, find the SDKs and CLI, and use the resource guides to plan payment workflows, liquidity, provider selection, and partner integrations.
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
[Guides](https://tempo.com/developers/docs/resources/guides) / [Payment workflows](https://tempo.com/developers/docs/resources/guides#payment-workflows) / Reconcile payments
# Reconcile payments
Match confirmed transfers to invoices and payables, then post the result to your finance system. Use the Tempo API for application activity, Goldsky to stream records into a database, or Allium for SQL reports. None of these supplies your invoice-to-ledger mapping.
## Store the matching records
| Record | Required fields |
| --- | --- |
| Invoice or payable | Business ID, legal entity, expected token and amount, authorized recipient. |
| Payment instructions | Network, token contract, recipient, and payment reference. |
| Settlement evidence | Network, token contract, transaction hash, transfer log index, delivered amount, and status. |
| Accounting result | Amount applied, remaining balance, fees, ERP record ID, and exceptions. |
Encode a short, opaque ID in the [32-byte transfer memo](https://tempo.com/developers/docs/guide/payments/transfer-memos). Keep customer details and invoice contents offchain. A transaction can contain several transfers, so its hash doesn't identify a single payment.
## Verify and apply each transfer once
:::steps
### Verify the candidate payment
Follow [Receive payments](https://tempo.com/developers/docs/guide/payments/accept-a-payment#reconcile-payments-with-memos) to verify the network, token contract, recipient, amount, and successful delivery. A matching memo or successful transaction isn't enough, because a receive policy can hold funds instead of crediting the recipient.
### Save the transfer and invoice update together
Use the network, transaction hash, and transfer log index as the unique event key. Apply the invoice update and save that key atomically so replayed events cannot credit the invoice twice. Route partial payments and unsupported assets to explicit matching rules or review.
### Recover missed activity
Keep an ingestion checkpoint and replay historical records after an interruption. For direct application access, use [account activity](https://tempo.com/developers/docs/api/activities), [transfers](https://tempo.com/developers/docs/api/transfers), and [API pagination](https://tempo.com/developers/docs/api/pagination).
:::
## Stream transfers into PostgreSQL with Goldsky
Choose Goldsky when your application needs transformed chain records delivered to a database or queue. Its [Tempo reconciliation example](https://docs.goldsky.com/solutions/real-time-reconciliation) decodes `TransferWithMemo` events and writes them to PostgreSQL.
Follow the [Turbo quickstart](https://docs.goldsky.com/turbo-pipelines/quickstart) to create a project and install the Turbo CLI extension. Store the PostgreSQL connection string as a Goldsky secret. Select the Tempo dataset and token contract, supply the event ABI, and configure the transformation and destination from the reconciliation example.
Set a historical start that covers the invoices you need to reconcile: the example's `start_at: latest` processes new activity without backfilling earlier payments. Join decoded memos to your invoice records, then apply the delivery and duplicate checks above. Monitor ingestion progress and destination writes.
## Run reconciliation reports with Allium
Choose Allium for SQL investigation and repeatable reports over indexed Tempo records. Check the [Tempo catalog](https://docs.allium.so/historical-data/supported-blockchains/evm/tempo) for dataset access, asset coverage, and freshness before selecting a reporting period.
Query [stablecoin transfers](https://docs.allium.so/historical-data/supported-blockchains/evm/tempo/stablecoins/transfers) by token contract and address; a transaction's `value` is not its stablecoin amount. Preserve precision with the schema's string amount fields, and keep USD valuations separate from token quantities.
To automate a saved query, follow the [Explorer API workflow](https://docs.allium.so/api/explorer/query-workflow): submit the saved query ID, retain its `run_id`, poll that run, and retrieve completed results. Distinguish a failed or incomplete run from zero rows. Report the query's coverage limits alongside totals.
## Close invoices and investigate differences
Compare expected payments, verified transfers, and posted ERP records. Track fees separately from principal and distinguish internal transfers from revenue. Keep unmatched references, partial payments, held receipts, and refunds visible. For fiat payouts, also retain the provider's evidence of bank delivery.
> Source: [/docs/resources/guides/batch-payments](https://tempo.com/developers/docs/resources/guides/batch-payments.md)
> Section: [Get Started](https://tempo.com/developers/get-started.md). Choose a starting point, send a test payment, get testnet funds, connect a coding agent, find the SDKs and CLI, and use the resource guides to plan payment workflows, liquidity, provider selection, and partner integrations.
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
[Guides](https://tempo.com/developers/docs/resources/guides) / [Payment workflows](https://tempo.com/developers/docs/resources/guides#payment-workflows) / Plan batch and scheduled payouts
# Plan batch and scheduled payouts
Batch payments group multiple obligations into a payout run. On Tempo, an atomic batch executes several calls in one transaction; independent transactions have separate receipts and outcomes. Your application schedules and submits recurring runs.
Start by choosing which calls must succeed together, then follow [Send payments](https://tempo.com/developers/docs/guide/payments/send-a-payment#batch-payment-transactions) for the implementation.
## Choose the payout failure boundary
| Approach | Behavior | Use when |
| --- | --- | --- |
| Atomic batch | Multiple calls execute in one transaction. A reverting call reverts the batch. | Related operations must succeed or fail together. |
| Independent transactions | Each transaction has its own receipt and outcome. | One recipient's failure should not block other payments. |
| Application scheduling | A service decides when to submit each run. | Payments recur or require a release time or approval event. |
Use [parallel transactions](https://tempo.com/developers/docs/guide/payments/send-parallel-transactions) for independent receipts. Tempo [transaction validity windows](https://tempo.com/developers/docs/protocol/transactions#scheduled-transactions) constrain when a submitted transaction may be included. They don't submit the transaction or guarantee inclusion.
## Validate the complete payout route
For cross-border runs, record each recipient's chosen asset or local currency, supported delivery method, eligibility, conversion quote, and provider reference.
For each payout, validate required fields, network, token contract, amount, duplicate obligation IDs, and approved destination. Verify any change to stored vendor payment instructions out of band. Check token policies and receive policies before release, because a receive policy can hold a transfer inside a successful transaction.
## Prepare and release a payout run
:::steps
### Define the run and its obligations
Keep approved invoices, payroll periods, and vendor information in your business system. Assign a separate payment ID to each obligation and decide which payments belong in one atomic transaction.
### Build the transfers
Use a distinct [payment reference](https://tempo.com/developers/docs/guide/payments/transfer-memos) for each call. Store the memo encoding with its offchain record. A batch shares one transaction hash, so references and transfer log indexes distinguish the individual payments.
### Fund principal and fees
Check usable balances and expected fees before signing. Use eligible fee tokens with sufficient Fee AMM liquidity, or configure [fee sponsorship](https://tempo.com/developers/docs/api/fee-payer). If conversion is required, quote it and check the output amount.
### Approve and submit
Apply your wallet, custodian, or application approval controls. Store the submitted transaction identifier before waiting for a result.
### Confirm each recipient transfer
Inspect the receipt and compare the delivered token, amount, and recipient for every expected payment. Match each transfer to the approved obligation and record it once.
:::
## Example of an approved supplier run
Consider three approved supplier invoices in the same stablecoin. Keep vendor details in the AP system and give each transfer a short opaque reference.
| Obligation | Pre-submission evidence | Completion evidence |
| --- | --- | --- |
| Supplier invoice | Approved amount, token contract, network, verified destination, and payment reference. | Successful delivered transfer matched to the invoice. |
| Batch | Funded principal and fees, approved call list, chosen failure boundary. | Transaction receipt and every expected transfer. |
| Fiat payout | Supported provider route, beneficiary, currency, quote, and limits. | Provider confirmation of local delivery as well as the onchain evidence. |
If the calls are atomic, a reverting call reverts the entire batch. For independent transactions, track each result separately. In either case, check the delivered transfers, not only transaction success.
If submission times out, inspect the existing transaction before retrying. Keep unresolved payments pending while investigating. Resending an entire run can pay some invoices twice.
## Budget for execution and operations
Standard stablecoin transfers on Tempo have sub-cent network fees, but a batch's actual cost depends on its calls. Use the [fee documentation](https://tempo.com/developers/docs/protocol/fees), and include provider charges, conversion, custody, payout costs, and exception handling in the run's economics.
Issuer-defined [TIP-403 policies](https://tempo.com/developers/docs/protocol/tip403/overview) and application permissions serve different roles. Token policies enforce eligibility rules. Onboarding, screening, payroll approval, and reporting stay in your application.
For private balances, see [Zones](https://tempo.com/developers/docs/zones). Zones is live on Mainnet, but its current runtime disables general TIP-20 transfers, so this batch workflow doesn't run inside a Zone.
## Batch payout questions
### Should a payout system use file uploads or an API?
A file-based approval flow can fit infrequent runs. Recurring or large runs need programmatic validation and submission. The application or provider supplies that interface; Tempo's atomic batch is the onchain execution primitive.
### How are failed payouts handled?
A reverting call reverts an atomic batch. Independent transactions have separate outcomes. Verify the delivered transfers and investigate unresolved submissions before retrying.
### How can bulk payments recur automatically?
Run a scheduler in the application or provider service, then submit and monitor each authorized run.
### How do batches connect to finance systems?
Map each transfer's reference and unique event key to the invoice or payout record. Preserve fees, exceptions, and any provider delivery records alongside the onchain evidence. See [payment reconciliation](https://tempo.com/developers/docs/resources/guides/payment-reconciliation).
> Source: [/docs/resources/guides/global-payouts](https://tempo.com/developers/docs/resources/guides/global-payouts.md)
> Section: [Get Started](https://tempo.com/developers/get-started.md). Choose a starting point, send a test payment, get testnet funds, connect a coding agent, find the SDKs and CLI, and use the resource guides to plan payment workflows, liquidity, provider selection, and partner integrations.
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
[Guides](https://tempo.com/developers/docs/resources/guides) / [Payment workflows](https://tempo.com/developers/docs/resources/guides#payment-workflows) / Plan global payouts
# Plan global payouts
Global stablecoin payouts use onchain transfers to pay contractors, merchants, or partners across countries. Recipients can receive a supported stablecoin directly or local currency through a payout provider. Tempo provides near-instant onchain settlement; funding, conversion, provider checks, and bank delivery have separate timing and completion signals.
Choose the recipient's required outcome, then use [Send payments](https://tempo.com/developers/docs/guide/payments/send-a-payment) for direct Tempo transfers or [Routes](https://tempo.com/developers/docs/routes) for supported cross-network flows.
## Define recipient access and delivery
A stablecoin payout needs a supported token and network, a verified receiving account, and a practical way for the recipient to use the funds. A local-currency payout also needs the provider's country coverage, beneficiary requirements, conversion quote, limits, and delivery confirmation.
For a $1,000 contractor payout in Brazil, compare two flows: a stablecoin delivered to a wallet and BRL delivered to a supported local account. The first can leave conversion to the contractor; the second includes it in the provider's service. Compare the usable recipient amount and complete delivery time for each.
Check asset support and country coverage for both deposits and withdrawals. For Routes, read the [supported route directory](https://tempo.com/developers/docs/routes/networks), then quote the asset pair, direction, funding method, and amount.
## Compare complete payout costs
Tempo's sub-cent network fees cover standard stablecoin transfers. The complete flow can also include funding, custody, conversion spreads, provider charges, local delivery, liquidity, and operational work.
Use comparable quotes for the same funding method, sender amount, recipient currency, and delivery method. Record quote expiry and whether fees are deducted from the recipient amount or charged separately. In [Routes quotes](https://tempo.com/developers/docs/routes/quotes), an empty separate-fee list doesn't mean the route is free, and a quote doesn't reserve liquidity.
## Choose the integration responsibilities
| Model | Responsibilities to assign |
| --- | --- |
| Provider-led | List which funding, custody, conversion, screening, payout, and reporting services the provider supplies. |
| Direct onchain | Operate account access, signing, fees, transfer submission, monitoring, and reconciliation. Arrange any fiat legs separately. |
| Hybrid | Define the handoff from your onchain account to the provider's conversion and local delivery service. |
For a provider-led evaluation, begin with [payments and ramps](https://tempo.com/developers/docs/partners/payments-and-ramps).
## Pilot a recurring payout flow
:::steps
### Establish the baseline
Pick one recurring corridor and a small recipient group. Record current cost, usable recipient amount, delivery time, exceptions, and reconciliation effort.
### Validate recipient preferences
Confirm whether each recipient wants a stablecoin balance or local currency. Verify destination instructions, supported asset and network, required references, and access to funds.
### Execute and observe
Fund principal and fees, apply approval controls, and submit. Record the existing transaction and provider identifiers before investigating an unresolved request or attempting a retry.
### Reconcile the outcome
Verify every delivered transfer. For fiat payouts, preserve local delivery evidence too. Compare the complete result with the baseline before expanding to more recipients or countries.
:::
## Keep payout states distinct
A request accepted by an API, a submitted transaction, finalized onchain delivery, and credited bank funds are different states. Model them separately in your payment record.
Save the network, transaction hash, and transfer log index for each onchain payout. Use an opaque [payment reference](https://tempo.com/developers/docs/guide/payments/transfer-memos) to link that evidence to the offchain obligation. Keep personal data off public ledgers. For Routes, follow [delivery and refund status](https://tempo.com/developers/docs/routes/delivery).
Virtual deposit addresses attribute incoming funds to a shared account. They don't reconcile outgoing payouts. See [payment reconciliation](https://tempo.com/developers/docs/resources/guides/payment-reconciliation) and [batch payouts](https://tempo.com/developers/docs/resources/guides/batch-payments) for the operating model.
## Match the payout flow to its use case
Marketplace payouts need seller eligibility, release rules, and traceable order or payout references. Contractor payouts need an approved compensation record and recipient preferences. Affiliate payouts need accurate payee data and a clear policy for thresholds and failed delivery.
For urgent or humanitarian payouts, verify connectivity, recipient access, and an actual way to use the money.
## Global payout questions
### Does the business have to hold stablecoins?
Not necessarily. A provider can accept fiat and handle the stablecoin leg. Record who owns and controls funds at each stage, the custody model, and the records supplied.
### Do recipients need to manage blockchain mechanics?
A provider or embedded wallet can handle some mechanics in its interface. Test the recipient experience, supported asset, withdrawal methods, and support process.
### How does local currency conversion work?
A supported off-ramp or payout provider supplies conversion and local delivery. Rates, eligibility, limits, fees, and delivery times depend on the specific route.
### Do stablecoins remove country or identity requirements?
No. Record which party handles sender and recipient checks, permitted uses, token policies, and any required reporting for each route.
> Source: [/docs/resources/guides/stablecoin-payroll-for-global-teams](https://tempo.com/developers/docs/resources/guides/stablecoin-payroll-for-global-teams.md)
> Section: [Get Started](https://tempo.com/developers/get-started.md). Choose a starting point, send a test payment, get testnet funds, connect a coding agent, find the SDKs and CLI, and use the resource guides to plan payment workflows, liquidity, provider selection, and partner integrations.
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
[Guides](https://tempo.com/developers/docs/resources/guides) / [Payment workflows](https://tempo.com/developers/docs/resources/guides#payment-workflows) / Plan stablecoin payroll
# Plan stablecoin payroll
Stablecoin payroll connects approved compensation to a token transfer or provider-mediated local payout. Keep calculation, deductions, and approval in your payroll system, and enable the payment method only where the worker and compensation are eligible. Start with [Send payments](https://tempo.com/developers/docs/guide/payments/send-a-payment) and use [batch payouts](https://tempo.com/developers/docs/resources/guides/batch-payments) for an approved run.
A production workflow needs worker onboarding, payment preferences, treasury funding, destination validation, error handling, reconciliation, and support.
## Separate payroll approval from payment execution
The payroll system determines the worker, amount, pay period, classification, and approval status. Your application or provider funds and executes the approved payment. A worker can receive a supported stablecoin directly, or a payout provider can convert it to a supported local payment method.
Define which route is available for each worker before offering it. Check permitted payment forms and currencies, any required consent, worker classification, supported assets, and local delivery requirements.
Keep withholding, reporting, and payroll records in the applicable process. For example, the [IRS digital-asset guidance](https://www.irs.gov/individuals/international-taxpayers/frequently-asked-questions-on-digital-asset-transactions) treats digital assets paid as employee remuneration as wages for U.S. federal employment tax purposes. Contractor payments have a separate treatment.
## Capture worker payment preferences
| Record | What to store |
| --- | --- |
| Approved compensation | Payroll or invoice ID, pay period, entity, amount, and approval. |
| Recipient preference | Stablecoin balance or local-currency payout and the agreed asset or currency. |
| Destination | Verified network and token contract, wallet address, or provider beneficiary details. |
| Delivery expectation | Required delivery date, provider estimate, and evidence of usable funds. |
| Support | Exception owner, communication process, and verified procedure for changing payment instructions. |
A dollar-denominated balance may fit a worker's preference, but it still involves issuer, custody, and conversion risks. Explain the withdrawal and spending options the product supports.
## Fund and schedule an authorized payroll run
Set the balances needed for principal, network fees, provider charges, and any conversion. Funding too late can delay a run; funding early ties up liquidity. Measure both before selecting a funding cadence.
Choose an atomic batch when the calls must succeed together. Choose [independent transactions](https://tempo.com/developers/docs/guide/payments/send-parallel-transactions) when a failure in one worker's transaction must not revert another worker's payment. A reverting call reverts an atomic batch. Each approach still requires verifying the delivered transfers; a receive-policy hold can occur without reverting the call.
Your application or provider schedules and submits recurring runs. [Transaction validity windows](https://tempo.com/developers/docs/protocol/transactions#scheduled-transactions) constrain when a transaction can be included; they don't create a recurring job or guarantee execution.
If you sponsor fees, monitor the sponsor's eligible fee-token balance and the applicable liquidity requirements. [Fee sponsorship](https://tempo.com/developers/docs/api/fee-payer) changes who pays network fees; the sponsor still has to fund them.
## Reconcile each worker payment
Attach an opaque [32-byte payment reference](https://tempo.com/developers/docs/guide/payments/transfer-memos) and map it to the offchain payroll record. Keep names, pay details, cost centers, and other sensitive information offchain. The memo is public transaction data on the public network.
A batch shares a transaction hash, so use each transfer's log index to distinguish outcomes. Store the network, transaction hash, and transfer log index as a unique event key. Verify the recipient, token, amount, and successful delivered transfer before marking the obligation paid.
For local-currency delivery, retain the provider payout ID and delivery evidence as well. See [global payouts](https://tempo.com/developers/docs/resources/guides/global-payouts) for route evaluation and [payment reconciliation](https://tempo.com/developers/docs/resources/guides/payment-reconciliation) for finance records.
## Handle unresolved and incorrect payouts
Keep an unresolved submission pending while inspecting its existing identifiers. Retrying a complete payroll run can pay workers twice. Test duplicate notifications, a blocked receipt, a wrong token, an outdated destination, a failed conversion, and a delayed provider payout before expanding.
Record support ownership and the evidence needed to resolve each exception. Verify a refund or corrected destination independently. A direct onchain correction is a new payment, not an edit to the confirmed transfer.
## Evaluate the worker experience
Compare the complete source amount, usable recipient amount, delivery time, prefunded balances, and support burden with the existing process. Stablecoin payroll succeeds when the worker can receive and use the promised funds and finance can reconcile the obligation once.
If you need private balances, review the [Zones privacy model](https://tempo.com/developers/docs/zones/privacy) and current [Zone capabilities](https://tempo.com/developers/docs/zones). The current permissioned runtime disables general TIP-20 transfers, so public-network payroll transfers don't work inside a Zone.
## Stablecoin payroll questions
### Do workers have to receive stablecoins directly?
No. A provider can convert the stablecoin leg into a supported local payment method. Verify the route, eligibility, price, and delivery evidence for each worker.
### Does the payment rail determine compensation treatment?
No. Keep worker classification, wage rules, tax reporting, and recordkeeping in the applicable payroll process.
### What infrastructure is required?
Worker onboarding, preferences, approved obligations, funding, signing controls, destination validation, monitoring, reconciliation, and support. Decide which parts your application operates and which the provider supplies.
### How do references support payroll reconciliation?
An opaque memo maps the transfer to an offchain payroll record. Combine it with verified delivery and a unique event key before marking the obligation paid.
> Source: [/docs/resources/guides/cross-border-payments](https://tempo.com/developers/docs/resources/guides/cross-border-payments.md)
> Section: [Get Started](https://tempo.com/developers/get-started.md). Choose a starting point, send a test payment, get testnet funds, connect a coding agent, find the SDKs and CLI, and use the resource guides to plan payment workflows, liquidity, provider selection, and partner integrations.
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
[Guides](https://tempo.com/developers/docs/resources/guides) / [Payment workflows](https://tempo.com/developers/docs/resources/guides#payment-workflows) / Plan cross-border payments
# Plan cross-border payments
A cross-border stablecoin payment uses an onchain transfer to move value between parties in different countries. A complete route may also need bank funding, currency conversion, and local payout. Evaluate the amount the recipient can use and the evidence of delivery for every leg.
Choose the recipient outcome first, then use [direct payments](https://tempo.com/developers/docs/guide/payments/send-a-payment) or a supported [Routes integration](https://tempo.com/developers/docs/routes) for the onchain path.
## Choose the recipient outcome first
For a **stablecoin payout**, the recipient receives a specified token on a specified network. They need an account or wallet that supports that asset and a way to use it. If they later sell it or withdraw to a bank, that is a separate step with its own price and availability.
For a **local-currency payout**, a provider converts or redeems stablecoins and delivers funds through a bank or another supported local method. The provider must support the origin, destination, customer type, currency, and amount.
For recipients who need **cash or mobile money**, start with that requirement. A wallet balance doesn't replace a cash collection point or a mobile money credit. Check the recipient's access, identification requirements, and delivery process.
## Verify a cross-border route before funding it
Record these details for each route. Recheck them when the provider, asset, amount, or destination changes.
| Check | What to establish |
| ----------------- | ---------------------------------------------------------------------------------------------------------------------------- |
| Origin and sender | Sending country, individual or business eligibility, funding currency, and permitted payment purpose. |
| Funding method | The account or wallet that supplies funds, required verification, funding instructions, and when funds become usable. |
| Asset and network | Source and destination networks and token contracts, not only token symbols. |
| Recipient | Intended beneficiary, wallet or account details, required references, and eligibility to receive. |
| Conversion | Whether conversion is needed, the quoted rate, quote expiry, and who bears changes in that rate. |
| Delivery | Bank, wallet, cash, or mobile money endpoint; supported institution; minimum and maximum amounts; and expected availability. |
| Cost and amount | Total sender outlay and expected recipient amount, including deductions and separately charged fees. |
| Exceptions | Evidence of completion, support contact, return or refund process, and handling of delayed payments. |
Check an exchange's deposit and withdrawal support for the specific Tempo asset. Support for the same symbol on another network doesn't carry over.
For Tempo Routes, the [network and asset directory](https://tempo.com/developers/docs/routes/networks) lists networks separately from available token pairs, directions, funding modes, and account access. Request a quote with the actual payment inputs before relying on a route.
## Compare the complete cost
A network fee pays only for the onchain transaction.
Build a quote comparison around one of two outcomes:
* **Fixed sender budget:** compare the final amount each option delivers in the recipient's required currency and account.
* **Fixed recipient amount:** compare the total amount the sender must provide for each option to deliver the same result.
Include funding charges, conversion rates and spreads, network fees, provider charges, payout fees, and any known receiving charges. Record the time of each quote and whether the quoted amount is guaranteed through execution. Don't count the same fee twice if it is already deducted from the recipient amount.
In [Routes quotes](https://tempo.com/developers/docs/routes/quotes), routed deductions reduce the destination amount, while some fees are charged separately. An empty separate-fee list doesn't mean the route is free, and a quote doesn't reserve liquidity.
Moving the same dollar-denominated token between wallets does not require a currency conversion for that leg. Converting from or into local currency can still create FX costs and exposure. Holding a dollar-pegged asset carries issuer, redemption, and custody risk.
## Track funding, settlement, and delivery separately
Use a payment record that links the business reference to each provider and network identifier. For a supplier payment, that could include the invoice, approved beneficiary, funding reference, onchain transaction, payout ID, quoted amount, and delivery evidence. A donation can use a campaign reference while keeping donor information in private records.
A route completes when the destination receives funds; track its status through the pending, completed, and refund states in [Routes delivery](https://tempo.com/developers/docs/routes/delivery). Investigate a delayed payment using its existing identifier before resending it; an unresolved payment can still complete.
Define the evidence that closes the payment before launching the flow. A wallet payout requires verified delivery of the correct token and amount. A bank payout also needs confirmation from the payout provider or receiving institution. An API acknowledgment only means the request was accepted.
[Payment references](https://tempo.com/developers/docs/guide/payments/transfer-memos) can connect a payment to an invoice or internal record. Keep personal information, bank details, and sensitive business data off public ledgers. See [payment reconciliation](https://tempo.com/developers/docs/resources/guides/payment-reconciliation) for the operating workflow.
## Match the route to the business workflow
**Supplier and contractor payments** need accurate beneficiary details, approval records, and an agreed delivery currency. Ask whether the recipient wants to retain a stablecoin balance or receive a bank deposit, then compare the full route accordingly.
**Treasury transfers** need clear ownership of balances, access to liquidity, and reconciliation between entities. Stablecoin settlement can change where liquidity sits, but payments still need funding. Review [prefunding](https://tempo.com/developers/docs/resources/guides/prefunding) and [nostro and vostro accounts](https://tempo.com/developers/docs/resources/guides/nostro-vostro-accounts) when comparing operating models.
**Remittances and regional payouts** depend on the recipient's ability to use the funds. Country-specific delivery methods and provider access matter as much as the settlement network. The [Latin America guide](https://tempo.com/developers/docs/resources/guides/cross-border-payments-latin-america) covers local delivery through Pix and SPEI.
## Implement the onchain payment leg
Tempo is a blockchain built for payments. It provides near-instant onchain settlement and sub-cent fees for standard stablecoin transfers. Its [fee system](https://tempo.com/developers/docs/protocol/fees) supports eligible USD-denominated TIP-20 tokens with sufficient Fee AMM liquidity. [Fee sponsorship](https://tempo.com/developers/docs/api/fee-payer) lets an application handle network fees as part of its payment experience.
Funding, conversion, identity checks, and bank payouts require the appropriate products and providers. Review [payments and ramps](https://tempo.com/developers/docs/partners/payments-and-ramps) for provider integrations.
Start with one recurring payment flow. Compare it with the existing method using total cost, usable recipient amount, time to delivery, exception rate, and reconciliation effort. Expand when the complete flow works for the intended recipients.
## Cross-border payment questions
How long do cross-border stablecoin payments take?
Separate the onchain transfer from funding, conversion, and local delivery. Tempo provides near-instant onchain settlement. The time until a recipient can use local currency depends on the providers, payment method, eligibility checks, and banking steps in that route.
Can I send a stablecoin to any wallet or exchange?
Only when the destination accepts that token contract on that network. A matching token name, dollar peg, or address format doesn't indicate support. Exchange deposits can also require a reference or memo and their own crediting process.
Does a confirmed blockchain transfer mean a bank payout is complete?
No. A bank payout needs its own evidence that the intended beneficiary received the quoted local-currency amount. Keep the blockchain transaction, provider payment ID, and payout reference connected in your records.
How should I compare the cost with a bank or money transfer service?
Compare the same sender funding method, amount, recipient currency, and delivery method. Include funding, network, conversion, payout, and recipient charges. Use current quotes and the amount the recipient can actually use, rather than comparing a network fee with a complete transfer price.
Do stablecoins remove country restrictions or identity checks?
No. Sender and recipient eligibility, permitted uses, identity requirements, token policies, and provider access still matter.
> Source: [/docs/resources/guides/cross-border-payments-latin-america](https://tempo.com/developers/docs/resources/guides/cross-border-payments-latin-america.md)
> Section: [Get Started](https://tempo.com/developers/get-started.md). Choose a starting point, send a test payment, get testnet funds, connect a coding agent, find the SDKs and CLI, and use the resource guides to plan payment workflows, liquidity, provider selection, and partner integrations.
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
[Guides](https://tempo.com/developers/docs/resources/guides) / [Payment workflows](https://tempo.com/developers/docs/resources/guides#payment-workflows) / Plan Latin America payment routes
# Plan Latin America payment routes
Cross-border stablecoin payments in Latin America connect an onchain settlement leg with country-specific funding, conversion, and delivery services. Evaluate one country and delivery method at a time using the [cross-border payment checklist](https://tempo.com/developers/docs/resources/guides/cross-border-payments). Use [Routes](https://tempo.com/developers/docs/routes) for its supported cross-network stablecoin operations.
Companies paying suppliers, contractors, sellers, or subsidiaries across Latin America work across different currencies, banks, and domestic payment systems. A useful route makes the recipient amount and delivery status clear while preserving evidence from every leg.
## Map country-specific payment requirements
A flow that works in Brazil can require a different provider, currency workflow, beneficiary record, and reconciliation process in Mexico, Colombia, Argentina, or Peru.
| Requirement | Operating implication |
| --- | --- |
| Funding and settlement timing | Bank funding, onchain delivery, conversion, and local payout have separate clocks. |
| Local currency | A USD-denominated stablecoin keeps that leg in dollars; a recipient spending in another currency still carries FX exposure. |
| Domestic rail | The payout provider must support both the stablecoin and the domestic rail. |
| Payment visibility | Link the invoice or payroll obligation to each network and provider identifier. |
| Recipient access | Verify the wallet, bank, account type, limits, and required beneficiary details. |
Stablecoin settlement can connect approved wallets and providers between these endpoints. Local banks, conversion providers, and payout services retain their own availability and operating requirements.
## Match the route to the business use case
**Payroll and contractor payouts** start with approved compensation and a worker's payment preference. Determine whether the worker wants a stablecoin balance or a local payout. A fast onchain leg is useful only if the worker can access the promised funds. See [stablecoin payroll](https://tempo.com/developers/docs/resources/guides/stablecoin-payroll-for-global-teams).
**Marketplace settlements** need seller eligibility, release rules, accurate beneficiary details, and an order or payout reference. The platform can share onchain infrastructure across markets while maintaining country-specific provider configurations.
**Treasury transfers** need clear entity ownership, custody controls, funding limits, and reconciliation. Model the balances each provider needs; faster settlement doesn't eliminate prefunding.
**Remittance and supplier payments** require an agreed delivery currency and endpoint. Preserve the recipient's requested local amount, conversion quote, and final delivery evidence. Settlement between providers is a separate step from delivery to the recipient.
## Verify local delivery country by country
Before funding a payment, verify one complete route: the sender's country and funding currency, the stablecoin and network, the recipient's eligibility, any conversion, and the final delivery method.
| Route detail | Evidence to request |
| -------------- | --------------------------------------------------------------------------------------------------------- |
| Sender access | The provider accepts this individual or business, origin country, funding method, and payment purpose. |
| Asset support | Deposit instructions name the network and token contract; withdrawal support is checked separately. |
| Local delivery | The required bank account, wallet, or other endpoint is supported for this recipient and amount. |
| Conversion | A current quote states the local-currency amount, applicable fees, expiry, and conversion timing. |
| Completion | A payment reference and delivery status can be matched to the beneficiary, invoice, and amount. |
| Exceptions | The provider explains delayed delivery, rejected beneficiary details, returns, and refunds. |
Use the same worksheet for Brazil, Mexico, Colombia, Argentina, Peru, and other markets. Check that the provider accepts the asset on Tempo specifically. For Tempo Routes, use the [network and asset directory](https://tempo.com/developers/docs/routes/networks) and quote the actual payment inputs.
### Brazil: separate Pix delivery from the cross-border route
Use [Banco Central do Brasil's Pix information](https://www.bcb.gov.br/en/financialstability/pix_en) to understand the domestic system. A Pix payout also needs a provider that accepts your stablecoin, converts it to BRL, and delivers the payment.
For a proposed Brazil payout, request the provider's current asset and network instructions, eligible recipient details, BRL quote, payout limits, and evidence of the final Pix delivery. Keep the onchain transaction and the provider's local payout reference together.
### Mexico: distinguish a SPEI payment from beneficiary credit
[SPEI is operated by Banco de México](https://www.banxico.org.mx/services/interbanking-electronic-payme.html) and moves payments between accounts through financial institutions. A proposed stablecoin-to-MXN payout still needs a provider that supports the complete route.
Banco de México's [payment-status guidance](https://www.banxico.org.mx/servicios/mi-spei_-transferencias-ban.html) distinguishes settlement in SPEI from credit to the beneficiary. Its electronic payment receipt, the CEP, is generated from the receiving institution's confirmation of that credit. Ask which payout identifiers and delivery evidence your provider supplies, then connect those records to the original payment.
### Compare the amount recipients can use
For a contractor expecting local currency, compare quotes for the same local-currency delivery. For a contractor choosing to retain a dollar-denominated balance, explain the supported asset, custody model, and withdrawal options. A dollar-pegged token isn't a dollar bank deposit, and converting it later still costs FX.
A treasury team should also model where liquidity must be available before the payout. [Prefunding](https://tempo.com/developers/docs/resources/guides/prefunding) can move between providers or accounts when the settlement architecture changes; a stablecoin leg doesn't remove it.
## Implement the settlement and reporting path
Use [Send payments](https://tempo.com/developers/docs/guide/payments/send-a-payment) for direct supported stablecoin transfers. Choose [atomic batches or independent transactions](https://tempo.com/developers/docs/resources/guides/batch-payments) according to the required failure boundary. Your application schedules and submits recurring runs.
Attach an opaque [payment reference](https://tempo.com/developers/docs/guide/payments/transfer-memos) and keep sensitive payroll, supplier, and bank data offchain. Save the network, transaction hash, and transfer log index, then connect them to the local payout reference. Recover missed events and process each transfer once.
Use the [fee documentation](https://tempo.com/developers/docs/protocol/fees) to choose eligible fee tokens and estimate actual execution. Include funding, FX, provider charges, and local delivery in the complete cost comparison.
For private balances, see [Zones](https://tempo.com/developers/docs/zones) and its [privacy model](https://tempo.com/developers/docs/zones/privacy). A Zone's operator can read its ledger, deposit and withdrawal amounts are public, and the current runtime disables general TIP-20 transfers.
## Latin America payment questions
How do businesses send money across Latin America?
Businesses usually use a mix of banks, money transmitters, fintech providers, local payment networks, and cross-border payment platforms. Some are adding stablecoin rails as a settlement layer that works alongside those systems.
What should companies evaluate before using stablecoin payment rails?
Companies should evaluate compliance, custody, privacy, reconciliation, local payout coverage, FX conversion, off-ramp availability, and issuer risk.
What are the main challenges of cross-border payments in Latin America?
The main challenges are currency fragmentation, settlement delays, FX costs, local regulatory differences, limited payment visibility, and the need to support different domestic payment systems in each country.
Does Pix or SPEI availability prove a Tempo payout route is supported?
No. Before funding a payment, confirm the provider, sender and recipient eligibility, asset and network, conversion quote, and final delivery method.
Does a confirmed onchain transfer prove the recipient received local currency?
No. Verify local delivery with the payout provider or receiving institution. Link the onchain transaction to the payout identifier, beneficiary, currency, amount, and delivery evidence in your payment records.
> Source: [/docs/resources/guides/remittances](https://tempo.com/developers/docs/resources/guides/remittances.md)
> Section: [Get Started](https://tempo.com/developers/get-started.md). Choose a starting point, send a test payment, get testnet funds, connect a coding agent, find the SDKs and CLI, and use the resource guides to plan payment workflows, liquidity, provider selection, and partner integrations.
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
[Guides](https://tempo.com/developers/docs/resources/guides) / [Payment workflows](https://tempo.com/developers/docs/resources/guides#payment-workflows) / Remittance payment operations
# Remittance payment operations
A stablecoin remittance uses an onchain transfer for part of a cross-border payment to a recipient. Sender funding and final delivery can still use bank accounts, wallets, or cash services. Begin with one corridor and map funding, conversion, settlement, and payout separately before selecting a provider or integrating Tempo.
## Map the complete remittance route
A remittance corridor identifies a sending and receiving country, such as the United States to Mexico. Add the funding currency, payout currency, and delivery method when defining an operational route. [Costs vary by corridor](https://remittanceprices.worldbank.org/), so a global average says little about one route.
A remittance can use local-currency collection, a stablecoin transfer between providers, and local-currency payout. This is sometimes called a stablecoin sandwich. A recipient can also receive a supported stablecoin directly where the product and recipient support that outcome.
| Stage | Required evidence |
| --- | --- |
| Sender funding | Source amount and currency, accepted funding method, and provider confirmation. |
| Acquisition or conversion | Token and network, executable quote, fees, and amount available. |
| Onchain transfer | Successful delivered transfer of the expected token and amount. |
| Destination conversion | Provider acceptance, FX terms, and amount available for payout. |
| Recipient payout | Completion in the promised currency and bank, wallet, or cash-delivery method. |
Tempo's near-instant settlement applies to the onchain leg. Funding, provider checks, conversion, bank processing, and recipient access still determine end-to-end delivery.
## Verify corridor support before accepting funds
Confirm the sending and receiving markets, institutions, customer eligibility, funding method, token contract, network, payout currency, and delivery method for your flow, not only the country.
Document which party supplies custody, wallets, currency conversion, identity checks, screening, information exchange, and local payout. An orchestration API can bundle several of these.
Where information-sharing requirements apply, identify who collects and exchanges the required data and what happens when checks remain unresolved. [FATF's virtual-asset guidance](https://www.fatf-gafi.org/en/topics/virtual-assets.html) describes secure originator and beneficiary information exchange under the Travel Rule. Transfer memos and other onchain data don't carry this exchange. Local requirements and the institutions involved determine how you implement it.
## Compare net recipient amounts and full costs
Hold the source currency, funding method, transfer amount, recipient currency, and payout method constant. Decide whether the comparison fixes the sender's total budget or the recipient's net amount.
Include collection charges, stablecoin acquisition, network fees, custody or orchestration charges, FX spreads, off-ramp charges, and local payout fees. Record quote expiry and the handling of failed, returned, or delayed payouts. The [World Bank's Remittance Prices Worldwide](https://remittanceprices.worldbank.org/) provides comparison context for relatively small transfers between countries. Its benchmarks aren't executable quotes, so match the corridor, transfer amount, and observation date before using them.
Sub-cent network fees cover a standard Tempo transfer's onchain expense. The remittance's total cost depends on every other stage.
## Choose the local payout rail
### Philippines: distinguish InstaPay, business access, and PESONet
For a proposed PHP payout, identify the provider's actual domestic delivery service:
| Service | What to verify with the payout provider |
| --- | --- |
| [InstaPay](https://www.bsp.gov.ph/PaymentAndSettlement/FAQ_Instapay.pdf) | Real-time PHP transfers between participating Philippine accounts, available around the clock. The standard limit is PHP50,000 per transfer; institutions can impose other account or daily limits. |
| [InstaPay for Business](https://www.bsp.gov.ph/Media_And_Research/Primers%20Faqs/FAQs-InstaPay-for-Business.pdf) | Transfers up to PHP500,000 for business or corporate accounts through participating institutions. Confirm that the sending account has this access; institutions can set their own limits. |
| [PESONet](https://www.bsp.gov.ph/PaymentAndSettlement/FAQ_PESONet.pdf) | Batch processing with same-banking-day credit subject to the applicable cutoff and clearing cycle. Ask the provider for its submission deadline. |
These are local PHP services. A Tempo-funded payout also needs a provider that accepts your stablecoin and network, quotes the conversion, reaches the beneficiary institution, and returns evidence of recipient credit.
## Plan payout liquidity
Document the destination provider balance or liquidity needed before a recipient can be paid, the replenishment path, and how a delayed conversion affects delivery. Faster onchain settlement can shorten one stage without eliminating local payout funding requirements.
Compare individual conversion with bulk funding against the delivery promise and liquidity required. A batch can reduce some operational work while introducing a wait for the batch; use measured route terms to decide.
Keep sender funds accepted, stablecoins available, funds submitted onchain, destination funds received, and recipient payout complete as separate balances or states. A single “complete” status hides where a delayed remittance needs intervention.
## Integrate and pilot the corridor
:::steps
### Select one measurable route
Choose a corridor with known customer demand and a clear existing delivery or cost baseline. Define the accepted funding method and recipient outcome before implementing.
### Record the quote and instruction
Create a stable remittance identifier. Save the sender and recipient references, source and destination amounts, quote expiry, provider identifiers, and required approvals in your application. Keep personal information offchain.
### Execute and verify each stage
Follow [sending payments](https://tempo.com/developers/docs/guide/payments/send-a-payment) for the onchain leg and [receiving payments](https://tempo.com/developers/docs/guide/payments/accept-a-payment) for delivery checks. Verify the network, contract, recipient, amount, and successful delivered transfer. Treat a receive-policy hold as an exception, not recipient delivery.
### Confirm the recipient payout
Require the destination provider's completion evidence for the promised bank, wallet, or cash payout. Don't mark a fiat remittance delivered because the stablecoin leg settled.
### Reconcile and review exceptions
Connect each provider stage and onchain transfer to the remittance identifier. Use the network, transaction hash, and log index to process the transfer once. Test unknown submissions and provider retries without duplicating a payout.
:::
Measure total sender cost, recipient net amount, delivery by stage, liquidity used, payout failures, support cases, and reconciliation completion. Expand only after the pilot shows that the complete route meets the promised outcome.
## Define remittance exception handling
Before launch, define what happens after an expired quote, held transfer, failed conversion, rejected recipient account, or uncertain payout. Save the stage and existing attempt before retrying. Don't answer a timeout with a second transfer.
Explain the payout status to customers using application evidence. An accepted request, an onchain transfer, and a completed local payout should have distinct meanings in the customer experience.
For refunds or returns, establish the approved destination, conversion treatment, charges, and verification process. A return can require another transfer and a new provider instruction.
## Remittance operation questions
### Must the recipient understand stablecoins?
Not for a supported local-currency payout. The provider can handle the stablecoin leg while the recipient receives the specified bank, wallet, or cash payout.
### Must the institution hold stablecoins directly?
Not in every provider model. Document custody, signing, asset exposure, fees, and the provider's responsibilities before using a flow that handles stablecoins on your behalf.
### Does onchain settlement prove the remittance is complete?
Only if the promised outcome is the verified onchain receipt itself. Local-currency payout needs separate destination-provider evidence. See [payment rail comparisons](https://tempo.com/developers/docs/resources/guides/payment-rails) for the distinction.
> Source: [/docs/resources/guides/subscriptions-on-tempo](https://tempo.com/developers/docs/resources/guides/subscriptions-on-tempo.md)
> Section: [Get Started](https://tempo.com/developers/get-started.md). Choose a starting point, send a test payment, get testnet funds, connect a coding agent, find the SDKs and CLI, and use the resource guides to plan payment workflows, liquidity, provider selection, and partner integrations.
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
[Guides](https://tempo.com/developers/docs/resources/guides) / [Payment workflows](https://tempo.com/developers/docs/resources/guides#payment-workflows) / Subscription billing with access keys
# Subscription billing with access keys
Use a scoped access key with a periodic spending limit to authorize recurring stablecoin charges. Your application schedules each charge, verifies payment, and manages the subscription. The key constrains spending; it is not a billing scheduler.
Access keys work on mainnet and testnet with single-key accounts. Access keys for configurable accounts run on testnet now and reach mainnet with [T14](https://tempo.com/developers/docs/protocol/upgrades/t14) on December 8, 2026. Follow the [access-key guide](https://tempo.com/developers/docs/accounts/access-keys) when choosing the account and network for your integration.
## Define the subscription and authorization
Record the customer account, asset contract, charge amount, billing schedule, service entitlement, cancellation terms, and key expiry. Keep those application terms distinct from the onchain bounds.
An [access key](https://tempo.com/developers/docs/accounts/access-keys) signs from the customer's account and spends its balance. The key holds no funds. The account's authorized signers approve the key, then the service can use it within its permitted spending, scopes, and expiry without a new signer approval for every payment.
For a billing service, set all three bounds:
* **Spending limit:** the maximum amount of the allowed token in a fixed period.
* **Scopes:** the contracts, functions, and supported recipient restrictions the charge needs.
* **Expiry:** when the delegated key stops working.
Omitting a bound removes that check. A key without scopes can call any contract; a spending limit doesn't restrict the payment destination.
## Align fixed periods with the billing model
[Periodic spending limits](https://tempo.com/developers/docs/accounts/access-keys/spending-limits) use a duration in seconds. The first period starts when the key is authorized, not at midnight or a calendar boundary. At the period boundary, the limit resets to its full amount; unused amounts don't carry over.
For example, an application can request authorization for up to 50 units of its chosen stablecoin every seven days until a specified expiry. The service schedules charges according to its terms and checks the remaining allowance before each charge.
Fixed durations are different from calendar months. If the product bills on a monthly anniversary, define how that schedule maps to the authorized fixed-duration budget rather than calling a fixed number of days “one month.”
A spending limit also covers fees paid by the account, approval increases, and other counted TIP-20 outflows. A charge equal to the whole limit can fail if the same limited balance must cover its network fee. Use a separately funded [fee payer](https://tempo.com/developers/docs/api/fee-payer) where appropriate, or make the fee allowance explicit. Read [what counts against a spending limit](https://tempo.com/developers/docs/accounts/access-keys/spending-limits#what-counts).
A `transferFrom` that uses an allowance the account already granted doesn't count against the key's spending limit, so a periodic key limit doesn't cap every debit from the account. Review existing token allowances.
## Scope the key to the billing operation
Scope the token contract and function selectors the charge requires. A scope for `transfer(address,uint256)` doesn't allow `transferWithMemo(address,uint256,bytes32)`; a payment-reference flow needs the appropriate additional scope.
Where supported, restrict the recipient to the billing account. The [scope guide](https://tempo.com/developers/docs/accounts/access-keys/scopes) describes the functions that support recipient restrictions. Scopes check direct calls signed by the key. A permitted contract can make its own downstream calls, so review that contract and any existing token approvals before allowing it.
Give each service its own key so it can be revoked independently. Protect the service's private key and preserve its authorization metadata alongside the subscription record.
## Schedule and reconcile recurring charges
:::steps
### Create one record per billing period
Use a stable subscription and period identifier. Save the asset, amount, due time, customer account, authorization, and entitlement to extend. Enforce uniqueness before submitting a charge.
### Check authorization and funding
Confirm the key is active, unexpired, correctly scoped, and within its remaining limit. Check the customer's payment balance and the selected fee payer's balance. A renewed spending limit doesn't add funds.
### Submit and preserve the attempt
Follow [sending payments](https://tempo.com/developers/docs/guide/payments/send-a-payment). Save the transaction identifier against the period record. If a request times out, inspect that attempt before submitting another charge.
### Confirm delivery before extending service
Follow [receiving payments](https://tempo.com/developers/docs/guide/payments/accept-a-payment) to verify the successful transaction and expected delivered transfer. Match the network, token, recipient, amount, and payment reference. A receive-policy hold is not a delivered charge.
### Update payment and entitlement records once
Store the verified transfer with its network, transaction hash, and log index. Mark the period paid and extend the service entitlement atomically. Repeated jobs or callbacks should return the existing outcome.
:::
Use states such as **due**, **submitted**, **paid**, and **needs attention** in the application. Define which failures can be retried, how the customer is notified, and what happens to service access during a funding or authorization problem.
## Handle cancellation, expiry, and changes
Stop new billing when the subscription is canceled. Keep customer cancellation, service entitlement, and onchain signing permissions as explicit records. If cancellation includes key revocation, submit it and verify the result; changing an application status doesn't revoke a key.
[Revoking a key](https://tempo.com/developers/docs/accounts/access-keys/revocation) ends its authority permanently. Prior payments remain final, and existing token approvals remain until changed separately. An expiry also ends future signing authority; a new billing period doesn't extend it.
If a customer changes a spending limit, read back the resulting authorization. Updating a limit resets the remaining amount to the new value; it doesn't add the difference to what was left. The period and its current end remain unchanged. Follow the [limit update rules](https://tempo.com/developers/docs/accounts/access-keys/spending-limits#change-a-spending-limit) when implementing plan changes.
Keep personal details and subscription terms offchain. Use an opaque [payment reference](https://tempo.com/developers/docs/guide/payments/transfer-memos) to connect the transfer to the billing record.
## Subscription billing questions
### Does a periodic limit charge the customer automatically?
No. It bounds what the service can spend during each period. Your application schedules and submits charges and checks that the requested payment was delivered.
### Does the period reset refill the customer's balance?
No. It replenishes the key's spending allowance. The account still needs payment funds, fee funding, valid permissions, and an unexpired key.
### Should usage-based APIs use subscriptions?
Use the model that matches the service. [MPP payment sessions](https://tempo.com/developers/docs/guide/machine-payments/pay-as-you-go) account for repeated usage with cumulative vouchers against a funded channel. Periodic access-key limits can bound an agent's spending without turning the session into a fixed subscription. See [metered billing](https://tempo.com/developers/docs/resources/guides/microtransactions).
> Source: [/docs/resources/guides/corporate-treasury](https://tempo.com/developers/docs/resources/guides/corporate-treasury.md)
> Section: [Get Started](https://tempo.com/developers/get-started.md). Choose a starting point, send a test payment, get testnet funds, connect a coding agent, find the SDKs and CLI, and use the resource guides to plan payment workflows, liquidity, provider selection, and partner integrations.
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
[Guides](https://tempo.com/developers/docs/resources/guides) / [Liquidity and issuance](https://tempo.com/developers/docs/resources/guides#liquidity-and-issuance) / Corporate treasury operations
# Corporate treasury operations
Stablecoin treasury operations connect intercompany funding and supplier payments to onchain settlement and finance records. Start with one flow, then define the entity that owns each account, who can authorize payments, and the evidence your finance system needs.
## Define the treasury operating model
Stablecoin balances add another asset and account type to cash positioning. Keep them distinct from bank cash, provider balances, and investment positions. A consolidated view needs records from each system.
| Decision | Record before the pilot |
| --- | --- |
| Account ownership | Legal entity, network, token contract, account address, and wallet or custodian. |
| Payment authority | Who proposes, approves, and submits a payment; amount and destination limits. |
| Asset selection | Issuer, token contract, redemption access, and provider support. |
| Liquidity | Operating balance, fee funding, replenishment, withdrawal access, and payout dependencies. |
| Reconciliation | Business reference, delivered transfer, internal ledger entry, and exception status. |
| Recovery | How to stop new submissions and investigate unknown or failed payments. |
Tempo's [account model](https://tempo.com/developers/docs/accounts/how-it-works) explains signers and delegated access keys; the [custodian and treasury setups](https://tempo.com/developers/docs/accounts/custodians) help you choose who holds them. Record legal entity ownership in your own records.
## Pilot an intercompany funding flow
For example, a parent company can fund a subsidiary's approved account with a supported stablecoin. The receiving entity verifies the asset and amount before posting the intercompany movement. If it needs bank funds, conversion and bank delivery are additional stages.
:::steps
### Establish the source and destination
Record both entities, accounts, network, token contract, business purpose, and amount. Choose the token from the [stablecoin registry](https://tempo.com/developers/docs/partners/stablecoins) and check that the receiver and any conversion provider accept it.
### Apply approvals and signing bounds
Keep the business approval record separate from submission. Use the selected account and custody model's controls. Where appropriate, give a backend its own [access key](https://tempo.com/developers/docs/accounts/access-keys) with amount limits, permitted calls, and expiry.
### Fund and submit the payment
Check payment and fee balances, then follow [sending payments](https://tempo.com/developers/docs/guide/payments/send-a-payment). Save the transaction identifier against the treasury instruction before processing retries.
### Verify receipt and any bank delivery
Use [receiving payments](https://tempo.com/developers/docs/guide/payments/accept-a-payment) to confirm the delivered token and amount. If a provider converts the funds or pays a bank account, require its completion evidence before marking that stage complete.
### Reconcile both entities' records
Match the treasury instruction, approval, delivered transfer, and any provider record. Post each movement once in the appropriate entity ledger and investigate differences explicitly.
:::
## Connect transfers to the ERP or TMS
Use an opaque [payment reference](https://tempo.com/developers/docs/guide/payments/transfer-memos) to connect a transfer to an instruction, invoice, or intercompany record. Store detailed accounting, entity, and counterparty data offchain.
Preserve the network, transaction hash, and transfer log index as a unique event key. One transaction can contain several transfers. Your integration or a provider connector maps transfers to the general ledger and posts the entries.
Reconcile onchain transfer records, wallet or custody statements, provider conversion records, and bank delivery where applicable. Read historical activity after reconnecting so a missed callback does not leave a payment unrecorded. See [payment reconciliation](https://tempo.com/developers/docs/resources/guides/payment-reconciliation).
## Keep usable liquidity visible
Monitor the balances needed for payments and network fees, pending instructions, provider holds, conversion capacity, and the time needed to reach bank accounts.
Tempo provides near-instant onchain settlement. Funding, redemption, conversion, and bank processing determine when funds are usable elsewhere. Test replenishment and out-of-hours operation on your provider route.
Keep payment liquidity separate from investment allocation. If the organization uses earning products, track the position, withdrawal terms, and available withdrawal amount separately.
## Measure the treasury pilot
Compare the same source and recipient outcome against the existing route. Record the full cost, delivery time for each stage, liquidity required, reconciliation completion, and unresolved exceptions. The network fee is only one part of that cost.
Test insufficient funds, rejected destinations, receive-policy holds, expired or revoked keys, unknown submissions, and failed provider delivery. Verify that an interrupted job can resume without sending the instruction twice.
## Treasury operation questions
### Must the company custody stablecoins directly?
Not for every model. A provider can supply agreed custody and settlement services. Document who holds the assets, who can authorize transfers, and which balances your entity can redeem or withdraw.
### Will an existing bank account support the flow?
It depends on the bank and provider terms for the entity, currency, payment direction, and funding or payout method.
### Does an intercompany transfer need separate controls?
Yes. Preserve the entity purpose, authority, accounting treatment, destination validation, and applicable requirements for the selected flow.
> Source: [/docs/resources/guides/nostro-vostro-accounts](https://tempo.com/developers/docs/resources/guides/nostro-vostro-accounts.md)
> Section: [Get Started](https://tempo.com/developers/get-started.md). Choose a starting point, send a test payment, get testnet funds, connect a coding agent, find the SDKs and CLI, and use the resource guides to plan payment workflows, liquidity, provider selection, and partner integrations.
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
[Guides](https://tempo.com/developers/docs/resources/guides) / [Liquidity and issuance](https://tempo.com/developers/docs/resources/guides#liquidity-and-issuance) / Nostro and vostro accounts
# Nostro and vostro accounts
A nostro account is an account a bank holds with another bank, commonly to make and receive payments in a foreign currency. Vostro describes that same account from the bank holding the funds. They are two perspectives on one banking relationship.
For a payments team, the important questions are who holds the funds, who can move them, and how much liquidity must be available before a payment can complete.
## One account viewed from two banks
Suppose Bank A holds a dollar account at Bank B. Bank A calls it its nostro account, meaning our account with you. Bank B calls it a vostro account, meaning your account with us. Bank A records a claim on Bank B; Bank B records its obligation to Bank A.
| Perspective | Name | Operational question |
| ----------------------------------- | ------ | ----------------------------------------------------------------------- |
| Bank A, which owns the balance | Nostro | Do we have enough available dollars to fund the payment? |
| Bank B, which maintains the account | Vostro | Can we execute this customer's instruction under the account agreement? |
The [ECB's explanation of correspondent banking](https://www.ecb.europa.eu/pub/pdf/other/ecb.eleventhsurveycorrespondentbankingeuro202011~c280262151.en.pdf#page=6) describes these two perspectives on the account relationship. The account provides access to services; its agreement and the payment route determine the speed and fees.
## How an account supports a payment
In a simplified example, Bank A instructs Bank B to use its dollar balance to pay a beneficiary. Bank B debits the account and arranges the receiving leg. Additional institutions, currency conversion, and local payment systems may be involved.
A sent instruction isn't a delivered payment. Retain the instruction identifier, account entry, fees, any FX trade, and final delivery confirmation. See the broader [payment rails comparison](https://tempo.com/developers/docs/resources/guides/payment-rails) for how messaging, clearing, and settlement differ.
## Why prefunding matters
Holding a nostro account and prefunding it are different decisions. The account is the arrangement; [prefunding](https://tempo.com/developers/docs/resources/guides/prefunding) is putting liquidity in place before payments need it. Available credit, incoming payments, and the service agreement can also affect funding needs.
A payout program tracks three figures separately: the account balance, the amount already committed to pending payouts, and the amount immediately available for new instructions. A large balance can still conceal a shortage if most of it is reserved.
Replenishment cutoffs, holidays, currency exposure, and access to credit determine how much buffer a particular program needs.
## What stablecoin settlement changes
Stablecoin transfers can provide another way to move value between participating providers. Tempo supports near-instant onchain settlement around the clock, so an operator can evaluate whether faster replenishment reduces balances held ahead of demand.
That benefit depends on the complete flow. A provider paying recipients in local currency still needs conversion liquidity, a supported payout method, and confirmation from the receiving provider. The bank account may remain part of that flow. A stablecoin balance also carries different issuer, custody, and redemption risks than a bank deposit.
Use the [cross-border payments guide](https://tempo.com/developers/docs/resources/guides/cross-border-payments) to assess the full payment and the [reconciliation guide](https://tempo.com/developers/docs/resources/guides/payment-reconciliation) to connect its records.
## Nostro and vostro accounts FAQ
Are nostro and vostro accounts separate accounts?
They can describe the same account from opposite sides. The bank holding money at another bank calls it a nostro; the servicing bank calls it a vostro.
Is a nostro account the same as prefunding?
No. Nostro describes an account relationship. Prefunding describes placing liquidity ahead of expected payments, which can happen in several types of account or provider arrangement.
Do stablecoins eliminate correspondent banking?
They can replace or complement parts of a settlement flow. Fiat collection, currency conversion, bank payouts, and issuer redemption can still depend on banking relationships.
> Source: [/docs/resources/guides/prefunding](https://tempo.com/developers/docs/resources/guides/prefunding.md)
> Section: [Get Started](https://tempo.com/developers/get-started.md). Choose a starting point, send a test payment, get testnet funds, connect a coding agent, find the SDKs and CLI, and use the resource guides to plan payment workflows, liquidity, provider selection, and partner integrations.
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
[Guides](https://tempo.com/developers/docs/resources/guides) / [Liquidity and issuance](https://tempo.com/developers/docs/resources/guides#liquidity-and-issuance) / Prefunding in payment operations
# Prefunding in payment operations
Prefunding means making funds available before payments or settlement obligations fall due. A payout provider might hold local currency with a receiving partner so customers can be paid before the provider's next replenishment arrives.
The practical goal is to fund reliable delivery without keeping more capital in each account than the payment flow requires.
## Why payment providers prefund
Timing mismatches create liquidity needs. Customer payments may arrive on one schedule while recipients expect payouts on another. Providers also need to account for uncertain demand, funding limits, holidays, and unavailable replenishment routes.
In cross-border operations, separate currencies and accounts can fragment liquidity. A balance available in one place may not be available where the next obligation must settle.
## A practical way to size a buffer
Start with the period between reliable replenishments. Estimate the net outflows expected during that period, then add a buffer for forecast error, delayed funding, and exceptional demand. Treat contractual minimum balances separately so they don't disappear into an average.
For example, a provider expecting $100,000 of net payouts before its next replenishment might reserve another $40,000 for uncertainty. That gives a $140,000 funding target.
Track these inputs for each funding pool:
* Expected and peak net outflows before replenishment.
* Available balance after pending payouts and holds.
* Replenishment time, including failures and holidays.
* Provider limits, required minimums, and available credit.
* Currency exposure and the cost of emergency rebalancing.
## Estimating the capital cost
Annual opportunity cost is the average funded balance multiplied by an assumed annual funding rate. A $1 million average balance at an assumed 5% annual rate represents $50,000 per year before any interest earned, FX effects, account charges, or operational costs.
Use the average balance held over time, not total annual payment volume. For a fuller comparison, add the cost of replenishment, conversion, failed payouts, and operating the alternative.
## Where stablecoin settlement can help
Tempo can move supported stablecoins with near-instant onchain settlement around the clock. If a receiving provider can use those funds promptly, shorter replenishment times may support a smaller prefunded balance.
Measure this for each flow. A local off-ramp may still require fiat liquidity or process payouts only during supported hours. Moving a buffer from a bank account into stablecoins also changes its custody and issuer exposure.
Compare a pilot against the existing flow using average committed capital, replenishment time, failed-payment rate, and time to recipient receipt. The [cross-border payments guide](https://tempo.com/developers/docs/resources/guides/cross-border-payments) explains the prerequisites; [nostro and vostro accounts](https://tempo.com/developers/docs/resources/guides/nostro-vostro-accounts) explains one common account arrangement.
## Prefunding in payment operations FAQ
Why can a fast payout still require prefunding?
The receiving provider may pay from funds already on hand and replenish them later. Delivery can be fast while the funding flow behind it is slow.
Do stablecoins remove all prefunding?
No. They can shorten an onchain funding leg, but conversion, bank payouts, contractual balances, and operational buffers may still require capital ahead of demand.
How should a team measure reduced prefunding?
Compare average committed capital and service performance for the same payment flow before and after the change. Include funding, conversion, custody, and operational costs.
> Source: [/docs/resources/guides/fbo-accounts](https://tempo.com/developers/docs/resources/guides/fbo-accounts.md)
> Section: [Get Started](https://tempo.com/developers/get-started.md). Choose a starting point, send a test payment, get testnet funds, connect a coding agent, find the SDKs and CLI, and use the resource guides to plan payment workflows, liquidity, provider selection, and partner integrations.
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
[Guides](https://tempo.com/developers/docs/resources/guides) / [Liquidity and issuance](https://tempo.com/developers/docs/resources/guides#liquidity-and-issuance) / FBO accounts in payment operations
# FBO accounts in payment operations
FBO means for benefit of. In payment operations, an FBO account commonly describes a bank account held by an intermediary for the benefit of its customers or other owners of the funds. The account may hold one owner's funds or pool funds for several owners.
The account agreement and ownership records determine who owns the money, what protections apply, and when customers can access funds.
## The bank balance and the customer ledger
Consider a platform collecting payments for several merchants. A bank account holds the funds, while the platform's ledger records the amount attributable to each merchant. Pending settlements, fees, reserves, and payout instructions can make that ledger more detailed than a simple list of balances.
| Record | Question it helps answer |
| ------------------------------ | ---------------------------------------------------------------- |
| Bank statement | How much is held at the bank? |
| Beneficial-owner records | Whose funds are represented by that balance? |
| Payment and payout ledger | Which movements are pending, complete, or under investigation? |
| Account and service agreements | Who can give instructions, and what happens during a disruption? |
Check how these records reconcile and who can produce them if the intermediary becomes unavailable. The [payment reconciliation guide](https://tempo.com/developers/docs/resources/guides/payment-reconciliation) describes connecting payments to internal records.
## Deposit insurance depends on the arrangement
For U.S. accounts, the [FDIC's pass-through insurance guidance](https://www.fdic.gov/financial-institution-employees-guide-deposit-insurance/pass-through-deposit-insurance-coverage) explains the conditions for recognizing the actual owners of funds held through a third party. These include actual ownership, disclosure of the agency relationship in bank records, and records identifying owners and their interests.
Pass-through coverage is not a separate insurance category. Eligible funds are aggregated with the same owner's other deposits in the same ownership category at the same bank. An FBO account doesn't get its own insurance limit. The FDIC determines whether the pass-through requirements are met when the insured bank fails.
The FDIC also explains that a [nonbank payment app is not itself FDIC-insured](https://www.fdic.gov/consumer-resource-center/2024-06/banking-third-party-apps). Deposit insurance covers an insured bank's failure. It doesn't cover the nonbank intermediary's failure or guarantee access to funds while the bank remains open.
## What to confirm before using an FBO arrangement
For a proposed payment flow, document the bank and intermediary, the legal owner of the funds, how customer interests are recorded, and the path for resolving a mismatch. Determine when funds reach the bank, when payouts become available, and which party reports completion.
For example, the platform ledger can mark a payout complete while the bank reports it rejected. The operating process needs to identify the mismatch, restore the correct available balance, and avoid paying the recipient twice.
Licensing depends on the parties' activities and jurisdictions. Opening an FBO account doesn't authorize a payment service.
## How stablecoin balances differ
A stablecoin balance isn't a bank deposit or an FBO account. Moving funds into tokens changes the assets held and adds issuer, custody, and redemption risk. The platform still keeps customer ownership records and a ledger of amounts it owes.
Tempo can carry the onchain leg of a payment flow while a bank account handles collection or payout. The guides to [minting and burning](https://tempo.com/developers/docs/guide/issuance/mint-stablecoins) and [stablecoins and tokenized deposits](https://tempo.com/learn/stablecoins-and-tokenized-deposits/) cover how the two differ.
## FBO accounts in payment operations FAQ
Is every FBO account a pooled account?
No. An account can hold funds for one owner or multiple owners. The account documents and ownership records determine the arrangement.
Does FBO mean every balance is FDIC-insured?
No. In the United States, coverage depends on the insured bank, ownership category, applicable limits, and pass-through requirements.
Does a stablecoin wallet replace an FBO account?
It can replace or complement a step in a payment flow, but it changes the asset and operating model. You still design fiat access, customer liabilities, ownership records, and reconciliation.
> Source: [/docs/resources/guides/genius-act](https://tempo.com/developers/docs/resources/guides/genius-act.md)
> Section: [Get Started](https://tempo.com/developers/get-started.md). Choose a starting point, send a test payment, get testnet funds, connect a coding agent, find the SDKs and CLI, and use the resource guides to plan payment workflows, liquidity, provider selection, and partner integrations.
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
[Guides](https://tempo.com/developers/docs/resources/guides) / [Liquidity and issuance](https://tempo.com/developers/docs/resources/guides#liquidity-and-issuance) / The GENIUS Act and stablecoin payments
# The GENIUS Act and stablecoin payments
The GENIUS Act is a U.S. federal law establishing a regulatory framework for payment stablecoins. Signed on July 18, 2025, it sets requirements for permitted issuers, reserve assets, redemption policies, disclosures, and supervision.
For a payment team, it's a framework for evaluating issuers and assets. It doesn't certify blockchains or approve individual stablecoins. This is general information, not legal advice.
## What the law covers
The [enacted text of Public Law 119-27](https://www.govinfo.gov/content/pkg/PLAW-119publ27/html/PLAW-119publ27.htm) defines payment stablecoins and establishes federal and state paths for permitted issuers. Its scope also includes certain activities by digital asset service providers and a framework for qualifying foreign issuers.
Authorization attaches to the issuer, not to the network a token moves on.
## Requirements relevant to payment teams
| Area | What the statute provides | Evidence to request for an evaluation |
| ------------------------ | ---------------------------------------------------------------------- | ----------------------------------------------------------------------- |
| Issuer authorization | Federal and qualifying state pathways for permitted issuers | The issuing legal entity, regulator, and applicable authorization |
| Reserves | Backing of at least one-to-one using specified eligible reserve assets | Current reserve disclosures and supporting reports |
| Redemption | A public redemption policy and disclosure of applicable fees | Eligibility, supported redemption routes, timing, and fees |
| Reporting | Monthly reserve disclosures and examination requirements | Dated disclosures tied to the issuer and asset |
| Financial crime controls | Bank Secrecy Act treatment and compliance with lawful orders | The issuer's controls and the responsibilities of each service provider |
Read the relevant sections with the applicable implementing regulations and issuer documentation.
## Effective dates and implementing rules
Section 20 makes the Act generally effective on the earlier of 18 months after enactment, January 18, 2027, or 120 days after primary federal payment stablecoin regulators issue final implementing regulations. Some provisions have their own timing, including the separate restriction on certain offers and sales by digital asset service providers three years after enactment.
Treasury's [August 17, 2026 notice](https://home.treasury.gov/news/press-releases/sb0605/) describes a proposed rule addressing issuance, offers, and sales, and identifies January 18, 2027 as the expected general effective date. A proposed rule isn't yet a requirement.
A [September 30, 2026 interim final rule](https://www.govinfo.gov/content/pkg/FR-2026-09-30/html/2026-19966.htm) establishes forms and procedures for reviewing state certifications. It is effective for that procedural purpose, while acceptance of certifications depends on the information-collection approval described in the rule.
## Yield and deposit insurance are separate questions
Section 4(a)(11) prohibits permitted payment stablecoin issuers and foreign payment stablecoin issuers from paying a holder interest or yield solely for holding, using, or retaining a payment stablecoin. Third-party reward, lending, and investment arrangements need their own analysis under the applicable rules.
The law also restricts representations that stablecoins are government guaranteed, legal tender, or federally insured. A stablecoin is different from a bank deposit. For the bank-account side of a payment flow, see [FBO accounts](https://tempo.com/developers/docs/resources/guides/fbo-accounts); for the asset distinction, see [stablecoins and tokenized deposits](https://tempo.com/learn/stablecoins-and-tokenized-deposits/).
## Applying the framework to a payment flow
Build an asset record that identifies the issuer, token contract and network, available redemption route, and supporting documents. Then map the parties handling custody, conversion, transfers, and bank delivery. Authorization for one activity doesn't cover the others.
Tempo provides payment infrastructure. Issuer roles and transfer policies help an issuer implement its controls, but compliance is a legal question, not a technical one. The [minting and burning guide](https://tempo.com/developers/docs/guide/issuance/mint-stablecoins) covers issuer controls, and [stablecoin payment infrastructure](https://tempo.com/developers/docs/resources/guides/stablecoin-payment-infrastructure-enterprise-scale) covers the broader operating model.
## The GENIUS Act and stablecoin payments FAQ
Is the GENIUS Act a law or a proposal?
The Act is an enacted federal law signed July 18, 2025. Implementing agency proposals and final rules are separate documents with their own scope and dates.
When does the GENIUS Act take effect?
Its general effective-date provision is the earlier of January 18, 2027 or 120 days after the specified final implementing regulations. Some provisions use separate dates, so check the rule and activity involved.
Does using Tempo make a stablecoin compliant with the Act?
No. An issuer's authorization, reserves, and redemption obligations, and the legal status of a payment service, don't depend on the network.
> Source: [/docs/resources/guides/402-payment-required](https://tempo.com/developers/docs/resources/guides/402-payment-required.md)
> Section: [Get Started](https://tempo.com/developers/get-started.md). Choose a starting point, send a test payment, get testnet funds, connect a coding agent, find the SDKs and CLI, and use the resource guides to plan payment workflows, liquidity, provider selection, and partner integrations.
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
[Guides](https://tempo.com/developers/docs/resources/guides) / [Machine payment models](https://tempo.com/developers/docs/resources/guides#machine-payment-models) / HTTP 402 Payment Required
# HTTP 402 Payment Required
HTTP `402 Payment Required` is a status code that payment protocols use to request payment for a resource. The HTTP standard reserves the code without defining a payment flow. On Tempo, use [Machine Payments Protocol integrations](https://tempo.com/developers/docs/guide/machine-payments) to let applications and agents pay for APIs, datasets, or other digital resources inside the request flow.
## What HTTP 402 specifies
The HTTP standard [reserves `402` for future use](https://www.rfc-editor.org/rfc/rfc9110.html#name-402-payment-required). It doesn't define a price, accepted asset, payment destination, proof format, or settlement rule. A payment protocol supplies those details.
The [Machine Payments Protocol](https://mpp.dev/) (MPP) supplies a challenge, credential, and receipt flow. Payment methods define the authorization and settlement rules. Each endpoint advertises the methods, assets, and networks it accepts.
## Follow an MPP payment request
| Stage | Client or server action |
| --- | --- |
| Request a resource | The application or agent sends its HTTP request. |
| Receive a challenge | The server returns `402` with payment terms in `WWW-Authenticate: Payment`. |
| Authorize payment | The client checks the terms against its budget and permissions, then creates a credential for a supported method. |
| Retry with a credential | The client supplies payment authorization in `Authorization: Payment` by default, or the credential header selected by the challenge. |
| Verify and respond | The server verifies the credential according to the payment method and returns the resource with a `Payment-Receipt`. |
The [Payment authentication draft](https://paymentauth.org/draft-httpauth-payment-01.html#name-credentials) lets a challenge select `Payment-Authorization` instead of the default `Authorization` header. Keep payment credentials separate from any application authentication the endpoint requires.
On Tempo, a credential can carry a signed transaction, a transaction reference, or a payment-channel voucher, depending on the intent. A voucher and an onchain transfer are different evidence. Follow the [MPP request flow](https://tempo.com/developers/docs/guide/machine-payments) and the selected method's verification rules.
A valid payment doesn't authorize access to a particular customer's data.
## Choose a charge or a session
Use [one-time payments](https://tempo.com/developers/docs/guide/machine-payments/one-time-payments) when each purchase has a distinct amount and delivery, such as a single dataset. The server verifies payment for that request before returning the resource.
Use [pay-as-you-go sessions](https://tempo.com/developers/docs/guide/machine-payments/pay-as-you-go) for repeated usage against a funded channel. The payer signs cumulative offchain vouchers, and the recipient can settle authorized usage onchain. A session can require top-ups and periodic settlement.
Use [streamed payments](https://tempo.com/developers/docs/guide/machine-payments/streamed-payments) when usage and delivery happen during a stream. The service meters billable units and checks the authorized voucher amount as it delivers them. Renewing a voucher increases authorized usage; adding funds to a channel is a separate operation.
For fixed recurring charges, use the [subscription billing guide](https://tempo.com/developers/docs/resources/guides/subscriptions-on-tempo). Access keys constrain spending, while the application schedules charges and manages subscriptions.
## Bound what an agent can purchase
Define the acceptable service, amount, asset, and network before allowing a client to answer payment challenges automatically. Use separate application budgets for a request or task and [access-key controls](https://tempo.com/developers/docs/accounts/access-keys) for the account authority delegated to the agent.
An access key can limit token spending, permitted calls, and expiry. A key without bounds has none of those checks. A spending limit doesn't restrict destinations or services, and scopes check only the calls the key signs directly. Read the [scope limits](https://tempo.com/developers/docs/accounts/access-keys/scopes#scope-limits) before allowing a contract.
For sessions, bound the amount deposited into channels and monitor outstanding channel funds. Authorized usage, channel deposits, settled funds, and the account's available balance are separate quantities.
## Handle payment retries and service delivery
Give each billable operation an application record. Preserve its request identifier, payment evidence, delivered result, and refund or recovery status. If the server receives a retry, determine whether it belongs to an existing operation before treating it as a new purchase.
Don't send another payment because a request timed out. Inspect the existing request and payment state first. For direct onchain payments, use the [receiving guide](https://tempo.com/developers/docs/guide/payments/accept-a-payment) to verify the network, token, intended recipient, amount, and delivered transfer. A successful transaction can still leave the funds held by a receive policy.
An MPP receipt covers payment, not delivery. Track whether your application delivered the purchased resource, how the customer can retrieve an existing result, and how failed delivery is resolved.
## Test a payment-gated endpoint
:::steps
### Configure the server's payment terms
Follow the [MPP server guide](https://tempo.com/developers/docs/guide/machine-payments/server) to set the server secret, recipient, supported method, currency, and network. Choose which requests or units are billable.
### Fund a compatible client
Follow the [MPP client guide](https://tempo.com/developers/docs/guide/machine-payments/client). Match the client's network and asset to the server's challenge. Testnet faucet tokens cannot pay a mainnet challenge.
### Exercise the complete request flow
Check the unpaid challenge, successful payment, receipt, and delivered resource. Exercise repeated requests, insufficient funds, exceeded budgets, and interrupted responses before enabling unattended purchases.
:::
## HTTP 402 questions
### Does every browser or agent automatically pay a 402 response?
No. The client needs a compatible payment method, a funded account, and authority to spend. An ordinary HTTP client can receive the response without acting on it.
### Does HTTP 402 require stablecoins?
No. The status code does not select a payment rail. MPP supports multiple payment methods, and the Tempo method is one of them.
### Is every service unit a separate onchain transaction?
Not with payment sessions. Signed vouchers account for cumulative usage between onchain settlements. Retain usage and voucher records alongside settlement records. See [microtransaction billing](https://tempo.com/developers/docs/resources/guides/microtransactions).
> Source: [/docs/resources/guides/microtransactions](https://tempo.com/developers/docs/resources/guides/microtransactions.md)
> Section: [Get Started](https://tempo.com/developers/get-started.md). Choose a starting point, send a test payment, get testnet funds, connect a coding agent, find the SDKs and CLI, and use the resource guides to plan payment workflows, liquidity, provider selection, and partner integrations.
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
[Guides](https://tempo.com/developers/docs/resources/guides) / [Machine payment models](https://tempo.com/developers/docs/resources/guides#machine-payment-models) / Microtransactions and metered billing
# Microtransactions and metered billing
Microtransactions are small payments for individual resources or units of service, such as an API result, article, or minute of usage. On Tempo, collect them as direct charges, payment sessions, or aggregated recurring bills. Define the purchased unit and compare delivery and collection costs before setting the price.
## Choose how to collect small charges
| Billing pattern | Use it for | Records to maintain |
| --- | --- | --- |
| Direct payment | A distinct purchase with a defined price and result. | Purchase, verified delivered transfer, and customer entitlement. |
| Payment session | Repeated requests or streaming usage against a funded channel. | Billable units, cumulative vouchers, channel deposits, and settlements. |
| Recurring payment | A fixed charge on an application billing schedule. | Subscription, billing period, authorization, charge, and service entitlement. |
Tempo's [stablecoin fee system](https://tempo.com/developers/docs/resources/guides/stablecoin-fees) supports sub-cent network fees for standard transfers. Acquiring the asset, custody, currency conversion, service delivery, and customer support cost extra. Compare the complete costs of individual charges, sessions, and aggregated invoices before setting a price.
## Define the billable unit
For an API, decide whether you charge for a request received, a successful result, compute consumed, or another measurable unit. For content, define the purchased entitlement: a specific article, a playback period, or repeat access to an existing purchase.
Record the price, asset, network, quantity, and delivery rule before requesting payment. Version pricing so an interrupted request can be resolved against the terms the customer accepted.
For agent purchases, [HTTP 402 and MPP](https://tempo.com/developers/docs/resources/guides/402-payment-required) let a service communicate payment requirements inside an HTTP request. The application decides which usage is billable.
## Collect a direct purchase
Use [one-time MPP payments](https://tempo.com/developers/docs/guide/machine-payments/one-time-payments) for payment-gated APIs, or the [receiving guide](https://tempo.com/developers/docs/guide/payments/accept-a-payment) for a direct token transfer.
Before fulfilling a direct payment, verify its network, token contract, recipient, amount, and successful delivered transfer. Save the transfer's network, transaction hash, and log index so it credits the purchase once. A matching memo only identifies which business record to check.
When the customer requests the same purchased article or result again, return the existing entitlement according to your product terms. Don't charge a second time because a response was interrupted or a user refreshed a page.
## Meter usage through a payment session
[Pay-as-you-go sessions](https://tempo.com/developers/docs/guide/machine-payments/pay-as-you-go) account for usage through signed cumulative vouchers against a funded channel. The service verifies the authorized amount before delivering additional usage and can settle vouchers onchain.
For streaming content, follow the [streamed payments guide](https://tempo.com/developers/docs/guide/machine-payments/streamed-payments). Keep these states distinct:
* **Usage delivered:** the units the application has actually supplied.
* **Usage authorized:** the amount covered by the current valid voucher.
* **Channel funding:** the tokens deposited into the channel.
* **Funds settled:** the amount collected onchain.
Request another voucher when more usage needs authorization. Add channel funds when the deposit is insufficient. Closing and settlement follow the channel's rules, including the handling of unused funds. A session can need several top-ups or settlements.
## Constrain delegated spending
[Access keys](https://tempo.com/developers/docs/accounts/access-keys) let a device, backend, or agent sign within defined spending limits, scopes, and expiry. A [spending limit](https://tempo.com/developers/docs/accounts/access-keys/spending-limits) caps the TIP-20 spending counted by the keychain; it doesn't measure API usage or schedule invoices. Transfers that use an existing allowance and assets other than TIP-20 tokens fall outside that limit, so review existing approvals as well as the key's bounds.
Set scopes for the contracts and functions the integration needs. Add recipient restrictions where the supported function allows them. Scopes check direct calls, so permit only contracts you trust. Fees the account pays consume its access-key limit; [fee sponsorship](https://tempo.com/developers/docs/api/fee-payer) moves that network expense to a separate fee payer.
Access keys work on mainnet and testnet with single-key accounts. Configurable-account access keys run on testnet now and reach mainnet with [T14](https://tempo.com/developers/docs/protocol/upgrades/t14) on December 8, 2026.
## Operate a metered billing service
:::steps
### Record usage and delivery together
Assign a stable identifier to each billable operation. Preserve the accepted price, measured units, delivered result, and associated payment or voucher. Define how failed and repeated requests affect the charge.
### Reconcile collection with consumption
For direct payments, reconcile verified transfers with purchases. For sessions, reconcile usage and vouchers with channel funding and onchain settlements. Track unresolved differences explicitly.
### Exercise billing exceptions
Test insufficient funds, exceeded limits, revoked keys, interrupted streams, duplicate requests, and failed delivery. Verify that a retry does not duplicate usage or payment, and that customers can recover an already purchased result.
:::
## Microtransaction questions
### How small can a payment be on Tempo?
The usable minimum depends on token precision, network fees, funding costs, and the service being purchased. Sessions can aggregate small usage charges between onchain settlements; they don't make collection free.
### Do customers need a standalone wallet application?
A stablecoin payment needs an account and a way to authorize spending. A wallet provider can embed that experience in your product. Define funding, key management, recovery, and purchase support as part of the integration.
### Can the same infrastructure support subscriptions?
Yes. Access keys support periodic spending limits, while your application schedules and reconciles charges. A renewed spending limit doesn't add funds or extend a key's expiry. See [subscription billing](https://tempo.com/developers/docs/resources/guides/subscriptions-on-tempo).
> Source: [/docs/resources/guides/embedded-wallets](https://tempo.com/developers/docs/resources/guides/embedded-wallets.md)
> Section: [Get Started](https://tempo.com/developers/get-started.md). Choose a starting point, send a test payment, get testnet funds, connect a coding agent, find the SDKs and CLI, and use the resource guides to plan payment workflows, liquidity, provider selection, and partner integrations.
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
[Guides](https://tempo.com/developers/docs/resources/guides) / [Wallets and funding](https://tempo.com/developers/docs/resources/guides#choose-wallets-and-funding) / Choose embedded wallets
# Choose embedded wallets
Choose a wallet integration by deciding who authorizes payments: the customer, your backend, or a custody operation. Then check the provider's Tempo signing path and the features your payment requires.
## Define payment authority
Customer login, provider signing policies, and onchain permissions serve different purposes. Decide whether every payment requires customer approval or whether a backend can act within delegated limits. Include recovery, key export, and revocation in that decision.
A [Tempo access key](https://tempo.com/developers/docs/accounts/access-keys) is optional. If you authorize one, configure its onchain limits and expiry separately from the wallet provider's policies. Start with [embedded-wallet accounts](https://tempo.com/developers/docs/accounts/apps) for the account model.
## Choose the integration path
### Privy: customer wallets and payments
Use Privy for embedded customer wallets and Tempo transfers, batches, and sponsored payments. Its [Tempo transaction reference](https://docs.privy.io/wallets/using-wallets/tempo/send-a-transaction) documents the SDK-specific fields. The React method supports `sponsor: true`; enable dashboard sponsorship and meet its TEE execution requirement. Server and REST parameter placement differs.
For its transfer API, save the wallet action ID and [track the action](https://docs.privy.io/wallets/actions/status). Use Privy's REST API with `include=steps` when retrieving step-level transaction hashes. Inspect [failed action steps](https://docs.privy.io/wallets/actions/lifecycle) before retrying because an action can have partial onchain effects. For a low-level send, retain the broadcast hash. Privy's older browser example requires SDK, network, and token updates; start from the current reference.
### Dynamic: authentication and embedded wallets
Use Dynamic's [Tempo JavaScript package](https://www.dynamic.xyz/docs/javascript/reference/tempo/overview), `@dynamic-labs-sdk/tempo`, and its `/waas` extension for embedded wallets. The old `@dynamic-labs-sdk/evm/tempo` entry point has been removed. Supply your own interface for the headless SDK.
Pass the token's actual decimal precision to `sendTip20Transaction`; its default is `18`. For [fee sponsorship](https://www.dynamic.xyz/docs/javascript/reference/tempo/sign-for-a-fee-sponsor), sign with `awaitingFeePayer: true`, then send the signed transaction to your fee-payer service for signing and broadcast. Embedded Tempo wallets don't support typed-data signing, and business-account wallets can't send transactions.
### Turnkey: policy-controlled signing
Use Turnkey for policy-controlled signing. Its [native Tempo policies](https://docs.turnkey.com/features/policies/examples/tempo) use `tempo.tx` fields for networks, fee tokens, validity windows, and calls. When every batch call must be approved, evaluate the full call list. Allowing a token contract or selector doesn't constrain the encoded recipient or amount.
Start from the [`with-tempo` implementation](https://github.com/tkhq/sdk/tree/main/examples/chain-integrations/with-tempo). Choose between your own Tempo fee payer and Turnkey's [managed sponsorship service](https://docs.turnkey.com/features/transaction-management), which requires an Enterprise plan and dashboard activation.
### Fireblocks: vaults and transaction approvals
Use Fireblocks for a vault-based payment operation. Query [workspace assets](https://developers.fireblocks.com/api-reference/blockchains-&-assets/list-assets), verify the network and token contract, and use the asset's `legacyId` where a transaction requires `assetId`.
Configure transaction policies before funding. Supply a unique `externalTxId` when [creating a transfer](https://developers.fireblocks.com/transactions/create-transactions) to reject duplicate submissions.
## Test one complete customer payment
Match the wallet, network, [token contract](https://tempo.com/developers/docs/partners/stablecoins), and [fee-payment approach](https://tempo.com/developers/docs/guide/payments/pay-fees-in-any-stablecoin). Test approval, rejected signing, revoked permissions, and account recovery. Before displaying payment completion, [verify the delivered transfer](https://tempo.com/developers/docs/guide/payments/accept-a-payment). Add [bank funding and payouts](https://tempo.com/developers/docs/resources/guides/funding-and-payouts) separately when the product needs them.
> Source: [/docs/resources/guides/funding-and-payouts](https://tempo.com/developers/docs/resources/guides/funding-and-payouts.md)
> Section: [Get Started](https://tempo.com/developers/get-started.md). Choose a starting point, send a test payment, get testnet funds, connect a coding agent, find the SDKs and CLI, and use the resource guides to plan payment workflows, liquidity, provider selection, and partner integrations.
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
[Guides](https://tempo.com/developers/docs/resources/guides) / [Wallets and funding](https://tempo.com/developers/docs/resources/guides#choose-wallets-and-funding) / Funding and payouts
# Funding and payout infrastructure
Start with one route: the sender's currency and bank rail, the asset moving on Tempo, and the recipient's delivery method. Confirm the whole route before selecting an API or promising a delivery time.
## Confirm the payment route
Record customer type, sender and recipient countries, currencies, payment direction, and minimum amounts. Bridge's [route explorer](https://apidocs.bridge.xyz/get-started/introduction/what-we-support/payment-routes) lists supported combinations. Its Tempo guide includes OUSD funding and payout examples; match the token contract against the [stablecoin registry](https://tempo.com/developers/docs/partners/stablecoins).
## Connect funding and payouts with Bridge
Bridge's [Tempo integration](https://apidocs.bridge.xyz/get-started/guides/move-money/tempo-integration-guide) manages the network connection through its APIs. Choose the component for the movement your application needs:
| Payment task | Bridge component |
| --- | --- |
| Receive recurring bank deposits as a supported stablecoin on Tempo | Virtual account with reusable deposit instructions. |
| Initiate a supported movement between funding and payout endpoints | Transfer. |
| Convert incoming stablecoin deposits to a configured destination | Liquidation address. |
| Hold a balance between movements | Custodial wallet. |
Bridge's wallet documentation specifies whole-cent processing. Check its rounding rules before choosing that path for [microtransactions](https://tempo.com/developers/docs/resources/guides/microtransactions).
## Prepare customers and test the flow
:::steps
### Obtain developer and customer access
Follow [Bridge account setup](https://apidocs.bridge.xyz/get-started/introduction/quick-start/get-set-up-with-bridge). Customers need applicable identity or business verification, terms acceptance, and rail endorsements. Production custodial wallets require [fund-flow review and approval](https://apidocs.bridge.xyz/platform/wallets/overview).
### Exercise the payment lifecycle in sandbox
Use the [sandbox](https://apidocs.bridge.xyz/get-started/introduction/quick-start/setting-up-sandbox) for resource creation, webhooks, retries, and reconciliation. It simulates bank and blockchain activity; it does not send real payouts or blockchain testnet transfers. Keep its credentials and resource IDs separate from production.
### Validate the enabled production route
Run controlled production tests under the provider's instructions. Check the actual asset, fees, rounding, recipient amount, and return handling. Resolve an uncertain existing transfer before submitting another.
:::
## Record when the recipient is paid
Link the business payment ID to the customer, provider transfer ID, asset, amount, fees, and transaction references. Follow [Bridge transfer states](https://apidocs.bridge.xyz/platform/orchestration/transfers/transfer-states) and keep submitted, processed, and returned outcomes distinct.
Tempo settles the onchain leg near-instantly. Bank delivery depends on provider processing, the selected rail, and the recipient bank. For direct token delivery, [verify the delivered transfer](https://tempo.com/developers/docs/guide/payments/accept-a-payment); for bank payouts, retain provider completion evidence. Use [payment reconciliation](https://tempo.com/developers/docs/resources/guides/payment-reconciliation) to connect both to finance records.
> Source: [/docs/resources/guides/payment-screening](https://tempo.com/developers/docs/resources/guides/payment-screening.md)
> Section: [Get Started](https://tempo.com/developers/get-started.md). Choose a starting point, send a test payment, get testnet funds, connect a coding agent, find the SDKs and CLI, and use the resource guides to plan payment workflows, liquidity, provider selection, and partner integrations.
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
[Guides](https://tempo.com/developers/docs/resources/guides) / [Compliance and security](https://tempo.com/developers/docs/resources/guides#compliance-and-security) / Payment screening
# Screen blockchain payments
Use address screening to assess a sender or recipient, transaction monitoring to review activity over time, and simulation to preview a payment before signing. Choose the check for the decision your application needs to make.
## Place checks in the payment flow
| Decision | Check | Provider options |
| --- | --- | --- |
| Authorize a payment to or from an address | Address risk and counterparty exposure. | [TRM](https://tempo.com/developers/docs/resources/guides/payment-screening#trm), [Chainalysis](https://tempo.com/developers/docs/resources/guides/payment-screening#chainalysis), [Elliptic](https://tempo.com/developers/docs/resources/guides/payment-screening#elliptic). |
| Review suspicious payment activity | Monitoring alerts and investigation tools. | [TRM](https://tempo.com/developers/docs/resources/guides/payment-screening#trm), [Chainalysis](https://tempo.com/developers/docs/resources/guides/payment-screening#chainalysis), [Elliptic](https://tempo.com/developers/docs/resources/guides/payment-screening#elliptic). |
| Show a user what a proposed transaction will do | Transaction simulation and security findings before signing. | [Blockaid](https://tempo.com/developers/docs/resources/guides/payment-screening#blockaid). |
| Enforce an approved address or token restriction | Token permissions or account receive policies. | [Tempo controls](https://tempo.com/developers/docs/resources/guides/compliance-controls). |
Screening provides risk information. Tempo's onchain controls enforce configured rules; connecting the two is your application's responsibility.
## Choose a screening provider
### TRM
[TRM's Tempo coverage](https://www.trmlabs.com/blockchain-coverage/tempo) includes wallet screening, monitoring, tracing, and entity attribution. Use Wallet Screening for address assessments and Transaction Monitoring for ongoing activity. Its [API portal](https://docs.trmlabs.com/api-reference) provides product documentation linked to your account; the public Sanctions API is a different product.
### Chainalysis
[Chainalysis supports](https://www.chainalysis.com/blog/tempo-automatic-token-coverage-march-2026/) Address Screening, KYT monitoring, and Reactor investigations on Tempo, including TIP-20 tokens and transfer memos. For an API integration, [rescreen an address](https://www.chainalysis.com/product/address-screening/) when you need an updated assessment; interface alerts don't refresh an earlier API result.
### Elliptic
[Elliptic's Tempo integration](https://www.elliptic.co/newsroom/elliptic-integrates-with-tempo-the-payments-first-blockchain/) covers address screening, payment monitoring, and cross-chain investigations. Its [analysis API](https://developers.elliptic.co/reference/analysissync) takes a subject, analysis type, and `customer_reference`. Choose the source-of-funds or destination-of-funds direction for your investigation, using [authenticated requests](https://developers.elliptic.co/docs/authentication-1).
## Preview a transaction before signing
Blockaid's [`client.evm.transaction.scan`](https://github.com/blockaid-official/blockaid-client-node/blob/main/src/resources/evm/transaction.ts) previews transaction effects and assesses security risk. Its [chain list](https://github.com/blockaid-official/blockaid-client-node/blob/main/src/resources/evm/evm.ts) includes `tempo` and `tempo-testnet` for individual scans. Set `options: ['simulation', 'validation']` for both outputs; the default requests validation only.
Check `validation.result_type` before presenting a result: `Error` is not a benign assessment. The bulk-scanning chain list doesn't include Tempo, and support for native Tempo batches and sponsored transactions needs confirming with Blockaid. Simulation doesn't assess a recipient's sanctions exposure.
## Connect results to a payment decision
:::steps
### Configure the provider connection
Confirm the product, credentials, Tempo network and asset identifiers, and subject schema for your account.
### Apply a decision policy
Map findings to proceed, review, or decline. Set a maximum result age and explicit handling for unavailable services and errors.
### Record and enforce the decision
Save the assessment, check time, decision, and payment reference together. Keep customer and case details offchain. Apply any onchain permission change through an authorized [token or receive-policy workflow](https://tempo.com/developers/docs/resources/guides/compliance-controls).
:::
A clean assessment doesn't replace customer checks. When accepting funds, [verify the delivered transfer](https://tempo.com/developers/docs/guide/payments/accept-a-payment) before crediting a customer.
> Source: [/docs/resources/guides/compliance-controls](https://tempo.com/developers/docs/resources/guides/compliance-controls.md)
> Section: [Get Started](https://tempo.com/developers/get-started.md). Choose a starting point, send a test payment, get testnet funds, connect a coding agent, find the SDKs and CLI, and use the resource guides to plan payment workflows, liquidity, provider selection, and partner integrations.
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
[Guides](https://tempo.com/developers/docs/resources/guides) / [Compliance and security](https://tempo.com/developers/docs/resources/guides#compliance-and-security) / Token and receive controls
# Token and receive controls
Use TIP-20 roles for privileged token operations, TIP-403 policies for token access rules, and receive policies for an account's incoming assets. Keep the institution's screening decisions and case records separate from the technical controls that enforce them.
For address risk checks and transaction monitoring, start with [Screen blockchain payments](https://tempo.com/developers/docs/resources/guides/payment-screening).
## Choose the control for each responsibility
| Responsibility | Tempo control | Application or institution responsibility |
| --- | --- | --- |
| Restrict token circulation | TIP-403 token policies. | Supply, review, and maintain the underlying address decisions. |
| Limit incoming transfers | Account-level receive policy. | Set accepted senders and tokens, choose recovery authority, and handle held receipts. |
| Pause token movement | TIP-20 pause and unpause roles. | Approve the action, protect the role holders, and document its basis. |
| Burn eligible balances | Dedicated TIP-20 burn authorities and guard receipt rules. | Establish authority for the action and preserve the approval and case evidence. |
| Connect a transfer to a case | A supported 32-byte transfer memo. | Store personal and case information offchain and control access to it. |
These controls enforce decisions; identity checks and sanctions screening happen in your application or provider. An allowlist records policy membership only, so keep the address-to-customer mapping current offchain.
## Separate issuer roles
[TIP-20 roles](https://tempo.com/developers/docs/protocol/tip20/spec#tip-20-roles) separate minting, pause controls, and burn authorities. Give each role only to the accounts authorized for that operation and protect the ability to grant or revoke roles.
* `ISSUER_ROLE` controls minting and issuer burning operations.
* `PAUSE_ROLE` and `UNPAUSE_ROLE` control the token's paused state.
* `BURN_BLOCKED_ROLE` permits burning eligible, unprotected balances from addresses that fail the TIP-403 sender check.
* `BURN_AT_ROLE` permits burning an unprotected balance without TIP-403 authorization, subject to the specification's checks.
Own-balance burning, burning a blocked balance, and `burnAt` are different operations. Burning reduces supply; it doesn't move funds to another account. Guard-held funds have [separate receipt-level burn rules](https://tempo.com/developers/docs/protocol/tip403/receive-policies#burns).
Pausing affects token movement, while administrative functions and protocol operations have their own rules. Read the [pause controls](https://tempo.com/developers/docs/protocol/tip20/spec#pause-controls) before relying on a pause as an emergency response.
## Configure token-level policies
The [Tempo Policy Registry](https://tempo.com/developers/docs/protocol/tip403/spec) supports simple allowlist and blocklist policies and compound policies. A compound policy can select different rules for senders, transfer recipients, and mint recipients.
An issuer associates a policy with its token. Policies can be shared across tokens, so a change to a shared underlying policy can affect several assets. Record that dependency when approving a policy update.
For customer-based restrictions, maintain the customer-to-address mapping offchain and update policy membership through an authorized workflow. Preserve who approved the change, the affected addresses and tokens, the transaction, and the internal case reference.
Start with [managing an issued stablecoin](https://tempo.com/developers/docs/guide/issuance/manage-stablecoin) and the [TIP-403 specification](https://tempo.com/developers/docs/protocol/tip403/spec).
## Handle receive-policy holds as a separate outcome
A [receive policy](https://tempo.com/developers/docs/accounts/policies/receive-policies) controls which senders and TIP-20 tokens an account accepts. It is an inbound control, not a general outbound transaction policy.
Token-level checks run first and revert on failure. If those checks pass but the receiver's policy blocks delivery, the call succeeds while funds are held in `ReceivePolicyGuard`. The token's `Transfer` event names the guard as the recipient, so don't credit the intended receiver on transaction success.
Handle each outcome separately:
| Outcome | Payment handling |
| --- | --- |
| Token policy rejects the operation | Record the failed attempt; do not credit delivery. |
| Receive policy holds the inbound | Index the blocked receipt and route it through the authorized recovery process. |
| Expected transfer reaches the receiver | Verify the token, recipient, amount, and successful transaction before crediting it. |
Each blocked inbound creates a receipt. The receipt captures the recovery authority in effect for that inbound; changing the account's authority affects future receipts. Claims consume a full receipt, and the allowed destination and current policy checks depend on the claim path. Held funds aren't part of the account balance; the [receive-policy specification](https://tempo.com/developers/docs/protocol/tip403/receive-policies) defines the claim rules.
## Keep compliance records offchain
[Transfer memos](https://tempo.com/developers/docs/guide/payments/transfer-memos) carry a 32-byte reference through supported TIP-20 methods. Use an opaque identifier to connect a payment to internal records. Do not put names, identity documents, account details, or other personal data in a public memo.
A memo isn't an information-sharing message. [FATF's virtual-asset standards](https://www.fatf-gafi.org/en/publications/Fatfrecommendations/Regulation-virtual-assets-interpretive-note.html) call for covered providers to obtain, retain, and transmit originator and beneficiary information, which doesn't need to travel with the onchain transfer. Keep that information and the exchange evidence in offchain systems.
Before updating a customer or case ledger, verify delivery with the [receiving guide](https://tempo.com/developers/docs/guide/payments/accept-a-payment), not only the matching reference.
## Test control changes before operating them
:::steps
### Map the authorities
List each token, policy, role holder, receive account, recovery authority, and offchain decision owner. Identify shared policies and the accounts that can change permissions.
### Exercise permitted and blocked paths
Test allowed transfers, issuer-policy rejections, receiver holds, authorized claims, and the pause behavior your application depends on. Check that a held transfer never credits a customer.
### Preserve action and decision evidence
Link policy and role changes, blocked receipts, claims, and burns to internal approvals and case records. Monitor changes to privileged authority and provide a way to stop new application submissions during an incident.
:::
## Token control questions
### Does TIP-403 perform KYC or sanctions screening?
No. It enforces configured address policies. Your institution or provider supplies the identity, screening, and review workflow behind those decisions.
### Can an account reject an unsupported token?
It can configure a receive-policy token filter. A blocked inbound is held by the guard rather than credited to the account. Index and handle the resulting receipt.
### Does an onchain control establish legal compliance?
No. Onchain controls enforce the institution's decisions. Compliance also depends on the applicable requirements and the institution's own workflow.
> Source: [/docs/accounts](https://tempo.com/developers/docs/accounts.md)
> Section: [Accounts](https://tempo.com/developers/docs/accounts.md). Create accounts, set up signing methods, policies, access keys, key rotation, and fees, and follow guides for users, automations, agents, and teams.
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
# Tempo Accounts
Give every customer and business a stablecoin account with security rules that Tempo enforces onchain.
[Create an account →](https://tempo.com/developers/docs/accounts/create)
A Tempo account: an address that holds stablecoin balances, a passkey and a private key as signers with weight 1 each toward a threshold of 2, and an access key with a daily limit.
## Overview
A Tempo account is an address that holds stablecoins. Its rules live onchain, and each account has three parts:
* **Address:** Holds the account's stablecoins. It never changes, even when you [replace its signers](https://tempo.com/developers/docs/accounts/account-configuration).
* **Signers:** Approve payments and changes to the account. Each is a [private key, device key, or passkey](https://tempo.com/developers/docs/accounts/authentication) with a weight. A transaction runs once its approvers' weights reach the [threshold](https://tempo.com/developers/docs/accounts/policies/signing-thresholds), such as any 2 of 3.
* **Access Keys:** Let a customer's phone, your backend, or an AI agent [pay on its own](https://tempo.com/developers/docs/accounts/access-keys). Each works within the limits, expiry, and allowed calls you set.
## Why Tempo Accounts
* **Native Account Abstraction:** Every [Tempo Transaction](https://tempo.com/developers/docs/guide/tempo-transaction) has passkey signatures, access keys, batched calls, and [fee sponsorship](https://tempo.com/developers/docs/accounts/fees/fee-sponsorship) built in. You run no wallet contracts, bundlers, or paymasters.
* **Self-Custodial:** Signing rules live onchain, and Tempo checks every transaction against them. When the customer holds the [passkey](https://tempo.com/developers/docs/accounts/authentication/passkeys) or [private key](https://tempo.com/developers/docs/accounts/authentication/private-keys), neither you nor Tempo can move their funds.
* **Your Wallet Stack Works:** Tempo is [EVM compatible](https://tempo.com/developers/docs/quickstart/evm-compatibility). [Wallet providers](https://tempo.com/developers/docs/accounts/apps) and [custodians](https://tempo.com/developers/docs/accounts/custodians) such as Privy, Turnkey, Dynamic, and Fireblocks work, and so do browser wallets like MetaMask.
## What You Can Build
* **Stablecoin Accounts for Your Users:** Each user gets their own account in your app. They approve with a key they hold, such as a [passkey](https://tempo.com/developers/docs/accounts/authentication/passkeys) or a provider key from Privy or Turnkey. You never hold their funds.
* **Automated Payments:** Your backend, card program, or AI agent pays with its own revocable [access key](https://tempo.com/developers/docs/accounts/access-keys). Tempo rejects any payment over its limit, to an unlisted payee, or after it expires.
* **Business Accounts:** Hold customer funds in one [omnibus account](https://tempo.com/developers/docs/accounts/custodians/omnibus-accounts), with a [deposit address](https://tempo.com/developers/docs/accounts/virtual-addresses) per customer and no sweep transactions. Or run a treasury from a [custodian](https://tempo.com/developers/docs/accounts/custodians) like Fireblocks.
## Start Building
On mainnet, [create a single-key account](https://tempo.com/developers/docs/accounts/create#create-a-single-key-account) or support the [wallets your users already have](https://tempo.com/developers/docs/accounts/wallets). To try several signers and recovery, [create a configurable account](https://tempo.com/developers/docs/accounts/create#create-a-configurable-account) on testnet. Then [add funds](https://tempo.com/developers/docs/accounts/fund).
:::warning
**Multiple signers arrive on mainnet with the [T14 network upgrade](https://tempo.com/developers/docs/protocol/upgrades/t14).** They are live on [testnet](https://tempo.com/developers/docs/accounts/create#connect-to-testnet) since T14 activated there on November 24, 2026. Mainnet activation is scheduled for December 8, 2026.
:::
[Set Up a Self-Custodial Wallet With a Provider](https://tempo.com/developers/docs/accounts/apps/self-custodial-wallets): Your provider's key and the user's passkey approve together, and only the user can recover or leave without you. Testnet until T14 reaches mainnet.
[Recover a User's Account](https://tempo.com/developers/docs/accounts/apps/recover-an-account): Replace a lost passkey with the signers the user still has, at the same address. Testnet until T14 reaches mainnet.
[Pay Out From a Backend](https://tempo.com/developers/docs/accounts/automations/pay-out-from-a-backend): Your backend pays approved payees, up to a daily limit, with a key in your KMS.
[Pay From a User's Embedded Wallet](https://tempo.com/developers/docs/accounts/automations/pay-from-an-embedded-wallet): A user's Privy or Turnkey wallet authorizes a key once, so your card or subscription backend pays within limits.
[Give an Agent a Wallet](https://tempo.com/developers/docs/accounts/automations/give-an-agent-a-wallet): An AI agent's own key, with a budget, an expiry, and only the calls it needs.
[Hold Customer Funds in an Omnibus Account](https://tempo.com/developers/docs/accounts/custodians/omnibus-accounts): A deposit address per customer, paying into one account that accepts only the stablecoins you list.
[Set Up a Team Multisig](https://tempo.com/developers/docs/accounts/custodians/team-multisig): Any two of three approvers sign each payment, so no one moves funds alone. Testnet until T14 reaches mainnet.
[Add Tempo to Your Wallet](https://tempo.com/developers/docs/accounts/wallets/add-tempo-to-your-wallet): Add the networks, show stablecoin balances, and send Tempo Transactions from your wallet.
## Related
[Signing Methods](https://tempo.com/developers/docs/accounts/authentication): Covers approving payments with a passkey, a key on the device, or a private key.
[Account Policies](https://tempo.com/developers/docs/accounts/policies): Covers requiring several approvals, and which stablecoins and senders can pay the account.
[Access Keys](https://tempo.com/developers/docs/accounts/access-keys): Covers keys that let a backend, a device, or an agent pay on its own, within limits you set.
[Account Configuration](https://tempo.com/developers/docs/accounts/account-configuration): Covers adding, removing, and rotating signers while the address stays the same.
[Fee Management](https://tempo.com/developers/docs/accounts/fees): Covers paying network fees in stablecoins, or paying them for your customers.
[Virtual Addresses](https://tempo.com/developers/docs/accounts/virtual-addresses): Covers giving each customer a deposit address that pays into one account.
> Source: [/docs/accounts/how-it-works](https://tempo.com/developers/docs/accounts/how-it-works.md)
> Section: [Accounts](https://tempo.com/developers/docs/accounts.md). Create accounts, set up signing methods, policies, access keys, key rotation, and fees, and follow guides for users, automations, agents, and teams.
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
# How It Works
A Tempo account holds stablecoins, and only the account's own keys can move them.
## Overview
A Tempo account is an address with two kinds of keys. Tempo checks what each key can do on every transaction:
* **Signers:** Own the account. They approve payments and any change to the account's keys. An existing wallet's account starts with one signer, its existing key.
* **Access Keys:** Pay on their own within the limits you set, such as a daily amount or a single recipient. Access keys are optional, and the signers authorize each one.
No one, including Tempo, can [move an account's funds](https://tempo.com/developers/docs/accounts/security) any other way.
Say you run a payments app and give each customer a Tempo account. The customer's passkey can approve anything on its own. If they lose their phone, their backup key and your app's recovery key replace it together. Your app's server holds an access key that pays the customer's scheduled bills, up to 500 OUSD a day.
## Addresses
An address holds stablecoins, access keys, and a fee token. It is either a single-key account, where one private key approves, or a configurable account, where weighted signers reach a threshold.
The address is the account's public ID. It holds the account's stablecoins and sets its default [fee token](https://tempo.com/developers/docs/accounts/fees), the stablecoin it pays network fees in.
A single-key account has one key, like a standard Ethereum account (an EOA). Losing the key loses the account. A [configurable account](https://tempo.com/developers/docs/development/configurable-accounts) has signers instead. Its address stays the same when they change. The customer keeps their address and balance after replacing a lost phone. You can [upgrade a single-key account](https://tempo.com/developers/docs/accounts/account-configuration/account-upgrade) to a configurable one at the same address.
Single-key accounts and their access keys work on mainnet and testnet today. They work in the [wallets](https://tempo.com/developers/docs/accounts/wallets) your users already have, your [app's embedded wallets](https://tempo.com/developers/docs/accounts/apps), your [backend automations](https://tempo.com/developers/docs/accounts/automations), and [custodians](https://tempo.com/developers/docs/accounts/custodians).
:::warning
**Multiple signers arrive on mainnet with the [T14 network upgrade](https://tempo.com/developers/docs/protocol/upgrades/t14).** They are live on [testnet](https://tempo.com/developers/docs/accounts/create#connect-to-testnet) since T14 activated there on November 24, 2026. Mainnet activation is scheduled for December 8, 2026.
:::
## Signers
Three signers with weights: a passkey at 2, and a backup key and a recovery key at 1 each, toward a threshold of 2. The passkey approves alone, or both keys approve together.
Each signer is a [private key](https://tempo.com/developers/docs/accounts/authentication/private-keys), a [device key](https://tempo.com/developers/docs/accounts/authentication/device-keys), or a [passkey](https://tempo.com/developers/docs/accounts/authentication/passkeys), with a weight. A payment, a new access key, or a configuration update goes through once its approvers' weights reach the account's [threshold](https://tempo.com/developers/docs/accounts/policies/signing-thresholds).
In the example, the threshold is 2. The passkey has weight 2, and the backup and recovery keys have weight 1 each. The passkey pays alone. Your recovery key alone reaches 1 of 2, so you can't move the customer's funds. If the customer loses their phone, the backup and recovery keys together [replace the passkey](https://tempo.com/developers/docs/accounts/apps/recover-an-account).
## Access Keys
An access key has a key type (passkey, P-256, or secp256k1), spending limits per TIP-20 token that apply once or per period, an expiry, and scopes over contracts, functions, and recipients.
A payout server can't ask for the customer's passkey on every payout. Instead, the signers approve an [access key](https://tempo.com/developers/docs/accounts/access-keys) once. From then on, it pays alone within its bounds. Its bounds are a spending limit per stablecoin, an expiry, and scopes. Scopes limit which contracts and functions it calls and whom it pays. Tempo checks those bounds on every transaction. A leaked payout server key can't spend past its daily limit.
No access key counts toward the threshold. Only the signers can change the signers or the threshold.
## Related
[Security](https://tempo.com/developers/docs/accounts/security): Covers who can move an account's funds and what a breach exposes.
[Signing Methods](https://tempo.com/developers/docs/accounts/authentication): Covers passkeys, device keys, and private keys, and who holds each.
[Signing Thresholds](https://tempo.com/developers/docs/accounts/policies/signing-thresholds): Covers signer weights and the threshold a transaction must reach.
[Access Keys](https://tempo.com/developers/docs/accounts/access-keys): Covers the limits, expiry, and scopes Tempo checks for a key that pays alone.
[Account Upgrade](https://tempo.com/developers/docs/accounts/account-configuration/account-upgrade): Use for turning a single-key account into a configurable one at the same address.
> Source: [/docs/accounts/use-cases](https://tempo.com/developers/docs/accounts/use-cases.md)
> Section: [Accounts](https://tempo.com/developers/docs/accounts.md). Create accounts, set up signing methods, policies, access keys, key rotation, and fees, and follow guides for users, automations, agents, and teams.
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
# Use Cases
Find the setup and guides for what you're building.
## Overview
Each use case is a Tempo account setup for one kind of product. The setups differ in who holds which key. A customer holds a passkey, and a provider holds its own key. Your backend holds an access key, and each approver holds a signer.
## Apps
For consumer apps, such as remittance or savings apps, built on embedded wallets from Privy, Turnkey, or a similar provider.
[Set Up a Self-Custodial Wallet With a Provider](https://tempo.com/developers/docs/accounts/apps/self-custodial-wallets): The provider's key and the user's passkey approve together; the user can recover or leave without you. Testnet until T14 reaches mainnet.
[Recover a User's Account](https://tempo.com/developers/docs/accounts/apps/recover-an-account): Replace a lost passkey with the signers the user still has. Testnet until T14 reaches mainnet.
## Automations
For backends that pay out, fund cards, or charge subscriptions, and for AI agents that pay on someone's behalf. Each gets its own access key.
[Pay Out From a Backend](https://tempo.com/developers/docs/accounts/automations/pay-out-from-a-backend): Pay approved payees up to a daily limit with a key in your KMS.
[Pay From a User's Embedded Wallet](https://tempo.com/developers/docs/accounts/automations/pay-from-an-embedded-wallet): Have a user's Privy or Turnkey wallet authorize a key once, so your backend pays within limits.
[Give an Agent a Wallet](https://tempo.com/developers/docs/accounts/automations/give-an-agent-a-wallet): An agent's own key, with a budget, an expiry, and only the calls it needs.
## Custodians
For exchanges and payments processors that hold customer funds. Also for businesses whose funds sit with a custodian such as Fireblocks, and companies running their own treasury.
[Hold Customer Funds in an Omnibus Account](https://tempo.com/developers/docs/accounts/custodians/omnibus-accounts): A deposit address per customer, paying into one account that accepts only the stablecoins you list.
[Custody Partners](https://tempo.com/developers/docs/partners/wallets#custodial--institutional): Custodians and institutional wallets that support Tempo, such as Fireblocks.
[Set Up a Team Multisig](https://tempo.com/developers/docs/accounts/custodians/team-multisig): Three approvers, any two of whom approve each payment. Testnet until T14 reaches mainnet.
## Wallets
For wallet teams adding Tempo, such as MetaMask, Rabby, or Ledger, and for apps whose users connect those wallets.
[Add Tempo to Your Wallet](https://tempo.com/developers/docs/accounts/wallets/add-tempo-to-your-wallet): Add the networks, show stablecoin balances, let users pay fees in stablecoins, and send Tempo Transactions.
## Related
[Apps](https://tempo.com/developers/docs/accounts/apps): Covers how each user's account is set up with your wallet provider, and who can move the funds.
[Automations](https://tempo.com/developers/docs/accounts/automations): Covers giving each service or agent its own access key with a limit, scopes, and an expiry.
[Custodians](https://tempo.com/developers/docs/accounts/custodians): Covers the recommended setup for omnibus accounts, custodian-held funds, and company treasuries.
[Wallets](https://tempo.com/developers/docs/accounts/wallets): Covers connecting MetaMask, Rabby, or Tempo Wallet to your app, and what a single-key account can do.
> Source: [/docs/accounts/security](https://tempo.com/developers/docs/accounts/security.md)
> Section: [Accounts](https://tempo.com/developers/docs/accounts.md). Create accounts, set up signing methods, policies, access keys, key rotation, and fees, and follow guides for users, automations, agents, and teams.
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
# Security
No one, including Tempo, can move an account's funds without the account's keys.
## Overview
Tempo enforces each account's rules on every transaction. A breach of your app, backend, or wallet provider exposes only that party's keys. Those keys still work only within their bounds.
Your security decision is who holds which keys.
## Onchain Enforcement
An account's rules are protocol rules. Every validator checks them on every transaction:
* **Signatures:** The signers' approvals reach the account's [signing threshold](https://tempo.com/developers/docs/accounts/policies/signing-thresholds).
* **Access Key Bounds:** Each [access key](https://tempo.com/developers/docs/accounts/access-keys) stays within its spending limits, scopes, and expiry.
* **Receive Policy:** Incoming transfers meet the account's [receive policy](https://tempo.com/developers/docs/accounts/policies/receive-policies).
A transaction that breaks any rule never lands. No validator or operator, including Tempo, can skip these checks.
A distributed set of validators runs Tempo, not a single sequencer. Each validator checks every block against the protocol's rules before agreeing to it. A block is [final](https://tempo.com/developers/docs/protocol/blockspace/consensus) once enough validators agree. A final block and its transactions can't be reverted or changed. These guarantees hold while fewer than a third of validators misbehave.
## Fund Control
Whoever holds keys that reach an account's threshold can move its whole balance. In every setup, access key holders pay only within their bounds.
:::warning
**Multiple signers arrive on mainnet with the [T14 network upgrade](https://tempo.com/developers/docs/protocol/upgrades/t14).** They are live on [testnet](https://tempo.com/developers/docs/accounts/create#connect-to-testnet) since T14 activated there on November 24, 2026. Mainnet activation is scheduled for December 8, 2026.
:::
| Setup | Who can move the whole balance |
| --- | --- |
| Embedded wallet in an [app](https://tempo.com/developers/docs/accounts/apps) | Whoever the provider lets sign with the account's key, such as the customer after they log in, or your backend under the provider's policies |
| Backend key for an [automation](https://tempo.com/developers/docs/accounts/automations) | Your backend, if it holds the account's key |
| [Custodian](https://tempo.com/developers/docs/accounts/custodians) | The custodian, under the policies you set with it |
| Browser or hardware [wallet](https://tempo.com/developers/docs/accounts/wallets) | The user, who holds the account's one private key |
| [Configurable account](https://tempo.com/developers/docs/accounts/policies/signing-thresholds) | Signers whose weights reach the threshold together. In the [recommended setups](https://tempo.com/developers/docs/accounts/policies/signing-thresholds#recommended-signer-setups), no outside party reaches it alone. |
## App Responsibilities
Tempo checks what a key signs, not whether the right person holds the key. Your app owns five decisions:
* **Where Keys Live:** Your app chooses where each passkey, device key, and backend key is stored. Keep passkeys and device keys on the customer's device, and backend keys in a KMS or HSM. A key that never leaves them can't be copied out in a breach of your app's servers.
* **How Your Backend Pays:** Authorize an [access key](https://tempo.com/developers/docs/accounts/access-keys) for each backend that pays. Don't give your backend the account's key. A breached backend then spends at most the key's remaining limit. You recover by revoking one key, not by changing the account's signers or moving its funds.
* **Which Signers Your App Holds:** A breach gives an attacker every signer your app or wallet provider holds. Their combined weight counts toward the threshold ([what a threshold protects against](https://tempo.com/developers/docs/accounts/policies/signing-thresholds#what-a-threshold-protects)). On a configurable account, keep that weight below the threshold. Count parties, not keys, when you add it up.
* **Each Account's Configuration:** Tempo stores only a hash of a configurable account's signers, weights, threshold, and version. Without the full configuration, the signers can't approve ([keep the current configuration](https://tempo.com/developers/docs/development/configurable-accounts#keep-the-current-configuration)).
* **What Gets Signed:** A wallet provider's policy engine sees only a raw hash, so it can't tell a key authorization from a payment. Check the key, limits, scopes, and expiry in your backend before the provider signs ([who can move the funds](https://tempo.com/developers/docs/accounts/apps#who-can-move-the-funds)).
## Compromised Keys and Services
Revoke the keys the breached party held. On a configurable account, use the remaining signers to replace any signer the attacker reached.
| Compromise | What an attacker can do | What you do |
| --- | --- | --- |
| Lost device | Pay with the device's access key, within its limits, until it expires. A passkey on the device still needs the device's unlock. | [Revoke](https://tempo.com/developers/docs/accounts/access-keys/revocation) the device key. On a configurable account, the other signers [replace the passkey](https://tempo.com/developers/docs/accounts/apps/recover-an-account). On a single-key account whose only key was on the device, no one can recover the funds. |
| Leaked access key | Spend up to the key's remaining [spending limit](https://tempo.com/developers/docs/accounts/access-keys/spending-limits), only to the contracts and recipients in its [scopes](https://tempo.com/developers/docs/accounts/access-keys/scopes), until its [expiry](https://tempo.com/developers/docs/accounts/access-keys/expiry). | Revoke the key. Set any token approvals it made to zero ([what revocation leaves in place](https://tempo.com/developers/docs/accounts/access-keys/revocation#what-revocation-leaves-in-place)). |
| Breached backend | Use every key the backend holds: access keys within their bounds, and any signer at its weight. If the backend holds a single-key account's key, it can move the whole balance. | Revoke its access keys and authorize new ones. On a configurable account, the other signers [remove the backend's signer](https://tempo.com/developers/docs/accounts/account-configuration/configuration-updates#remove-a-lost-or-compromised-signer). For a single-key account, move the funds to a new account. |
| Breached wallet provider | On a single-key embedded wallet, sign anything with the account's key and move the whole balance. On a configurable account where the provider's key is [one signer](https://tempo.com/developers/docs/accounts/apps/self-custodial-wallets), approve only at that key's weight, which can't reach the threshold alone. | On a configurable account, the customer's passkey and backup remove the provider's signer. On a single-key account, move the funds to a new account once you control signing again. |
| Your app or wallet provider is down | Nothing new, but customers can't sign through you. | On a configurable account where the customer holds two signers, they [pay or leave without you](https://tempo.com/developers/docs/accounts/apps/self-custodial-wallets#if-something-goes-wrong). On a single-key embedded wallet, customers wait until the provider is back. |
| Lost saved configuration | Nothing. The configuration lists signer addresses and weights, not keys. | Restore it from a backup. Registration and each later configuration update emit a `ConfigurableAccountConfigUpdated` event with the full configuration, so you can rebuild a lost copy from the latest one. For an account that has never transacted, your saved copy is the only record, so back it up. |
On a configurable account, a configuration update leaves the account's access keys in place. After replacing a signer, list every key the account has authorized and [revoke the ones its old holder could use](https://tempo.com/developers/docs/accounts/access-keys/revocation#revoke-when-signers-change).
## Post-Quantum Accounts
A [configurable Tempo account](https://tempo.com/developers/docs/development/configurable-accounts) changes the keys behind its address, so it can switch to quantum-safe signatures without moving funds once Tempo supports a quantum-safe key type.
A large enough quantum computer could forge the signatures that protect crypto accounts today. That includes the secp256k1 keys in Ethereum wallets and the P-256 keys behind passkeys.
### Key Changes on Other Chains
An account's address ends up in many places:
* Customers save it.
* Exchanges and banks allowlist it.
* Payment providers hold token approvals from it.
* Your own records use it to identify the account.
On Ethereum, an address is computed from its public key, so a new key is a new address. Moving to a quantum-safe key means creating a new address and moving every balance to it. It means granting every token approval again and asking every counterparty to update what they've saved. Every account on the network has to do the same, before quantum computers can break the old keys.
### Stable Addresses on Tempo
A configurable account's address is computed from the account's first configuration, not from any one key ([configurable account address](https://tempo.com/developers/docs/development/configurable-accounts#configurable-account-address)). Its signers are a list the account changes through configuration updates. The address stays the same through every change.
A [single-key Tempo account](https://tempo.com/developers/docs/development/single-key-accounts#single-key-address-derivation) works like an Ethereum account. Its key fixes its address. It [upgrades in place](https://tempo.com/developers/docs/accounts/account-configuration/account-upgrade) to a configurable account at the same address.
### Migration to Quantum-Safe Keys
1. **Upgrade the Account in Place:** A single-key account's original key signs one upgrade. The account becomes a configurable account at the same address. From then on, the original key approves only if you list it as a signer.
2. **Add a Quantum-Safe Signer:** Once Tempo supports a quantum-safe key type, [add a signer](https://tempo.com/developers/docs/accounts/account-configuration/configuration-updates#add-a-signer) with that key type.
3. **Swap Keys Together:** The old keys approve one update that adds the new signer and [removes the old ones](https://tempo.com/developers/docs/accounts/account-configuration/configuration-updates#remove-a-signer). No old key controls the account afterward. The address, balances, and token approvals don't change, and counterparties do nothing.
4. **Replace Access Keys:** An [access key](https://tempo.com/developers/docs/accounts/access-keys) with an old key type is as breakable as the account's old signers. Revoke each one, such as a backend's or an agent's, and authorize a quantum-safe replacement without touching the account's signers.
Tempo accounts already support upgrading, removing signers, and replacing access keys. Only step 2, adding a quantum-safe signer, isn't built yet.
### Protocol Requirements
Tempo accounts accept secp256k1, P-256, and passkey (WebAuthn) signatures today. A large enough quantum computer could break all three. Quantum-safe key types include ML-DSA, standardized by NIST in FIPS 204.
Supporting a quantum-safe key type is a protocol change with three parts:
* **A New Signature Type:** Accounts list it as a signer, and access keys sign with it.
* **Room for Larger Signatures:** A secp256k1 signature is 65 bytes, and Tempo accepts passkey signatures of up to 2,049 bytes ([signature types](https://tempo.com/developers/docs/protocol/transactions/spec-tempo-transaction)). An ML-DSA-65 signature is 3,309 bytes, and its public key adds 1,952 more. Transaction size limits and fees have to allow for them.
* **A Way to Stop Accepting Old Signatures:** Removing old signers covers the account's own keys. Access keys and token permits signed with old key types also have to stop working. Otherwise, a forged old-style signature could still spend from the account.
### Timing
Changing keys protects an account only while its old keys are still safe. An attacker with a large enough quantum computer can work out a private key from its public key. Tempo then can't tell the attacker from the real owner. Accounts must retire their old keys before those keys can be broken.
A retired key can also still act outside the account's own rules:
* **On Other Chains:** A secp256k1 key controls the same address on other EVM chains, whatever happens to it on Tempo.
* **In Contracts That Try `ecrecover` First:** Contracts that try `ecrecover` before or instead of ERC-1271 still accept the original key, such as those using OpenZeppelin `SignatureChecker` before v5.1. Permit2 checks the upgraded account through ERC-1271 only ([what an upgrade changes](https://tempo.com/developers/docs/accounts/account-configuration/account-upgrade#what-an-upgrade-changes)).
## Related
[Signing Thresholds](https://tempo.com/developers/docs/accounts/policies/signing-thresholds): Covers signer weights, thresholds, and what a threshold protects against.
[Access Keys](https://tempo.com/developers/docs/accounts/access-keys): Covers keys that pay within spending limits, scopes, and an expiry.
[Revocation](https://tempo.com/developers/docs/accounts/access-keys/revocation): Use for revoking access keys after a breach or a signer change.
[Recover a User's Account](https://tempo.com/developers/docs/accounts/apps/recover-an-account): Use for replacing a lost passkey with the account's other signers.
[Configurable Accounts](https://tempo.com/developers/docs/development/configurable-accounts): Covers configuration hashes, stable addresses, and keeping the current configuration.
> Source: [/docs/accounts/create](https://tempo.com/developers/docs/accounts/create.md)
> Section: [Accounts](https://tempo.com/developers/docs/accounts.md). Create accounts, set up signing methods, policies, access keys, key rotation, and fees, and follow guides for users, automations, agents, and teams.
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
# Create an Account
Create a Tempo account from a key, with no API call and no transaction.
## Overview
A single-key Tempo account's address comes from the key that approves its payments. Your app can create one as soon as it has a key. The address can receive stablecoins right away.
## Create a Single-Key Account
On mainnet and testnet today, an account is a [single-key account](https://tempo.com/developers/docs/development/single-key-accounts) (EOA). One key, such as a passkey, approves its payments and authorizes its [access keys](https://tempo.com/developers/docs/accounts/access-keys).
Create one on Moderato testnet from a passkey, a device key, or a private key.
In the interactive web page, create a single-key account on Moderato testnet from a passkey, a non-extractable P-256 device key, or a secp256k1 private key, kept in the tab. The address comes from the key with no transaction. Then get test stablecoins from the faucet and pay 1 test stablecoin with the key. Each payment is a real testnet transaction.
In code, create a passkey account on Moderato testnet and fund it from the testnet faucet.
```ts [passkey-account.ts]
import { tempoModerato } from 'viem/chains'
import { Account, createClient, WebAuthnP256 } from 'viem/tempo'
const credential = await WebAuthnP256.createCredential({ label: 'My Tempo account' }) // [!code hl]
export const account = Account.fromWebAuthnP256(credential) // [!code hl]
// Save credential.id and credential.publicKey with your user record.
const client = createClient({ chain: tempoModerato })
await client.faucet.fundSync({ account: account.address }) // test stablecoins
```
For a device key, use `Account.fromWebCryptoP256(await WebCryptoP256.createKeyPair())`. For a private key, use `Account.fromSecp256k1(privateKey)`.
For mainnet, use the `tempo` chain from `viem/chains` and fund the address with real stablecoins.
A single-key account can't change its key. Losing the key loses the account. Read [Passkeys](https://tempo.com/developers/docs/accounts/authentication/passkeys#passkey-limits) before customers fund one.
## Create a Configurable Account
:::warning
**Multiple signers arrive on mainnet with the [T14 network upgrade](https://tempo.com/developers/docs/protocol/upgrades/t14).** They are live on [testnet](https://tempo.com/developers/docs/accounts/create#connect-to-testnet) since T14 activated there on November 24, 2026. Mainnet activation is scheduled for December 8, 2026.
:::
A configurable account's signers can change while its address stays the same. Add a backup key, rotate keys, or require several approvals. Pick a first signer in the sandbox to create one on testnet.
In the interactive web page, create a Tempo account on testnet from its first signer: a passkey or a generated private key. Then get test funds, add signers, set weights and the threshold, authorize access keys with limits, and send payments. Every change is a real testnet transaction, so the page must be able to reach testnet.
### Configurable Account Creation
1. You choose a passkey, a device key, or a private key as the first signer. It approves alone, because its weight is 1 and so is the account's [threshold](https://tempo.com/developers/docs/accounts/policies/signing-thresholds).
2. Your app computes the address from that signer. The address can receive stablecoins right away. It stays the same when you change signers or add [access keys](https://tempo.com/developers/docs/accounts/access-keys).
3. The account's first transaction, such as a payment, registers it onchain. That transaction pays a network fee in a stablecoin. Fund the address first, or [sponsor the fee](https://tempo.com/developers/docs/accounts/fees/fee-sponsorship).
### Create the Account in Code
```ts [account.ts]
import { generatePrivateKey } from 'viem/accounts'
import { Account } from 'viem/tempo'
const privateKey = generatePrivateKey() // Keep this secret: it approves the account's transactions.
const signer = Account.fromSecp256k1(privateKey) // [!code hl]
export const account = Account.fromConfig({ address: 'infer', owners: [signer] }) // [!code hl]
// Save account.address and account.config with your user record.
```
`address: 'infer'` tells [`Account.fromConfig`](https://viem.sh/tempo/accounts/account.fromConfig) to compute the address from the signer. Viem calls a signer an owner. You need the saved `account.config` to [add signers](https://tempo.com/developers/docs/accounts/account-configuration/configuration-updates#add-a-signer) later. Its `version` is a bigint, so store `AccountConfig.toRpc(account.config)` and read it back with `AccountConfig.fromRpc` ([Keep the current configuration](https://tempo.com/developers/docs/development/configurable-accounts#keep-the-current-configuration)).
For a passkey or device key, use [that signer](https://tempo.com/developers/docs/accounts/authentication) instead. To create a second account from the same key, pass a different 32-byte `salt`. If you already have a single-key account, [upgrade it in place](https://tempo.com/developers/docs/accounts/account-configuration/account-upgrade) to keep its address.
## Connect to Testnet
The Accounts examples and demos run on testnet, where [T14](https://tempo.com/developers/docs/protocol/upgrades/t14) is live. Configurable accounts reach mainnet with T14 on December 8, 2026. Testnet's public RPC needs no key. Your own app connects with the `tempoModerato` chain from Viem and a default `http()` transport, as in `client.ts` below.
To fund the address, call the testnet faucet, which sends test stablecoins, including pathUSD:
:::code-group
```ts [fund.ts]
import { account } from './account'
import { client } from './client'
await client.faucet.fundSync({ account: account.address }) // [!code hl]
```
```ts [client.ts]
import { http } from 'viem'
import { tempoModerato } from 'viem/chains'
import { createClient } from 'viem/tempo'
// Tempo testnet. The public RPC needs no key.
export const client = createClient({
chain: tempoModerato,
transport: http(),
})
```
:::
The [funding page](https://tempo.com/developers/docs/accounts/fund#get-test-funds) lists other ways to get test funds. In production, [onramps and other chains](https://tempo.com/developers/docs/accounts/fund) fund the address.
## Next Steps
[Add Funds](https://tempo.com/developers/docs/accounts/fund): Use for funding the account from another account, an onramp, or another chain.
[Configuration Updates](https://tempo.com/developers/docs/accounts/account-configuration/configuration-updates): Use for adding a backup signer or rotating a key.
[Account Upgrade](https://tempo.com/developers/docs/accounts/account-configuration/account-upgrade): Use for adding signers to a single-key account at the same address.
[Access Keys](https://tempo.com/developers/docs/accounts/access-keys): Covers keys that sign for the account within limits.
> Source: [/docs/accounts/fund](https://tempo.com/developers/docs/accounts/fund.md)
> Section: [Accounts](https://tempo.com/developers/docs/accounts.md). Create accounts, set up signing methods, policies, access keys, key rotation, and fees, and follow guides for users, automations, agents, and teams.
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
# Add Funds
Anyone can send stablecoins to a Tempo account's address, with nothing to set up first.
## Overview
Funding a Tempo account means sending stablecoins to its address. Pick a path by where the money starts. Then check the balance to confirm it arrived.
## Funding Options
[From Another Tempo Account](https://tempo.com/developers/docs/guide/payments/accept-a-payment): Share the account's address. Any Tempo account or wallet can send stablecoins to it.
[With Tempo Wallet](https://tempo.com/developers/docs/accounts/fund#add-money-with-tempo-wallet): The user adds money with Tempo Wallet's built-in onramp. Try it in the demo on this page.
[From a Card or Bank](https://tempo.com/developers/docs/partners/payments-and-ramps): Embed an onramp such as Stripe, MoonPay, or Mt Pelerin that sends stablecoins to the address.
[From Another Chain](https://tempo.com/developers/docs/routes): Tempo Routes moves stablecoins from supported networks to the account.
[Test Funds](https://tempo.com/developers/docs/quickstart/faucet): Get test stablecoins on Moderato testnet from the faucet.
## Add Money With Tempo Wallet
This demo uses Moderato testnet, whose stablecoins have no value. Select **Sign in with Tempo**, then **Add funds**. On testnet, Tempo's funding page offers the faucet first. On mainnet, the same page shows the funding methods, amount, and any fees before you confirm.
**Interactive demo: Add Funds**
1. Sign in with Tempo
2. Deposit to tempo wallet
To add the same button to your app, request [`wallet_deposit`](https://tempo.com/developers/docs/guide/getting-funds#open-funding-with-the-accounts-sdk) with the Accounts SDK.
## Check the Balance
Enter the account's address, choose Moderato (`chainId=42431`) or mainnet (`chainId=4217`), and select **Try**.
`GET /v1/addresses/{address}/balances`
List address balances
[API reference](https://tempo.com/developers/docs/api/balances#getaddressbalances) — request parameters, authentication, and response schema. The examples below use editable sample values.
**cURL**
```bash
curl 'https://api.tempo.xyz/v1/addresses/0xbe058e1c4df8a4366a387bf595b284246a93039e/balances?chainId=42431'
```
**TypeScript**
```ts
fetch('https://api.tempo.xyz/v1/addresses/0xbe058e1c4df8a4366a387bf595b284246a93039e/balances?chainId=42431')
```
Card and bank funding can land after the wallet or onramp says it's done. A balance shows the total, not which payment arrived. To credit a specific payment, [verify the incoming transfer](https://tempo.com/developers/docs/guide/payments/accept-a-payment) rather than the balance.
## Next Steps
[Receive Payments](https://tempo.com/developers/docs/guide/payments/accept-a-payment): Use for sharing an address and verifying incoming transfers.
[Fund an Account](https://tempo.com/developers/docs/guide/getting-funds): Use for adding a funding button to your app with the Accounts SDK.
[Tempo Routes](https://tempo.com/developers/docs/routes): Use for moving stablecoins from other networks to the account.
> Source: [/docs/accounts/authentication](https://tempo.com/developers/docs/accounts/authentication.md)
> Section: [Accounts](https://tempo.com/developers/docs/accounts.md). Create accounts, set up signing methods, policies, access keys, key rotation, and fees, and follow guides for users, automations, agents, and teams.
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
# Signing Methods
A signing method is the kind of key that approves an account's transactions.
## Overview
A signing method is a passkey, a device key, or a private key. Choose one by who should hold it. A passkey or device key stays with the customer. A private key on your server or with a wallet provider lets that party sign too.
Every method works on mainnet and testnet today. Each can be the one key of a [single-key account](https://tempo.com/developers/docs/accounts/how-it-works#address) or an [access key](https://tempo.com/developers/docs/accounts/access-keys).
Tempo verifies three kinds of signature onchain:
* **secp256k1:** Ethereum wallets use it.
* **P-256:** Device keys and P-256 private keys use it.
* **WebAuthn P-256:** Passkeys use it.
The kind of key decides where it can live and how the holder approves. Its role on the account decides what it can do.
## Methods
[Passkeys](https://tempo.com/developers/docs/accounts/authentication/passkeys): The customer approves with Face ID or a fingerprint. Synced across their devices, and tied to your domain.
[Device Keys](https://tempo.com/developers/docs/accounts/authentication/device-keys): A key the customer's phone, computer, or browser creates and can't export, for payments without a prompt.
[Private Keys](https://tempo.com/developers/docs/accounts/authentication/private-keys): A key in a wallet, a wallet provider, or your KMS or HSM, for servers, treasury approvers, and backups.
## Combining Methods
Each key joins the account in one of two roles:
| Role | What it does |
| --- | --- |
| Signer | Approves with a weight. A transaction runs once the approving signers' weights reach the account's [threshold](https://tempo.com/developers/docs/accounts/policies/signing-thresholds). |
| [Access key](https://tempo.com/developers/docs/accounts/access-keys) | Pays alone within its limits. Never counts toward the threshold. |
Add device keys and server payout keys as access keys. A signer has no spending limit.
:::warning
**Multiple signers arrive on mainnet with the [T14 network upgrade](https://tempo.com/developers/docs/protocol/upgrades/t14).** They are live on [testnet](https://tempo.com/developers/docs/accounts/create#connect-to-testnet) since T14 activated there on November 24, 2026. Mainnet activation is scheduled for December 8, 2026.
:::
Several weighted signers on one account need a configurable account. Tempo has no override. Your app or a provider can approve only with the signers it holds. Set weights so no one but the customer reaches the threshold alone. [Recommended signer setups](https://tempo.com/developers/docs/accounts/policies/signing-thresholds#recommended-signer-setups) gives the weights for customer accounts, embedded wallets, and treasuries.
## Related
[Signing Thresholds](https://tempo.com/developers/docs/accounts/policies/signing-thresholds): Covers signer weights and the threshold a transaction must reach.
[Access Keys](https://tempo.com/developers/docs/accounts/access-keys): Covers keys that pay alone within limits, expiry, and scopes.
[Configurable Accounts](https://tempo.com/developers/docs/development/configurable-accounts): Covers accounts with several weighted signers and a threshold.
[Multisig Signatures](https://tempo.com/developers/docs/development/configurable-accounts#multisig-signature-format): Covers the signature format for a transaction that several signers approve.
> Source: [/docs/accounts/authentication/passkeys](https://tempo.com/developers/docs/accounts/authentication/passkeys.md)
> Section: [Accounts](https://tempo.com/developers/docs/accounts.md). Create accounts, set up signing methods, policies, access keys, key rotation, and fees, and follow guides for users, automations, agents, and teams.
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
# Passkeys
A passkey lets only the customer approve the account's transactions, with Face ID, a fingerprint, or a security key.
## Overview
A passkey is the WebAuthn credential behind passwordless sign-in. It's a P-256 key that stays on the customer's device or security key and signs only when the customer approves. Tempo checks each passkey signature onchain. For payments without a prompt, add a [device key](https://tempo.com/developers/docs/accounts/authentication/device-keys). On a server, use a [private key](https://tempo.com/developers/docs/accounts/authentication/private-keys) instead.
## Supported Authenticators
Passkeys work with Face ID and Touch ID, Windows Hello, an Android screen lock, and security keys such as YubiKey.
Your servers and wallet providers never hold the passkey. Its security rests on the customer's device. A synced passkey also rests on the service that syncs it: iCloud Keychain, Google Password Manager, or a password manager.
## Create a Passkey
In the interactive web page, create a passkey account or reconnect an existing passkey, inspect and copy its address, and disconnect. Creating the account does not move or fund stablecoins.
The demo creates a passkey and shows the single-key account it signs for. On mainnet and testnet today, a passkey can be a single-key account's one key. Losing it loses the account.
:::warning
**Multiple signers arrive on mainnet with the [T14 network upgrade](https://tempo.com/developers/docs/protocol/upgrades/t14).** They are live on [testnet](https://tempo.com/developers/docs/accounts/create#connect-to-testnet) since T14 activated there on November 24, 2026. Mainnet activation is scheduled for December 8, 2026.
:::
On testnet, make the passkey the first signer of a configurable account instead. It approves alone.
```ts [passkey.ts]
import { Account, WebAuthnP256 } from 'viem/tempo'
const credential = await WebAuthnP256.createCredential({ label: 'Acme' }) // [!code hl]
const passkey = Account.fromWebAuthnP256(credential) // [!code hl]
const account = Account.fromConfig({ address: 'infer', owners: [passkey] }) // [!code hl]
```
`account.address` receives stablecoins right away. The account's first transaction registers it onchain. Next, [add a recovery signer](https://tempo.com/developers/docs/accounts/apps/self-custodial-wallets) so a lost passkey doesn't lock the customer out. [Recommended signer setups](https://tempo.com/developers/docs/accounts/policies/signing-thresholds#recommended-signer-setups) gives the weights for customer accounts and treasuries.
## Limits
* A passkey works only on its domain, the relying party ID (`rpId`), and that domain's subdomains. Pick the `rpId`, such as `acme.com`, before customers create passkeys. Pass it to both `WebAuthnP256.createCredential` and `Account.fromWebAuthnP256`.
* WebAuthn returns the public key only at creation. Save `credential.id` and `credential.publicKey`. Pass them to `Account.fromWebAuthnP256` when the customer returns.
* Passkeys work only over HTTPS or on `localhost`. A cancelled or timed-out prompt fails with `NotAllowedError`.
* A passkey on a security key isn't synced, so losing the key loses the signer.
* On mainnet and testnet, a passkey account is a single-key account and can't add a signer or swap its key. A synced passkey survives a lost phone only through its sync provider, such as iCloud Keychain or Google Password Manager. If the customer loses every synced copy, they lose the account and its funds.
## Related
[Device Keys](https://tempo.com/developers/docs/accounts/authentication/device-keys): Covers keys that pay from the customer's device without a prompt.
[Private Keys](https://tempo.com/developers/docs/accounts/authentication/private-keys): Covers keys in a wallet, a wallet provider, or your KMS or HSM.
[Set Up a Self-Custodial Wallet With a Provider](https://tempo.com/developers/docs/accounts/apps/self-custodial-wallets): Use for adding a recovery signer beside the customer's passkey.
[Signing Thresholds](https://tempo.com/developers/docs/accounts/policies/signing-thresholds): Covers signer weights and the threshold a transaction must reach.
> Source: [/docs/accounts/authentication/device-keys](https://tempo.com/developers/docs/accounts/authentication/device-keys.md)
> Section: [Accounts](https://tempo.com/developers/docs/accounts.md). Create accounts, set up signing methods, policies, access keys, key rotation, and fees, and follow guides for users, automations, agents, and teams.
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
# Device Keys
A device key lets the customer's phone, computer, or browser pay without asking the customer to approve each payment.
## Overview
A device key is a P-256 key that the device's own key store creates and never exports. The customer's passkey authorizes it once as an [access key](https://tempo.com/developers/docs/accounts/access-keys). Tempo rejects any payment it signs over its spending limit or after it expires. On a server, use a [private key](https://tempo.com/developers/docs/accounts/authentication/private-keys) in your KMS or HSM instead.
## Key Stores
Each platform keeps device keys in its own key store:
| Platform | Key store |
| --- | --- |
| iPhone, iPad, and Mac | Secure Enclave |
| Android | Android Keystore, backed by StrongBox or other secure hardware where available |
| Windows | TPM, through the Microsoft Platform Crypto Provider |
| Browsers | Non-extractable WebCrypto key, kept in IndexedDB |
Your servers and wallet providers never hold the device key. Anyone who unlocks the device can pay with it, up to its [spending limit](https://tempo.com/developers/docs/accounts/access-keys/spending-limits) and until it [expires](https://tempo.com/developers/docs/accounts/access-keys/expiry). Add a device key as an access key to get that cap. A signer has no spending limit.
## Create a Device Key
In the interactive web page, create a non-extractable P-256 key with WebCrypto, kept in this browser’s IndexedDB, and see that the browser refuses to export it. Fund its test account on testnet from the faucet, pay 1 AlphaUSD with no prompt, reload to see the key restored, then delete it. Each payment is a real testnet transaction.
The demo makes the device key its own account on testnet to show signing without a prompt. Reload the page and the key is still there.
In your app, add the key to the customer's account as an access key instead. The device creates the key. The customer's passkey authorizes it for up to 500 OUSD a day for 30 days. The first payment carries that authorization.
On mainnet and testnet today, a device key can be an access key on a single-key account. That account's one key is the customer's passkey.
:::warning
**Multiple signers arrive on mainnet with the [T14 network upgrade](https://tempo.com/developers/docs/protocol/upgrades/t14).** They are live on [testnet](https://tempo.com/developers/docs/accounts/create#connect-to-testnet) since T14 activated there on November 24, 2026. Mainnet activation is scheduled for December 8, 2026.
:::
This example uses a configurable account with the passkey as its signer. `client.ts` connects to [testnet](https://tempo.com/developers/docs/accounts/create#connect-to-testnet). In `device-key.ts`, `account` is the customer's funded account, built as in [Passkeys](https://tempo.com/developers/docs/accounts/authentication/passkeys#create-a-passkey-signer).
:::code-group
```ts [device-key.ts]
import { parseUnits } from 'viem'
import { Account, Expiry, WebCryptoP256 } from 'viem/tempo'
import { client } from './client'
// A test stablecoin on testnet
const stablecoin = '0x20c0000000000000000000000000000000000001'
// Non-extractable. Save keyPair in IndexedDB so it survives a reload.
const keyPair = await WebCryptoP256.createKeyPair() // [!code hl]
const deviceKey = Account.fromWebCryptoP256(keyPair, { access: account }) // [!code hl]
// approved by the customer's passkey
const keyAuthorization = await client.accessKey.signAuthorization({ // [!code hl]
accessKey: deviceKey, // [!code hl]
account, // [!code hl]
expiry: Expiry.days(30), // [!code hl]
limits: [{ token: stablecoin, limit: parseUnits('500', 6), period: 86_400 }], // [!code hl]
}) // [!code hl]
```
```ts [client.ts]
import { http } from 'viem'
import { tempoModerato } from 'viem/chains'
import { createClient } from 'viem/tempo'
// Tempo testnet. The public RPC needs no key.
export const client = createClient({
chain: tempoModerato,
transport: http(),
})
```
:::
Pass `keyAuthorization` with the device key's first payment, signed by `deviceKey`, as in [Access keys](https://tempo.com/developers/docs/accounts/access-keys#authorize-an-access-key). Later payments need only `deviceKey`.
## Limits
* Each device needs its own key, authorized by the customer's passkey.
* Clearing site data deletes a browser key. Authorize a new one the same way.
* If a device is lost, [revoke its key](https://tempo.com/developers/docs/accounts/access-keys/revocation#revoke-an-access-key). The account's signers don't change.
## Related
[Access Keys](https://tempo.com/developers/docs/accounts/access-keys): Covers keys that pay alone within limits, expiry, and scopes.
[Spending Limits](https://tempo.com/developers/docs/accounts/access-keys/spending-limits): Covers how much of one TIP-20 token an access key can spend.
[Revocation](https://tempo.com/developers/docs/accounts/access-keys/revocation): Use for revoking a lost device's key.
[Passkeys](https://tempo.com/developers/docs/accounts/authentication/passkeys): Covers the customer's passkey, which authorizes each device key.
[Private Keys](https://tempo.com/developers/docs/accounts/authentication/private-keys): Covers keys in a wallet, a wallet provider, or your KMS or HSM.
> Source: [/docs/accounts/authentication/private-keys](https://tempo.com/developers/docs/accounts/authentication/private-keys.md)
> Section: [Accounts](https://tempo.com/developers/docs/accounts.md). Create accounts, set up signing methods, policies, access keys, key rotation, and fees, and follow guides for users, automations, agents, and teams.
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
# Private Keys
Signs for a Tempo account with a key you already hold in a wallet, KMS, or HSM.
## Overview
A private key is a secp256k1 or P-256 key that you hold. It lives in a wallet, a wallet provider, or your KMS or HSM. Tempo verifies each signature onchain. Use one for servers, scripts, treasury approvers, and backups. For a key that stays with the customer, use a [passkey](https://tempo.com/developers/docs/accounts/authentication/passkeys) or a [device key](https://tempo.com/developers/docs/accounts/authentication/device-keys) instead.
## Key Roles
Add each key as a signer or as an [access key](https://tempo.com/developers/docs/accounts/access-keys). A signer approves toward the account's [threshold](https://tempo.com/developers/docs/accounts/policies/signing-thresholds). An access key pays alone within its limits.
| Where the key lives | Add it as |
| --- | --- |
| CLI wallet, such as the [Tempo CLI wallet](https://tempo.com/developers/docs/cli/wallet) or Foundry `cast` | Access key for scripts and agents |
| Hardware, browser, or mobile wallet | Signer at weight 1, one per approver |
| [Wallet provider](https://tempo.com/developers/docs/accounts/apps/self-custodial-wallets), such as Turnkey or Privy | Signer at weight 1. The provider signs only when its own policies allow. |
| Cloud KMS or HSM | Signer for recovery, or access key for [backend payouts](https://tempo.com/developers/docs/accounts/automations/pay-out-from-a-backend) |
Anyone who can make the key sign approves at its weight, including anyone with signing access in your KMS. That lasts until you [remove the key](https://tempo.com/developers/docs/accounts/account-configuration/configuration-updates#remove-a-lost-or-compromised-signer).
## Add a Private Key
On mainnet and testnet today, a private key can be a single-key account's one key. That works like a standard Ethereum account. It can also be an access key on that account.
:::warning
**Multiple signers arrive on mainnet with the [T14 network upgrade](https://tempo.com/developers/docs/protocol/upgrades/t14).** They are live on [testnet](https://tempo.com/developers/docs/accounts/create#connect-to-testnet) since T14 activated there on November 24, 2026. Mainnet activation is scheduled for December 8, 2026.
:::
Signers need a configurable account, so this example runs only on testnet. Give each key a weight below the threshold, so no single holder can pay alone. Keep each approver's key in its own wallet or HSM. Here both signers must approve.
```ts [treasury.ts]
import { Account } from 'viem/tempo'
const finance = Account.fromSecp256k1(process.env.FINANCE_SIGNER_KEY as `0x${string}`)
const operations = Account.fromSecp256k1(process.env.OPERATIONS_SIGNER_KEY as `0x${string}`)
const account = Account.fromConfig({ // [!code hl]
// derive the address from these first signers
address: 'infer', // [!code hl]
// weight 1 each
owners: [finance, operations], // [!code hl]
threshold: 2, // [!code hl]
}) // [!code hl]
```
The example reads raw keys from the environment. To keep a key in its wallet, KMS, HSM, or provider, pass the Viem account that source provides. For a raw P-256 key, use `Account.fromP256`.
## Limits
* A signer has no spending limit. To cap what a key can pay, make it an access key instead.
* Signers don't control the account's address on other chains. To [recover funds sent there](https://tempo.com/developers/docs/accounts/account-configuration#recover-funds-sent-on-another-chain), create the account from a fresh key that upgrades it.
## Related
[Signing Thresholds](https://tempo.com/developers/docs/accounts/policies/signing-thresholds): Covers signer weights and the threshold a transaction must reach.
[Access Keys](https://tempo.com/developers/docs/accounts/access-keys): Covers keys that pay alone within limits, expiry, and scopes.
[Set Up a Team Multisig](https://tempo.com/developers/docs/accounts/custodians/team-multisig): Use for a treasury where any two of three approvers sign each payment.
[Configuration Updates](https://tempo.com/developers/docs/accounts/account-configuration/configuration-updates): Use for removing a lost or compromised signer.
> Source: [/docs/accounts/policies](https://tempo.com/developers/docs/accounts/policies.md)
> Section: [Accounts](https://tempo.com/developers/docs/accounts.md). Create accounts, set up signing methods, policies, access keys, key rotation, and fees, and follow guides for users, automations, agents, and teams.
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
# Account Policies
Enforces onchain who can move an account's funds and who can pay it.
## Overview
A policy is a rule Tempo enforces onchain for an account, so your app doesn't have to.
A Tempo account has two policies, one for each direction money moves. A [signing threshold](https://tempo.com/developers/docs/accounts/policies/signing-thresholds) covers funds going out. A [receive policy](https://tempo.com/developers/docs/accounts/policies/receive-policies) covers payments coming in.
## Policy Checks
Tempo checks each policy onchain:
* **Outgoing Funds:** Tempo checks the signing threshold on every transaction the account sends.
* **Incoming Funds:** Tempo checks the receive policy on every transfer and mint to the account.
No one can skip either check, including your app, your wallet provider, Tempo, a breached backend, or a buggy client.
## Combined Policies
The two policies work independently. Without a receive policy, an account accepts every transfer the token itself allows. Add one only when the account must refuse some stablecoins or senders.
Spending limits aren't a policy. They belong to [access keys](https://tempo.com/developers/docs/accounts/access-keys), which pay alone within their limits and never count toward the threshold.
## Related
[Signing Thresholds](https://tempo.com/developers/docs/accounts/policies/signing-thresholds): Covers who can move funds out, through signer weights and a threshold. Testnet until T14 reaches mainnet.
[Receive Policies](https://tempo.com/developers/docs/accounts/policies/receive-policies): Covers which stablecoins and senders can pay the account, and how Tempo holds the rest.
[Access Keys](https://tempo.com/developers/docs/accounts/access-keys): Covers keys that pay alone within their spending limits.
> Source: [/docs/accounts/policies/signing-thresholds](https://tempo.com/developers/docs/accounts/policies/signing-thresholds.md)
> Section: [Accounts](https://tempo.com/developers/docs/accounts.md). Create accounts, set up signing methods, policies, access keys, key rotation, and fees, and follow guides for users, automations, agents, and teams.
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
# Signing Thresholds
Sets the total signer weight a transaction needs before a configurable account can pay.
## Overview
A signing threshold is the [account policy](https://tempo.com/developers/docs/accounts/policies) that decides who controls a configurable Tempo account. Each signer is a key with a weight. A transaction runs only when the signers who approve it reach the threshold in total weight.
:::warning
**Multiple signers arrive on mainnet with the [T14 network upgrade](https://tempo.com/developers/docs/protocol/upgrades/t14).** They are live on [testnet](https://tempo.com/developers/docs/accounts/create#connect-to-testnet) since T14 activated there on November 24, 2026. Mainnet activation is scheduled for December 8, 2026.
:::
## Signer Weights
Take a customer account at threshold 2. Its passkey has weight 2, and a backup key and a recovery provider's key have weight 1 each:
```ts [threshold.ts]
import { Account } from 'viem/tempo'
const account = Account.fromConfig({
address: 'infer', // derive the address from these first signers
owners: [ // [!code hl]
{ owner: passkey.address, weight: 2 }, // [!code hl]
{ owner: backup.address, weight: 1 }, // [!code hl]
{ owner: recovery.address, weight: 1 }, // [!code hl]
], // [!code hl]
threshold: 2, // [!code hl]
})
```
The passkey approves alone. The backup and recovery keys approve together. Either of those alone reaches 1 of 2 and can't pay.
Signers approve a whole transaction at once, including every call in a batch. The same threshold covers payments, configuration updates, and new [access keys](https://tempo.com/developers/docs/accounts/access-keys). Access keys don't count toward it. Each pays alone within its limits.
To change signers or the threshold, send a [configuration update](https://tempo.com/developers/docs/accounts/account-configuration/configuration-updates#add-a-signer), approved at the current threshold.
## Theft and Loss
A signer can be stolen or lost, such as when a key leaks, a phone breaks, or an approver leaves. Weights that survive both meet two tests:
* **Theft:** No single party reaches the threshold alone, unless that party is the customer.
* **Loss:** The other signers still reach the threshold without any one of them ([plan for recovery](https://tempo.com/developers/docs/accounts/account-configuration#plan-for-recovery)).
Two keys in the same KMS belong to one party. So do a wallet provider's key and a recovery key it also runs. That party approves with the keys' combined weight.
## Recommended Setups
| Setup | Signers (weight) | Threshold | Who can approve |
| --- | --- | --- | --- |
| [Getting started](https://tempo.com/developers/docs/accounts/apps/self-custodial-wallets) | Passkey (1), backup key (1) | 1 | Either one |
| [Customer accounts](https://tempo.com/developers/docs/accounts/apps/self-custodial-wallets) | Passkey (2), backup key (1), recovery provider (1) | 2 | The passkey, or both keys |
| [Self-custodial wallets with a provider](https://tempo.com/developers/docs/accounts/apps/self-custodial-wallets) | Customer's passkey (1), your wallet provider's key (1), customer's backup key (1) | 2 | Any two: the passkey and the provider day to day, or the customer's two keys without you |
| [Team multisig](https://tempo.com/developers/docs/accounts/custodians/team-multisig) | Three approvers (1 each) | 2 | Any two |
A recovery provider holds one key to help replace a lost signer. It's any party other than the customer and your wallet provider. It can be a key in your own KMS or a recovery service you contract. Tempo doesn't limit a signer to recovery. Any signers that reach the threshold together can also pay and send configuration updates.
Getting started survives a lost passkey, but either key can pay alone. Keep both keys with the customer, and move to customer accounts before balances grow.
To let a team spend without lowering the treasury's threshold, [give the team a budget](https://tempo.com/developers/docs/accounts/custodians/team-multisig). The treasury authorizes the team's own account as an access key. The team's signers then approve payments within that budget.
## Collect Approvals
Each signer's key stays with its holder:
| Signer | Where the key stays |
| --- | --- |
| Passkey | The customer's device |
| Backup key | The customer's hardware wallet |
| Recovery key | The [recovery provider](https://tempo.com/developers/docs/accounts/policies/signing-thresholds#recovery-provider), such as your KMS |
Tempo stores only a hash of the account's configuration, which covers its signers, weights, threshold, and version. Tempo checks approvals against that hash but can't read the configuration back. When your app creates the account, save `account.address` and `account.config` with the account record, `saved`.
Before each transaction, rebuild the account from the latest saved record. The examples call that helper [`openAccount`](https://tempo.com/developers/docs/accounts/apps/self-custodial-wallets). It passes `saved` to `Account.fromConfig` with the approving keys on this device in place of their addresses. It uses `address: 'infer'` until the first configuration update, then the saved address.
A configuration update raises the configuration's version. After it succeeds, save `AccountConfig.update(saved.config, nextConfig)`. Tempo checks every later transaction against the new hash. An account built from the old configuration fails with `multisig configuration commitment mismatch`.
When the keys on one device reach the threshold, attach them and send the transaction as usual. Here the customer's passkey reaches the threshold alone, so the payment runs in the customer's browser. `client.ts` connects to [testnet](https://tempo.com/developers/docs/accounts/create#connect-to-testnet).
:::code-group
```ts [pay.ts]
import { client } from './client'
await client.token.transferSync({ account: openAccount([passkey]), amount, to, token }) // [!code hl]
```
```ts [client.ts]
import { http } from 'viem'
import { tempoModerato } from 'viem/chains'
import { createClient } from 'viem/tempo'
// Tempo testnet. The public RPC needs no key.
export const client = createClient({
chain: tempoModerato,
transport: http(),
})
```
:::
`passkey` is the customer's passkey account, such as `Account.fromWebAuthnP256(credential)`. Viem signs with the attached keys, highest weight first, until their weights reach the threshold. If they fall short, it throws `Local owners do not meet the threshold.` and sends nothing.
### Approvers on Separate Devices
When no single device holds enough weight, collect approvals across devices. Your app prepares the transaction once. Each approver signs it on their own device. Your app submits it with their approvals. Here the backup key and the recovery provider's key approve together:
```ts [approve.ts]
import { Actions } from 'viem/tempo'
import { client } from './client'
// 1. Your app: prepare the payment once, from the account with no keys attached.
const request = await client.prepareTransactionRequest({ // [!code hl]
account: openAccount([]), // [!code hl]
calls: [Actions.token.transfer.call({ amount, to, token })], // [!code hl]
}) // [!code hl]
// 2. Each approver signs the same request on their own device: the backup key, then the recovery provider.
const backupApproval = await client.signTransaction({ ...request, account: backup }) // [!code hl]
const recoveryApproval = await client.signTransaction({ ...request, account: recovery }) // [!code hl]
// 3. Your app: submit the same request with the approvals.
const receipt = await client.sendTransactionSync({ ...request, signatures: [backupApproval, recoveryApproval] }) // [!code hl]
```
For a configurable account, `signTransaction` returns the signer's approval rather than a signed transaction. An approval covers the exact transaction, the account, and the configuration version. Show each approver what they're approving, such as the recipient and amount. Send every approver the same `request`. Submit the request unchanged. The request contains bigints, so move it between devices in an encoding that keeps them.
Approvals can arrive in any order. Viem sorts them by signer address when it combines them. Submit only the approvals the threshold needs. For this account, that's the passkey's approval alone, or the backup and recovery approvals together. Tempo adds up approvals in signer-address order. It rejects the transaction with `excess multisig owner signatures` if any approval comes after the total reaches the threshold. Too few fail with `multisig signature weight below threshold`.
An approval also covers the transaction's nonce, its place in the account's sequence of transactions. If another transaction from the account lands first, submitting fails with `nonce too low`, so prepare again and collect new approvals. To keep slow approvals valid while the account keeps paying, pass `prepareTransactionRequest` its own `nonceKey`. Use a random `bigint` from `1n` to `2n ** 256n - 2n`, which starts a [separate sequence](https://tempo.com/developers/docs/guide/tempo-transaction#concurrent-transactions) for this transaction. The maximum `uint256` selects an [expiring nonce](https://tempo.com/developers/docs/guide/tempo-transaction#expiring-nonces) instead.
A configuration update works the same way. Put `Actions.accounts.updateConfig.call({ currentConfig: saved.config, nextConfig })` in `calls`, and collect approvals from the current signers. Set `throwOnReceiptRevert: true` when sending it, and save `AccountConfig.update(saved.config, nextConfig)` only after success. An update voids approvals collected under the old configuration, so collect those again.
## Verify in a Contract
A registered account answers ERC-1271 `isValidSignature`, so Permit2 and other contracts that check signatures that way accept its signers' approvals unchanged. A contract can also call `verifyConfigurableAccount` directly. It's on the [signature verifier](https://tempo.com/developers/docs/development/configurable-accounts#verify-owner-approvals-in-a-contract), a contract built into Tempo at `0x5165300000000000000000000000000000000000`. Like configurable accounts, `verifyConfigurableAccount` exists on testnet now and reaches mainnet with T14. On mainnet until then, the call reverts with `UnknownFunctionSelector`.
```solidity [ApprovalCheck.sol]
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.24;
interface ISignatureVerifier {
function verifyConfigurableAccount(address account, bytes32 hash, bytes calldata signature) external view returns (bool);
}
contract ApprovalCheck {
ISignatureVerifier constant VERIFIER = ISignatureVerifier(0x5165300000000000000000000000000000000000);
function isApproved(address account, bytes32 hash, bytes calldata signature) external view returns (bool) {
return VERIFIER.verifyConfigurableAccount(account, hash, signature); // [!code hl]
}
}
```
`verifyConfigurableAccount` checks the account's signers at call time, so approvals from removed signers fail. An account that hasn't sent a transaction yet verifies against its first signers. The call returns `false` when the signers don't match the account. It reverts with `InvalidSignature()` when approvals fall short. Include your chain ID, contract address, and the account in `hash`, so an approval can't be replayed elsewhere.
To check a single access key's signature instead, call `verifyKeychain`. It also works on mainnet and testnet. It accepts only access keys that sign with one key. A call for a configurable account signing as an access key, such as a team budget, reverts with `InvalidFormat()`.
## Limits
| Limit | Value |
| --- | --- |
| Signers per account | 1 to 48 |
| Weight per signer | At least 1 |
| Total weight | Up to 255 |
| Approvals per transaction | Up to 8, so the eight largest weights must reach the threshold |
## Related
[Account Policies](https://tempo.com/developers/docs/accounts/policies): Covers how signing thresholds and receive policies work together.
[Configuration Updates](https://tempo.com/developers/docs/accounts/account-configuration/configuration-updates#add-a-signer): Use for changing signers, weights, or the threshold.
[Set Up a Self-Custodial Wallet With a Provider](https://tempo.com/developers/docs/accounts/apps/self-custodial-wallets): Use for building customer accounts with a wallet provider and a backup key.
[Set Up a Team Multisig](https://tempo.com/developers/docs/accounts/custodians/team-multisig): Use for a team account and team budgets.
> Source: [/docs/accounts/policies/receive-policies](https://tempo.com/developers/docs/accounts/policies/receive-policies.md)
> Section: [Accounts](https://tempo.com/developers/docs/accounts.md). Create accounts, set up signing methods, policies, access keys, key rotation, and fees, and follow guides for users, automations, agents, and teams.
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
# Receive Policies
Controls which stablecoins an address accepts and who can pay it.
## Overview
A receive policy controls which stablecoins an address accepts and who can pay it. It's one of a Tempo account's two [policies](https://tempo.com/developers/docs/accounts/policies), and it works on any account on mainnet and testnet.
A regulated business uses one to accept payments only from verified senders. An exchange uses one to accept only the stablecoins it lists. A blocked payment doesn't fail. Tempo holds the funds until the recovery authority you name claims them.
## Policy Parts
Each address sets its policy in the [TIP-403](https://tempo.com/developers/docs/protocol/tip403/spec) registry. Tokens use the same registry of allowlists and blocklists to restrict transfers. The policy has three parts:
| Part | Decides | Set it to |
| --- | --- | --- |
| Token filter | Which stablecoins the address accepts | Built-in policy `1` (allow all) or `0` (reject all), or a `WHITELIST` or `BLACKLIST` policy of token contract addresses |
| Sender policy | Who can pay the address | The same options, with sender addresses as members |
| Recovery authority | Who can claim held payments | `address(0)` for the payment's sender or minter, the receiver's own address, or another address |
Neither the token filter nor the sender policy can be a `COMPOUND` policy. An address with no receive policy accepts every transfer and mint the token itself allows.
## Blocked Payments
Every TIP-20 transfer and mint to the address runs through its receive policy:
* **The Token's Own Policy Rejects It:** The call reverts and nothing moves.
* **The Receive Policy Rejects It:** The transaction succeeds, but Tempo holds the funds in `ReceivePolicyGuard`, a system contract, instead of crediting the receiver. The recovery authority can [claim them](https://tempo.com/developers/docs/accounts/policies/receive-policies#claim-blocked-receipts).
* **Both Accept It:** Tempo credits the receiver.
A payment to a [virtual address](https://tempo.com/developers/docs/accounts/virtual-addresses) is checked against its master address's policy. A virtual address can't set its own, so set the policy on the master.
A held payment looks like a success. The token still emits its usual `Transfer` event, but that event's recipient is `ReceivePolicyGuard`, not the receiver. Credit a payment only when the confirmed event names the receiver.
## Set a Receive Policy
**Interactive demo: Hold and recover a payment**
1. Create a temporary testnet account, accept AlphaUSD, hold BetaUSD, and recover the blocked payment.
The demo and the steps in this section run on testnet. The steps set the same policy in code: accept only one stablecoin, from any sender, and let the receiver claim held payments. `client.ts` connects to [testnet](https://tempo.com/developers/docs/accounts/create#connect-to-testnet).
`account` is the receiving account, such as one from [Create an account](https://tempo.com/developers/docs/accounts/create). `receiver` is its address. `stablecoin` is `0x20c0000000000000000000000000000000000001`, a test stablecoin on testnet. Fund the receiver from the [testnet faucet](https://tempo.com/developers/docs/accounts/create#fund-an-account-on-testnet) first, because each transaction pays a network fee.
The steps use Viem. From Wagmi, create the allowlist with `Hooks.policy.useCreateSync` from `wagmi/tempo`. Make the other calls with `useWriteContract` or `useReadContract`, using `Abis` and `Addresses` from `viem/tempo`. From the CLI, call the TIP-403 registry at `0x403c000000000000000000000000000000000000` with `cast`:
* `createPolicyWithAccounts(address,uint8,address[])`. Policy type `0` is whitelist, and the new policy ID is `topics[1]` of the `PolicyCreated` log.
* `setReceivePolicy(uint64,uint64,address)`.
* `validateReceivePolicy(address,address,address)(bool,uint8)`.
Claim with `claim(address,bytes)` on `ReceivePolicyGuard`.
::::steps
### Create a Token Allowlist
Create a `WHITELIST` policy whose only member is the stablecoin's token contract address:
:::code-group
```ts [token-filter.ts]
import { client } from './client'
const { policyId: tokenPolicyId } = await client.policy.createSync({
account,
type: 'whitelist', // [!code hl]
addresses: [stablecoin], // [!code hl]
})
```
```ts [client.ts]
import { http } from 'viem'
import { tempoModerato } from 'viem/chains'
import { createClient } from 'viem/tempo'
// Tempo testnet. The public RPC needs no key.
export const client = createClient({
chain: tempoModerato,
transport: http(),
})
```
:::
[`policy.create`](https://viem.sh/tempo/actions/policy.create) also creates `blacklist` policies and policies with no members.
### Set the Receive Policy
Call `setReceivePolicy` from the receiving account with the sender policy, token filter, and recovery authority, in that order:
```ts [set-policy.ts]
import { client } from './client'
await client.receivePolicy.setSync({
account,
senderPolicyId: 'allow-all', // [!code hl]
tokenPolicyId, // [!code hl]
claimer: 'self', // [!code hl]
})
```
The sender policy here is built-in policy `1` (`'allow-all'` in Viem), so anyone can pay. To limit who can pay, create a sender allowlist the same way as the token allowlist. Give it sender addresses as members, and pass its ID instead.
Viem's [`receivePolicy.set`](https://viem.sh/tempo/actions/receivePolicy.set) calls the token filter `tokenPolicyId` and the recovery authority `claimer`. Set `claimer` to `'self'` for the signing account, `'sender'` for `address(0)`, or another address.
Changing the [recovery authority](https://tempo.com/developers/docs/protocol/tip403/receive-policies#receive-policy-configuration) affects only payments held afterward. Existing receipts keep the authority they were held under.
::::
## Check Before Sending
Ask whether the receiver's policy accepts a token from a sender. `sender` is the paying address:
```ts [validate.ts]
import { client } from './client'
const { authorized, blockedReason } = await client.receivePolicy.validate({ // [!code hl]
token: stablecoin, sender, receiver, // [!code hl]
}) // [!code hl]
```
The answer covers only the receive policy. It doesn't cover the token's own policy, the sender's balance, or the rest of the transaction. The policy can also change before the payment executes, so a passing check isn't a credited payment.
## Claim a Held Payment
The recovery authority claims a held payment by passing a destination and the `receipt` bytes from its `TransferBlocked` event. You can't list held payments onchain, so index the guard's events. This query finds the `TransferBlocked` events for an address and marks each payment `held`, `claimed`, or `burned`:
Save this query as `query.sql` and run it against the public Tempo mainnet indexer (chain ID 4217).
```sql
SELECT
multiIf(
(token, blockedNonce) IN (SELECT token, blockedNonce FROM ReceiptClaimed), 'claimed',
(token, blockedNonce) IN (SELECT token, blockedNonce FROM ReceiptBurned), 'burned',
'held'
) AS status,
token, blockedNonce, amount, block_num, tx_hash
FROM TransferBlocked
WHERE receiver = '0xec0eca588024e2d0091e74bd9034ff581111ea7f'
ORDER BY block_num DESC
LIMIT 10
```
```bash
curl --get "https://indexer.tempo.xyz/query" \
--data-urlencode "chainId=4217" \
--data-urlencode "engine=clickhouse" \
--data-urlencode "signature=TransferBlocked(address indexed token, address indexed receiver, uint64 indexed blockedNonce, uint256 amount, uint8 receiptVersion, bytes receipt)" \
--data-urlencode "signature=ReceiptClaimed(address indexed token, address indexed receiver, uint64 indexed blockedNonce, uint64 blockedAt, uint8 receiptVersion, address originator, address recipient, address recoveryAuthority, address caller, address to, uint256 amount)" \
--data-urlencode "signature=ReceiptBurned(address indexed token, address indexed receiver, uint64 indexed blockedNonce, uint64 blockedAt, uint8 receiptVersion, address originator, address recipient, address recoveryAuthority, address caller, uint256 amount)" \
--data-urlencode "sql@query.sql"
```
Here the receiver claims a held payment to itself. `blockedReceipt` holds those `receipt` bytes:
```ts [claim.ts]
import { client } from './client'
await client.receivePolicy.claimSync({ account, to: receiver, receipt: blockedReceipt }) // [!code hl]
```
A claim releases the receipt's full amount. Partial claims aren't supported. When a recovery authority other than `address(0)` claims back to the receiver, Tempo doesn't recheck the receive policy. The payment completes under the token's own policy. Claim only payments your application has approved. Every other claim, including any claim under an `address(0)` recovery authority, is a reroute with extra checks.
The token's issuer can instead [burn a held payment](https://tempo.com/developers/docs/protocol/tip403/receive-policies#claims). It calls `burnBlockedReceipt` from an account with the token's `BURN_BLOCKED_ROLE`. The burn works only while the token's own policy bars the receipt's subject from sending. The subject is the payment's sender or minter under an `address(0)` recovery authority, and the receiver otherwise.
## Related
[Account Policies](https://tempo.com/developers/docs/accounts/policies): Covers how receive policies and signing thresholds work together.
[TIP-403 Receive Policies](https://tempo.com/developers/docs/protocol/tip403/receive-policies): Covers receive policy configuration, claims, and burns in the protocol.
[Tempo Policy Registry (TIP-403) Specification](https://tempo.com/developers/docs/protocol/tip403/spec): Covers the registry of allowlists and blocklists.
[Virtual Addresses](https://tempo.com/developers/docs/accounts/virtual-addresses): Covers addresses that use their master address's receive policy.
> Source: [/docs/accounts/access-keys](https://tempo.com/developers/docs/accounts/access-keys.md)
> Section: [Accounts](https://tempo.com/developers/docs/accounts.md). Create accounts, set up signing methods, policies, access keys, key rotation, and fees, and follow guides for users, automations, agents, and teams.
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
# Access Keys
Lets a customer's phone, your backend, or an AI agent pay without the account's signers approving each payment.
## Overview
An access key signs transactions from an account's address and pays from its balance. The account's signers authorize it once. From then on, the key signs by itself. Tempo checks the key's bounds on every transaction, so a leaked key spends only what those bounds allow.
An access key holds no funds itself. The account stores only the key's address, type, and bounds, never its private key.
Access keys work on mainnet and testnet with a [single-key account](https://tempo.com/developers/docs/accounts/how-it-works#address). Access keys on a configurable account run on testnet now and reach mainnet with [T14](https://tempo.com/developers/docs/protocol/upgrades/t14) on December 8, 2026.
## Signers
An access key isn't a signer:
* **No Threshold Weight:** It never counts toward the [signing threshold](https://tempo.com/developers/docs/accounts/policies/signing-thresholds), so it can't change the account's signers.
* **Survives Signer Changes:** Changing a configurable account's signers leaves every access key in place.
## Bounds
Each key carries up to three bounds: a spending limit, scopes, and an expiry. Every bound is optional. Leaving one out removes that check. A key without scopes can call any contract, so give a backend, agent, or [card program](https://tempo.com/developers/docs/accounts/automations/pay-from-an-embedded-wallet) key all three.
[Spending Limits](https://tempo.com/developers/docs/accounts/access-keys/spending-limits): Cap how much of each stablecoin the key can spend, in total or per period.
[Scopes](https://tempo.com/developers/docs/accounts/access-keys/scopes): Limit which contracts and functions the key can call, and whom it can pay.
[Expiry](https://tempo.com/developers/docs/accounts/access-keys/expiry): Set when the key stops working. You can replace a key, not extend it.
[Revocation](https://tempo.com/developers/docs/accounts/access-keys/revocation): Stop a key immediately, and clean up what it left behind.
## Key Types
Give each device, service, agent, or team its own key, so you can revoke one without touching the rest. The key type depends on where its holder signs.
| Holder | Key type |
| --- | --- |
| A customer's browser or phone | A P-256 [device key](https://tempo.com/developers/docs/accounts/authentication/device-keys) the device can't export, or a WebAuthn [passkey](https://tempo.com/developers/docs/accounts/authentication/passkeys) |
| Your backend or an [AI agent](https://tempo.com/developers/docs/accounts/automations/give-an-agent-a-wallet) | A P-256 key it generates, or a secp256k1 key in your [KMS or HSM](https://tempo.com/developers/docs/accounts/automations/pay-out-from-a-backend#keep-the-key-in-your-kms) |
| A wallet | A secp256k1 key |
| A [team](https://tempo.com/developers/docs/accounts/custodians/team-multisig) | A configurable account, whose own signers and threshold approve as the key. Testnet until [T14](https://tempo.com/developers/docs/protocol/upgrades/t14) reaches mainnet. |
## Try It
The demo authorizes a key with a daily limit and pays with it. Tempo rejects a payment over the limit, then the demo revokes the key.
In the interactive web page, create a test account on testnet whose signer is a non-extractable P-256 key in this browser, fund it with test AlphaUSD from the testnet faucet, authorize a second non-extractable P-256 browser key as an access key with a 10 AlphaUSD daily limit, a one-hour expiry, and transfers only, pay 2 AlphaUSD with it, attempt a 20 AlphaUSD payment that Tempo rejects, and revoke the key. Each step is a real testnet transaction.
## Authorize a Key
Enough signers to reach the threshold sign a key authorization. It's a message that names the key and its bounds. Submit it in one of two ways:
* **With the Key's First Payment:** `signAuthorization` returns a `keyAuthorization` that travels with the first transaction the key signs. The key stays authorized even if that transaction's calls revert.
* **On Its Own:** `authorizeSync` sends the authorization in a separate transaction, before the key pays.
This example takes the first path. A new account's signer gives a payout key 10 OUSD for one hour, payable to one recipient.
`account.ts` is the configurable account with one signer from [Create an account](https://tempo.com/developers/docs/accounts/create#create-an-account-in-code). The [testnet faucet](https://tempo.com/developers/docs/accounts/create#fund-an-account-on-testnet) funds it. `client.ts` connects to [testnet](https://tempo.com/developers/docs/accounts/create#connect-to-testnet). To run the example with a single-key account, set `account` to that signer. It also runs on mainnet when you connect `client` to [mainnet](https://tempo.com/developers/docs/quickstart/connection-details#mainnet).
:::code-group
```ts [access-keys.ts]
import { parseUnits } from 'viem'
import { Account, Expiry, P256 } from 'viem/tempo'
import { account } from './account'
import { client } from './client'
export { account }
// A test stablecoin on testnet
export const stablecoin = '0x20c0000000000000000000000000000000000001'
export const recipient = process.env.TEMPO_RECIPIENT as `0x${string}`
export const accessKey = Account.fromP256(P256.randomPrivateKey(), { access: account }) // [!code hl]
const keyAuthorization = await client.accessKey.signAuthorization({ // [!code hl]
accessKey, // [!code hl]
account, // [!code hl]
expiry: Expiry.hours(1), // [!code hl]
limits: [{ token: stablecoin, limit: parseUnits('10', 6), period: 0 }], // [!code hl]
scopes: [{ address: stablecoin, recipients: [recipient], selector: 'transfer(address,uint256)' }], // [!code hl]
}) // [!code hl]
await client.token.transferSync({
account: accessKey,
amount: parseUnits('2', 6),
keyAuthorization, // [!code hl]
to: recipient,
token: stablecoin,
})
```
```ts [client.ts]
import { http } from 'viem'
import { tempoModerato } from 'viem/chains'
import { createClient } from 'viem/tempo'
// Tempo testnet. The public RPC needs no key.
export const client = createClient({
chain: tempoModerato,
transport: http(),
})
```
:::
The other pages in this section import `account`, `accessKey`, `stablecoin`, and `recipient` from this file. To confirm the key landed, read it back with `client.accessKey.getMetadata({ account, accessKey })`.
Tempo stores each limit and scope with the key, so each one adds to the network fee for authorizing it. This example's authorization and first payment cost under a cent together.
To cancel a signed authorization before anyone submits it, sign it with a 32-byte [`witness`](https://viem.sh/tempo/guides/access-keys/witnesses). Burning the witness cancels the authorization. Viem's [Authorize access keys](https://viem.sh/tempo/guides/access-keys/authorize) guide shows both.
## Revoke and Audit
[Revoke](https://tempo.com/developers/docs/accounts/access-keys/revocation) a key to end it permanently, for example when a device is lost or a service is retired. Payments the key already made stay final, and its token approvals stay until you set them to zero.
Tempo emits `KeyAuthorized` when an account adds a key and `KeyRevoked` when it revokes one. The [public indexer](https://tempo.com/developers/docs/api/indexer-api) lists every key an account has had from these events. Replace the address with your account's.
Save this query as `query.sql` and run it against the public Tempo mainnet indexer (chain ID 4217).
```sql
SELECT 'authorized' AS event, publicKey AS access_key, expiry, block_num, tx_hash
FROM KeyAuthorized
WHERE account = '0x6028375ea6ae3339b16f29b343f8f32f7bb3ee8a'
UNION ALL
SELECT 'revoked' AS event, publicKey AS access_key, NULL AS expiry, block_num, tx_hash
FROM KeyRevoked
WHERE account = '0x6028375ea6ae3339b16f29b343f8f32f7bb3ee8a'
ORDER BY block_num DESC
LIMIT 20
```
```bash
curl --get "https://indexer.tempo.xyz/query" \
--data-urlencode "chainId=4217" \
--data-urlencode "engine=clickhouse" \
--data-urlencode "signature=KeyAuthorized(address indexed account, address indexed publicKey, uint8 signatureType, uint64 expiry)" \
--data-urlencode "signature=KeyRevoked(address indexed account, address indexed publicKey)" \
--data-urlencode "sql@query.sql"
```
## Limits
* An access key can't create a contract at the top level of a transaction ([scope limits](https://tempo.com/developers/docs/accounts/access-keys/scopes#scope-limits)).
* All of an account's transactions share one sequence number (nonce) by default, whichever key signs them. They land in order. To send payments concurrently, use expiring nonces or separate nonce keys ([parallel payments](https://tempo.com/developers/docs/guide/payments/send-parallel-transactions)).
* Calls that authorize, change, or revoke keys must come from the account's own transaction (`msg.sender == tx.origin`), not through a contract.
The [Account Keychain specification](https://tempo.com/developers/docs/protocol/transactions/AccountKeychain) defines these rules in full.
## Related
[Pay Out From a Backend](https://tempo.com/developers/docs/accounts/automations/pay-out-from-a-backend): Use for paying out from a server with a bounded access key.
[Give an Agent a Wallet](https://tempo.com/developers/docs/accounts/automations/give-an-agent-a-wallet): Use for letting an AI agent pay within limits you set.
[Pay From a User's Embedded Wallet](https://tempo.com/developers/docs/accounts/automations/pay-from-an-embedded-wallet): Use for card programs and other payments from a user's embedded wallet.
[Account Keychain Precompile](https://tempo.com/developers/docs/protocol/transactions/AccountKeychain): Covers the contract that stores access keys and enforces their bounds.
> Source: [/docs/accounts/access-keys/spending-limits](https://tempo.com/developers/docs/accounts/access-keys/spending-limits.md)
> Section: [Accounts](https://tempo.com/developers/docs/accounts.md). Create accounts, set up signing methods, policies, access keys, key rotation, and fees, and follow guides for users, automations, agents, and teams.
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
# Spending Limits
Caps how much of one TIP-20 token an access key can spend, such as 500 OUSD a day.
## Overview
A spending limit caps how much of one TIP-20 token an [access key](https://tempo.com/developers/docs/accounts/access-keys) can spend. It's one of the key's three bounds, with [expiry](https://tempo.com/developers/docs/accounts/access-keys/expiry) and [scopes](https://tempo.com/developers/docs/accounts/access-keys/scopes). Tempo reverts any transaction that would take the key over its limit.
A limit is either one-time or renews each period. To control where the money goes, use scopes.
## Counted Outflows
A spending limit covers every TIP-20 outflow in a transaction the key signs:
* **Transfers:** Tokens the key sends count.
* **Approvals:** Approval increases count, so the key can't let a contract pull more than its limit.
* **Fees:** Fees the account pays count, unless a [fee payer](https://tempo.com/developers/docs/accounts/fees/fee-sponsorship) sponsors them.
* **Precompile Pulls:** Tokens that Tempo's built-in contracts (precompiles) pull from the account count.
* **Burns:** Since T12, tokens burned from the account with `burnAt` count.
Assets other than TIP-20 tokens, such as NFTs, don't count. A `transferFrom` that spends an allowance the account already granted doesn't count either. A transaction that would go over the remaining limit reverts entirely with [`SpendingLimitExceeded`](https://tempo.com/developers/docs/protocol/transactions/AccountKeychain#error-spendinglimitexceeded).
## Set a Limit
Pass `limits` when you [authorize the key](https://tempo.com/developers/docs/accounts/access-keys#authorize-an-access-key) with Viem's [`accessKey.authorize`](https://viem.sh/tempo/actions/accessKey.authorize) or [`accessKey.signAuthorization`](https://viem.sh/tempo/actions/accessKey.signAuthorization). Each entry covers one token, with the amount in base units (most USD stablecoins have 6 decimals). For example, `{ token: stablecoin, limit: parseUnits('500', 6), period: 86_400 }` allows 500 OUSD a day.
A key without `limits` spends any amount of any token. Once you pass `limits`, a token not in the list has a limit of zero. That includes fees paid in it. `limits: []` lets the key spend no TIP-20 tokens.
`period` decides whether the limit renews:
* **One-Time:** Set `period` to `0` or omit it. Once the key spends the limit, it can't spend that token again.
* **Renewing:** Set `period` to a number of seconds, such as `86_400` for a day. The first period starts when the key is authorized, not at midnight or another calendar boundary. The limit resets to its full amount when each period ends. Unspent amounts don't carry over.
## Check the Remaining Limit
Read what a key can still spend with Viem's [`accessKey.getRemainingLimit`](https://viem.sh/tempo/actions/accessKey.getRemainingLimit). It returns two values:
* `remaining` is what the key can spend now. Once a period ends, it reads as the full limit.
* `periodEnd` is when the current period ends, as a Unix timestamp, or `0` for a one-time limit.
A missing, revoked, or expired key reads as zero.
Each payment an access key signs emits an `AccessKeySpend` event. It records the amount spent and the limit left, both in base units. The indexer shows that spend history for one key. Replace the account and key addresses with yours.
Save this query as `query.sql` and run it against the public Tempo mainnet indexer (chain ID 4217).
```sql
SELECT token, amount, remainingLimit, block_num, tx_hash
FROM AccessKeySpend
WHERE account = '0x1e0c78105f12079899f7165eb1f74891d4d0f57f'
AND publicKey = '0xb9f81dd7e629d2ec01e363c7a174c0f4ebe723e3'
ORDER BY block_num DESC
LIMIT 10
```
```bash
curl --get "https://indexer.tempo.xyz/query" \
--data-urlencode "chainId=4217" \
--data-urlencode "engine=clickhouse" \
--data-urlencode "signature=AccessKeySpend(address indexed account, address indexed publicKey, address indexed token, uint256 amount, uint256 remainingLimit)" \
--data-urlencode "sql@query.sql"
```
## Change a Limit
Enough signers to reach the threshold change a key's limit without revoking it. Set the new limit with Viem's [`accessKey.updateLimit`](https://viem.sh/tempo/actions/accessKey.updateLimit).
The update sets both the limit and what's left of it to the new value. Later periods renew to the new value. For example, a key has spent 400 of its 500 OUSD today. Updating it to `parseUnits('600', 6)` lets it spend 600 more today, not 100. It then spends 600 a day after that. The period and the current period's end stay the same. On a key with no limits, the update turns limits on.
## Limits
* A limited access key can't change limits, including its own.
* `updateLimit` reverts on a revoked key ([`KeyAlreadyRevoked`](https://tempo.com/developers/docs/protocol/transactions/AccountKeychain#error-keyalreadyrevoked)) or an expired key ([`KeyExpired`](https://tempo.com/developers/docs/protocol/transactions/AccountKeychain#error-keyexpired)).
Specification: [Account Keychain spending limits](https://tempo.com/developers/docs/protocol/transactions/AccountKeychain#spending-limit-enforcement).
## Related
[Access Keys](https://tempo.com/developers/docs/accounts/access-keys): Covers how access keys sign for an account within their bounds.
[Scopes](https://tempo.com/developers/docs/accounts/access-keys/scopes): Covers which contracts, functions, and recipients a key can use.
[Expiry](https://tempo.com/developers/docs/accounts/access-keys/expiry): Covers when a key stops working and how to replace it.
[Fee Sponsorship](https://tempo.com/developers/docs/accounts/fees/fee-sponsorship): Covers fee payers, whose sponsored fees don't count against a limit.
> Source: [/docs/accounts/access-keys/scopes](https://tempo.com/developers/docs/accounts/access-keys/scopes.md)
> Section: [Accounts](https://tempo.com/developers/docs/accounts.md). Create accounts, set up signing methods, policies, access keys, key rotation, and fees, and follow guides for users, automations, agents, and teams.
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
# Scopes
Restricts an access key to the contracts, functions, and recipients its task needs.
## Overview
Scopes are an [access key](https://tempo.com/developers/docs/accounts/access-keys)'s allowlist of the contracts, functions, and addresses it can call or pay. They're one of the key's three bounds, with [spending limits](https://tempo.com/developers/docs/accounts/access-keys/spending-limits) and [expiry](https://tempo.com/developers/docs/accounts/access-keys/expiry).
Tempo reverts any call outside the key's scopes, so a leaked payout key can pay only your payees. A spending limit caps how much the key spends. Scopes decide where it goes. Give every backend, agent, and card key both.
## Scope Entries
Each scope entry allows one contract, optionally narrowed to one function and a list of recipients:
| Field | Allows |
| --- | --- |
| `address` | Calls to this contract. |
| `selector` | Only this function, as a signature such as `transfer(address,uint256)` or a 4-byte selector. Omit it to allow every function on the contract. |
| `recipients` | Only these addresses as the recipient of `transfer` or `transferWithMemo`, or as the spender of `approve`. Works with no other function. Omit it, or pass `[]`, to allow any address. |
A call that matches no entry reverts with [`CallNotAllowed`](https://tempo.com/developers/docs/protocol/transactions/AccountKeychain#error-callnotallowed). A key without `scopes` can call anything. A key with `scopes: []` calls nothing.
## Set Scopes
Pass `scopes` when you [authorize the key](https://tempo.com/developers/docs/accounts/access-keys#authorize-an-access-key) with Viem's [`accessKey.authorize`](https://viem.sh/tempo/actions/accessKey.authorize) or [`accessKey.signAuthorization`](https://viem.sh/tempo/actions/accessKey.signAuthorization). For example, `{ address: stablecoin, selector: 'transfer(address,uint256)', recipients: [payee] }` lets the key send that stablecoin to `payee` and nothing else.
A key scoped to `transfer` can't call `transferWithMemo(address,uint256,bytes32)`, which payments with a reference use. Give that function its own entry. An Earn deposit needs two entries. One allows `approve(address,uint256)` on the stablecoin, with the vault as recipient. The other allows `deposit(uint256,address,uint256)` on the vault. [Pay out from a backend](https://tempo.com/developers/docs/accounts/automations/pay-out-from-a-backend) and [Sweep into Earn](https://tempo.com/developers/docs/earn) show complete keys.
## Change Scopes
Enough signers to reach the threshold change a key's scopes without revoking it. Call `setAllowedCalls` on the [Account Keychain](https://tempo.com/developers/docs/protocol/transactions/AccountKeychain), Tempo's built-in contract that stores access keys. For each contract you pass, it replaces that contract's rules and leaves the others alone. List every rule you want to keep.
Add a second recipient to the key from `access-keys.ts`, the example in [Authorize an access key](https://tempo.com/developers/docs/accounts/access-keys#authorize-an-access-key), and allow `transferWithMemo`. List both functions, because the call replaces the stablecoin's rules. The example uses a configurable account, so `client.ts` connects to [testnet](https://tempo.com/developers/docs/accounts/create#connect-to-testnet). With a single-key account, `setAllowedCalls` works the same on mainnet and testnet.
:::code-group
```ts [set-allowed-calls.ts]
import { toFunctionSelector } from 'viem'
import { Abis, Addresses } from 'viem/tempo'
import { accessKey, account, stablecoin, recipient } from './access-keys'
import { client } from './client'
const newRecipient = process.env.TEMPO_NEW_RECIPIENT as `0x${string}`
await client.writeContractSync({
account,
abi: Abis.accountKeychain,
address: Addresses.accountKeychain,
functionName: 'setAllowedCalls', // [!code hl]
args: [
accessKey.accessKeyAddress,
[{
target: stablecoin,
selectorRules: [
{
selector: toFunctionSelector('transfer(address,uint256)'),
recipients: [recipient, newRecipient], // [!code hl]
},
{
selector: toFunctionSelector('transferWithMemo(address,uint256,bytes32)'),
recipients: [recipient, newRecipient], // [!code hl]
},
],
}],
],
})
```
```ts [client.ts]
import { http } from 'viem'
import { tempoModerato } from 'viem/chains'
import { createClient } from 'viem/tempo'
// Tempo testnet. The public RPC needs no key.
export const client = createClient({
chain: tempoModerato,
transport: http(),
})
```
:::
An entry with `selectorRules: []` allows every function on that contract. To remove one contract from the key's scopes, call `removeAllowedCalls(keyId, target)`.
To read a key's current scopes, call `getAllowedCalls(account, keyId)`. It returns the scope list and `isScoped`, which is `false` for a key that can call anything. A missing, revoked, or expired key reads as scoped with no allowed calls.
## Limits
* Scopes check only the calls the key signs directly. A contract the key can call makes any calls of its own. An allowed factory contract can deploy contracts, even though the key can't deploy one itself. Allow only contracts you trust.
* A limited access key can't change scopes, including its own.
* `setAllowedCalls` reverts with [`InvalidCallScope`](https://tempo.com/developers/docs/protocol/transactions/AccountKeychain#error-invalidcallscope) when its list of contracts is empty, or on a zero address or a duplicate entry.
Specification: [Account Keychain call scopes](https://tempo.com/developers/docs/protocol/transactions/AccountKeychain#call-scope-enforcement).
## Related
[Access Keys](https://tempo.com/developers/docs/accounts/access-keys): Covers how access keys sign for an account within their bounds.
[Spending Limits](https://tempo.com/developers/docs/accounts/access-keys/spending-limits): Covers how much of each TIP-20 token a key can spend.
[Pay Out From a Backend](https://tempo.com/developers/docs/accounts/automations/pay-out-from-a-backend): Use for a complete payout key, scopes included.
[Account Keychain Precompile](https://tempo.com/developers/docs/protocol/transactions/AccountKeychain): Covers the contract that stores access keys and checks their scopes.
> Source: [/docs/accounts/access-keys/expiry](https://tempo.com/developers/docs/accounts/access-keys/expiry.md)
> Section: [Accounts](https://tempo.com/developers/docs/accounts.md). Create accounts, set up signing methods, policies, access keys, key rotation, and fees, and follow guides for users, automations, agents, and teams.
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
# Expiry
Makes an access key stop working at a set time, so a forgotten or leaked key ends on its own.
## Overview
An expiry is the time an [access key](https://tempo.com/developers/docs/accounts/access-keys) stops working. It's one of the key's three bounds, with [spending limits](https://tempo.com/developers/docs/accounts/access-keys/spending-limits) and [scopes](https://tempo.com/developers/docs/accounts/access-keys/scopes). You set it when you authorize the key, and you can't extend it later.
Tempo checks the expiry against block time (the current block's timestamp), not your server's clock. Once block time reaches the expiry, Tempo rejects every transaction the key signs with [`KeyExpired`](https://tempo.com/developers/docs/protocol/transactions/AccountKeychain#error-keyexpired). The key's remaining limit reads as zero.
## Set an Expiry
Pass `expiry`, a Unix timestamp in seconds, when you [authorize the key](https://tempo.com/developers/docs/accounts/access-keys#authorize-an-access-key) with Viem's [`accessKey.authorize`](https://viem.sh/tempo/actions/accessKey.authorize). A key without `expiry` never expires. The `Expiry` helpers in `viem/tempo` return a timestamp relative to now, such as `Expiry.days(30)` or `Expiry.hours(1)`.
Use the shortest window the holder needs. A shorter expiry ends a forgotten or leaked key sooner.
| Holder | Expiry |
| --- | --- |
| A one-off task | Hours |
| A device | 30 days |
| A backend | 90 days |
## Renew a Key
Tempo never authorizes the same key address twice for an account. To renew, authorize a new key before the old one expires. Read the old key's `expiry` with `client.accessKey.getMetadata({ account, accessKey })`. Before that time:
1. Generate a new key where the holder signs.
2. Have the signers authorize it with a new expiry.
3. Switch the holder to the new key.
4. [Revoke](https://tempo.com/developers/docs/accounts/access-keys/revocation) the old key if it hasn't expired yet.
Until the old key expires or is revoked, both keys can spend, each up to its own limit. To keep one budget, authorize the new key with a limit of what the old key has left. [Raise it](https://tempo.com/developers/docs/accounts/access-keys/spending-limits#change-a-spending-limit) once the old key is revoked. If the holder can pause, revoke the old key first instead.
## Limits
* An expiry at or before the current block time reverts with [`ExpiryInPast`](https://tempo.com/developers/docs/protocol/transactions/AccountKeychain#error-expiryinpast).
* Changing an expired key's limit with `updateLimit` reverts with [`KeyExpired`](https://tempo.com/developers/docs/protocol/transactions/AccountKeychain#error-keyexpired).
Specification: [Account Keychain key expiry](https://tempo.com/developers/docs/protocol/transactions/AccountKeychain#key-expiry).
## Related
[Access Keys](https://tempo.com/developers/docs/accounts/access-keys): Covers how access keys sign for an account within their bounds.
[Revocation](https://tempo.com/developers/docs/accounts/access-keys/revocation): Covers how to end a key before its expiry.
[Spending Limits](https://tempo.com/developers/docs/accounts/access-keys/spending-limits): Covers how much of each TIP-20 token a key can spend.
> Source: [/docs/accounts/access-keys/revocation](https://tempo.com/developers/docs/accounts/access-keys/revocation.md)
> Section: [Accounts](https://tempo.com/developers/docs/accounts.md). Create accounts, set up signing methods, policies, access keys, key rotation, and fees, and follow guides for users, automations, agents, and teams.
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
# Revocation
Shuts off an access key for good.
## Overview
Revocation ends an [access key](https://tempo.com/developers/docs/accounts/access-keys) on demand, without waiting for its [expiry](https://tempo.com/developers/docs/accounts/access-keys/expiry). Once the revocation lands, Tempo rejects every transaction the key signs. Revoke a key as soon as its device is lost, its secret leaks, or its holder no longer needs it.
## Remaining Effects
Revocation doesn't undo what the key did while it was active:
* **Transactions Stay Final:** A payment racing the revocation goes through only if it lands first. Once the revocation lands, Tempo rejects the rest.
* **Token Approvals Stay:** A spender the key approved still pulls tokens up to the allowance. Set each allowance to zero from the account.
## Revoke a Key
Enough of the account's signers to meet its threshold approve the revocation. In Viem, call [`accessKey.revoke`](https://viem.sh/tempo/actions/accessKey.revoke) with the account and the key's address.
When you authorize a key, save its address next to the device or service that holds it. That record tells you which address to revoke. Show a key as removed only after the revocation confirms.
## Signer Changes
:::warning
**Multiple signers arrive on mainnet with the [T14 network upgrade](https://tempo.com/developers/docs/protocol/upgrades/t14).** They are live on [testnet](https://tempo.com/developers/docs/accounts/create#connect-to-testnet) since T14 activated there on November 24, 2026. Mainnet activation is scheduled for December 8, 2026.
:::
Changing a configurable account's signers doesn't touch its access keys. Revoke them yourself after a recovery and before a hand-off.
After you [replace a lost or compromised signer](https://tempo.com/developers/docs/accounts/account-configuration/configuration-updates#remove-a-lost-or-compromised-signer), revoke every key that signer's holder could use. That includes any key an attacker authorized. You won't have those addresses saved, so list every key the account has authorized from its `KeyAuthorized` events. Read the events in pages, because the testnet RPC searches at most 100,000 blocks per request.
```ts [find-keys.ts]
import { Abis, Addresses } from 'viem/tempo'
import { account } from './access-keys'
import { client } from './client'
const latestBlock = await client.getBlockNumber()
const pageSize = 100_000n
const events = []
// Start from 0, or from the block of the account's first transaction if you saved it
for (let fromBlock = 0n; fromBlock <= latestBlock; fromBlock += pageSize) {
const toBlock = fromBlock + pageSize - 1n
const page = await client.getContractEvents({ // [!code hl]
abi: Abis.accountKeychain,
address: Addresses.accountKeychain,
args: { account: account.address },
eventName: 'KeyAuthorized', // [!code hl]
fromBlock,
toBlock: toBlock < latestBlock ? toBlock : latestBlock,
strict: true,
})
events.push(...page)
}
const keys = await Promise.all(
events.map(({ args }) => client.accessKey.getMetadata({ account, accessKey: args.publicKey })),
)
// compare with the keys you saved
const unrevoked = keys.filter((key) => !key.isRevoked) // [!code hl]
```
Before you [hand an account to a customer](https://tempo.com/developers/docs/accounts/apps/self-custodial-wallets), revoke your app's access keys, then swap out your app's signers. Once your signers are gone, your app can't approve anything, including a revocation.
## Limits
* A limited access key can't revoke any key, including itself.
* A revoked key's address can never be authorized again for this account. To restore access, authorize a new key.
* Revoking a key the account hasn't authorized reverts with [`KeyNotFound`](https://tempo.com/developers/docs/protocol/transactions/AccountKeychain#error-keynotfound). That includes a key whose authorization hasn't landed yet. If you signed the authorization with a [witness](https://viem.sh/tempo/guides/access-keys/witnesses), a 32-byte value, cancel it with `client.accessKey.burnWitnessSync({ account, witness })`. Tempo then rejects any authorization signed with that witness.
* An expired key needs no revocation. Tempo already rejects its transactions.
Specification: [Account Keychain key revocation](https://tempo.com/developers/docs/protocol/transactions/AccountKeychain#key-revocation).
## Related
[Access Keys](https://tempo.com/developers/docs/accounts/access-keys): Covers how access keys sign for an account within their bounds.
[Expiry](https://tempo.com/developers/docs/accounts/access-keys/expiry): Covers when a key stops working on its own.
[Configuration Updates](https://tempo.com/developers/docs/accounts/account-configuration/configuration-updates): Use for replacing a lost or compromised signer.
[Set Up a Self-Custodial Wallet With a Provider](https://tempo.com/developers/docs/accounts/apps/self-custodial-wallets): Use for handing an account to a customer.
> Source: [/docs/accounts/account-configuration](https://tempo.com/developers/docs/accounts/account-configuration.md)
> Section: [Accounts](https://tempo.com/developers/docs/accounts.md). Create accounts, set up signing methods, policies, access keys, key rotation, and fees, and follow guides for users, automations, agents, and teams.
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
# Account Configuration
Changes a configurable account's signers, weights, and threshold without changing its address.
## Overview
An account's configuration is its signers, their weights, and its threshold. A signer is a key that approves the account's transactions. Because the address stays, the balance and history survive a lost phone or a departing approver.
:::warning
**Multiple signers arrive on mainnet with the [T14 network upgrade](https://tempo.com/developers/docs/protocol/upgrades/t14).** They are live on [testnet](https://tempo.com/developers/docs/accounts/create#connect-to-testnet) since T14 activated there on November 24, 2026. Mainnet activation is scheduled for December 8, 2026.
:::
A [configuration update](https://tempo.com/developers/docs/accounts/account-configuration/configuration-updates) replaces the account's whole signer list and its [threshold](https://tempo.com/developers/docs/accounts/policies/signing-thresholds) in one transaction. Signers whose weights reach the current threshold approve it, the same way they approve a payment. Only the current signers can approve a change. Tempo has no override, so [plan for recovery](https://tempo.com/developers/docs/accounts/account-configuration#plan-for-recovery) before you need it.
A single-key account (EOA) has no signer list to change. [Upgrade it](https://tempo.com/developers/docs/accounts/account-configuration/account-upgrade) to a configurable account first.
## Approvers by Situation
The situations differ in who approves:
| Situation | The update | Who approves |
| --- | --- | --- |
| [Add a backup or recovery signer](https://tempo.com/developers/docs/accounts/account-configuration/configuration-updates#add-a-signer) | Adds the new signer | The current signers |
| [Rotate a key](https://tempo.com/developers/docs/accounts/account-configuration/configuration-updates#rotate-a-key-by-replacing-it-in-one-update) | Swaps the new key in at the old one's weight | The current signers, including the old key |
| [Replace a lost or compromised signer](https://tempo.com/developers/docs/accounts/account-configuration/configuration-updates#remove-a-lost-or-compromised-signer) | Swaps a new signer in for it | The other signers, without it |
| [Offboard an approver](https://tempo.com/developers/docs/accounts/custodians/team-multisig) | Removes their signer, and lowers the threshold if needed | The remaining approvers |
| [Hand off to a self-custodial wallet](https://tempo.com/developers/docs/accounts/apps/self-custodial-wallets) | Replaces your app's signers with one the user holds | Your app's signers |
A configuration update doesn't touch access keys or token approvals. A device key on a lost phone keeps paying within its limits until you [revoke it](https://tempo.com/developers/docs/accounts/access-keys/revocation#revoke-after-a-signer-change).
## Watch Changes
Each [configuration update](https://tempo.com/developers/docs/development/configurable-accounts#configuration-updates) emits `ConfigurableAccountConfigUpdated` with the account, its new version, threshold, and signer list. Registration emits it too, with version 0. Read the event with Viem's `getContractEvents` from a testnet client. The testnet RPC searches at most 100,000 blocks per request.
```ts [watch-signers.ts]
import { parseAbiItem } from 'viem'
import { Addresses } from 'viem/tempo'
import { account } from './account'
import { client } from './client'
const latestBlock = await client.getBlockNumber()
const updates = await client.getContractEvents({ // [!code hl]
abi: [ // [!code hl]
parseAbiItem( // [!code hl]
'event ConfigurableAccountConfigUpdated(address indexed account, bytes32 salt, uint64 version, uint8 threshold, (address owner, uint8 weight)[] owners)', // [!code hl]
), // [!code hl]
], // [!code hl]
address: Addresses.configurableAccount,
eventName: 'ConfigurableAccountConfigUpdated', // [!code hl]
args: { account: account.address },
fromBlock: latestBlock - 99_999n,
toBlock: latestBlock,
strict: true,
})
// each update's args: { account, salt, version, threshold, owners }
```
## Plan for Recovery
Only the other signers can replace a lost one. When you create the account, choose weights that reach the threshold without any one signer. The test is total weight minus the largest signer's weight. When that's at least the threshold, the account survives losing any one signer.
For example, give a passkey weight 2, and a backup key and a recovery provider's key weight 1 each. Set the threshold to 2. It passes, because 4 minus 2 leaves 2. The two keys together replace a lost passkey. The passkey alone replaces either key. Other [recommended signer setups](https://tempo.com/developers/docs/accounts/policies/signing-thresholds#recommended-signer-setups) also pass. On an existing account, [add a recovery signer](https://tempo.com/developers/docs/accounts/account-configuration/configuration-updates#add-a-recovery-signer).
A recovery signer can approve payments at its weight too, so give it no more weight than recovery needs.
### Funds on Other Chains
The account has the same address on other EVM chains. A sender can pay it on the wrong chain by mistake. Nothing controls an address derived from a configuration on another chain, so those funds are lost.
To keep a way to recover them, create the account from a fresh secp256k1 key instead ([TIP-1113](https://tips.sh/1113)). Before you share or fund its address, have that key [upgrade the account](https://tempo.com/developers/docs/accounts/account-configuration/account-upgrade) to its real signers, without listing itself. A fee payer can sponsor the upgrade. Tempo then retires the key, but it still controls the address on other chains.
Keep that key offline and use it only to move mistaken transfers out. Contracts that try `ecrecover` before or instead of ERC-1271, such as OpenZeppelin `SignatureChecker` before v5.1, still accept it, so don't sign anything else with it.
## Related
[Configuration Updates](https://tempo.com/developers/docs/accounts/account-configuration/configuration-updates): Use for adding, removing, or replacing a signer at the same address.
[Account Upgrade](https://tempo.com/developers/docs/accounts/account-configuration/account-upgrade): Use for turning a single-key account into a configurable account.
[Signing Thresholds](https://tempo.com/developers/docs/accounts/policies/signing-thresholds): Covers how signer weights reach a threshold to approve a transaction.
[Revocation](https://tempo.com/developers/docs/accounts/access-keys/revocation): Covers how to stop an access key from signing.
[Configurable Accounts](https://tempo.com/developers/docs/development/configurable-accounts): Covers the protocol reference for signers, updates, and addresses.
> Source: [/docs/accounts/account-configuration/configuration-updates](https://tempo.com/developers/docs/accounts/account-configuration/configuration-updates.md)
> Section: [Accounts](https://tempo.com/developers/docs/accounts.md). Create accounts, set up signing methods, policies, access keys, key rotation, and fees, and follow guides for users, automations, agents, and teams.
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
# Configuration Updates
Changes a configurable account's signers, weights, or threshold at the same address.
## Overview
A configuration update replaces the whole signer list and threshold of a [configurable account](https://tempo.com/developers/docs/development/configurable-accounts) in one transaction. A signer is a key that approves the account's transactions. The current signers approve the update. The address, balance, token approvals, and access keys stay the same.
Use a configuration update to back up a key, add an approver, end an approver's access, or rotate a key.
:::warning
**Multiple signers arrive on mainnet with the [T14 network upgrade](https://tempo.com/developers/docs/protocol/upgrades/t14).** They are live on [testnet](https://tempo.com/developers/docs/accounts/create#connect-to-testnet) since T14 activated there on November 24, 2026. Mainnet activation is scheduled for December 8, 2026.
:::
## Build an Update
Build each update from the address and configuration your app saved for the account ([keep the current configuration](https://tempo.com/developers/docs/development/configurable-accounts#keep-the-current-configuration)):
1. Rebuild the account with the approving signers' keys attached, as in [Signing Thresholds](https://tempo.com/developers/docs/accounts/policies/signing-thresholds#collect-approvals).
2. Build the call with `Actions.accounts.updateConfig.call` and send it with `writeContractSync`. Viem signs with the attached keys, highest weight first, until their weights reach the current threshold.
Approvals can also come from [separate devices](https://tempo.com/developers/docs/accounts/policies/signing-thresholds#approvers-on-separate-devices).
Each update raises the configuration's version by one. After the transaction succeeds, save `AccountConfig.update(config, nextConfig)` with the account record. Rebuild from the latest saved record before every payment or update. An account built from the old configuration no longer matches the hash Tempo stores, so its next transaction fails.
These examples avoid Viem 2.57.5's `updateConfigSync`, which still expects the old event name and throws after a successful testnet update.
Once the update lands, a removed signer can't approve anything. Approvals collected under the old signer list stop counting.
## Add a Signer
The weight you give the new signer decides what it can approve alone. Every signer has a weight of at least 1:
* **Below the Threshold:** The new signer approves only together with others. No single backup or recovery signer controls the account.
* **At or Above the Threshold:** The new signer approves anything alone, including removing every other signer. Give this weight only to a key you'd trust with the whole account.
The threshold stays the same unless you change it, so each new signer adds a way to reach it. To keep requiring the same approvers, raise the threshold in the same update.
A recovery signer can approve payments at its weight too. Give it enough weight that the account can [lose any one signer](https://tempo.com/developers/docs/accounts/account-configuration#plan-for-recovery) and still reach the threshold, and no more.
`client.ts` connects to [testnet](https://tempo.com/developers/docs/accounts/create#connect-to-testnet). The remove and replace examples use the same `account.ts` and `client.ts`.
:::code-group
```ts [add-signer.ts]
import { writeFileSync } from 'node:fs'
import { AccountConfig, Actions } from 'viem/tempo'
import { account, config } from './account'
import { client } from './client'
// The new signer's address
const newSigner = process.env.NEW_SIGNER as `0x${string}`
const nextConfig = { // [!code hl]
owners: [...config.owners, { owner: newSigner, weight: 1 }], // [!code hl]
threshold: config.threshold, // [!code hl]
} // [!code hl]
await client.writeContractSync({
account,
...Actions.accounts.updateConfig.call({ currentConfig: config, nextConfig }),
throwOnReceiptRevert: true,
})
const updated = AccountConfig.update(config, nextConfig)
// Save the new configuration. The next action rebuilds the account from it.
writeFileSync('account.json', JSON.stringify({ address: account.address, config: AccountConfig.toRpc(updated) }))
```
```ts [account.ts]
import { readFileSync } from 'node:fs'
import { isAddressEqual } from 'viem'
import { Account, AccountConfig } from 'viem/tempo'
// The address and configuration your app saved for the account
const saved = JSON.parse(readFileSync('account.json', 'utf8'))
export const config = AccountConfig.fromRpc(saved.config)
// The signers approving this time. Their weights must reach the threshold.
const approvers = [Account.fromSecp256k1(process.env.SIGNER_KEY as `0x${string}`)]
const owners = config.owners.map(({ owner, weight }) => ({
owner: approvers.find((key) => isAddressEqual(key.address, owner)) ?? owner,
weight,
}))
// Until the first update, the configuration derives the address.
export const account =
config.version === 0n
? Account.fromConfig({ address: 'infer', owners, salt: config.salt, threshold: config.threshold })
: Account.fromConfig({ ...config, address: saved.address, owners })
```
```ts [client.ts]
import { http } from 'viem'
import { tempoModerato } from 'viem/chains'
import { createClient } from 'viem/tempo'
// Tempo testnet. The public RPC needs no key.
export const client = createClient({
chain: tempoModerato,
transport: http(),
})
```
:::
`account.ts` rebuilds the account from the record your app saved and attaches the approving keys. The new signer can be a passkey, a device key, or a key in a KMS or hardware wallet. It can also be an address from a recovery provider. Viem sorts the signers by address, as Tempo requires. [`updateConfig`](https://viem.sh/tempo/actions/accounts.updateConfig) in Viem lists every option.
Tempo can't tell whether a signer still holds its key. Have each new signer approve once before you rely on it.
## Remove a Signer
When an approver leaves or a key is lost, the remaining signers approve a list without that signer.
```ts [remove-signer.ts]
import { writeFileSync } from 'node:fs'
import { isAddressEqual } from 'viem'
import { AccountConfig, Actions } from 'viem/tempo'
import { account, config } from './account'
import { client } from './client'
// The address of the signer that's leaving
const departing = process.env.DEPARTING_SIGNER as `0x${string}`
const nextConfig = { // [!code hl]
owners: config.owners.filter(({ owner }) => !isAddressEqual(owner, departing)), // [!code hl]
threshold: config.threshold, // [!code hl]
} // [!code hl]
await client.writeContractSync({
account,
...Actions.accounts.updateConfig.call({ currentConfig: config, nextConfig }),
throwOnReceiptRevert: true,
})
const updated = AccountConfig.update(config, nextConfig)
writeFileSync('account.json', JSON.stringify({ address: account.address, config: AccountConfig.toRpc(updated) }))
```
If the remaining weights fall short of the threshold, lower `threshold` in the same update. Or [replace the signer](https://tempo.com/developers/docs/accounts/account-configuration/configuration-updates#replace-a-signer-in-one-update) instead. Lowering the threshold to 1 lets any one remaining signer pay and change signers alone. A 2-of-3 multisig that drops to two signers at threshold 1 no longer needs two approvals. For a team multisig, [replace an approver](https://tempo.com/developers/docs/accounts/custodians/team-multisig#replace-an-approver).
[Access keys](https://tempo.com/developers/docs/accounts/access-keys) keep working after the update. A device key or agent key the removed signer authorized keeps paying within its limits. [Revoke every key](https://tempo.com/developers/docs/accounts/access-keys/revocation#revoke-after-a-signer-change) its holder could reach, including any an attacker added.
## Replace a Signer
Rotate when the holder stays but the key changes, such as a new hardware wallet, device, or wallet provider. Put the new key at the old one's weight and keep the threshold. Every group of signers that could approve before still can.
```ts [rotate-signer.ts]
import { writeFileSync } from 'node:fs'
import { isAddressEqual } from 'viem'
import { AccountConfig, Actions } from 'viem/tempo'
import { account, config } from './account'
import { client } from './client'
// The key being replaced, and its replacement
const oldSigner = process.env.OLD_SIGNER as `0x${string}`
const newSigner = process.env.NEW_SIGNER as `0x${string}`
const nextConfig = { // [!code hl]
owners: config.owners.map((entry) => // [!code hl]
isAddressEqual(entry.owner, oldSigner) ? { owner: newSigner, weight: entry.weight } : entry, // [!code hl]
), // [!code hl]
threshold: config.threshold, // [!code hl]
} // [!code hl]
await client.writeContractSync({
account,
...Actions.accounts.updateConfig.call({ currentConfig: config, nextConfig }),
throwOnReceiptRevert: true,
})
const updated = AccountConfig.update(config, nextConfig)
writeFileSync('account.json', JSON.stringify({ address: account.address, config: AccountConfig.toRpc(updated) }))
```
Because one update swaps the keys, the account never has both keys active, or neither.
### Lost or Compromised Signers
When a signer is lost or compromised, the other signers approve the update without it. Tempo has no recovery service or override. This works only if their weights still reach the threshold. Check the [recovery rule](https://tempo.com/developers/docs/accounts/account-configuration#plan-for-recovery) when you create the account. To replace a user's lost passkey, [recover their account](https://tempo.com/developers/docs/accounts/apps/recover-an-account).
Treat a compromised signer as an attacker. Leave it out of the approvers. If its weight reaches the threshold alone, it can remove your other signers before you remove it.
## Limits
* An account holds 1 to 48 signers, with total weight at most 255. A transaction carries at most 8 approvals, so the 8 largest weights must reach the threshold. Viem checks these limits before sending and throws `Invalid account config` with the reason. A signer already on the list fails with the reason `owners must be strictly ascending`.
* The approving signers must reach the current threshold, and the new signer list must reach the new one. If the attached keys fall short, Viem throws `Local owners do not meet the threshold.` If the new list falls short, it throws `Invalid account config: threshold exceeds total owner weight.`
* `multisig configuration commitment mismatch` means the account was built from an outdated configuration. It no longer matches the hash Tempo stores, for example because another configuration update landed first. Load the latest saved configuration and rebuild the update.
* Rebuild with `address: 'infer'` only while the configuration is version 0. After a configuration update, the current signers no longer derive the address. Pass the saved `address`, as [Signing Thresholds](https://tempo.com/developers/docs/accounts/policies/signing-thresholds#collect-approvals) does.
## Related
[Account Configuration](https://tempo.com/developers/docs/accounts/account-configuration): Covers signers, weights, and recovery planning for configurable accounts.
[Signing Thresholds](https://tempo.com/developers/docs/accounts/policies/signing-thresholds): Use for collecting approvals that reach a threshold.
[Revocation](https://tempo.com/developers/docs/accounts/access-keys/revocation): Use for revoking access keys after a signer change.
[Recover a User's Account](https://tempo.com/developers/docs/accounts/apps/recover-an-account): Use for replacing a user's lost passkey.
[Configurable Accounts](https://tempo.com/developers/docs/development/configurable-accounts#configuration-updates): Covers the protocol reference for configuration updates.
> Source: [/docs/accounts/account-configuration/account-upgrade](https://tempo.com/developers/docs/accounts/account-configuration/account-upgrade.md)
> Section: [Accounts](https://tempo.com/developers/docs/accounts.md). Create accounts, set up signing methods, policies, access keys, key rotation, and fees, and follow guides for users, automations, agents, and teams.
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
# Account Upgrade
Adds backup signers to a single-key account without changing its address.
## Overview
An account upgrade turns a single-key account into a configurable account at the same address. A configurable account has several signers and a threshold. A single-key account works like a standard Ethereum account (an EOA). One key controls it, so losing that key loses the account. The upgrade is permanent.
:::warning
**Multiple signers arrive on mainnet with the [T14 network upgrade](https://tempo.com/developers/docs/protocol/upgrades/t14).** They are live on [testnet](https://tempo.com/developers/docs/accounts/create#connect-to-testnet) since T14 activated there on November 24, 2026. Mainnet activation is scheduled for December 8, 2026.
:::
On mainnet, until T14 activates there on December 8, 2026, the upgrade transaction does nothing. It succeeds and charges its fee, but the original key still approves alone. Tempo rejects transactions from the configurable account.
In the interactive web page, create a private-key account on testnet, fund it from the faucet, and pay 1 AlphaUSD with it. Then upgrade it in place to a configurable account with the original key and a new backup key as signers and a threshold of 2. A payment signed by the original key alone is rejected, and a payment approved by both signers succeeds. The address and balance stay the same. Each step is a real testnet transaction.
## Upgrade Effects
The upgrade gives the account a list of signers, each with a weight. It also sets a threshold, the total weight an approval needs. From then on, signers whose weights reach the threshold approve for the account. The original key approves only if you list it, at its weight. The address, balances, token approvals, nonce, contract storage, and access keys with their limits stay the same.
Tempo retires the original key. It can no longer sign transactions, TIP-20 permits, or fee sponsorships for the account, even ones it signed before the upgrade. The upgrade installs a one-byte code marker, so Permit2 and other contracts that check for code route signatures to the account's [ERC-1271 check](https://tempo.com/developers/docs/development/configurable-accounts#verify-owner-approvals-in-a-contract). Contracts that try `ecrecover` before or instead of ERC-1271, such as OpenZeppelin `SignatureChecker` before v5.1, still accept the original key. It also still controls the address on other EVM chains.
## Choose Signers
List the original key and at least one backup signer. A backup can be a passkey on the user's device or a key your recovery provider holds.
| Setup | Threshold | Result |
| --- | --- | --- |
| Original key and one backup, each at weight 1 | 1 | Either key pays alone and replaces the other if it's lost. |
| Three signers at weight 1 | 2 | Every payment needs two approvals. |
In any setup, the signers left after losing any one must still reach the threshold ([Plan for Recovery](https://tempo.com/developers/docs/accounts/account-configuration#plan-for-recovery)).
[Revoke](https://tempo.com/developers/docs/accounts/access-keys/revocation) any access key you don't want before you upgrade.
## Send the Upgrade
The original key signs a transaction with a top-level `upgradeAccount(threshold, owners)` call on Tempo's built-in multisig contract. Call it with `writeContractSync`, and stop unless the client is on testnet. Set `feeToken` to the stablecoin that pays the fee. Without it, Viem sends a standard Ethereum transaction, and the upgrade reverts with `PrimitiveRootRequired`.
`client.ts` connects to [testnet](https://tempo.com/developers/docs/accounts/create#connect-to-testnet).
:::code-group
```ts [upgrade.ts]
import { concat, keccak256, parseAbi, toHex } from 'viem'
import { tempoModerato } from 'viem/chains'
import { Account, Addresses } from 'viem/tempo'
import { client } from './client'
// Until T14 activates on mainnet, mainnet accepts the transaction but doesn't upgrade the account.
if (client.chain.id !== tempoModerato.id) throw new Error('Account upgrades run on testnet until T14 reaches mainnet.') // [!code hl]
// The key that controls the account today
const original = Account.fromSecp256k1(process.env.PRIVATE_KEY as `0x${string}`)
// The backup signer's address. Its key stays on the user's device or with your recovery provider.
const backup = '0x70997970C51812dc3A010C7d01b50e0d17dc79C8'
// The account's configuration after the upgrade
const account = Account.fromConfig({ // [!code hl]
address: original.address, // [!code hl]
owners: [original, backup], // [!code hl]
threshold: 1, // [!code hl]
salt: keccak256(concat([toHex('tempo:configurable-account:upgrade'), original.address])), // [!code hl]
version: 1n, // [!code hl]
}) // [!code hl]
const { owners, threshold } = account.config
// A test stablecoin on testnet
const token = '0x20c0000000000000000000000000000000000001'
await client.writeContractSync({ // [!code hl]
account: original, // [!code hl]
address: Addresses.configurableAccount, // [!code hl]
abi: parseAbi([ // [!code hl]
'function upgradeAccount(uint8 threshold, (address owner, uint8 weight)[] owners) returns (bytes32)', // [!code hl]
]), // [!code hl]
functionName: 'upgradeAccount', // [!code hl]
args: [threshold, owners], // [!code hl]
feeToken: token, // [!code hl]
}) // [!code hl]
// Save account.config. Your app rebuilds the account from it.
```
```ts [client.ts]
import { http } from 'viem'
import { tempoModerato } from 'viem/chains'
import { createClient } from 'viem/tempo'
// Tempo testnet. The public RPC needs no key.
export const client = createClient({
chain: tempoModerato,
transport: http(),
})
```
:::
The upgraded configuration uses `version: 1n` and a salt Tempo derives from the address. `account.config` lists the signers sorted by address, as Tempo requires.
After the upgrade, the record your app [saves](https://tempo.com/developers/docs/development/configurable-accounts#keep-the-current-configuration) is the account's only readable list of signers. Each time your app acts for the account, rebuild it from that record with `Account.fromConfig`. Attach the keys that approve, such as `original`. The other signers stay as addresses.
Viem signs with the attached keys until their weights reach the threshold. If they fall short, it throws `Local owners do not meet the threshold.` and sends nothing. Approvals can also come from [separate devices](https://tempo.com/developers/docs/accounts/policies/signing-thresholds#approvers-on-separate-devices).
[Adding](https://tempo.com/developers/docs/accounts/account-configuration/configuration-updates#add-a-signer) or [removing](https://tempo.com/developers/docs/accounts/account-configuration/configuration-updates#remove-a-signer) signers later raises the version. After the update succeeds, save `AccountConfig.update(saved.config, nextConfig)` and rebuild the account from it. Otherwise the next transaction fails with `multisig configuration commitment mismatch`.
## Limits
* Only the original key can sign the upgrade. Access keys can't, but a [fee payer](https://tempo.com/developers/docs/accounts/fees/fee-sponsorship) can sponsor it.
* The upgrade must be a top-level call, with no EIP-7702 authorization list. It can sit anywhere in a batch. Calls before it run under the original key, and calls after it see the new signers.
* Accounts with contract code, an EIP-7702 delegation, or existing signers can't upgrade.
* Afterward, a direct signature from the original key fails with `RootKeyRetired` (`primitive root key retired`). Sign with the account rebuilt from the saved configuration instead.
## Related
[Account Configuration](https://tempo.com/developers/docs/accounts/account-configuration): Covers signers, weights, thresholds, and recovery planning.
[Configuration Updates](https://tempo.com/developers/docs/accounts/account-configuration/configuration-updates): Use for adding, removing, or replacing signers after the upgrade.
[Signing Thresholds](https://tempo.com/developers/docs/accounts/policies/signing-thresholds): Covers how signer weights approve a transaction.
[Single-Key Accounts](https://tempo.com/developers/docs/development/single-key-accounts#upgrade-to-a-configurable-account): Covers the protocol reference for the upgrade to a configurable account.
> Source: [/docs/accounts/fees](https://tempo.com/developers/docs/accounts/fees.md)
> Section: [Accounts](https://tempo.com/developers/docs/accounts.md). Create accounts, set up signing methods, policies, access keys, key rotation, and fees, and follow guides for users, automations, agents, and teams.
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
# Fee Management
Pays each Tempo transaction's network fee in a USD stablecoin, with no separate gas token.
## Overview
Fee management decides who pays each transaction's network fee and which stablecoin pays it. Every Tempo transaction pays its fee in a USD stablecoin, so accounts need no separate gas token.
Fee tokens and fee sponsorship work on mainnet and testnet. Configurable accounts can't sponsor other accounts, and run on [testnet](https://tempo.com/developers/docs/accounts/create#connect-to-testnet) until T14 reaches mainnet.
## Fee Payment
Each transaction pays its fee in one of three ways:
* **By Default:** The account pays its own fee. A plain transfer pays in the stablecoin it sends.
* **With a Fee Token:** The fee is paid in a different stablecoin, the [fee token](https://tempo.com/developers/docs/accounts/fees/fee-tokens).
* **With a Fee Payer:** A [fee payer](https://tempo.com/developers/docs/accounts/fees/fee-sponsorship) pays for your customers. It can't change the account's calls or move its funds.
## Fee Costs
A standard stablecoin transfer costs about $0.00003 when the network is quiet. It costs about $0.0006 at the base fee's cap.
Before the transaction runs, Tempo deducts its maximum fee from the fee payer's balance in the fee token. The maximum fee is the gas limit times the gas price. Afterward, Tempo refunds the unused part.
When the validator producing the block wants a different stablecoin, the [Fee AMM](https://tempo.com/developers/docs/protocol/fees/spec-fee-amm) converts the fee to it. The Fee AMM is a set of built-in exchange pools.
Insufficient balance, unavailable conversion liquidity, or other failed [fee token checks](https://tempo.com/developers/docs/accounts/fees/fee-tokens#supported-fee-tokens) make the transaction invalid. Tempo never includes it, so it costs nothing. A transaction that's included and then fails still pays its fee.
## Fee Token Order
Tempo uses the first of these that applies:
1. `feeToken` on the transaction.
2. The fee payer's default fee token.
3. The token being transferred. This applies when every call is a `transfer` or `transferWithMemo` on the same USD token. The account must also pay its own fee.
4. The input token of a single Stablecoin DEX swap.
5. The protocol fallback tries pathUSD, then OUSD.
If one of the first four rules selects a token, Tempo uses only that token. If its fee checks fail, the transaction is invalid. An explicit pathUSD choice does not fall back to OUSD.
Without a token selected by those rules, Tempo uses the [protocol fallback](https://tempo.com/developers/docs/protocol/fees/spec-fee#ordered-fallback-from-t13). It tries pathUSD first, then OUSD when the fee payer's pathUSD balance cannot cover the maximum fee. One token must cover the entire maximum fee; balances are not combined. Only an insufficient balance advances the fallback, not policy, pause, access-key, or Fee AMM liquidity failures.
[Set a default fee token](https://tempo.com/developers/docs/accounts/fees/fee-tokens#set-a-default-fee-token) to choose which stablecoin an account pays fees in.
## Related
[Fee Tokens](https://tempo.com/developers/docs/accounts/fees/fee-tokens): Use for choosing which stablecoin pays an account's fees, per account or per transaction.
[Fee Sponsorship](https://tempo.com/developers/docs/accounts/fees/fee-sponsorship): Use for paying your customers' fees with a fee payer, so they need no fee balance.
[Fee Specification](https://tempo.com/developers/docs/protocol/fees/spec-fee#fee-token-preferences): Covers fee token preferences and how Tempo picks the fee token.
[Fee AMM Specification](https://tempo.com/developers/docs/protocol/fees/spec-fee-amm): Covers how the Fee AMM converts fees between stablecoins.
> Source: [/docs/accounts/fees/fee-tokens](https://tempo.com/developers/docs/accounts/fees/fee-tokens.md)
> Section: [Accounts](https://tempo.com/developers/docs/accounts.md). Create accounts, set up signing methods, policies, access keys, key rotation, and fees, and follow guides for users, automations, agents, and teams.
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
# Fee Tokens
Sets the USD stablecoin an account pays its network fees in.
## Overview
A fee token is the USD stablecoin a transaction pays its network fee in. A Tempo account needs no separate gas token for fees.
Set the account's default fee token once. Override it on any transaction that should pay in another stablecoin. On mainnet, use [OUSD](https://tempo.com/developers/docs/guide/ousd) for most accounts.
## Supported Fee Tokens
After selecting a fee token, Tempo checks it before running the transaction:
* It's a [TIP-20 token](https://tempo.com/developers/docs/protocol/tip20/overview), Tempo's token standard, whose currency is USD.
* The account paying the fee holds enough of it to cover the maximum fee. The maximum fee is the gas limit times the gas price.
* If the block's validator wants a different stablecoin, the [Fee AMM](https://tempo.com/developers/docs/protocol/fees/spec-fee-amm) has enough liquidity to convert it. The Fee AMM is Tempo's built-in exchange pools.
If any check fails, the transaction is invalid and isn't included. Tempo doesn't try another token.
## Set a Default Fee Token
The default covers every transaction the account pays the fee for. That includes ones it sponsors for other accounts as a [fee payer](https://tempo.com/developers/docs/accounts/fees/fee-sponsorship). Without one, Tempo follows the [fee token order](https://tempo.com/developers/docs/accounts/fees#fee-token-precedence).
Its final fallback tries pathUSD, then OUSD. OUSD is tried only when pathUSD cannot cover the maximum fee. This fallback does not override an explicit token, a stored preference, or a token inferred from the transaction.
In the code, `account` is a funded configurable account from [Create an account](https://tempo.com/developers/docs/accounts/create#create-an-account-from-a-signing-key). Configurable accounts run on testnet until T14 reaches mainnet. `client.ts` connects to [testnet](https://tempo.com/developers/docs/accounts/create#connect-to-testnet). The examples pay fees in its faucet's test stablecoins. A single-key account on mainnet or testnet sets and overrides its fee token the same way, with that network's stablecoins.
:::code-group
```ts [set-fee-token.ts]
import { client } from './client'
// A test stablecoin on testnet
const otherStablecoin = '0x20c0000000000000000000000000000000000002'
const { receipt } = await client.fee.setUserTokenSync({ // [!code hl]
account, // [!code hl]
token: otherStablecoin, // [!code hl]
// pays this transaction's own fee in the same stablecoin // [!code hl]
feeToken: otherStablecoin, // [!code hl]
}) // [!code hl]
```
```ts [client.ts]
import { http } from 'viem'
import { tempoModerato } from 'viem/chains'
import { createClient } from 'viem/tempo'
// Tempo testnet. The public RPC needs no key.
export const client = createClient({
chain: tempoModerato,
transport: http(),
})
```
:::
[`fee.setUserToken`](https://viem.sh/tempo/actions/fee.setUserToken) calls `setUserToken` on the FeeManager, Tempo's built-in fee contract. Pass `feeToken` as well. This selects the token for the transaction's own fee instead of relying on the protocol fallback.
Read the current default with `client.fee.getUserToken({ account: account.address })`. It returns `null` until one is set.
The default outranks the token being transferred. With OUSD as the default, a transfer of another stablecoin still pays its fee in OUSD. The transaction is invalid if the account's OUSD can't cover it.
## Override the Fee Token
Pass `feeToken` to pay one transaction's fee in a different stablecoin. It outranks the default and every other rule, for that transaction only. Here the account sends one stablecoin to `recipient`, the payee's address. It pays the fee in another stablecoin:
```ts [transfer.ts]
import { parseUnits } from 'viem'
import { client } from './client'
// Two test stablecoins on testnet
const stablecoin = '0x20c0000000000000000000000000000000000001'
const otherStablecoin = '0x20c0000000000000000000000000000000000002'
await client.token.transferSync({
account,
amount: parseUnits('25', 6),
// this transaction's fee token
feeToken: stablecoin, // [!code hl]
to: recipient,
token: otherStablecoin,
})
```
On a transaction sent through a [fee payer server](https://tempo.com/developers/docs/accounts/fees/fee-sponsorship#fee-sponsorship-limits), leave `feeToken` off, because the server picks it. When your backend sponsors the transaction itself, set `feeToken` to the token being transferred.
## Related
[Fee Management](https://tempo.com/developers/docs/accounts/fees): Covers who pays each fee and the order Tempo uses to pick the fee token.
[Fee Sponsorship](https://tempo.com/developers/docs/accounts/fees/fee-sponsorship): Use for paying your customers' fees with a fee payer.
[Choose a Fee Token](https://tempo.com/developers/docs/guide/payments/pay-fees-in-any-stablecoin): Use for trying a per-transaction fee token in Wagmi, Rust, Python, Go, or Cast.
[Fee Specification](https://tempo.com/developers/docs/protocol/fees/spec-fee#fee-token-preferences): Covers fee token preferences in the protocol.
> Source: [/docs/accounts/fees/fee-sponsorship](https://tempo.com/developers/docs/accounts/fees/fee-sponsorship.md)
> Section: [Accounts](https://tempo.com/developers/docs/accounts.md). Create accounts, set up signing methods, policies, access keys, key rotation, and fees, and follow guides for users, automations, agents, and teams.
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
# Fee Sponsorship
Pays your customers' network fees, so their accounts need no fee balance.
## Overview
A fee payer is an account that you run or Tempo hosts. It adds its signature to a customer's Tempo transaction and pays the fee from its own balance. That signature covers only the fee, so the fee payer can't change what the account signed or move its funds.
1. The account signs its calls.
2. The fee payer decides whether to sponsor the transaction. It picks the fee token and adds its signature.
3. Tempo verifies both signatures and charges the fee to the fee payer.
Tempo rejects the transaction if either signature fails or the fee payer can't cover the fee. The worst a fee payer can do is refuse or delay sponsorship. The account can then pay its own fee if it holds a fee token.
## Run Your Own Fee Payer
Your own fee payer is an account funded with stablecoins. Its key stays on your backend. How you use it depends on where the customer's transaction is signed:
* **Your Backend Signs:** It signs with a key it holds for the account, such as an [access key](https://tempo.com/developers/docs/accounts/access-keys). It passes the fee payer as `feePayer`.
* **The Customer's Device Signs:** It signs with a key such as a passkey, then sends the transaction to your fee payer server. The server adds the fee payer's signature.
### When Your Backend Signs
`client.ts` connects to [testnet](https://tempo.com/developers/docs/accounts/create#connect-to-testnet). Configurable accounts run on testnet until T14 reaches mainnet, so these examples can sponsor either kind of account. To sponsor single-key accounts on mainnet, connect `client` to mainnet instead.
In `sponsored-transfer.ts`, `account` is the paying account with the keys that approve the payment attached. It can be the account from [Create an account](https://tempo.com/developers/docs/accounts/create#create-an-account-from-a-signing-key) or an [access key](https://tempo.com/developers/docs/accounts/access-keys) your backend holds for it. `recipient` is the payee's address. Fund the fee payer's address from the [testnet faucet](https://tempo.com/developers/docs/accounts/create#fund-an-account-on-testnet) first, so it can pay fees:
:::code-group
```ts [sponsored-transfer.ts]
import { parseUnits } from 'viem'
import { Account } from 'viem/tempo'
import { client } from './client'
// A test stablecoin on testnet
const stablecoin = '0x20c0000000000000000000000000000000000001'
// Keep the fee payer's private key on your server.
const feePayer = Account.fromSecp256k1(process.env.FEE_PAYER_KEY as `0x${string}`) // [!code hl]
await client.token.transferSync({
account, // needs the stablecoin for the payment, none for the fee
amount: parseUnits('25', 6),
// The fee payer signs only for the fee, pays it, and picks the token being transferred.
feePayer, // [!code hl]
feeToken: stablecoin, // [!code hl]
to: recipient,
token: stablecoin,
})
```
```ts [client.ts]
import { http } from 'viem'
import { tempoModerato } from 'viem/chains'
import { createClient } from 'viem/tempo'
// Tempo testnet. The public RPC needs no key.
export const client = createClient({
chain: tempoModerato,
transport: http(),
})
```
:::
Your backend decides what to sponsor. The fee payer pays for every transaction your code passes it to. Authenticate and rate-limit the requests that trigger one.
### When the Customer's Device Signs
The customer's keys stay on their device and sign the payment. The fee payer's key stays on your backend and signs only for the fee. Run the fee payer as a server that the customer's device sends its transactions to. Viem's `Relay` with the [`Relay.feePayer` plugin](https://viem.sh/tempo/relay/plugins/fee-payer) is that server. It forwards requests to testnet through the same `client`. It adds the fee payer's signature to each transaction that `validate` approves:
```ts [fee-payer-server.ts]
import { Account, Relay } from 'viem/tempo'
import { client } from './client'
const relay = Relay.create({
client, // forwards to testnet
plugins: [
Relay.feePayer({ // [!code hl]
account: Account.fromSecp256k1(process.env.FEE_PAYER_KEY as `0x${string}`), // [!code hl]
// pays every fee in a test stablecoin on testnet // [!code hl]
feeToken: '0x20c0000000000000000000000000000000000001', // [!code hl]
validate: async (request) => request.from !== undefined && (await isCustomer(request.from)), // [!code hl]
}), // [!code hl]
],
})
export default { fetch: relay.fetch }
```
The server's URL ships in your app, so anyone can send it transactions. Each transaction it sponsors spends the fee payer's balance.
`validate` is your sponsorship policy. It receives the filled transaction, with the sending account's address as `request.from`. `isCustomer` stands for your own check, such as looking that address up in your user records. Only `true` sponsors the transaction. With `false`, the customer's call fails with `Sponsorship rejected.` and nothing is sent. Without `validate`, the server sponsors every transaction it receives. Add rate limits too, since one customer can send many transactions.
`bun fee-payer-server.ts` serves this file unchanged. Other servers can pass their requests to `relay.fetch`. It takes a standard `Request` and returns a `Response`. Set `FEE_PAYER_KEY` on the server. Fund the fee payer's address from the faucet.
On the customer's device, route the client through your server with [`withRelay`](https://viem.sh/tempo/transports/withRelay). Set `feePayer: true` on each transaction you want sponsored. The first `http()` is the transport to testnet's public RPC, as in `client.ts`. It needs no key:
```ts [pay.ts]
import { http, parseUnits } from 'viem'
import { tempoModerato } from 'viem/chains'
import { createClient, withRelay } from 'viem/tempo'
// A test stablecoin on testnet
const stablecoin = '0x20c0000000000000000000000000000000000001'
const client = createClient({
chain: tempoModerato,
// fee payer requests go to your server, everything else to testnet
transport: withRelay(http(), http('https://fee-payer.example.com')), // [!code hl]
})
await client.token.transferSync({
account, // needs the stablecoin for the payment, none for the fee
amount: parseUnits('25', 6),
// ask your fee payer server to sponsor
feePayer: true, // [!code hl]
to: recipient,
token: stablecoin,
})
```
`account` is the customer's account, with the keys on this device attached. It's a single-key account, or a configurable account [rebuilt from its saved configuration](https://tempo.com/developers/docs/accounts/policies/signing-thresholds#collect-approvals). `recipient` is the payee's address. Leave `feeToken` off, because the server picks it.
## Use the Hosted Fee Payer
Tempo also hosts a fee payer server. The [Fee Payer API](https://tempo.com/developers/docs/api/fee-payer) takes your server's place in `withRelay`, with a Tempo API key. It runs on mainnet and testnet.
## Limits
* When your backend sponsors directly, the fee payer pays in the transaction's `feeToken`.
* A fee payer server pays in its own `feeToken` setting.
* Fund the fee payer with the [supported fee token](https://tempo.com/developers/docs/accounts/fees/fee-tokens#supported-fee-tokens) it pays in.
* A sponsored transaction that's included and then fails still costs the fee payer its fee.
## Related
[Fee Tokens](https://tempo.com/developers/docs/accounts/fees/fee-tokens): Covers which stablecoins can pay fees and how to set a default.
[Fee Payer API](https://tempo.com/developers/docs/api/fee-payer): Covers Tempo's hosted fee payer on mainnet and the Moderato testnet.
[Sponsor Fees](https://tempo.com/developers/docs/api/fee-payer): Use for trying the hosted fee payer in a browser demo.
[Fee Specification](https://tempo.com/developers/docs/protocol/fees/spec-fee#fee-payer): Covers the fee payer in the protocol.
> Source: [/docs/accounts/virtual-addresses](https://tempo.com/developers/docs/accounts/virtual-addresses.md)
> Section: [Accounts](https://tempo.com/developers/docs/accounts.md). Create accounts, set up signing methods, policies, access keys, key rotation, and fees, and follow guides for users, automations, agents, and teams.
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
# Virtual Addresses
Give each customer their own deposit address while every payment lands in one Tempo account.
## Overview
Virtual addresses turn one Tempo account into an omnibus account. You register the account once, then hand each customer a deposit address derived from it. Stablecoins sent to any of those addresses land in your account.
Each deposit names the address it was sent to, and that address carries your customer tag. You credit the right customer without per-customer wallets or sweep jobs. The tag tells you whose address received the deposit, not who sent it.
## Use Cases
Virtual addresses fit a business that holds funds for many customers in one account:
* **Exchanges and Brokers:** Give each customer a deposit address.
* **Custodians:** Run an omnibus wallet for many clients.
* **Payment Processors and Platforms:** Issue an address per merchant, customer, or invoice.
If each customer controls their own funds, give them their own [Tempo account](https://tempo.com/developers/docs/accounts/apps) instead.
## Receiving Account
Deposit addresses stay bound to the account you register, so register one whose keys can change. A [configurable account](https://tempo.com/developers/docs/accounts/account-configuration/configuration-updates) adds or removes signers at the same address, and runs on testnet now and on mainnet from [T14](https://tempo.com/developers/docs/protocol/upgrades/t14) on December 8, 2026. On mainnet, register a multisig or upgradeable contract instead of a single-key account if you expect to rotate keys.
## Setup
:::steps
### Register Your Account
Send one [registration transaction](https://tempo.com/developers/docs/guide/payments/virtual-addresses) from the account. Register more than once to get separate ranges of addresses, such as one per business line.
### Give Each Customer an Address
Derive each customer's address offchain from your registration and a customer tag you choose. Creating an address needs no transaction, so issue as many as you need. Keep the mapping from tag to customer in your own records.
### Credit Each Deposit
Every deposit to a customer's address shows up in your account's transfer history with that address. Read the customer tag from it and credit that customer. For history, read transfers with the [Tempo API](https://tempo.com/developers/docs/api/transfers).
:::
## Account Rules
Deposits to a virtual address are deposits to your account. Your account's [receive policy](https://tempo.com/developers/docs/accounts/policies/receive-policies#virtual-address-behavior) decides which stablecoins and senders it accepts. Tempo holds anything else instead of crediting it. Confirm each deposit reached your account before you credit the customer.
Tempo forwards only TIP-20 stablecoins. Other tokens sent to a virtual address are unrecoverable, so tell customers to send only supported stablecoins on Tempo.
## Related
[Virtual Addresses for TIP-20 Deposits](https://tempo.com/developers/docs/protocol/tip20/virtual-addresses): Covers how forwarding works, the address format, and what changes for wallets and indexers.
[Customer Deposit Addresses](https://tempo.com/developers/docs/guide/payments/virtual-addresses): Use for sending the registration transaction and deriving each address.
[Receive Policies](https://tempo.com/developers/docs/accounts/policies/receive-policies): Covers which stablecoins and senders an account accepts.
> Source: [/docs/accounts/apps](https://tempo.com/developers/docs/accounts/apps.md)
> Section: [Accounts](https://tempo.com/developers/docs/accounts.md). Create accounts, set up signing methods, policies, access keys, key rotation, and fees, and follow guides for users, automations, agents, and teams.
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
# Apps
Gives each user an account they control, with your wallet provider signing alongside them.
## Overview
A consumer app holds each user's Tempo account through a wallet provider, such as Privy, Turnkey, or Dynamic. Examples include wallets, remittance apps, and savings apps.
Each user keeps the same address when they recover the account or leave your app. Users who connect a [wallet they already have](https://tempo.com/developers/docs/accounts/wallets) hold their own key instead.
:::warning
**Multiple signers arrive on mainnet with the [T14 network upgrade](https://tempo.com/developers/docs/protocol/upgrades/t14).** They are live on [testnet](https://tempo.com/developers/docs/accounts/create#connect-to-testnet) since T14 activated there on November 24, 2026. Mainnet activation is scheduled for December 8, 2026.
:::
## Recommended App Setup
Provider wallets with one key each work on mainnet and testnet today ([what your provider sets up today](https://tempo.com/developers/docs/accounts/apps#what-your-provider-sets-up-today)).
Give each account three signers at weight 1, with any two approving ([signing thresholds](https://tempo.com/developers/docs/accounts/policies/signing-thresholds)):
* **User Passkey:** The user's [passkey](https://tempo.com/developers/docs/accounts/authentication/passkeys) on their phone.
* **Provider Key:** A key your provider manages. It signs only for a user your app has signed in.
* **Backup Key:** A key the user keeps, such as a second passkey on another device or a hardware key.
Day to day, the passkey and the provider sign each payment together. No payment goes through without the user. If the user loses their phone, the provider and the backup replace the passkey.
The passkey and backup work without your app or the provider, even when either is down or breached. Together they pay, recover the account, or remove the provider's key.
## Existing Provider Wallets
Each user gets one secp256k1 key. The provider holds it and unlocks it when the user logs in. That key makes the user's wallet a [single-key account](https://tempo.com/developers/docs/accounts/how-it-works#address), which works unchanged on Tempo mainnet and testnet.
The key controls the whole balance. Anyone the provider lets request a signature moves it. That includes the user after they log in, and your backend under the provider's policies. Because the key is secp256k1, the account's own key can't be a passkey or device key.
## Migration From Provider Wallets
If your users already have wallets with Privy or another provider, you don't create new accounts. Each wallet's secp256k1 key gives it the same address on Tempo as on other EVM chains. Balances on other chains don't carry over. Sending and receiving stablecoins works unchanged.
Fee tokens, batched calls, and access keys need the provider's Tempo integration, which sends [Tempo Transactions](https://tempo.com/developers/docs/guide/tempo-transaction). Privy's Tempo-specific React hook supports `sponsor: true`. Its [Tempo transaction guide](https://docs.privy.io/wallets/using-wallets/tempo/send-a-transaction) lists the SDK and project requirements. To operate your own sponsorship service, use a [fee payer](https://tempo.com/developers/docs/accounts/fees/fee-sponsorship).
## Provider Support on Tempo
Any provider that signs Ethereum transactions can hold and send stablecoins on Tempo ([EVM compatibility](https://tempo.com/developers/docs/quickstart/evm-compatibility)). Tempo Transaction features need more. They include paying fees in any stablecoin, batching payments, sponsoring fees, and authorizing [access keys](https://tempo.com/developers/docs/accounts/access-keys).
For those, the provider sends Tempo Transactions itself. Or it signs a transaction's raw hash, and your app sends the transaction to a Tempo RPC. Privy, Turnkey, and Dynamic do both.
| Provider | Sends Tempo Transactions | Signs raw hashes |
| --- | --- | --- |
| [Privy](https://docs.privy.io/wallets/using-wallets/tempo/send-a-transaction) | Yes, with calls, fee token, nonces, and sponsorship | `secp256k1_sign`, or `raw_sign` on server wallets |
| [Turnkey](https://docs.turnkey.com/features/networks/overview) | Yes, through `sign_transaction`, which its policies can inspect | `sign_raw_payload` with no hash function |
| [Dynamic](https://www.dynamic.xyz/docs) | Yes, through its Tempo SDK extension | `signRawMessage` |
The provider's policy engine can't read a raw hash. It can't tell a payment or a key authorization from any other request. Route raw signing through one backend service that builds and checks each transaction. It checks any access key's limits, scopes, and expiry before it calls the provider.
To keep key authorization inside the policy engine instead, use the provider's transaction API. Send a Tempo Transaction that calls `authorizeKey` on the [Account Keychain](https://tempo.com/developers/docs/protocol/transactions/AccountKeychain).
## Related
[Set Up a Self-Custodial Wallet With a Provider](https://tempo.com/developers/docs/accounts/apps/self-custodial-wallets): Use for giving each user a passkey, a provider key, and a backup key.
[Recover a User's Account](https://tempo.com/developers/docs/accounts/apps/recover-an-account): Use for replacing a lost passkey or backup at the same address.
[Pay From a User's Embedded Wallet](https://tempo.com/developers/docs/accounts/automations/pay-from-an-embedded-wallet): Use for letting your backend or an agent pay within limits the wallet signs once.
[Signing Thresholds](https://tempo.com/developers/docs/accounts/policies/signing-thresholds): Covers signer weights and how many approvals an account needs.
> Source: [/docs/accounts/apps/self-custodial-wallets](https://tempo.com/developers/docs/accounts/apps/self-custodial-wallets.md)
> Section: [Accounts](https://tempo.com/developers/docs/accounts.md). Create accounts, set up signing methods, policies, access keys, key rotation, and fees, and follow guides for users, automations, agents, and teams.
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
# Set Up a Self-Custodial Wallet With a Provider
Builds an account where your provider's key and the user's passkey approve each payment together.
## Overview
This guide builds a three-signer Tempo account for each user of a consumer app with its own login. A wallet provider, such as Privy or Turnkey, holds one signer. Only the user can recover the account or leave without you.
Self-custody rules in some markets require two properties:
* **No Unilateral Control:** Neither your app nor your provider can move or recover the funds alone.
* **Access During Outages:** The user reaches the funds when your systems are down or breached.
A key export meets the first requirement only. It also leaves most users with key material they can't safely use.
:::warning
**Multiple signers arrive on mainnet with the [T14 network upgrade](https://tempo.com/developers/docs/protocol/upgrades/t14).** They are live on [testnet](https://tempo.com/developers/docs/accounts/create#connect-to-testnet) since T14 activated there on November 24, 2026. Mainnet activation is scheduled for December 8, 2026.
:::
Each user's account has three signers:
* **Passkey:** The user's passkey, on their phone.
* **Provider Key:** A key your provider manages.
* **Backup Key:** A second key the user keeps.
Any two approve a transaction. The passkey and backup reach the [threshold](https://tempo.com/developers/docs/accounts/policies/signing-thresholds) without your app or the provider.
## Fund Control
| Who | What they can do alone |
| --- | --- |
| The user, with their passkey and backup | Pay, recover, remove the provider's key, or leave |
| Your wallet provider | Nothing. Its key is one approval of the two each transaction needs. |
| Your app | Nothing. It holds no key; it asks the provider to sign only for a signed-in user. |
## Setup
::::steps
### Connect Privy or Turnkey
Your provider signs through its own API, and only for a user your app has signed in.
* [Privy](https://docs.privy.io/wallets/using-wallets/tempo/send-a-transaction): Start from the [Privy Tempo example](https://github.com/privy-io/examples/tree/main/examples/privy-next-tempo). Sign transaction hashes with `secp256k1_sign`, or `raw_sign` on server wallets.
* [Turnkey](https://docs.turnkey.com/features/networks/tempo): Start from the [Turnkey Tempo example](https://github.com/tkhq/sdk/tree/main/examples/chain-integrations/with-tempo). Sign transaction hashes with `sign_raw_payload` and no hash function.
Create a wallet for the user with your provider. Wrap it as a Viem account that asks the provider to sign, as in [Pay from a user's embedded wallet](https://tempo.com/developers/docs/accounts/automations/pay-from-an-embedded-wallet#wrap-the-providers-signing-as-an-account). Call it `providerAccount`.
### Create the Account
Give the [passkey](https://tempo.com/developers/docs/accounts/authentication/passkeys), the provider's key, and the backup key weight 1 each, with a [threshold](https://tempo.com/developers/docs/accounts/policies/signing-thresholds) of 2.
The backup is a second passkey on another device, or a hardware key. The user sets it up during onboarding, and the account lists it by address. `client.ts` connects to [testnet](https://tempo.com/developers/docs/accounts/create#connect-to-testnet).
:::code-group
```ts [account.ts]
import { Account, WebAuthnP256 } from 'viem/tempo'
import { providerAccount } from './provider-account'
const credential = await WebAuthnP256.createCredential({ label: 'My account' })
const passkey = Account.fromWebAuthnP256(credential)
export const account = Account.fromConfig({
address: 'infer', // derive the address from these first signers
owners: [ // [!code hl]
{ owner: passkey, weight: 1 }, // [!code hl]
{ owner: providerAccount, weight: 1 }, // [!code hl]
{ owner: backupAddress, weight: 1 }, // [!code hl]
], // [!code hl]
threshold: 2, // [!code hl]
})
```
```ts [client.ts]
import { http } from 'viem'
import { tempoModerato } from 'viem/chains'
import { createClient } from 'viem/tempo'
// Tempo testnet. The public RPC needs no key.
export const client = createClient({
chain: tempoModerato,
transport: http(),
})
```
:::
Creating the account sends nothing. The address receives stablecoins right away, and its first transaction registers it onchain.
Save these with the user's record, and rebuild the account from them each time ([keep the current configuration](https://tempo.com/developers/docs/development/configurable-accounts#keep-the-current-configuration)):
* `account.address`
* `account.config`
* The passkey's [`credential.id` and `credential.publicKey`](https://tempo.com/developers/docs/accounts/authentication/passkeys#passkey-limits)
### Sign Each Payment
Viem signs with the account's attached keys until their weights reach the threshold. With the passkey and `providerAccount` attached, each payment prompts for the passkey and requests one provider signature.
```ts [pay.ts]
import { parseUnits } from 'viem'
import { account } from './account'
import { client } from './client'
// A test stablecoin on testnet
const token = '0x20c0000000000000000000000000000000000001'
await client.faucet.fundSync({ account: account.address }) // testnet test stablecoins
await client.token.transferSync({ account, amount: parseUnits('1', 6), to: recipient, token }) // [!code hl]
```
The provider signs only the transaction's hash, so its policy engine can't read the payment. Build each transaction in your backend and check it before the provider signs ([route raw signing through one backend](https://tempo.com/developers/docs/accounts/apps#route-raw-signing-through-one-backend)).
To skip the passkey prompt on small payments, authorize a [device key](https://tempo.com/developers/docs/accounts/authentication/device-keys) with a spending limit. The passkey and provider sign that authorization.
### Back Up the User's Account
Have the user test their backup before they fund the account. They sign a test message with it, or approve one small payment with the passkey and backup together.
Without the passkey and backup, the user depends on your provider. If the provider is also unreachable, no one can approve until it's back.
::::
## Failure Cases
| What happened | Who approves | What they do |
| --- | --- | --- |
| The user lost their phone | The provider and the backup | [Replace the passkey](https://tempo.com/developers/docs/accounts/apps/recover-an-account) with one on the new phone |
| Your app or the provider is down or breached | The passkey and the backup | Pay as usual, or [remove the provider's key](https://tempo.com/developers/docs/accounts/account-configuration/configuration-updates#remove-a-lost-or-compromised-signer) |
| The user wants to leave | The passkey and the backup | [Remove the provider's key](https://tempo.com/developers/docs/accounts/account-configuration/configuration-updates#remove-a-signer), or swap it for another signer the user holds ([replace a signer](https://tempo.com/developers/docs/accounts/account-configuration/configuration-updates#replace-a-signer-in-one-update)), at the same address |
A configuration update keeps the account's address, balances, and [Earn](https://tempo.com/developers/docs/earn) positions. Save the new configuration each update returns.
## Leave Without Your App
The passkey and backup sign from any Tempo client, not only your app. To leave, the user [withdraws from Earn](https://tempo.com/developers/docs/earn/withdraw), then sends their stablecoins to another account or an [offramp](https://tempo.com/developers/docs/partners/payments-and-ramps).
## Add a Recovery Service
A user who loses both the passkey and the backup needs a fourth signer. Add one at weight 1, held by a recovery service you contract.
The service approves with one of the user's keys or the provider. Any two signers can also pay, so choose a service you'd trust to approve payments ([recovery provider](https://tempo.com/developers/docs/accounts/policies/signing-thresholds#recovery-provider)).
## Related
[Recover a User's Account](https://tempo.com/developers/docs/accounts/apps/recover-an-account): Use for replacing a lost passkey or backup at the same address.
[Pay From a User's Embedded Wallet](https://tempo.com/developers/docs/accounts/automations/pay-from-an-embedded-wallet): Use for wrapping the provider's signing and spending within limits.
[Signing Thresholds](https://tempo.com/developers/docs/accounts/policies/signing-thresholds): Covers signer weights, thresholds, and recovery providers.
[Configuration Updates](https://tempo.com/developers/docs/accounts/account-configuration/configuration-updates): Use for adding, removing, or replacing a signer.
> Source: [/docs/accounts/apps/recover-an-account](https://tempo.com/developers/docs/accounts/apps/recover-an-account.md)
> Section: [Accounts](https://tempo.com/developers/docs/accounts.md). Create accounts, set up signing methods, policies, access keys, key rotation, and fees, and follow guides for users, automations, agents, and teams.
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
# Recover a User's Account
Replaces a user's lost passkey at the same address, with the two signers they still have.
## Overview
Recovery replaces the passkey a user lost with their phone. Their funds don't move to a new account.
The steps assume the [self-custodial setup](https://tempo.com/developers/docs/accounts/apps/self-custodial-wallets). It has three signers at weight 1, and any two approve:
* **Passkey:** The user's passkey, lost with the phone.
* **Provider Key:** A key your wallet provider manages.
* **Backup Key:** A second key the user keeps.
The provider's key and the backup approve a new passkey from the user's new phone. The new passkey and the provider then revoke the lost phone's device key. The balance and [Earn](https://tempo.com/developers/docs/earn) positions stay at the same address.
:::warning
**Multiple signers arrive on mainnet with the [T14 network upgrade](https://tempo.com/developers/docs/protocol/upgrades/t14).** They are live on [testnet](https://tempo.com/developers/docs/accounts/create#connect-to-testnet) since T14 activated there on November 24, 2026. Mainnet activation is scheduled for December 8, 2026.
:::
## Recovery Requirements
Replacing a lost signer needs a configurable account. Tempo can't override an account's signers, so recovery works only if the remaining signers reach the threshold. Run this check for every signer before the user funds the account.
```ts [check.ts]
const total = saved.config.owners.reduce((sum, { weight }) => sum + weight, 0)
const recoverable = saved.config.owners.every(({ weight }) => total - weight >= saved.config.threshold)
```
Tempo stores only a hash of the account's configuration. Your app rebuilds the account from the address and configuration it saved after the last update. The examples call them `saved.address` and `saved.config`.
## Recovery Demo
The demo runs the same recovery in this browser, with stand-in signers:
* **Passkey:** A device key at weight 2, which the demo treats as lost.
* **Provider Key:** A private key.
* **Backup Key:** A second private key.
The replacement device key has weight 2, so it approves the revoke alone.
In the interactive web page, a demo runs the steps that follow on testnet with the reader's own signers: a passkey on their device, or keys the page generates. Each step that changes the account sends a testnet transaction and shows its hash, next to what changed in the app and on the account. It runs only where the page can reach testnet.
## Setup
::::steps
### Create the Replacement Signer
The user creates a new passkey on their new phone. It isn't a signer until the next step adds it. Save its `credential.id` and `credential.publicKey` with the user's record, as at signup.
```ts [recover.ts]
import { Account, WebAuthnP256 } from 'viem/tempo'
const credential = await WebAuthnP256.createCredential({ label: 'My account' })
const passkey = Account.fromWebAuthnP256(credential) // [!code hl]
```
### Approve With the Remaining Signers
Rebuild the account from `saved`, and attach the two keys that approve:
* **`providerAccount`:** The provider's key, wrapped as in [Set up a self-custodial wallet](https://tempo.com/developers/docs/accounts/apps/self-custodial-wallets#connect-privy-or-turnkey).
* **`backup`:** The user's backup key.
A signer without an attached key stays an address that can't sign, such as the lost passkey at `lostPasskey`.
At version 0, `openAccount` derives the address from the original configuration. After an update, it passes the saved address instead.
The update swaps the lost passkey for the new one at the same weight. Viem signs it with both attached keys, and their weights of 1 each reach the threshold of 2.
`client.ts` connects to [testnet](https://tempo.com/developers/docs/accounts/create#connect-to-testnet).
:::code-group
```ts [recover.ts]
import { isAddressEqual } from 'viem'
import { AccountConfig, Actions } from 'viem/tempo'
import { client } from './client'
import { providerAccount } from './provider-account'
/** The account that `saved` describes, holding the approvers' keys. */
function openAccount(approvers: Account.RootAccount[]) {
const { address, config } = saved
const owners = config.owners.map(({ owner, weight }) => ({
owner: approvers.find((key) => isAddressEqual(key.address, owner)) ?? owner,
weight,
}))
if (config.version === 0n)
return Account.fromConfig({ address: 'infer', owners, salt: config.salt, threshold: config.threshold })
return Account.fromConfig({ ...config, address, owners })
}
// the user's backup passkey, from its saved id and public key
const backup = Account.fromWebAuthnP256(backupCredential)
const nextConfig = { // [!code hl]
owners: saved.config.owners.map(({ owner, weight }) => ({ // [!code hl]
owner: isAddressEqual(owner, lostPasskey) ? passkey.address : owner, // [!code hl]
weight, // [!code hl]
})), // [!code hl]
threshold: saved.config.threshold, // [!code hl]
} // [!code hl]
await client.writeContractSync({ // [!code hl]
account: openAccount([providerAccount, backup]), // [!code hl]
...Actions.accounts.updateConfig.call({ currentConfig: saved.config, nextConfig }), // [!code hl]
throwOnReceiptRevert: true, // [!code hl]
}) // [!code hl]
// Save only after success. The next step builds from this new version.
saved.config = AccountConfig.update(saved.config, nextConfig) // [!code hl]
```
```ts [client.ts]
import { http } from 'viem'
import { tempoModerato } from 'viem/chains'
import { createClient } from 'viem/tempo'
// Tempo testnet. The public RPC needs no key.
export const client = createClient({
chain: tempoModerato,
transport: http(),
})
```
:::
As with every payment, build the update in your backend. Check it before the provider signs ([route raw signing through one backend](https://tempo.com/developers/docs/accounts/apps#route-raw-signing-through-one-backend)). Once the update lands, the lost passkey can't approve anything.
If the attached keys don't reach the threshold, Viem throws `Local owners do not meet the threshold.` and sends nothing. Approvals can also come from [separate devices](https://tempo.com/developers/docs/accounts/policies/signing-thresholds#approvers-on-separate-devices), such as the backup on the user's laptop.
### Revoke the Lost Device's Keys
The lost phone's device key is an [access key](https://tempo.com/developers/docs/accounts/access-keys), so it still pays within its limits. A configuration update doesn't revoke it. Revoke it now.
The new passkey and the provider approve the revoke together, as for any payment. `lostDeviceKey` is the address your app saved when it authorized the key.
Build from the updated `saved.config`. An account built from the old configuration fails with `multisig configuration commitment mismatch`.
```ts [recover.ts]
await client.accessKey.revokeSync({ // [!code hl]
// rebuilt from the new `saved.config`
account: openAccount([passkey, providerAccount]), // [!code hl]
accessKey: lostDeviceKey, // [!code hl]
}) // [!code hl]
```
If you didn't save the lost key's address, [list the keys the account has authorized](https://tempo.com/developers/docs/accounts/access-keys/revocation#revoke-when-signers-change). A revoked key can't be authorized again, so authorize a new [device key](https://tempo.com/developers/docs/accounts/authentication/device-keys) for the new phone.
::::
## Replace a Lost Backup Key
The passkey and the provider replace a lost backup the same way. Attach `passkey` and `providerAccount` to `openAccount`, and swap the lost backup's address for the new backup's. Have the user sign a test message or approve one small payment with the new backup before relying on it.
The provider's key can't approve alone. If the user loses both the passkey and the backup, the account stays locked. It recovers only if it has a fourth signer, such as a [recovery service](https://tempo.com/developers/docs/accounts/apps/self-custodial-wallets#add-a-recovery-service).
## Related
[Set Up a Self-Custodial Wallet With a Provider](https://tempo.com/developers/docs/accounts/apps/self-custodial-wallets): Use for creating the three-signer account this guide recovers.
[Revocation](https://tempo.com/developers/docs/accounts/access-keys/revocation): Covers revoking access keys, including when signers change.
[Device Keys](https://tempo.com/developers/docs/accounts/authentication/device-keys): Covers the keys that sign on each of a user's devices.
[Signing Thresholds](https://tempo.com/developers/docs/accounts/policies/signing-thresholds): Covers signer weights and approvers on separate devices.
> Source: [/docs/accounts/automations](https://tempo.com/developers/docs/accounts/automations.md)
> Section: [Accounts](https://tempo.com/developers/docs/accounts.md). Create accounts, set up signing methods, policies, access keys, key rotation, and fees, and follow guides for users, automations, agents, and teams.
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
# Automations
Lets a backend or an agent pay from an account without holding the account's key.
## Overview
An automation is code that sends stablecoins without a person approving each payment. Examples include payouts, payroll, card funding, and AI agents. Give that code its own [access key](https://tempo.com/developers/docs/accounts/access-keys) instead of the account's key.
The account's signers authorize the key once. Tempo rejects any payment over its [spending limit](https://tempo.com/developers/docs/accounts/access-keys/spending-limits), outside its [scopes](https://tempo.com/developers/docs/accounts/access-keys/scopes), or after its [expiry](https://tempo.com/developers/docs/accounts/access-keys/expiry). Access keys are part of the protocol, so you don't add session-key modules or wallet contracts.
Access keys are live on mainnet and testnet with a single-key account. None of these setups needs a configurable account.
## Access Keys and Account Keys
* **Account Key on the Server:** A breach lets the attacker move the whole balance.
* **Access Key on the Server:** A breach lets the attacker pay only within that key's limit, recipients, and expiry. The account can [revoke](https://tempo.com/developers/docs/accounts/access-keys/revocation) the key.
Keep the account's key with the user, their wallet provider, or your own approvers for a business account.
Any key that signs Ethereum transactions can send stablecoins on Tempo. A backend that already signs with a KMS key or a provider's server wallet can keep that key. Authorize it as an access key to add the limits. The key pays fees in a stablecoin, or a [fee payer](https://tempo.com/developers/docs/accounts/fees/fee-sponsorship) covers them. The service never holds a gas token.
## Sign With a KMS Key
AWS KMS and Google Cloud KMS keys work as access keys. The private key never leaves the KMS. An access key signs the 32-byte digest of each [Tempo Transaction](https://tempo.com/developers/docs/guide/tempo-transaction). Both KMSs sign digests with secp256k1 and P-256 keys. Wrap the KMS signing call as a Viem account, as in [Keep the key in your KMS](https://tempo.com/developers/docs/accounts/automations/pay-out-from-a-backend#keep-the-key-in-your-kms).
## Sign With Server Wallets
Privy server wallets and Turnkey both sign Tempo Transactions and raw hashes.
| Provider | How it signs on Tempo |
| --- | --- |
| [Privy](https://docs.privy.io/wallets/using-wallets/tempo/send-a-transaction) server wallets | Sends Tempo Transactions through its wallet API, or signs raw hashes with `raw_sign` |
| [Turnkey](https://docs.turnkey.com/features/networks/overview) | Signs Tempo Transactions with `sign_transaction`, which its policies can inspect, or raw hashes with `sign_raw_payload` |
Either can act as an access key. Wrap its raw-hash signing as a Viem account, as in [Pay from a user's embedded wallet](https://tempo.com/developers/docs/accounts/automations/pay-from-an-embedded-wallet#wrap-the-providers-signing-as-an-account).
## Rotate and Revoke Backend Keys
To rotate, authorize a new key, switch the service to it, then [revoke](https://tempo.com/developers/docs/accounts/access-keys/revocation) the old one. A key can't be extended past its expiry, so [renew it](https://tempo.com/developers/docs/accounts/access-keys/expiry#renew-an-expiring-key) before then. Save each key's address with the service that holds it, so you can revoke one key without stopping the others.
## Guidelines
### One Key per Service
A breach of one service then exposes only that key's limit, recipients, and expiry. Authorize a separate access key for each service or agent. Generate it where it runs or in your KMS, so only the key's address leaves it.
### Set All Three Bounds
A key with a limit, scopes, and an expiry can pay only for the job it does. Set a daily limit per stablecoin sized to the job. Add scopes that list the only recipients or contracts it pays, and an expiry.
## Related
[Pay Out From a Backend](https://tempo.com/developers/docs/accounts/automations/pay-out-from-a-backend): Use for paying approved payees up to a daily limit, with a key in your KMS.
[Pay From a User's Embedded Wallet](https://tempo.com/developers/docs/accounts/automations/pay-from-an-embedded-wallet): Use for card programs and subscriptions that pay from a user's Privy or Turnkey wallet.
[Give an Agent a Wallet](https://tempo.com/developers/docs/accounts/automations/give-an-agent-a-wallet): Use for giving an AI agent a budget, an expiry, and only the calls it needs.
[Access Keys](https://tempo.com/developers/docs/accounts/access-keys): Covers the keys an account authorizes with limits, scopes, and expiry.
> Source: [/docs/accounts/automations/pay-out-from-a-backend](https://tempo.com/developers/docs/accounts/automations/pay-out-from-a-backend.md)
> Section: [Accounts](https://tempo.com/developers/docs/accounts.md). Create accounts, set up signing methods, policies, access keys, key rotation, and fees, and follow guides for users, automations, agents, and teams.
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
# Pay Out From a Backend
Sends payouts from your backend with a key that can pay only approved payees, up to a daily limit.
## Overview
This guide builds a payout service that pays contractors, vendors, or sellers in stablecoins without holding the account's key. Nobody approves each payment.
The account's signers, your approvers or your customer's, approve an [access key](https://tempo.com/developers/docs/accounts/access-keys) once. Your backend keeps it in its KMS. Tempo lets that key pay only the [payees they list](https://tempo.com/developers/docs/accounts/access-keys/scopes), up to a [daily limit](https://tempo.com/developers/docs/accounts/access-keys/spending-limits). The key works until it [expires](https://tempo.com/developers/docs/accounts/access-keys/expiry) or is revoked. Until then, a leaked key still sends up to the limit each day, but only to those payees.
The demo and the code run on testnet, a test network whose stablecoins have no value. The demo's customer account is a configurable account whose one signer is a device key in this browser. On mainnet and testnet, a single-key account authorizes a payout key the same way. Its key can be the customer's passkey.
In the interactive web page, a demo runs the steps that follow on testnet with the reader's own signers: a passkey on their device, or keys the page generates. Each step that changes the account sends a testnet transaction and shows its hash, next to what changed in the app and on the account. It runs only where the page can reach testnet.
The code pays out a test stablecoin. You supply the undefined names:
* `account` and `address` are the customer's account and its address.
* `payees` are the addresses the key may pay, and `payee` is one of them.
* `payoutKeyAddress` is the KMS key's address.
* `kms`, `kmsKeyId`, and `kmsPublicKey` are your KMS client, key ID, and public key.
`client.ts` connects to [testnet](https://tempo.com/developers/docs/accounts/create#connect-to-testnet).
## Setup
::::steps
### Authorize a Scoped, Limited Key
Create one secp256k1 key per customer in your KMS. To pay contractors from your company's own account, create one key per payout service instead. Its address, derived from the public key, is the key's ID on Tempo. Send that address to the customer's app, where the customer's signers authorize it.
:::code-group
```ts [app/approve-payouts.ts]
import { parseUnits } from 'viem'
import { Expiry } from 'viem/tempo'
import { client } from '../client'
// A test stablecoin on testnet
const stablecoin = '0x20c0000000000000000000000000000000000001'
await client.accessKey.authorizeSync({
accessKey: { accessKeyAddress: payoutKeyAddress, keyType: 'secp256k1' },
account, // the customer's account, signed by its signers, such as a passkey
expiry: Expiry.days(90), // [!code hl]
// 1,000 of the stablecoin a day
limits: [{ token: stablecoin, limit: parseUnits('1000', 6), period: 86_400 }], // [!code hl]
scopes: [ // [!code hl]
{ address: stablecoin, selector: 'transfer(address,uint256)', recipients: payees }, // [!code hl]
{ address: stablecoin, selector: 'transferWithMemo(address,uint256,bytes32)', recipients: payees }, // [!code hl]
], // [!code hl]
})
```
```ts [client.ts]
import { http } from 'viem'
import { tempoModerato } from 'viem/chains'
import { createClient } from 'viem/tempo'
// Tempo testnet. The public RPC needs no key.
export const client = createClient({
chain: tempoModerato,
transport: http(),
})
```
:::
Authorizing is one transaction the customer approves, for example with their passkey. Payouts then go out without prompting them. Show the customer the payees, daily limit, and expiry before they approve.
Limits are in base units. The stablecoin has 6 decimals, so `parseUnits('1000', 6)` is 1,000 OUSD. Size the limit to your largest payout day plus fees. Fees count against the limit unless a [fee payer](https://tempo.com/developers/docs/accounts/fees/fee-sponsorship) sponsors them.
### Keep the Key in Your KMS
The private key never leaves the KMS. Tempo stores only the key's address, payees, limit, and expiry. Wrap the key in a Viem account that asks the KMS for each signature.
```ts [backend/payout-key.ts]
import { PublicKey, Signature } from 'ox'
import { Account } from 'viem/tempo'
export const payoutKey = Account.from({ // [!code hl]
access: address, // the customer's account address
keyType: 'secp256k1',
publicKey: PublicKey.fromHex(kmsPublicKey), // read once from your KMS
async sign({ hash }) { // [!code hl]
// your KMS client returns { r, s, yParity }
return Signature.toHex(await kms.sign(kmsKeyId, hash)) // [!code hl]
}, // [!code hl]
}) // [!code hl]
```
Anyone who can sign with the KMS key can send payouts within its bounds. In your KMS, allow only the payout service to sign with the key. Log each signing request so you can match it to a payout.
### Send Payouts
```ts [backend/send-payout.ts]
import { parseUnits, stringToHex } from 'viem'
import { client } from '../client'
import { payoutKey } from './payout-key'
// A test stablecoin on testnet
const stablecoin = '0x20c0000000000000000000000000000000000001'
await client.token.transferSync({ // [!code hl]
// the key signs for the customer's account
account: payoutKey, // [!code hl]
amount: parseUnits('250', 6), // [!code hl]
// the fee counts against the key's daily limit
feeToken: stablecoin, // [!code hl]
// your payout ID, for reconciliation
memo: stringToHex('payout-1042', { size: 32 }), // [!code hl]
to: payee, // [!code hl]
token: stablecoin, // [!code hl]
}) // [!code hl]
```
The customer isn't prompted. Tempo rejects three kinds of payout:
* To an address outside `payees`.
* Over what's left of today's limit.
* After the key expires.
To stop payouts, have the signers [revoke the key](https://tempo.com/developers/docs/accounts/access-keys/revocation#revoke-an-access-key).
::::
## Production Checklist
* **Concurrent Payouts:** An account's transactions share one nonce, a counter that orders them, so payouts confirm one at a time by default. To send them concurrently, use [expiring nonces or nonce keys](https://tempo.com/developers/docs/guide/payments/send-parallel-transactions).
* **New Payees:** To add a payee, the signers update the key's [scopes](https://tempo.com/developers/docs/accounts/access-keys/scopes#change-allowed-calls).
* **Expiry:** An expiry can't be extended. [Authorize a replacement key](https://tempo.com/developers/docs/accounts/access-keys/expiry#renew-an-expiring-key) before it passes.
## Move Idle Funds Into Earn
Balances waiting for the next payout run can sit in an [Earn](https://tempo.com/developers/docs/earn) vault. Use a separate key scoped to the vault's `approve` and `deposit` calls, so the payout key still pays only payees. Follow [Deposit](https://tempo.com/developers/docs/earn/integrate) for the vault checks.
## Related
[Access Keys](https://tempo.com/developers/docs/accounts/access-keys): Covers the keys an account authorizes with limits, scopes, and expiry.
[Scopes](https://tempo.com/developers/docs/accounts/access-keys/scopes): Covers which contracts, functions, and recipients a key can use.
[Spending Limits](https://tempo.com/developers/docs/accounts/access-keys/spending-limits): Covers budgets per stablecoin and how they renew.
[Revocation](https://tempo.com/developers/docs/accounts/access-keys/revocation): Covers ending an access key's access for good.
> Source: [/docs/accounts/automations/pay-from-an-embedded-wallet](https://tempo.com/developers/docs/accounts/automations/pay-from-an-embedded-wallet.md)
> Section: [Accounts](https://tempo.com/developers/docs/accounts.md). Create accounts, set up signing methods, policies, access keys, key rotation, and fees, and follow guides for users, automations, agents, and teams.
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
# Pay From a User's Embedded Wallet
Lets your backend pay from a user's Privy or Turnkey wallet, within limits, without holding the user's key.
## Overview
This guide gives your backend an [access key](https://tempo.com/developers/docs/accounts/access-keys) that pays from a user's Privy or Turnkey embedded wallet. Examples include card top-ups, subscriptions, and recurring transfers.
The provider keeps the account key and signs the key's authorization once. After that, your backend signs each payment with its own key. It stays within the limit, recipients, and expiry the user approved.
The example funds a card program. Your card backend gets a key that sends up to 100 OUSD a day for 30 days. It pays only the card program's funding address from your [card issuing partner](https://tempo.com/developers/docs/partners/cards). The code runs on Moderato testnet, whose stablecoins have no value, and works the same on mainnet.
## Key Holders
On each card swipe, your card backend pulls the purchase amount from the user's balance in seconds. It doesn't ask the wallet provider to sign. Each party does only what its own key allows.
| Party | Holds | Can do on its own |
| --- | --- | --- |
| The wallet provider | The account key | Sign what its setup allows, including a transfer of the whole balance |
| Your card backend | Its own access key | Send up to 100 OUSD a day to the card program's funding address, for 30 days |
| Your app | Credentials for the provider's API | Ask the provider to sign, within the provider's policies |
An agent or a partner can hold an access key the same way as the card backend.
## Setup
::::steps
### Wrap the Provider's Signing
Tempo needs the account key to sign a 32-byte hash as is, with no message prefix. Both providers offer that.
* **Privy:** `secp256k1_sign` on an embedded wallet's provider, or `POST /v1/wallets/{wallet_id}/raw_sign` on a server wallet.
* **Turnkey:** `sign_raw_payload` with `HASH_FUNCTION_NO_OP` and `PAYLOAD_ENCODING_HEXADECIMAL`. The account that [`@turnkey/viem`](https://github.com/tkhq/sdk/tree/main/examples/chain-integrations/with-tempo)'s `createAccount` returns already signs hashes this way.
Put that call behind a `signHash` function. Then build a Tempo account that signs only through it. The account needs the key's public key. If your provider doesn't return it, recover it once from a signature.
:::code-group
```ts [provider-account.ts]
import { isAddressEqual, keccak256, recoverPublicKey, toHex } from 'viem'
import { Account, PublicKey } from 'viem/tempo'
import { signHash, walletAddress } from './provider' // your calls to the provider's API
// Recover the wallet's public key once, from a signature over a fixed hash that isn't a transaction
const probe = keccak256(toHex('tempo:recover-public-key'))
const publicKey = PublicKey.fromHex(await recoverPublicKey({ hash: probe, signature: await signHash(probe) }))
export const providerAccount = Account.from({ // [!code hl]
keyType: 'secp256k1', // [!code hl]
publicKey, // [!code hl]
// every signature goes through the provider // [!code hl]
sign: ({ hash }) => signHash(hash), // [!code hl]
}) // [!code hl]
if (!isAddressEqual(providerAccount.address, walletAddress)) throw new Error('Wrong public key')
```
```ts [client.ts]
import { tempoModerato } from 'viem/chains'
import { createClient } from 'viem/tempo'
export const client = createClient({ chain: tempoModerato })
```
:::
`providerAccount.address` is the user's account address. To fund it on Moderato, call `client.faucet.fundSync({ account: providerAccount.address })`.
### Create the Holder's Key
The card backend generates its own key and sends the app only the key's address. The private key never leaves the backend.
```ts [holder-key.ts]
import { Account, P256 } from 'viem/tempo'
// the private key stays with the holder
const privateKey = P256.randomPrivateKey() // [!code hl]
export const holderKey = Account.fromP256(privateKey, { access: accountAddress }) // [!code hl]
// send this address to the app
console.log(holderKey.accessKeyAddress) // [!code hl]
```
`accountAddress` is the user's account address, which the app sends the holder. The holder can use any [access key type](https://tempo.com/developers/docs/accounts/access-keys#give-each-holder-its-own-key), including a secp256k1 key in its own KMS.
### Sign the Key Authorization
The app builds a key authorization, a message that names the holder's key and its bounds. The provider signs it. `holderKeyAddress` is the address the holder sent, and `cardFunding` is the card program's funding address. Nothing goes onchain yet. The backend then pays without asking again, so show the user the card program, limit, and expiry before they approve.
```ts [authorize.ts]
import { parseUnits } from 'viem'
import { Expiry } from 'viem/tempo'
import { KeyAuthorization } from 'ox/tempo'
import { client } from './client'
import { providerAccount } from './provider-account'
// A test stablecoin on testnet
export const stablecoin = '0x20c0000000000000000000000000000000000001'
const keyAuthorization = await client.accessKey.signAuthorization({ // [!code hl]
account: providerAccount, // [!code hl]
accessKey: { accessKeyAddress: holderKeyAddress, keyType: 'p256' }, // [!code hl]
expiry: Expiry.days(30), // [!code hl]
limits: [{ token: stablecoin, limit: parseUnits('100', 6), period: 86_400 }], // [!code hl]
scopes: [{ address: stablecoin, recipients: [cardFunding], selector: 'transfer(address,uint256)' }], // [!code hl]
}) // [!code hl]
export const message = JSON.stringify(KeyAuthorization.toRpc(keyAuthorization)) // send to the holder
```
The provider receives only a 32-byte hash of this authorization. It can't tell a key authorization from any other hash, so [your app decides what the provider signs](https://tempo.com/developers/docs/accounts/apps#route-raw-signing-through-one-backend).
### Send the First Payment
The holder parses the app's `message` and attaches the authorization to its first payment. Tempo registers the key and checks the payment against the key's bounds in the same transaction.
```ts [first-payment.ts]
import { parseUnits } from 'viem'
import { KeyAuthorization } from 'ox/tempo'
import { message, stablecoin } from './authorize' // message: received from the app
import { client } from './client'
import { holderKey } from './holder-key'
const { receipt } = await client.token.transferSync({
account: holderKey,
amount: parseUnits('1', 6),
// first payment only
keyAuthorization: KeyAuthorization.fromRpc(JSON.parse(message)), // [!code hl]
to: cardFunding,
token: stablecoin,
})
```
Later payments leave out `keyAuthorization`. The account pays each payment's network fee, and the fees count against the key's daily limit. Size the daily limit to the card's daily spend limit plus fees.
To register the key before the holder pays, the app sends the authorization on its own instead. The provider signs the authorization's hash, then a transaction from the account that carries it. The account needs a stablecoin balance for the fee.
```ts [register.ts]
import { parseUnits } from 'viem'
import { Expiry } from 'viem/tempo'
import { stablecoin } from './authorize'
import { client } from './client'
import { providerAccount } from './provider-account'
await client.accessKey.authorizeSync({ // [!code hl]
account: providerAccount, // [!code hl]
accessKey: { accessKeyAddress: holderKeyAddress, keyType: 'p256' }, // [!code hl]
expiry: Expiry.days(30), // [!code hl]
limits: [{ token: stablecoin, limit: parseUnits('100', 6), period: 86_400 }], // [!code hl]
scopes: [{ address: stablecoin, recipients: [cardFunding], selector: 'transfer(address,uint256)' }], // [!code hl]
}) // [!code hl]
```
### Check and Revoke the Key
Anyone can read the key's state from the account address. Revoking the key needs the account key, so the provider signs the revocation.
```ts [check.ts]
import { stablecoin } from './authorize'
import { client } from './client'
import { providerAccount } from './provider-account'
const key = await client.accessKey.getMetadata({ account: providerAccount.address, accessKey: holderKeyAddress }) // [!code hl]
// key.expiry, key.isRevoked, key.spendPolicy ('limited' when the key has limits)
const { remaining, periodEnd } = await client.accessKey.getRemainingLimit({ // [!code hl]
account: providerAccount.address, // [!code hl]
accessKey: holderKeyAddress, // [!code hl]
token: stablecoin, // [!code hl]
}) // [!code hl]
```
```ts [revoke.ts]
import { client } from './client'
import { providerAccount } from './provider-account'
await client.accessKey.revokeSync({ account: providerAccount, accessKey: holderKeyAddress }) // [!code hl]
```
Once the [revocation](https://tempo.com/developers/docs/accounts/access-keys/revocation) lands, Tempo rejects every payment the key signs. The payments it already made stay final.
::::
## Authorize in the Browser
When the account key is a Privy embedded wallet the user unlocks in your app, use version 0 of the Accounts SDK (`accounts@0.19.1`). Version 1 (`accounts@alpha`) holds only an access key and has no Privy or Turnkey adapter. Version 0 signs the authorization through Privy's `secp256k1_sign`. Its Privy adapter needs `@privy-io/react-auth` 3.25.0 or later. Mount `PrivyAccountsBridge` from `accounts/react/privy` under Privy's `PrivyProvider`. Then ask the provider to authorize the holder's key.
```ts [connect.ts]
import { parseUnits, toHex } from 'viem'
import { Provider } from 'accounts'
import { privy } from 'accounts/react/privy'
import { tempoModerato } from 'viem/chains'
import { Expiry } from 'viem/tempo'
// A test stablecoin on testnet
const stablecoin = '0x20c0000000000000000000000000000000000001'
const provider = Provider.create({ adapter: privy(), chains: [tempoModerato], testnet: true }) // [!code hl]
await provider.request({ method: 'wallet_connect' })
const { keyAuthorization, rootAddress } = await provider.request({ // [!code hl]
method: 'wallet_authorizeAccessKey', // [!code hl]
params: [ // [!code hl]
{ // [!code hl]
address: holderKeyAddress, // [!code hl]
keyType: 'p256', // [!code hl]
expiry: Expiry.days(30), // [!code hl]
limits: [{ token: stablecoin, limit: toHex(parseUnits('100', 6)), period: 86_400 }], // [!code hl]
scopes: [{ address: stablecoin, recipients: [cardFunding], selector: 'transfer(address,uint256)' }], // [!code hl]
}, // [!code hl]
], // [!code hl]
}) // [!code hl]
// keyAuthorization is already JSON-safe: send it and rootAddress to the holder
```
`rootAddress` is the account address the holder passes as `access`. The holder then submits `KeyAuthorization.fromRpc(keyAuthorization)` with its first payment, as in the setup steps. The Accounts SDK's `turnkey` adapter, exported from `accounts`, does the same for Turnkey wallets. Both adapters are Tempo code, not Privy or Turnkey code. Privy publishes no guide for this flow.
## Related
[Access Keys](https://tempo.com/developers/docs/accounts/access-keys): Covers the keys an account authorizes with limits, scopes, and expiry.
[Apps](https://tempo.com/developers/docs/accounts/apps): Covers provider wallets and routing raw signing through one backend.
[Revocation](https://tempo.com/developers/docs/accounts/access-keys/revocation): Covers ending an access key's access for good.
[Cards](https://tempo.com/developers/docs/partners/cards): Covers card issuing partners on Tempo.
> Source: [/docs/accounts/automations/give-an-agent-a-wallet](https://tempo.com/developers/docs/accounts/automations/give-an-agent-a-wallet.md)
> Section: [Accounts](https://tempo.com/developers/docs/accounts.md). Create accounts, set up signing methods, policies, access keys, key rotation, and fees, and follow guides for users, automations, agents, and teams.
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
# Give an Agent a Wallet
Gives an agent a key that pays from an account, but only within the bounds you set.
## Overview
An agent's wallet on Tempo is an access key the agent generates and holds. The account's signers, the keys the customer or your approvers hold, authorize that key. Don't give the agent the account's key. The access key limits what a compromised or misbehaving agent can spend.
In this guide, the key has three bounds:
* **Budget:** 50 OUSD a day.
* **Expiry:** 30 days.
* **Scopes:** Only sending the stablecoin with a memo to merchants you list.
Tempo enforces those bounds on every transaction, whatever the agent decides to do.
The demo and the code run on testnet and pay in a test stablecoin. The demo's account is a single-key account. An agent key works the same way from one on mainnet and testnet. A configurable account can authorize an agent key on testnet now, and on mainnet once [T14](https://tempo.com/developers/docs/protocol/upgrades/t14) activates there on December 8, 2026. The demo uses smaller bounds than the code: 10 a day, a one-hour expiry, and `transfer` to any address.
In the interactive web page, create a test account on testnet whose signer is a non-extractable P-256 key in this browser, fund it with test AlphaUSD from the testnet faucet, authorize a second non-extractable P-256 browser key as an access key with a 10 AlphaUSD daily limit, a one-hour expiry, and transfers only, pay 2 AlphaUSD with it, attempt a 20 AlphaUSD payment that Tempo rejects, and revoke the key. Each step is a real testnet transaction.
`client.ts` connects to [testnet](https://tempo.com/developers/docs/accounts/create#connect-to-testnet).
## Setup
::::steps
### Authorize the Agent's Key
Give each agent its own key, generated where it runs, so you can revoke one without stopping the others. Only the key's address leaves the agent.
:::code-group
```ts [agent-key.ts]
import { Account, P256 } from 'viem/tempo'
// store in the agent runtime's secret storage
const privateKey = P256.randomPrivateKey() // [!code hl]
// the account's address
const agentKey = Account.fromP256(privateKey, { access: address }) // [!code hl]
// send to the signers; save it with the agent's name
const agentKeyAddress = agentKey.accessKeyAddress // [!code hl]
```
```ts [client.ts]
import { http } from 'viem'
import { tempoModerato } from 'viem/chains'
import { createClient } from 'viem/tempo'
// Tempo testnet. The public RPC needs no key.
export const client = createClient({
chain: tempoModerato,
transport: http(),
})
```
:::
The signers authorize that address and its bounds in one transaction.
```ts [authorize-agent.ts]
import { parseUnits } from 'viem'
import { Expiry } from 'viem/tempo'
import { client } from './client'
// A test stablecoin on testnet
const stablecoin = '0x20c0000000000000000000000000000000000001'
// the addresses the agent may pay
const merchants = [merchant]
await client.accessKey.authorizeSync({ // [!code hl]
accessKey: { accessKeyAddress: agentKeyAddress, keyType: 'p256' }, // [!code hl]
// the account, signed by its signers
account, // [!code hl]
expiry: Expiry.days(30), // [!code hl]
// 50 of the stablecoin a day
limits: [{ token: stablecoin, limit: parseUnits('50', 6), period: 86_400 }], // [!code hl]
scopes: [{ address: stablecoin, selector: 'transferWithMemo(address,uint256,bytes32)', recipients: merchants }], // [!code hl]
}) // [!code hl]
```
Fit all three bounds to the agent's task. Leaving one out removes that check.
* [`limits`](https://tempo.com/developers/docs/accounts/access-keys/spending-limits) is the budget, in base units. The stablecoin has 6 decimals, so `parseUnits('50', 6)` is 50 OUSD. `period: 86_400` renews it daily. Leave `period` out for a one-time budget. The key's fees count against it unless a [fee payer](https://tempo.com/developers/docs/accounts/fees/fee-sponsorship) covers them.
* [`scopes`](https://tempo.com/developers/docs/accounts/access-keys/scopes) lists the only calls the key can make. Without `recipients`, the key could pay any address.
* [`expiry`](https://tempo.com/developers/docs/accounts/access-keys/expiry) is when the key stops working.
Never give an agent a key without a budget, scopes, and expiry. The agent could spend the whole balance.
### Let the Agent Pay
The agent signs with its key and pays from the account's balance. The signers don't approve each payment.
```ts [agent-pay.ts]
import { parseUnits, stringToHex } from 'viem'
import { client } from './client'
const stablecoin = '0x20c0000000000000000000000000000000000001'
await client.token.transferSync({ // [!code hl]
account: agentKey, // [!code hl]
amount: parseUnits('2', 6), // [!code hl]
// a memo makes this transferWithMemo, the key's one allowed call
memo: stringToHex('order-1042', { size: 32 }), // [!code hl]
// one of the scoped merchants
to: merchant, // [!code hl]
token: stablecoin, // [!code hl]
}) // [!code hl]
```
Tempo rejects any payment that breaks a bound:
* Over the remaining budget.
* Outside the scopes, such as to an address not in `merchants`.
* After the expiry.
Read what's left with `client.accessKey.getRemainingLimit`. The signers can [change the limit](https://tempo.com/developers/docs/accounts/access-keys/spending-limits#change-a-spending-limit) or [the scopes](https://tempo.com/developers/docs/accounts/access-keys/scopes#change-allowed-calls) without replacing the key.
### Revoke the Agent's Key
When the task ends or the agent misbehaves, the signers revoke the key by its saved address.
```ts [revoke-agent.ts]
import { client } from './client'
await client.accessKey.revokeSync({ account, accessKey: agentKeyAddress }) // [!code hl]
```
[Revocation](https://tempo.com/developers/docs/accounts/access-keys/revocation) is permanent. Once it confirms, Tempo rejects every transaction the key signs. Show the agent's access as removed only then.
::::
## Pay for APIs With MPP
APIs that use the [Machine Payments Protocol (MPP)](https://tempo.com/developers/docs/guide/machine-payments) answer `402 Payment Required` with a price. The agent pays with its key and retries. A one-time payment (`charge`) is a transfer to the service with a memo. The agent's key needs both transfer calls, with the recipient left open so it can pay any service. The budget then bounds the total.
```ts [authorize-agent.ts]
scopes: [
{ address: stablecoin, selector: 'transferWithMemo(address,uint256,bytes32)' }, // [!code hl]
{ address: stablecoin, selector: 'transfer(address,uint256)' }, // [!code hl]
],
```
For a [payment session](https://tempo.com/developers/docs/guide/machine-payments/pay-as-you-go), also scope its payment-channel calls. In the agent, pass the key and testnet `client` to the [MPP client](https://tempo.com/developers/docs/guide/machine-payments/client). `Mppx.create` patches `fetch` to pay each `402` and retry the request.
```ts [agent.ts]
import { Mppx, tempo } from 'mppx/client'
import { client } from './client'
// pays on testnet
Mppx.create({ methods: [tempo({ account: agentKey, getClient: () => client })] }) // [!code hl]
const response = await fetch(paidUrl) // [!code hl]
```
`getClient` makes mppx pay through the same testnet client. If Tempo rejects the payment for the key's bounds, the request fails without paying. A terminal agent can use [`tempo request`](https://tempo.com/developers/docs/guide/machine-payments/agent) instead.
The paid APIs in [Find services](https://tempo.com/developers/docs/guide/machine-payments/discover-services) charge real funds. To test, run your own [MPP server](https://tempo.com/developers/docs/guide/machine-payments/server) on testnet. In its `tempo()` method, set `currency` to the `stablecoin` address. Pass `chainId: 42431` and `getClient: () => client`.
### Watch the Agent's Spending
The agent reads each payment's receipt from the response. Your app reads how much of the budget is left.
```ts [watch-spending.ts]
import { Receipt } from 'mppx'
import { client } from './client'
const stablecoin = '0x20c0000000000000000000000000000000000001'
const receipt = Receipt.fromResponse(response) // [!code hl]
// receipt.reference is the payment's transaction hash
const { remaining, periodEnd } = await client.accessKey.getRemainingLimit({ // [!code hl]
account: address, // [!code hl]
accessKey: agentKeyAddress, // [!code hl]
token: stablecoin, // [!code hl]
}) // [!code hl]
// remaining is in base units; periodEnd is when the budget renews
```
Log each receipt with its request, and alert when `remaining` runs low. Show the agent's spending in your app next to a [revoke](https://tempo.com/developers/docs/accounts/access-keys/revocation#revoke-an-access-key) action.
## Accept Payments on Your API
To charge agents for your own API, add the [`mppx` middleware](https://tempo.com/developers/docs/guide/machine-payments/server) to its endpoints. The server answers `402 Payment Required` with a price. It returns the resource once the payment verifies.
## Agent Wallet Limits
* **Total Budget:** The budget caps the total, not each payment. One large payment or one expensive API request can use all of it. Cap each payment in the agent's own code. For MPP, [handle payments manually](https://tempo.com/developers/docs/guide/machine-payments/client#handle-mpp-payments-manually) and check the price first. In a terminal, [`tempo request --max-spend`](https://tempo.com/developers/docs/cli/request) caps what one command spends.
* **Fees:** Fees count against the budget. The exception is a fee payer that covers them, such as an MPP service that sponsors fees.
* **Fixed Expiry:** An expiry can't be extended. To keep the agent running past it, [authorize a new key](https://tempo.com/developers/docs/accounts/access-keys/expiry#renew-an-expiring-key) before it passes.
## Related
[Access Keys](https://tempo.com/developers/docs/accounts/access-keys): Covers the keys an account authorizes with limits, scopes, and expiry.
[Spending Limits](https://tempo.com/developers/docs/accounts/access-keys/spending-limits): Covers budgets per stablecoin and how they renew.
[Scopes](https://tempo.com/developers/docs/accounts/access-keys/scopes): Covers which contracts, functions, and recipients a key can use.
[Revocation](https://tempo.com/developers/docs/accounts/access-keys/revocation): Covers ending an access key's access for good.
[How MPP Works](https://tempo.com/developers/docs/guide/machine-payments): Covers how agents pay for APIs with the Machine Payments Protocol.
> Source: [/docs/accounts/custodians](https://tempo.com/developers/docs/accounts/custodians.md)
> Section: [Accounts](https://tempo.com/developers/docs/accounts.md). Create accounts, set up signing methods, policies, access keys, key rotation, and fees, and follow guides for users, automations, agents, and teams.
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
# Custodians
Hold stablecoins for your customers or your team, yourself or through a custodian.
## Overview
A custody setup decides who holds the keys to stablecoins you hold for others. Either a custodian holds them, or your own approvers do.
Start here if any of these describe you:
* You run an exchange or payments processor that holds many customers' funds.
* Your funds sit with a custodian, such as Fireblocks.
* Your team wants no single person able to move its stablecoins.
## Custody Setups
| Setup | Account | Who holds the keys | Who approves a payment |
| --- | --- | --- | --- |
| A custodian holds your funds | [Single-key account](https://tempo.com/developers/docs/accounts/how-it-works#address) | The custodian | The custodian, through its own policies and approvals |
| You hold the keys | [Team multisig](https://tempo.com/developers/docs/accounts/custodians/team-multisig), a configurable account | Your approvers | Approvers whose weights reach the threshold |
Plain stablecoin transfers from a custody address work as on any EVM chain. Fee tokens, fee sponsorship, and access keys need your custodian to send [Tempo Transactions](https://tempo.com/developers/docs/guide/tempo-transaction). Ask your custodian which it supports before you plan on them for a custody address.
A team multisig keeps its address when its approvers change. It runs on [testnet](https://tempo.com/developers/docs/accounts/create#connect-to-testnet) now and reaches mainnet with [T14](https://tempo.com/developers/docs/protocol/upgrades/t14) on December 8, 2026.
For customer deposits, an [omnibus account](https://tempo.com/developers/docs/accounts/custodians/omnibus-accounts) gives each customer a deposit address that pays into one account. [Custody partners](https://tempo.com/developers/docs/partners/wallets#custodial--institutional), such as Fireblocks, support Tempo.
## Tempo Features
* **[Fee Tokens](https://tempo.com/developers/docs/accounts/fees/fee-tokens):** Tempo has no gas token. Set a default stablecoin for fees on each address that sends.
* **[Virtual Addresses](https://tempo.com/developers/docs/accounts/virtual-addresses):** Give each customer a deposit address that pays straight into your account, with no sweeps.
* **[Receive Policies](https://tempo.com/developers/docs/accounts/policies/receive-policies):** Accept only the stablecoins and senders you allow. Tempo holds anything else instead of crediting it.
* **[Transfer Memos](https://tempo.com/developers/docs/guide/payments/transfer-memos):** Add a payment reference to each payment, so you can reconcile it with your records.
## Related
[Hold Customer Funds in an Omnibus Account](https://tempo.com/developers/docs/accounts/custodians/omnibus-accounts): Use for customer deposit addresses that pay into one account.
[Set Up a Team Multisig](https://tempo.com/developers/docs/accounts/custodians/team-multisig): Use for one account where any two of three approvers approve each payment.
[Wallet Partners](https://tempo.com/developers/docs/partners/wallets#custodial--institutional): Covers custodians and institutional wallets that support Tempo, such as Fireblocks.
[Virtual Addresses](https://tempo.com/developers/docs/accounts/virtual-addresses): Covers deposit addresses that pay straight into your account.
[Receive Policies](https://tempo.com/developers/docs/accounts/policies/receive-policies): Covers which stablecoins and senders an account accepts.
> Source: [/docs/accounts/custodians/omnibus-accounts](https://tempo.com/developers/docs/accounts/custodians/omnibus-accounts.md)
> Section: [Accounts](https://tempo.com/developers/docs/accounts.md). Create accounts, set up signing methods, policies, access keys, key rotation, and fees, and follow guides for users, automations, agents, and teams.
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
# Hold Customer Funds in an Omnibus Account
Take deposits for every customer into one account, and still know who paid.
## Overview
An omnibus account holds many customers' stablecoins in one account, such as an exchange's or a payments processor's. Each customer's balance lives in your own ledger.
On Tempo, you give each customer a [virtual address](https://tempo.com/developers/docs/accounts/virtual-addresses). It's a deposit address that pays straight into your account, with no per-customer wallet and no sweep job. Each deposit names the address it was sent to, so you know which customer to credit.
Virtual addresses and receive policies are live on mainnet and testnet. The code on this page runs on Moderato testnet.
## Setup
::::steps
### Choose the Receiving Account
Registering an account binds every deposit address you derive from it to that account permanently. Pick one whose keys you can change without changing its address.
* **Single-Key Account:** On mainnet and testnet, its deposit addresses work only while you keep that one key. If you expect to rotate keys, register a multisig or upgradeable contract instead.
* **Configurable Account:** [Add](https://tempo.com/developers/docs/accounts/account-configuration/configuration-updates#add-a-signer) and [remove signers](https://tempo.com/developers/docs/accounts/account-configuration/configuration-updates#remove-a-signer) at the same address. It runs on [testnet](https://tempo.com/developers/docs/accounts/create#connect-to-testnet) now and reaches mainnet with T14 on December 8, 2026.
### Register and Derive Addresses
Register the account once. From it, call `registerVirtualMaster` on the virtual-address registry, with a salt you mine offchain with `VirtualMaster.mineSaltAsync`. Registration returns a 4-byte master ID. Register more than once to get separate ranges of addresses, such as one per business line.
Then derive each customer's address offchain from the master ID and a 6-byte customer tag you choose. Deriving an address sends no transaction.
```ts [virtualAddress.ts]
import { VirtualAddress } from 'viem/tempo'
const masterId = process.env.TEMPO_MASTER_ID
if (!masterId || !/^0x[0-9a-fA-F]{8}$/.test(masterId)) {
throw new Error('Set TEMPO_MASTER_ID to your registered 4-byte master ID')
}
const virtualAddress = VirtualAddress.from({ // [!code hl]
masterId: masterId as `0x${string}`, // [!code hl]
userTag: '0x000000000001', // [!code hl]
}) // [!code hl]
```
Keep the mapping from customer tag to customer in your own records. To try registration first, use the [live deposit address demo](https://tempo.com/developers/docs/guide/payments/virtual-addresses).
### Accept Listed Stablecoins Only
Set a [receive policy](https://tempo.com/developers/docs/accounts/policies/receive-policies) on the registered account. Tempo checks deposits to its virtual addresses against the account's policy, because a virtual address can't set its own. This policy accepts one stablecoin from any sender. With `claimer: 'self'`, your account claims anything the policy holds back.
:::code-group
```ts [receive-policy.ts]
import { client } from './client'
// The stablecoins you list, by token contract address
const { policyId: tokenPolicyId } = await client.policy.createSync({
account,
type: 'whitelist', // [!code hl]
addresses: [stablecoin], // [!code hl]
})
await client.receivePolicy.setSync({
account,
senderPolicyId: 'allow-all', // [!code hl]
tokenPolicyId, // [!code hl]
claimer: 'self', // [!code hl]
})
```
```ts [client.ts]
import { tempoModerato } from 'viem/chains'
import { createClient } from 'viem/tempo'
export const client = createClient({ chain: tempoModerato })
```
:::
`account` is the registered account and `stablecoin` is the token contract address you accept. Only TIP-20 stablecoins are forwarded to your account. Other tokens sent to a virtual address can't be recovered. Tell customers to send only the stablecoins you list on Tempo.
### Credit Each Deposit Once
A deposit to a virtual address emits [two `Transfer` events](https://tempo.com/developers/docs/protocol/tip20/virtual-addresses) in one transaction. The first goes from the sender to the virtual address. The second goes from the virtual address to your account. Treat the pair as one deposit to your account, not two. Then:
* **Read the Customer Tag:** The virtual address's last 6 bytes are the tag you chose. Look up the customer in your records.
* **Check the Recipient:** A deposit your receive policy blocks still succeeds and still emits `Transfer`. Its recipient is `ReceivePolicyGuard`, not your account. Credit only when the confirmed event names your account.
* **Record It Once:** Store the network, transaction hash, and log index as a unique key. Credit the customer in the same database transaction.
Read live deposits with [webhooks](https://tempo.com/developers/docs/api/webhooks) or [transfer events](https://tempo.com/developers/docs/guide/payments/accept-a-payment#detect-payments), and history with the [transfers API](https://tempo.com/developers/docs/api/transfers).
### Handle Held Payments
A deposit in a stablecoin you don't list stays in `ReceivePolicyGuard` until your account claims it. Index the guard's `TransferBlocked` events for your account to find held deposits. Decide whether to return or accept each one, then [claim it](https://tempo.com/developers/docs/accounts/policies/receive-policies#claim-blocked-receipts) with `client.receivePolicy.claimSync`. A claim releases the full amount.
To let senders recover their own held payments instead, set the recovery authority to the sender (`claimer: 'sender'`).
::::
## Omnibus Account Limits
* A virtual address never holds a balance. `balanceOf` on it returns `0`. Show customers the balance from your ledger.
* Some protocols record ownership against the literal address they're given. Don't send LP shares, receipts, or rewards to a virtual address unless that protocol supports it.
* The customer tag tells you whose address received a deposit, not who sent it.
## Related
[Virtual Addresses](https://tempo.com/developers/docs/accounts/virtual-addresses): Covers deposit addresses that pay straight into one account.
[Receive Policies](https://tempo.com/developers/docs/accounts/policies/receive-policies): Covers which stablecoins and senders an account accepts, and claiming held payments.
[Customer Deposit Addresses](https://tempo.com/developers/docs/guide/payments/virtual-addresses): Use for trying registration in a live deposit address demo.
[Virtual Addresses for TIP-20 Deposits](https://tempo.com/developers/docs/protocol/tip20/virtual-addresses): Covers the two Transfer events a deposit emits.
> Source: [/docs/accounts/custodians/team-multisig](https://tempo.com/developers/docs/accounts/custodians/team-multisig.md)
> Section: [Accounts](https://tempo.com/developers/docs/accounts.md). Create accounts, set up signing methods, policies, access keys, key rotation, and fees, and follow guides for users, automations, agents, and teams.
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
# Set Up a Team Multisig
Set up one Tempo account that three approvers share, where any two must approve each payment.
## Overview
A team multisig is one account whose payments need approvals from several people. It's for stablecoins your team holds together, such as a company's funds or a shared budget. No single person or key moves them.
Here you create a multisig account on testnet. Its three signers are keys held by finance, operations, and a controller. Tempo checks the approvals itself. Neither one stolen key nor your own backend can pay without a second approver.
Each approver's signer has a weight of 1, and the [threshold](https://tempo.com/developers/docs/accounts/policies/signing-thresholds) is 2. The same threshold covers configuration updates, so no single approver can add or remove a signer.
:::warning
**Multiple signers arrive on mainnet with the [T14 network upgrade](https://tempo.com/developers/docs/protocol/upgrades/t14).** They are live on [testnet](https://tempo.com/developers/docs/accounts/create#connect-to-testnet) since T14 activated there on November 24, 2026. Mainnet activation is scheduled for December 8, 2026.
:::
## Setup
`client.ts` connects to [testnet](https://tempo.com/developers/docs/accounts/create#connect-to-testnet).
::::steps
### Create the Multisig
Keep each approver's key somewhere different, so one breach can't reach two of them. Use a hardware wallet, a separate KMS per team, or the approver's passkey. Here finance and operations sign with [private keys](https://tempo.com/developers/docs/accounts/authentication/private-keys). The controller signs with a passkey on their own device, so your app knows only the controller's address.
:::code-group
```ts [multisig.ts]
import { Account } from 'viem/tempo'
import { client } from './client'
const env = (name: string) => process.env[name] as `0x${string}`
const finance = Account.fromSecp256k1(env('FINANCE_SIGNER_KEY'))
const operations = Account.fromSecp256k1(env('OPERATIONS_SIGNER_KEY'))
const controller = env('CONTROLLER_PASSKEY_ADDRESS') // the key stays on the controller's device
const multisig = Account.fromConfig({ // [!code hl]
address: 'infer', // [!code hl]
owners: [ // [!code hl]
{ owner: finance.address, weight: 1 }, // [!code hl]
{ owner: operations.address, weight: 1 }, // [!code hl]
{ owner: controller, weight: 1 }, // [!code hl]
], // [!code hl]
threshold: 2, // [!code hl]
}) // [!code hl]
// Save with your multisig record.
const saved = { address: multisig.address, config: multisig.config } // [!code hl]
await client.faucet.fundSync({ account: saved.address }) // testnet test stablecoins
```
```ts [client.ts]
import { http } from 'viem'
import { tempoModerato } from 'viem/chains'
import { createClient } from 'viem/tempo'
// Tempo testnet. The public RPC needs no key.
export const client = createClient({
chain: tempoModerato,
transport: http(),
})
```
:::
`address: 'infer'` computes the address from the first signers and threshold. Creating the multisig sends nothing. Tempo records the multisig with its first transaction. The address can receive stablecoins before then. On testnet, the [faucet](https://tempo.com/developers/docs/accounts/create#fund-an-account-on-testnet) sends it test stablecoins. The multisig pays transaction fees from its own balance unless a [fee payer](https://tempo.com/developers/docs/accounts/fees/fee-sponsorship) sponsors them.
Tempo stores only a hash of the configuration (signers, weights, threshold, salt, and version). The hash is enough to check approvals, but not to tell your app who the signers are. Save the address and configuration with your multisig record. The configuration contains bigints, so [encode it with `AccountConfig.toRpc`](https://tempo.com/developers/docs/development/configurable-accounts#keep-the-current-configuration). The address stays the same when signers change. Every approval is built from the saved configuration.
### Approve a Payment
To pay, rebuild the multisig from its saved record and attach the keys of the approvers signing this payment. The other signers stay as addresses.
```ts [multisig.ts]
import { isAddressEqual, parseUnits } from 'viem'
// A test stablecoin on testnet
const stablecoin = '0x20c0000000000000000000000000000000000001'
// Placeholder: the vendor's address
const vendor = env('VENDOR_ADDRESS')
/** Rebuilds the multisig from its saved record, with the approvers' keys attached. */
function openMultisig(approvers: readonly Account.RootAccount[]) {
const { address, config } = saved
const owners = config.owners.map(({ owner, weight }) => ({
// other signers stay addresses
owner: approvers.find((key) => isAddressEqual(key.address, owner)) ?? owner, // [!code hl]
weight,
}))
// Never updated (version 0): the address still comes from the first signers.
if (config.version === 0n)
return Account.fromConfig({ address: 'infer', owners, salt: config.salt, threshold: config.threshold })
return Account.fromConfig({ ...config, address, owners })
}
// Finance and operations approve: 1 + 1 reaches the threshold of 2.
await client.token.transferSync({ // [!code hl]
account: openMultisig([finance, operations]), // [!code hl]
// 1,200 of the stablecoin, in base units (6 decimals)
amount: parseUnits('1200', 6), // [!code hl]
to: vendor, // [!code hl]
token: stablecoin, // [!code hl]
}) // [!code hl]
```
Viem signs with the attached keys, highest weight first, until they reach the threshold. With only finance's key attached, it throws `Local owners do not meet the threshold.` and sends nothing. Call `openMultisig` for every action, not once at startup. A [configuration update](https://tempo.com/developers/docs/accounts/account-configuration/configuration-updates#add-a-signer) raises the configuration's version. Save the new configuration after success, because Tempo rejects approvals built from an older record with `multisig configuration commitment mismatch`.
This example holds two approvers' keys in one process, so that process could pay alone. In production, have each approver check the recipient and amount and sign on their own device. Your app can [collect approvals from separate devices](https://tempo.com/developers/docs/accounts/policies/signing-thresholds#approvers-on-separate-devices). Your own contract can also [verify the multisig's approvals](https://tempo.com/developers/docs/accounts/policies/signing-thresholds#verify-approvals).
::::
## Replace an Approver
When an approver leaves, swap their signer for their successor's in one configuration update, at the same weight and threshold. The two remaining approvers approve it, so the multisig stays 2 of 3 throughout.
```ts [multisig.ts]
import { AccountConfig, Actions } from 'viem/tempo'
const successor = env('NEW_CONTROLLER_PASSKEY_ADDRESS') // the successor's passkey, on their device
const nextConfig = { // [!code hl]
owners: saved.config.owners.map((entry) => // [!code hl]
isAddressEqual(entry.owner, controller) ? { owner: successor, weight: entry.weight } : entry, // [!code hl]
), // [!code hl]
threshold: saved.config.threshold, // [!code hl]
} // [!code hl]
await client.writeContractSync({ // [!code hl]
account: openMultisig([finance, operations]), // [!code hl]
...Actions.accounts.updateConfig.call({ currentConfig: saved.config, nextConfig }), // [!code hl]
throwOnReceiptRevert: true, // [!code hl]
}) // [!code hl]
// Save only after the update succeeds.
saved.config = AccountConfig.update(saved.config, nextConfig) // [!code hl]
```
The multisig keeps its address and balance. The departing approver's key can no longer approve anything. A [configuration update](https://tempo.com/developers/docs/accounts/account-configuration/configuration-updates#remove-a-signer) also removes a signer without a successor, or rotates the key of an approver who stays.
Removing a signer doesn't revoke [access keys](https://tempo.com/developers/docs/accounts/access-keys). [List the keys the multisig has authorized](https://tempo.com/developers/docs/accounts/access-keys/revocation#revoke-after-a-signer-change). Revoke every access key the departing approver held or managed with `client.accessKey.revokeSync`. Set to zero any token allowance one of those keys approved.
## Limits and Changes
A multisig holds 1 to 48 signers. A transaction carries at most 8 approvals, so set a threshold that eight approvers can reach.
A team or a backend can pay within a daily limit without two approvals per payment. Authorize an [access key](https://tempo.com/developers/docs/accounts/access-keys) with a [spending limit](https://tempo.com/developers/docs/accounts/access-keys/spending-limits) for it.
A configuration update voids approvals collected for a payment that hasn't been sent, so collect them again. If another update landed first, rebuild the multisig from the latest saved configuration.
## Related
[Signing Thresholds](https://tempo.com/developers/docs/accounts/policies/signing-thresholds): Covers signer weights, thresholds, and collecting approvals from separate devices.
[Configuration Updates](https://tempo.com/developers/docs/accounts/account-configuration/configuration-updates): Use for adding, removing, or rotating a signer.
[Spending Limits](https://tempo.com/developers/docs/accounts/access-keys/spending-limits): Covers how much an access key can spend.
[Revocation](https://tempo.com/developers/docs/accounts/access-keys/revocation): Use for revoking access keys after a signer change.
[Configurable Accounts](https://tempo.com/developers/docs/development/configurable-accounts): Covers configuration hashes and keeping the current configuration.
> Source: [/docs/accounts/wallets](https://tempo.com/developers/docs/accounts/wallets.md)
> Section: [Accounts](https://tempo.com/developers/docs/accounts.md). Create accounts, set up signing methods, policies, access keys, key rotation, and fees, and follow guides for users, automations, agents, and teams.
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
# Wallets
Add Tempo to a wallet, or let your users pay with the wallet they already have.
## Overview
A wallet, such as MetaMask, Rabby, or Ledger, holds the private key of a [single-key account](https://tempo.com/developers/docs/accounts/how-it-works#address). That key approves every transaction. Single-key accounts work on mainnet and testnet.
Wallet teams [add Tempo to their wallet](https://tempo.com/developers/docs/accounts/wallets/add-tempo-to-your-wallet), so users hold and send stablecoins on Tempo from it. App teams [connect a wallet to their app](https://tempo.com/developers/docs/accounts/wallets#connect-a-wallet-to-your-app), so users pay with the wallet they already have.
## Connect a Browser Wallet
Connect your wallet to add Tempo mainnet to it.
Connect a wallet in the interactive web page.
In your app, wagmi's `injected` connector connects the browser's wallet. wagmi also finds every other installed wallet that announces itself ([EIP-6963](https://eips.ethereum.org/EIPS/eip-6963)) and lists it in `useConnectors()`. Keep it for users who already have a browser wallet.
```ts [wagmi.config.ts]
import { tempo } from 'viem/chains'
import { createConfig, http } from 'wagmi'
import { injected } from 'wagmi/connectors'
export const config = createConfig({
chains: [tempo],
connectors: [injected()], // [!code hl]
transports: { [tempo.id]: http() },
})
```
From there, `useConnect` and wagmi's transaction hooks work as on any EVM chain. Tempo has no native gas token. The wallet pays each fee in a stablecoin. [By default](https://tempo.com/developers/docs/accounts/fees#fee-token-precedence), that's the stablecoin a payment sends, and pathUSD for most other calls. Some wallets also show a placeholder native balance. [Show stablecoin balances](https://tempo.com/developers/docs/quickstart/evm-compatibility#handling-eth-native-token-balance-checks) in your app instead.
## Browser Wallet Limits
A browser wallet signs standard Ethereum transactions. They differ from [Tempo Transactions](https://tempo.com/developers/docs/guide/tempo-transaction), Tempo's own transaction type, in these ways.
| | Standard Ethereum transactions (browser wallet) | Tempo Transactions |
| --- | --- | --- |
| Signers | One private key, in the wallet | [Passkeys, device keys, or private keys](https://tempo.com/developers/docs/accounts/authentication); several per configurable account |
| Lost key | Loses the account and its funds | On a configurable account, [another signer replaces it](https://tempo.com/developers/docs/accounts/account-configuration#plan-for-recovery). On a single-key account, losing the key loses the account. |
| Network fees | Paid by the user | [Sponsored by your app](https://tempo.com/developers/docs/accounts/fees/fee-sponsorship), if you choose |
| Several calls | One call per transaction | Several calls that succeed or fail together |
| [Access keys](https://tempo.com/developers/docs/accounts/access-keys) | The wallet authorizes one with an `authorizeKey` call to the [Account Keychain](https://tempo.com/developers/docs/development/account-keychain#authorize-an-access-key). The access key then signs its own Tempo Transactions in your app. | Authorized in the transaction that first uses the key |
A hardware wallet also holds one private key, so its account is a single-key account (EOA) with the same limits. Several signers per account and lost-key replacement need a configurable account.
:::warning
**Multiple signers arrive on mainnet with the [T14 network upgrade](https://tempo.com/developers/docs/protocol/upgrades/t14).** They are live on [testnet](https://tempo.com/developers/docs/accounts/create#connect-to-testnet) since T14 activated there on November 24, 2026. Mainnet activation is scheduled for December 8, 2026.
:::
## Passkeys for Wallet Users
### Move to a New Account
For accounts you create for your users, prefer a [passkey or device key](https://tempo.com/developers/docs/accounts/authentication). To move off a browser wallet, a user sends the funds to a new account. Its key is a passkey or device key. On mainnet, that's a [single-key account](https://tempo.com/developers/docs/development/single-key-accounts). On testnet, it can also be a [configurable account](https://tempo.com/developers/docs/accounts/create) with that key as its first signer.
### Upgrade in Place
To keep the address instead, [upgrade the account in place](https://tempo.com/developers/docs/accounts/account-configuration/account-upgrade). The upgrade adds signers, such as backup signers, at the same address. Upgrades run on testnet now and on mainnet from T14 on December 8, 2026. The original key signs it as a Tempo Transaction, so the wallet holding that key must support Tempo Transactions.
## Connect a User's Wallet
If a user already has a Tempo Account, sign them in with Tempo through the [Accounts SDK](https://accounts.tempo.xyz). Tempo holds the account's keys, and your app receives the user's address and an access key that signs within the limits the user approves. Tempo sends transactions through its own RPC endpoint, not your own client. The demo and code run on testnet, whose stablecoins have no value.
**Interactive demo: Connect Tempo Wallet**
1. Sign in with Tempo
```bash [Terminal]
pnpm add accounts@alpha viem
```
```ts [connect.ts]
import { Accounts } from 'accounts'
import { viem } from 'accounts/plugins'
export const accounts = Accounts.create({
// Each sign-in requests an access key that sends up to 100 AlphaUSD for a day.
accessKey: () => ({ expiry: '1d', limits: [{ limit: '100', token: 'alphaUSD' }] }),
chain: 'testnet',
plugins: [viem()],
})
// Call from a click handler, such as a Sign in button's.
export async function connect() {
const session = await accounts.dialog.signIn() // [!code hl]
const address = session.accessKey?.account // [!code hl]
if (!address) throw new Error('No account was selected')
return address
}
```
Call `connect` from a click handler, since the popup fallback of `dialog.signIn` opens only within a user gesture. Track the Tempo session separately from your app's own signed-in session. In `accounts.session.subscribe`, update the address, or clear it when the user signs out. In `accounts.chain.subscribe`, refresh network-dependent state before you enable transactions. To send payments, use `accounts.viem`, the Viem client the `viem` plugin adds, as in the [browser wallet setup](https://tempo.com/developers/docs/guide/payments/send-a-payment/examples#browser-wallet-setup). You can also connect other [wallet partners](https://tempo.com/developers/docs/partners/wallets).
## Related
[Add Tempo to Your Wallet](https://tempo.com/developers/docs/accounts/wallets/add-tempo-to-your-wallet): Use for adding the networks, stablecoin balances, fee tokens, and Tempo Transactions to a wallet.
[Signing Methods](https://tempo.com/developers/docs/accounts/authentication): Covers passkeys, device keys, and private keys.
[Account Upgrade](https://tempo.com/developers/docs/accounts/account-configuration/account-upgrade): Use for adding signers to an existing address. Testnet until T14 reaches mainnet.
[Wallet Partners](https://tempo.com/developers/docs/partners/wallets): Covers wallets that support Tempo.
> Source: [/docs/accounts/wallets/add-tempo-to-your-wallet](https://tempo.com/developers/docs/accounts/wallets/add-tempo-to-your-wallet.md)
> Section: [Accounts](https://tempo.com/developers/docs/accounts.md). Create accounts, set up signing methods, policies, access keys, key rotation, and fees, and follow guides for users, automations, agents, and teams.
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
# Add Tempo to Your Wallet
Support Tempo in your wallet, from network settings to Tempo Transactions.
## Overview
Any wallet, such as a browser extension, mobile wallet, or hardware wallet, already signs standard Ethereum transactions on Tempo. Tempo has no native gas token, so [balance checks and fee quotes need changes](https://tempo.com/developers/docs/quickstart/wallet-developers). [Tempo Transactions](https://tempo.com/developers/docs/guide/tempo-transaction) give your users stablecoin fee selection, sponsored fees, batched calls, and access keys. Everything on this page is live on mainnet and testnet.
## Setup
::::steps
### Add the Tempo Networks
Add mainnet for production and Moderato testnet for development. Both use `USD` as the currency symbol, because fees are denominated in USD.
| Network | Chain ID | HTTP RPC | WebSocket RPC | Explorer |
| --- | --- | --- | --- | --- |
| Tempo Mainnet | `4217` | `https://rpc.tempo.xyz` | `wss://rpc.tempo.xyz` | [explore.tempo.xyz](https://explore.tempo.xyz) |
| Tempo Testnet (Moderato) | `42431` | `https://rpc.moderato.tempo.xyz` | `wss://rpc.moderato.tempo.xyz` | [explore.testnet.tempo.xyz](https://explore.testnet.tempo.xyz) |
In Viem, use the `tempo` and `tempoModerato` chains from `viem/chains`.
### Show Stablecoin Balances
Don't show a native balance. `eth_getBalance` [returns a large placeholder value](https://tempo.com/developers/docs/quickstart/evm-compatibility#handling-eth-native-token-balance-checks) so existing balance checks don't block users. The `BALANCE` opcode returns 0. Read each stablecoin's TIP-20 balance instead. Remove any check that blocks a transaction on the native balance.
:::code-group
```ts [balance.ts]
import { client } from './client'
const balance = await client.token.getBalance({
account: '0x742d35cc6634c0532925a3b844bc9e7595f0bebb',
token: '0x20c0000000000000000000000000000000000001', // a Moderato test stablecoin
})
// { amount: bigint; decimals: number; formatted: string }
```
```ts [client.ts]
import { tempoModerato } from 'viem/chains'
import { Account, createClient } from 'viem/tempo'
const privateKey = process.env.TEMPO_PRIVATE_KEY
if (!privateKey || !/^0x[0-9a-fA-F]{64}$/.test(privateKey)) {
throw new Error('Set TEMPO_PRIVATE_KEY to your funded test account private key')
}
export const client = createClient({
account: Account.fromSecp256k1(privateKey as `0x${string}`),
chain: tempoModerato,
feeToken: '0x20c0000000000000000000000000000000000001',
})
```
:::
Pull token names, symbols, and icons from the [tokenlist](https://tempo.com/developers/docs/quickstart/tokenlist), at `tokenlist.tempo.xyz/list/4217` for mainnet and `tokenlist.tempo.xyz/list/42431` for testnet.
### Let Users Choose Fee Tokens
Each transaction pays its fee in a USD stablecoin, its [fee token](https://tempo.com/developers/docs/accounts/fees/fee-tokens). Quote fees in the transaction's fee token, and let users choose it in your confirmation screen or account settings. Pass `feeToken` for one transaction, or set the account's default with `setUserTokenSync`.
:::code-group
```ts [fee-token.ts]
import { client } from './client'
// Pay this transaction's fee in a different stablecoin
await client.token.transferSync({
amount: { formatted: '100' },
feeToken: '0x20c0000000000000000000000000000000000002', // [!code hl]
to: '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEbb',
token: '0x20c0000000000000000000000000000000000001',
})
// Or set the account's default fee token
await client.fee.setUserTokenSync({
token: '0x20c0000000000000000000000000000000000001',
})
```
```ts [client.ts]
import { tempoModerato } from 'viem/chains'
import { Account, createClient } from 'viem/tempo'
const privateKey = process.env.TEMPO_PRIVATE_KEY
if (!privateKey || !/^0x[0-9a-fA-F]{64}$/.test(privateKey)) {
throw new Error('Set TEMPO_PRIVATE_KEY to your funded test account private key')
}
export const client = createClient({
account: Account.fromSecp256k1(privateKey as `0x${string}`),
chain: tempoModerato,
feeToken: '0x20c0000000000000000000000000000000000001',
})
```
:::
Without a default, Tempo follows the [fee token precedence](https://tempo.com/developers/docs/accounts/fees#fee-token-precedence). It can fall back to pathUSD, a stablecoin the user might not hold. Setting a fee token for each transaction needs a Tempo Transaction.
### Send Tempo Transactions
Replace your EIP-1559 (type 2) envelope with the Tempo Transaction envelope (type `0x76`). Use a [Tempo SDK](https://tempo.com/developers/docs/guide/tempo-transaction#integration-guides) for TypeScript, Rust, Go, Python, or Foundry. With Tempo Transactions, your wallet can:
* [Batch calls](https://tempo.com/developers/docs/guide/tempo-transaction#batch-calls) that succeed or fail together, such as an approval and a swap.
* Accept [sponsored fees](https://tempo.com/developers/docs/accounts/fees/fee-sponsorship), so an app pays the fee for your user.
* Authorize [access keys](https://tempo.com/developers/docs/accounts/access-keys) that let an app or agent pay from the user's account. Each key has a spending limit, scopes, and an expiry.
* Sign with a [passkey](https://tempo.com/developers/docs/accounts/authentication/passkeys), and send [concurrent transactions](https://tempo.com/developers/docs/guide/payments/send-parallel-transactions) or [expiring nonces](https://tempo.com/developers/docs/guide/tempo-transaction#expiring-nonces) without tracking one nonce sequence.
If you already use EIP-7702 or EIP-4337 for batching or sponsorship, Tempo Transactions [include both in the protocol](https://tempo.com/developers/docs/protocol/transactions/eip-7702#feature-comparison).
::::
## Add Backup Signers
Your users hold [single-key accounts](https://tempo.com/developers/docs/development/single-key-accounts), so a lost key still loses the account. A user adds backup signers at the same address through an [account upgrade](https://tempo.com/developers/docs/accounts/account-configuration/account-upgrade). The wallet signs it as a Tempo Transaction. Upgrades run on [testnet](https://tempo.com/developers/docs/accounts/create#connect-to-testnet) now and on mainnet from [T14](https://tempo.com/developers/docs/protocol/upgrades/t14) on December 8, 2026.
## List Your Wallet
To list your wallet in [Wallet partners](https://tempo.com/developers/docs/partners/wallets), [tell us about your integration](https://tempo.com/developers/docs/partners/join).
## Related
[Use Tempo Transactions](https://tempo.com/developers/docs/guide/tempo-transaction): Use for batched calls, sponsored fees, access keys, and the Tempo SDKs.
[Fee Tokens](https://tempo.com/developers/docs/accounts/fees/fee-tokens): Covers which stablecoin pays each transaction's fee.
[Integrating Wallet Support for Tempo](https://tempo.com/developers/docs/quickstart/wallet-developers): Covers balance checks and fee quotes without a native gas token.
[Account Upgrade](https://tempo.com/developers/docs/accounts/account-configuration/account-upgrade): Use for adding backup signers at the same address. Testnet until T14 reaches mainnet.
[Partner With Tempo](https://tempo.com/developers/docs/partners/join): Use for listing your wallet in Wallet partners.
> Source: [/docs/earn](https://tempo.com/developers/docs/earn.md)
> Section: [Earn](https://tempo.com/developers/docs/earn.md). Choose a vault, deposit stablecoins, read positions, and withdraw. Earn is in beta; see the introduction for access.
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
# Tempo Earn
Put stablecoin balances to work in your app. Customers deposit stablecoins into a vault, see their earnings, and withdraw funds.
[Try a testnet deposit →](https://tempo.com/developers/docs/earn/integrate#try-a-deposit)
Illustrative Earn position: 1,200 vault shares valued at 1,250 OUSD. A historical chart illustrates position tracking, not a forecast of returns.
:::warning
Earn is in beta. [Contact Tempo](https://tempo.com/contact) to discuss access and the right integration for your application.
:::
## Earn capabilities
| Capability | What it does |
| --- | --- |
| **Earning balances** | Customer stablecoins earn in a vault until they withdraw them to spend or send. |
| **Strategies** | [Vaults](https://tempo.com/developers/docs/earn/vaults#where-yield-comes-from) earn from U.S. Treasuries, institutional credit, or collateralized lending. |
| **Revenue share** | A vault can pay your platform a [share of returns](https://tempo.com/developers/docs/earn/how-it-works#fees-and-revenue-share), never principal. |
| **Withdrawals** | Immediate or queued, depending on the vault's liquidity. |
| **Access controls** | A vault's share token is open or allowlisted to approved holders. |
| **Private positions** | Zone-routed vaults keep positions and activity [private](https://tempo.com/developers/docs/earn/integrate#track-private-earn-activity). |
## How Earn works
A vault accepts stablecoin deposits and issues shares representing an account's position. The value of those shares changes with the underlying strategy's returns, losses, and fees. Your app shows the position's current asset value as an earning balance.
Design your program around its target return, liquidity needs, and customer eligibility, then choose vaults by accepted asset, access rules, strategy, and withdrawal behavior. Position value and the amount immediately available to withdraw can differ. [How Earn works](https://tempo.com/developers/docs/earn/how-it-works) explains the vault and share model.
## Start building
Use an existing Tempo account and signer. Viem’s Earn actions submit deposits and supported withdrawals; the Earn API reads vaults, positions, and earnings.
[Vaults](https://tempo.com/developers/docs/earn/vaults): Choose an asset, strategy, and withdrawal path.
[Deposit](https://tempo.com/developers/docs/earn/integrate): Try a testnet deposit with a vault and amount already selected.
[Balances and earnings](https://tempo.com/developers/docs/earn/balances): Show position value and returns in your application.
[Withdraw](https://tempo.com/developers/docs/earn/withdraw): Return funds to the account and track delivery.
To use an earning balance for a payment, withdraw the required stablecoins and confirm their arrival before [sending the payment](https://tempo.com/developers/docs/guide/payments/send-a-payment).
If you operate a yield strategy, see [Connect a strategy](https://tempo.com/developers/docs/earn/providers). For a Zone integration, check the vault's support for [private Earn activity](https://tempo.com/developers/docs/earn/integrate#track-private-earn-activity).
> Source: [/docs/earn/vaults](https://tempo.com/developers/docs/earn/vaults.md)
> Section: [Earn](https://tempo.com/developers/docs/earn.md). Choose a vault, deposit stablecoins, read positions, and withdraw. Earn is in beta; see the introduction for access.
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
# Vaults
Choose a vault that accepts the stablecoin your customers hold and supports the access and withdrawal requirements of your product.
An Earn [vault](https://tempo.com/developers/docs/earn/how-it-works) is a contract that accepts one stablecoin and issues vault shares, units that represent each account's position. The vault earns from one underlying strategy.
## Find a vault
Use the vault address and network agreed for your integration; [contact Tempo](https://tempo.com/contact) to discuss which vaults fit. Evaluate where its returns come from, what customers net, how they exit, and who can deposit. A vault's `verified` flag is `true` when the vault is in Tempo's curated Earn registry. It doesn't describe the strategy's risk or guarantee a return.
### Inspect a vault
The demo starts with the Sentora pathUSD vault on Tempo mainnet. Switch to [Moderato](https://tempo.com/developers/docs/quickstart/connection-details), Tempo's testnet, to inspect the pathUSD test vault. Each network lists only its approved demo vault, with live configuration from the [Earn API](https://tempo.com/developers/docs/api/earn).
The interactive page defaults to Sentora pathUSD on Tempo mainnet and lets you switch to the pathUSD demo vault on Moderato testnet. The vault dropdown lists only the approved demo for the selected network. It reads that vault directly from Tempo API to show its asset, access rules, deposit status, withdrawal capabilities, and liquidity. See the [Earn API reference](https://tempo.com/developers/docs/api/earn) for request and response fields.
Read your vault's configuration with the Earn API `GET /v1/earn/vaults/{vaultId}` endpoint. Add `include=access,apy,capabilities` to return the access, rate, and operation fields this page uses. Save the vault's `id`, its lowercase contract address, together with its network; the same address on another network is a different contract.
## How vaults generate returns
Each vault earns from one strategy. Strategies fall into three categories by the assets they hold:
* **U.S. Treasuries** — Tokenized U.S. Treasury bonds and sovereign debt products.
* **Institutional credit** — Tokenized private credit, such as warehouse lending and CLOs.
* **Collateralized lending** — Onchain lending pools. Rates move with borrow demand.
An engine is the contract that connects an Earn vault to its underlying strategy. The vault configuration reports its `engine` and accepted asset (`assetToken`); available strategies vary by network. Engines connect to their source in one of three ways:
| Source | How it connects to Earn |
| --- | --- |
| **Lending** | An engine deposits into an underlying lending vault. |
| **Managed strategies** | An engine connects to a provider-managed vault that allocates funds across its strategy. |
| **Tokenized assets** | An engine accesses an asset, such as tokenized treasuries or private credit, through a supported liquidity pool. |
## What changes a position's value
A vault share's value moves with its strategy's returns, losses, and fees. A `verified` vault carries these risks too.
| Strategy | What moves value |
| --- | --- |
| **U.S. Treasuries** | Interest rates, and the tokenized product's issuer and redemption terms. |
| **Institutional credit** | Borrower repayment. A default reduces value. |
| **Collateralized lending** | Borrow demand sets the rate. A loan whose collateral falls short can cause a loss. |
## What customers net
The vault's `apy` object reports observed rates, measured over a past window. Its `apy.vault` rate already reflects [Earn fees](https://tempo.com/developers/docs/earn/how-it-works#fees-and-revenue-share), the share of returns a vault pays to fee recipients such as your platform, and the underlying venue's fees. Show the remaining costs before the account deposits:
| Cost | Where it appears |
| --- | --- |
| **Earn fees** | Already in the share price and `apy.vault`. The vault's `state.feesActive` field reports whether it charges them. |
| **Underlying venue fees** | Already in the engine's reported value. |
| **Provider deposit, management, and withdrawal fees** | Read them from the strategy provider's terms before presenting a rate. |
| **Network fees** | Each deposit and withdrawal transaction. |
| **Moving funds from another network** | Each [Routes](https://tempo.com/developers/docs/routes) quote, in and out. Routes moves stablecoins between Tempo and other networks. |
| **Rewards** | Reported separately in the `apy` object, under temporary terms. |
An observed APY describes a measurement window; it is not a promised return.
## How customers exit
Check withdrawal support in the vault's `capabilities` object before the first deposit:
| Path | Vault support | Settlement | When liquidity is short |
| --- | --- | --- | --- |
| **Immediate redemption** | `capabilities.redeem` | In the redemption transaction | Fails; it does not enter a queue. |
| **Queued withdrawal** | `capabilities.asyncRedeem` | A request, then a later claim | Waits in the queue. |
The vault's `instantLiquidity` field is the amount, in asset base units, that the strategy would release right now across the whole vault. It isn't a quote for one account, and `null` means the engine can't report a reliable value. [Withdraw](https://tempo.com/developers/docs/earn/withdraw) covers the exit flow.
## Who can deposit
A vault accepts one stablecoin, and `access.status` reports whether its share token is `open` or `allowlisted` to approved holders. Before enabling a deposit, check the accepted asset, the access status, `state.depositsPaused`, and the operations listed in `capabilities`. The Earn API only reads data; submit deposits and withdrawals with [Viem's Earn actions](https://tempo.com/developers/docs/earn/integrate#deposit-into-a-vault) or a direct contract call.
Continue with [Deposit](https://tempo.com/developers/docs/earn/integrate).
> Source: [/docs/earn/integrate](https://tempo.com/developers/docs/earn/integrate.md)
> Section: [Earn](https://tempo.com/developers/docs/earn.md). Choose a vault, deposit stablecoins, read positions, and withdraw. Earn is in beta; see the introduction for access.
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
# Deposit
Deposit stablecoins from a funded Tempo account into an Earn vault, then read the resulting position.
A [vault](https://tempo.com/developers/docs/earn/how-it-works) is a contract that accepts one stablecoin and issues vault shares, units that represent the account's position. A share isn't necessarily worth one stablecoin, so the position's asset value is read separately from its share count.
## Try a deposit
Create a passkey test account, get faucet funds, and deposit into a pathUSD test vault on [Moderato](https://tempo.com/developers/docs/quickstart/connection-details), Tempo's testnet. [pathUSD](https://tempo.com/developers/docs/protocol/exchange/quote-tokens#pathusd) is a Tempo stablecoin, and the vault is verified, meaning it's in Tempo's curated Earn registry. The amount starts at 1 pathUSD. The demo checks that the vault supports deposits and redemptions before enabling them. You can withdraw the test position afterward.
In the interactive web page, create a testnet passkey account, get test pathUSD from the faucet, choose a deposit amount (1 pathUSD by default), approve it for the verified vault, and confirm a deposit. Inspect the resulting shares and receipt, then withdraw the test position. Every transaction requires your confirmation and uses Moderato testnet.
## Deposit into a vault
Each tab deposits 1 pathUSD (`1000000` base units) into the Moderato test vault. The tabs use values defined in the [Earn testnet example](https://tempo.com/developers/docs/earn/example), which sets up each tool:
* **CLI (Cast).** Shell variables for the keystore (`KEYSTORE`), RPC URL (`TEMPO_RPC_URL`), `VAULT`, `ASSET_TOKEN`, `ASSET_AMOUNT`, and `ACCOUNT`, funded from the faucet.
* **Viem.** A `client` created with `createClient` from `viem/tempo` on `tempoModerato`, with a funded account, plus `vault`, `assetToken`, and `assetAmount`.
* **Wagmi.** A React component connected to a funded Moderato account (`address`), with the same constants and hook imports from `wagmi` and `wagmi/tempo`.
Keep the signer and vault on the same network.
::::steps
### Check the asset and access requirements
Read the vault with the [Earn API](https://tempo.com/developers/docs/api/earn) `GET /v1/earn/vaults/{vaultId}` endpoint, adding `include=access,capabilities`. Save the vault address and network together. Before enabling the deposit action, check these fields:
* **`assetToken`.** Matches the stablecoin the account holds.
* **`access.status`.** `open` accepts any holder; `allowlisted` accepts only approved holders.
* **`capabilities.deposit`.** Is `true`.
* **`state.depositsPaused`.** Is `false`.
### Approve funds
The vault pulls the stablecoin from the account, so the deposit simulation that follows needs an approval for the amount. Show the asset, amount, and vault before asking the account to sign. Cast pays the network fee in the vault's asset, pathUSD here, with `--tempo.fee-token`.
:::code-group
```ts [Viem]
await client.token.approveSync({
token: assetToken,
spender: vault,
amount: assetAmount,
})
```
```bash [CLI (Cast)]
cast erc20 approve "$ASSET_TOKEN" "$VAULT" "$ASSET_AMOUNT" \
--rpc-url "$TEMPO_RPC_URL" --account "$KEYSTORE" \
--tempo.fee-token "$ASSET_TOKEN"
```
```tsx [Wagmi]
const approval = Hooks.token.useApproveSync({
mutation: { onSuccess: () => setApproved(true) },
})
const approve = () => approval.mutateAsync({
token: assetToken, spender: vault, amount: assetAmount,
})
```
:::
`shareAmountMin` is the fewest shares the vault may mint before it rejects the deposit, which protects the account if the share price moves before the deposit lands. After approval confirms, simulate the deposit with `shareAmountMin` set to 1, which only reads the quoted share amount. Then set `shareAmountMin` 0.5% below the quote: `EarnShares.minimumOutput(quotedShares, 50)` subtracts 50 basis points, and the Cast tab defines a `minimum_output` helper that does the same in integer math. `Actions`, `Abis`, and `EarnShares` come from `viem/tempo`.
:::code-group
```ts [Viem]
const { result: quotedShares } = await Actions.earn.deposit.simulate(client, {
vault,
assetAmount,
shareAmountMin: 1n,
})
const shareAmountMin = EarnShares.minimumOutput(quotedShares, 50)
```
```bash [CLI (Cast)]
minimum_output() {
python3 - "$1" <<'PYTHON'
import sys
amount = int(sys.argv[1])
if amount <= 0:
raise ValueError("The quote must be positive")
print(max(1, amount * 9950 // 10000))
PYTHON
}
QUOTED_SHARES=$(cast call "$VAULT" \
'deposit(uint256,address,uint256)(uint256)' \
"$ASSET_AMOUNT" "$ACCOUNT" 1 --from "$ACCOUNT" \
--rpc-url "$TEMPO_RPC_URL" --json | \
python3 -c 'import json,sys; print(json.load(sys.stdin)[0])')
MIN_SHARES=$(minimum_output "$QUOTED_SHARES")
```
```tsx [Wagmi]
const quote = useSimulateContract({
abi: Abis.earnVault, address: vault, account: address,
functionName: 'deposit', args: [assetAmount, address, 1n],
query: { enabled: approved },
})
const shareAmountMin = quote.data
? EarnShares.minimumOutput(quote.data.result, 50)
: undefined
```
:::
Refresh the simulation if the customer waits before signing. In Wagmi, call `quote.refetch()` to refresh and keep the deposit button disabled until a positive quote is available.
A deposit is a contract call; a direct transfer to the vault address doesn't create a position. The Earn API only reads data and doesn't submit deposits or withdrawals.
### Make a deposit
Viem's `depositSync` and Wagmi's `Actions.earn.deposit.calls` send an approval and the deposit together as one atomic transaction, so in those tabs the earlier approval only enables the simulation. Cast sends the deposit alone and uses the earlier approval. The account receives shares, and the vault rejects the deposit if it would mint fewer than `shareAmountMin`. In Wagmi, `forceAtomic: true` requires the wallet to run both calls in one transaction.
:::code-group
```ts [Viem]
const { receipt, shareAmount } = await client.earn.depositSync({
vault,
assetAmount,
shareAmountMin,
})
```
```bash [CLI (Cast)]
cast send "$VAULT" 'deposit(uint256,address,uint256)' \
"$ASSET_AMOUNT" "$ACCOUNT" "$MIN_SHARES" \
--rpc-url "$TEMPO_RPC_URL" --account "$KEYSTORE" \
--tempo.fee-token "$ASSET_TOKEN"
```
```tsx [Wagmi]
const deposit = useSendCallsSync()
const submitDeposit = async () => {
if (!shareAmountMin) return
const calls = Actions.earn.deposit.calls({
vault, assetToken, assetAmount,
recipient: address, shareAmountMin,
})
return deposit.mutateAsync({ calls, forceAtomic: true })
}
```
:::
Confirm the receipt succeeded. Save its transaction hash, the deposited amount, and the shares received, so you can match them against your own ledger later.
### Confirm your position
Read the position with the Earn API `GET /v1/earn/vaults/{vaultId}/positions/{address}` endpoint. The request builder starts with the Moderato test vault as `vaultId` and `chainId` set to `testnet`. Set the `address` path parameter to your test account’s address; use a matching vault and network for other deposits. Use **Try** to read the position, or switch the request’s code language to copy an example.
`GET /v1/earn/vaults/{vaultId}/positions/{address}`
Get account position
[API reference](https://tempo.com/developers/docs/api/earn#getearnvaultposition) — request parameters, authentication, and response schema. The examples below use editable sample values.
**cURL**
```bash
curl 'https://api.tempo.xyz/v1/earn/vaults/0x20147491b5701dea880263241c335caca9be326d/positions/0xbe058e1c4df8a4366a387bf595b284246a93039e?chainId=testnet'
```
**TypeScript**
```ts
fetch('https://api.tempo.xyz/v1/earn/vaults/0x20147491b5701dea880263241c335caca9be326d/positions/0xbe058e1c4df8a4366a387bf595b284246a93039e?chainId=testnet')
```
In the response, read `shareBalance` for the shares held and `value` for their current value in the vault's stablecoin. Don't treat the share count as the same amount of stablecoins.
::::
## Display the earning balance
Follow [Balances and earnings](https://tempo.com/developers/docs/earn/balances) to show position value, earnings, and rate measurement windows. Make [withdrawal behavior](https://tempo.com/developers/docs/earn/withdraw) visible before accepting the deposit.
## Track private Earn activity
A [Zone](https://tempo.com/developers/docs/zones) is a private stablecoin ledger connected to Tempo. A vault supports Zone positions when `capabilities.privateRouting` is `true`; request `include=zones` to read its Zone routes. Funds in a Zone reach a vault on Tempo through a [Zone withdrawal](https://tempo.com/developers/docs/zones/withdraw), so Zone-routed positions start from a withdrawal, not from the approval and deposit steps on this page. Tempo runs the Earn operation, then deposits the result back into the Zone.
Each Zone withdrawal emits a `senderTag`, a 32-byte tag shared by withdrawals from one sender in one Zone transaction. Pass it to [`GET /v1/earn/transactions/{senderTag}`](https://tempo.com/developers/docs/api/earn#getearntransaction). The response reports the Earn execution on Tempo in `l1Execution` and the return deposit into the Zone in `zoneDeposit`. Show returned funds as available once `zoneDeposit.status` is `completed`.
The Earn API's account position listing includes Zone positions, but it returns no earnings data for them.
## Read Earn data
The [Earn API](https://tempo.com/developers/docs/api/earn) covers vault discovery, positions, share prices, and earnings. Keep the network consistent across discovery, transactions, and reads. The API's `chainId` parameter takes `mainnet`, `testnet`, or a numeric chain ID.
> Source: [/docs/earn/balances](https://tempo.com/developers/docs/earn/balances.md)
> Section: [Earn](https://tempo.com/developers/docs/earn.md). Choose a vault, deposit stablecoins, read positions, and withdraw. Earn is in beta; see the introduction for access.
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
# Balances and earnings
Display the current asset value of each account's position as its earning balance. Keep share balance, earnings, available withdrawals, and pending withdrawals distinct.
## Read a position
Use `GET /v1/earn/addresses/{address}/positions` to list an account's positions, or `GET /v1/earn/vaults/{vaultId}/positions/{address}` for one vault. Keep `chainId` consistent with the network used for the deposit.
The API example starts with the [deposit demo’s vault](https://tempo.com/developers/docs/earn/integrate#try-a-deposit) on `testnet`. Replace `address` with your depositor address, or change both the vault and network to read another position. Use **Try** to read the position or switch the request’s code language to copy an example.
`GET /v1/earn/vaults/{vaultId}/positions/{address}`
Get account position
[API reference](https://tempo.com/developers/docs/api/earn#getearnvaultposition) — request parameters, authentication, and response schema. The examples below use editable sample values.
**cURL**
```bash
curl 'https://api.tempo.xyz/v1/earn/vaults/0x20147491b5701dea880263241c335caca9be326d/positions/0xbe058e1c4df8a4366a387bf595b284246a93039e?chainId=testnet'
```
**TypeScript**
```ts
fetch('https://api.tempo.xyz/v1/earn/vaults/0x20147491b5701dea880263241c335caca9be326d/positions/0xbe058e1c4df8a4366a387bf595b284246a93039e?chainId=testnet')
```
The single-position response includes `shareBalance`, `value`, and `valueToken`. Format the asset value using the token's decimals. The share count isn't a stablecoin amount.
For public-chain data, these endpoints support anonymous reads. Use [API authentication](https://tempo.com/developers/docs/api/authentication) for dedicated quotas; an API key requires `data:read` access.
## Calculate earnings
Use `GET /v1/earn/vaults/{vaultId}/earnings/{address}` for earnings over a selected period. Deposits, withdrawals, and share transfers change a balance without being earnings. When the response reports `status: incomplete_cost_basis`, show earnings as unavailable, rather than zero.
Choose the measurement window with the same account, vault, and network:
`GET /v1/earn/vaults/{vaultId}/earnings/{address}`
Get vault earnings
[API reference](https://tempo.com/developers/docs/api/earn#getearnvaultearnings) — request parameters, authentication, and response schema. The examples below use editable sample values.
**cURL**
```bash
curl 'https://api.tempo.xyz/v1/earn/vaults/0x20147491b5701dea880263241c335caca9be326d/earnings/0xbe058e1c4df8a4366a387bf595b284246a93039e?chainId=testnet'
```
**TypeScript**
```ts
fetch('https://api.tempo.xyz/v1/earn/vaults/0x20147491b5701dea880263241c335caca9be326d/earnings/0xbe058e1c4df8a4366a387bf595b284246a93039e?chainId=testnet')
```
### Show rates and rewards
Vault responses can include an `apy` object with observed vault returns, reward information, and a measurement window. It can be `null` when no component is measurable. Display unavailable data as unavailable, rather than as zero.
Request account-specific APY from the [position endpoint](https://tempo.com/developers/docs/api/earn#getearnvaultposition) when showing an account's effective rate. Reward qualification can lag a new deposit or transfer, and a boost can apply to only part of the balance. Keep temporary reward terms separate from observed vault returns.
For charts, use the [share-price history endpoint](https://tempo.com/developers/docs/api/earn#getearnvaultshareprices) for vault share prices and the [earnings endpoint](https://tempo.com/developers/docs/api/earn#getearnvaultearnings) for an account's earnings. Label each chart for the metric it shows.
## Read private positions
Account position listing supports private Zones, but earnings data is unavailable for those positions. See [private Earn tracking](https://tempo.com/developers/docs/earn/integrate#track-private-earn-activity).
For schema details, see the [Earn API](https://tempo.com/developers/docs/api/earn).
> Source: [/docs/earn/withdraw](https://tempo.com/developers/docs/earn/withdraw.md)
> Section: [Earn](https://tempo.com/developers/docs/earn.md). Choose a vault, deposit stablecoins, read positions, and withdraw. Earn is in beta; see the introduction for access.
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
# Withdraw
Redeem vault shares to return stablecoins to the account. The flow below is immediate redemption; use it only when the vault supports it.
## Try a withdrawal
Redeem the shares from your [test deposit](https://tempo.com/developers/docs/earn/integrate#try-a-deposit). The demo restores your passkey test account in this browser, selects its full position in the same pathUSD vault on Moderato, and returns the test funds to that account.
In the interactive web page, restore the passkey test account from the deposit demo and redeem its full position in the verified Moderato pathUSD vault. Confirm the withdrawal and inspect the receipt. If the account has no shares, make a test deposit first.
## Check available funds
A vault uses available cash or liquidity from its underlying venue for redemptions. An immediate redemption can fail when liquidity is unavailable. Vaults with async redemption use a separate request-and-claim flow; a failed immediate redemption doesn't enter that queue.
Keep three amounts distinct in your app:
| Amount | What to show |
| --- | --- |
| **Position value** | The current asset value of the account's shares. |
| **Available to withdraw** | The amount available through the vault's supported withdrawal path and a current quote. |
| **Pending withdrawal** | An exit requested but not yet delivered to the destination account. |
Read `capabilities.redeem` and `capabilities.asyncRedeem` to distinguish immediate and queued redemption support. The vault's `instantLiquidity` reports liquidity across the vault, not a user-specific withdrawal quote; `null` means a reliable value is unavailable.
Read the selected vault before enabling withdrawal. The API example starts with the same testnet vault. Keep `chainId` set to `testnet` and include `capabilities`, or change both the vault and network for your integration.
`GET /v1/earn/vaults/{vaultId}`
Get vault
[API reference](https://tempo.com/developers/docs/api/earn#getearnvault) — request parameters, authentication, and response schema. The examples below use editable sample values.
**cURL**
```bash
curl 'https://api.tempo.xyz/v1/earn/vaults/0x20147491b5701dea880263241c335caca9be326d?chainId=testnet'
```
**TypeScript**
```ts
fetch('https://api.tempo.xyz/v1/earn/vaults/0x20147491b5701dea880263241c335caca9be326d?chainId=testnet')
```
This reads vault-wide support. Get a quote for the account’s share amount before signing; a quote doesn't reserve liquidity.
## Request a withdrawal
::::steps
### Get current withdrawal terms
Set `shareAmount` (CLI: `SHARE_AMOUNT`) to the shares to redeem in base units. Use your tool’s [testnet setup](https://tempo.com/developers/docs/earn/example), then read the current asset output, including vault fees. Wagmi’s `Abis` and `EarnShares` come from `viem/tempo`.
:::code-group
```ts [Viem]
const assetAmount = await client.earn.getRedeemQuote({
vault,
shareAmount,
})
```
```bash [CLI (Cast)]
ASSET_QUOTE=$(cast call "$VAULT" 'previewRedeem(uint256)(uint256)' \
"$SHARE_AMOUNT" --rpc-url "$TEMPO_RPC_URL" --json | \
python3 -c 'import json,sys; print(json.load(sys.stdin)[0])')
MIN_ASSETS=$(minimum_output "$ASSET_QUOTE")
```
```tsx [Wagmi]
const quote = useReadContract({
abi: Abis.earnVault, address: vault,
functionName: 'previewRedeem', args: [shareAmount],
})
const assetAmountMin = quote.data
? EarnShares.minimumOutput(quote.data, 50)
: undefined
```
:::
Show the asset, quoted output, network fee, recipient, and withdrawal timing before the account signs. Refresh stale quotes; Wagmi exposes `quote.refetch()`.
### Submit the withdrawal
Approve the vault to spend the share token, then redeem the selected shares. Earn’s `redeem(uint256,address,uint256)` takes the share amount, recipient, and minimum asset output; it differs from the ERC-4626 signature. Viem and Wagmi batch these calls; Cast sends and confirms them separately. Each version sends assets to the signing account and accepts at most 0.5% less than the displayed quote. Keep the submit button disabled until a positive quote is available.
:::code-group
```ts [Viem]
const { receipt } = await client.earn.redeemSync({
vault,
shareAmount,
assetAmount,
slippageBps: 50,
})
```
```bash [CLI (Cast)]
cast erc20 approve "$SHARE_TOKEN" "$VAULT" "$SHARE_AMOUNT" \
--rpc-url "$TEMPO_RPC_URL" \
--account "$KEYSTORE" --tempo.fee-token "$ASSET_TOKEN"
cast send "$VAULT" 'redeem(uint256,address,uint256)' \
"$SHARE_AMOUNT" "$ACCOUNT" "$MIN_ASSETS" \
--rpc-url "$TEMPO_RPC_URL" --account "$KEYSTORE" \
--tempo.fee-token "$ASSET_TOKEN"
```
```tsx [Wagmi]
const redemption = useSendCallsSync()
const submitWithdrawal = async () => {
if (!assetAmountMin) return
const calls = Actions.earn.redeem.calls({
vault, shareToken, shareAmount,
recipient: address, assetAmountMin,
})
return redemption.mutateAsync({ calls, forceAtomic: true })
}
```
:::
For queued withdrawals, [contact Tempo](https://tempo.com/contact) for the selected vault’s request-and-claim integration. Save the request identifier and keep pending funds separate from available stablecoins.
### Track its status
Track the transaction and any later settlement. Keep the withdrawal pending until the destination receives funds, then refresh the position and stablecoin balance. Use the [transaction and transfer model](https://tempo.com/developers/docs/api/transactions-and-transfers) to distinguish execution from delivery.
::::
## Pay with withdrawn funds
Once the withdrawn stablecoins reach the account, you can [send a payment](https://tempo.com/developers/docs/guide/payments/send-a-payment).
For private balances, use a vault that supports [Zone routing](https://tempo.com/developers/docs/zones). Private positions are tracked differently; see [private Earn activity](https://tempo.com/developers/docs/earn/integrate#track-private-earn-activity).
> Source: [/docs/earn/how-it-works](https://tempo.com/developers/docs/earn/how-it-works.md)
> Section: [Earn](https://tempo.com/developers/docs/earn.md). Choose a vault, deposit stablecoins, read positions, and withdraw. Earn is in beta; see the introduction for access.
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
# How Earn works
When your application deposits stablecoins into a vault, the account receives shares representing its position. Use the shares' current asset value to display an earning balance, and the vault's withdrawal interface to return stablecoins to the account.
An account deposits stablecoins into a vault and receives vault shares. The vault's engine connects it to one strategy, such as U.S. Treasuries, institutional credit, or collateralized lending.
Each vault connects to one strategy through its engine.
| Component | Role |
| --- | --- |
| **Vault** | Accepts deposits and accounts for positions. |
| **Vault shares** | Units representing an account's position in the vault. Check the selected vault's share token and contract interface. |
| **Engine** | Connects the vault to a lending market, managed strategy, or liquidity pool. |
A share is not necessarily worth one stablecoin. Its value changes with the underlying strategy's returns, losses, and fees. An account's **position value** is the asset value of all its shares; **earnings** are returns over a period, separate from deposits and withdrawals.
The account that deposits holds the shares: each customer's account, or a company account that your ledger allocates.
The [Earn API](https://tempo.com/developers/docs/api/earn) exposes the vault's engine, share token, accepted asset, accounting state, and supported operations.
## Keep value and liquidity separate
A position's value isn't necessarily the amount the account can withdraw immediately. Read the vault's withdrawal methods and current terms before showing funds as available.
A vault's `verified` flag marks a curated listing, not a risk rating or a guaranteed return. [Choose a vault](https://tempo.com/developers/docs/earn/vaults) based on its accepted asset, access rules, strategy, and withdrawal behavior.
## Fees and revenue share
A vault can pay a share of its returns to fee recipients, such as your platform. Earn fees apply only to returns above the vault's previous high in value per share, never to deposited principal.
Illustrative split of $100.00 in returns: 20%, or $20.00, to your business as a fee recipient and 80%, or $80.00, to your customers.
| Fee | How it is calculated | Example on a 5% return |
| --- | --- | --- |
| **Fixed fee** | A percentage of positive returns, paid to one recipient. A vault supports up to four. | A 20% fee leaves customers 4% and pays the recipient 1%. |
| **Excess-return fee** | A percentage of returns above a target rate for customers, paid to one recipient. | A 4% target with a 100% fee leaves customers 4% and pays the recipient the remaining 1%. |
At 1%, $10 million in balances earns the fee recipient $100,000 a year. Returns vary, so the fee amount does too.
The vault takes fees by issuing new shares for its fee recipients, so the share price and the observed `apy.vault` already reflect them. Fees charged by the underlying venue are reflected in the engine's reported value. See [what customers net](https://tempo.com/developers/docs/earn/vaults#what-customers-net) for the costs outside the observed rate.
Fee terms are set per vault; `state.feesActive` reports whether a vault charges Earn fees. [Contact Tempo](https://tempo.com/contact) to configure fee recipients for your Earn program.
Continue with [Deposit](https://tempo.com/developers/docs/earn/integrate), then [show balances and earnings](https://tempo.com/developers/docs/earn/balances). If you operate a yield strategy, see [Connect a strategy](https://tempo.com/developers/docs/earn/providers).
> Source: [/docs/earn/providers](https://tempo.com/developers/docs/earn/providers.md)
> Section: [Earn](https://tempo.com/developers/docs/earn.md). Choose a vault, deposit stablecoins, read positions, and withdraw. Earn is in beta; see the introduction for access.
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
# Connect a strategy
An engine connects an Earn vault to its underlying yield strategy. If you operate a lending market, managed strategy, or liquidity pool, agree the engine interface and deployment with Tempo before integrating it.
## Define the vault
Specify the accepted stablecoin, strategy, share valuation, venue and [Earn fees](https://tempo.com/developers/docs/earn/how-it-works#fees-and-revenue-share), and account eligibility. Applications show these terms to customers. The [vault configuration](https://tempo.com/developers/docs/earn/vaults) exposes the asset, engine, access rules, and supported capabilities.
## Define deposits and withdrawals
Document the contract interface and approvals required to deposit, and how the vault issues shares. Define whether redemptions are immediate or queued, the liquidity available to serve them, and how applications track completion.
Applications use [Viem’s Earn actions](https://tempo.com/developers/docs/earn/integrate) for supported vault operations and the [Earn API](https://tempo.com/developers/docs/api/earn) for discovery, positions, share prices, and earnings. Document any engine-specific restrictions or queued withdrawal requirements.
## Confirm the integration
[Contact Tempo](https://tempo.com/contact) to agree the engine interface, deployment, and supported operations. Mention any planned Zone integration, since it adds routing, access, and tracking requirements.
See [How Earn works](https://tempo.com/developers/docs/earn/how-it-works) for the shared vault model and [Deposit](https://tempo.com/developers/docs/earn/integrate) for the application flow.
> Source: [/docs/earn/example](https://tempo.com/developers/docs/earn/example.md)
> Section: [Earn](https://tempo.com/developers/docs/earn.md). Choose a vault, deposit stablecoins, read positions, and withdraw. Earn is in beta; see the introduction for access.
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
# Earn testnet example
Use CLI, Viem, or Wagmi to deposit 1 pathUSD into a verified Moderato vault, read the position, and redeem the shares. For the short [Deposit](https://tempo.com/developers/docs/earn/integrate) and [Withdraw](https://tempo.com/developers/docs/earn/withdraw) snippets, start with your tool’s setup below. All examples use testnet assets and a six-decimal pathUSD vault.
## Set up the CLI
Install the [current upstream Foundry release](https://tempo.com/developers/docs/sdk/foundry) with Tempo support, plus Python 3 for exact integer calculations. The write commands use `--tempo.fee-token` to pay fees in pathUSD.
Create a dedicated test keystore. Cast prompts for its password when signing; never use this test account for production funds.
```bash
cast wallet new ~/.foundry/keystores tempo-earn-test
```
Set the variables used in [Deposit](https://tempo.com/developers/docs/earn/integrate) and [Withdraw](https://tempo.com/developers/docs/earn/withdraw):
```bash
set -euo pipefail
KEYSTORE=tempo-earn-test
TEMPO_RPC_URL=https://rpc.moderato.tempo.xyz
VAULT=0x20147491b5701dea880263241c335caca9be326d
ASSET_TOKEN=0x20c0000000000000000000000000000000000000
SHARE_TOKEN=0x20c0000000000000000000006ac30cbdea0747fa
ASSET_AMOUNT=1000000
ACCOUNT=$(cast wallet address --account "$KEYSTORE")
```
Confirm the chain is `42431`, the asset and share token match those above, and deposits are not paused:
```bash
cast chain-id --rpc-url "$TEMPO_RPC_URL"
cast call "$VAULT" 'asset()(address)' --rpc-url "$TEMPO_RPC_URL"
cast call "$VAULT" 'earnShare()(address)' --rpc-url "$TEMPO_RPC_URL"
cast call "$VAULT" 'depositsPaused()(bool)' --rpc-url "$TEMPO_RPC_URL"
```
Request test funds. Wait for the returned faucet transactions to confirm before approving or depositing:
```bash
cast rpc tempo_fundAddress "$ACCOUNT" --rpc-url "$TEMPO_RPC_URL"
```
The quote snippets use this helper to set a positive minimum output 0.5% below the quote, without floating-point arithmetic:
```bash
minimum_output() {
python3 - "$1" <<'PYTHON'
import sys
amount = int(sys.argv[1])
if amount <= 0:
raise ValueError("The quote must be positive")
print(max(1, amount * 9950 // 10000))
PYTHON
}
```
After depositing, read the shares held by this account. The withdrawal example redeems this full balance; set a smaller positive `SHARE_AMOUNT` for a partial withdrawal.
```bash
SHARE_AMOUNT=$(cast erc20 balance "$SHARE_TOKEN" "$ACCOUNT" \
--rpc-url "$TEMPO_RPC_URL")
```
## Run the Viem example
Install Viem 2.57.4 or later and a TypeScript runner in your example project:
```bash
pnpm add viem
pnpm add -D tsx
```
Save the following as `earn.ts`. The vault accepts six-decimal pathUSD on Moderato (`42431`). The script checks its deployed asset and engine, approves only the deposit amount, and simulates before signing with a 0.5% output bound. The deposit and redemption actions each include their required approval.
```ts [earn.ts]
import { generatePrivateKey } from 'viem/accounts'
import { tempoModerato } from 'viem/chains'
import { Account, Actions, createClient, EarnShares } from 'viem/tempo'
const vault = '0x20147491b5701dea880263241c335caca9be326d'
const assetToken = '0x20c0000000000000000000000000000000000000'
const engine = '0x49c4600ba4f39c11006cb2269c371e8a19f26a26'
const assetAmount = 1_000_000n
const account = Account.fromSecp256k1(generatePrivateKey())
const client = createClient({ account, chain: tempoModerato, feeToken: assetToken })
const state = await client.earn.getVault({ vault })
if (
state.assetToken.toLowerCase() !== assetToken ||
state.engine.address.toLowerCase() !== engine ||
state.depositsPaused || !state.isSynced
) throw new Error('The test vault is unavailable or its configuration changed.')
await client.faucet.fundSync({ account, timeout: 60_000 })
await client.token.approveSync({ token: assetToken, spender: vault, amount: assetAmount })
const { result: quotedShares } = await Actions.earn.deposit.simulate(client, {
vault,
assetAmount,
shareAmountMin: 1n,
})
const shareAmountMin = EarnShares.minimumOutput(quotedShares, 50)
const deposit = await client.earn.depositSync({ vault, assetAmount, shareAmountMin })
if (deposit.receipt.status !== 'success') throw new Error('Deposit failed.')
console.log('Deposit:', deposit.receipt.transactionHash)
const position = await client.earn.getPosition({ vault })
console.log('Shares:', position.shareBalance, 'Value:', position.value)
const shareAmount = deposit.shareAmount
const withdrawal = await client.earn.redeemSync({
vault,
shareAmount,
slippageBps: 50,
})
if (withdrawal.receipt.status !== 'success') throw new Error('Withdrawal failed.')
console.log('Withdrawal:', withdrawal.receipt.transactionHash)
```
Run the script:
```bash
pnpm exec tsx earn.ts
```
A successful run prints the deposit and withdrawal transaction hashes. The generated key stays in process memory and is discarded when the script exits. Use only faucet funds with this example.
## Set up Wagmi
Use the [Wagmi setup](https://tempo.com/developers/docs/sdk/typescript#wagmi-sdk-for-tempo) with a Tempo Wallet connector and `tempoModerato` in the chain config. Wrap your React app with `WagmiProvider` and `QueryClientProvider`, then connect and [fund](https://tempo.com/developers/docs/quickstart/faucet) a test account.
The main guide's Wagmi snippets run inside a connected React component. Import the real Wagmi contract hooks and Viem Earn call builders:
```tsx [Earn.tsx]
import { useState } from 'react'
import type { Address } from 'viem'
import { Abis, Actions, EarnShares } from 'viem/tempo'
import { useReadContract, useSendCallsSync, useSimulateContract } from 'wagmi'
import { Hooks } from 'wagmi/tempo'
const vault = '0x20147491b5701dea880263241c335caca9be326d'
const assetToken = '0x20c0000000000000000000000000000000000000'
const shareToken = '0x20c0000000000000000000006ac30cbdea0747fa'
const assetAmount = 1_000_000n
```
Pass the connected `address` and the shares to redeem into this hook. Mount its component only on Moderato, and remount it when the account changes (for example, with `key={address}`). This resets account-specific approval and quote state.
```tsx [Earn.tsx]
export function useEarn(address: Address, shareAmount: bigint) {
const [approved, setApproved] = useState(false)
const approval = Hooks.token.useApproveSync({
mutation: { onSuccess: () => setApproved(true) },
})
const depositQuote = useSimulateContract({
abi: Abis.earnVault, address: vault, account: address,
functionName: 'deposit', args: [assetAmount, address, 1n],
query: { enabled: approved },
})
const redemptionQuote = useReadContract({
abi: Abis.earnVault, address: vault,
functionName: 'previewRedeem', args: [shareAmount],
query: { enabled: shareAmount > 0n },
})
const deposit = useSendCallsSync()
const redemption = useSendCallsSync()
const approve = () => approval.mutateAsync({
token: assetToken, spender: vault, amount: assetAmount,
})
const submitDeposit = () => {
if (!depositQuote.data || Date.now() - depositQuote.dataUpdatedAt > 60_000)
throw new Error('Refresh the deposit quote before signing.')
const calls = Actions.earn.deposit.calls({
vault, assetToken, assetAmount, recipient: address,
shareAmountMin: EarnShares.minimumOutput(depositQuote.data.result, 50),
})
return deposit.mutateAsync({ calls, forceAtomic: true })
}
const submitWithdrawal = () => {
if (!redemptionQuote.data || Date.now() - redemptionQuote.dataUpdatedAt > 60_000)
throw new Error('Refresh the withdrawal quote before signing.')
const calls = Actions.earn.redeem.calls({
vault, shareToken, shareAmount, recipient: address,
assetAmountMin: EarnShares.minimumOutput(redemptionQuote.data, 50),
})
return redemption.mutateAsync({ calls, forceAtomic: true })
}
return {
approve, submitDeposit, submitWithdrawal,
approval, depositQuote, redemptionQuote, deposit, redemption,
}
}
```
Call the returned actions from buttons, catch and display their errors, and disable submission while a mutation is pending or its quote is unavailable. Show the quoted output before requesting a signature. Each quote exposes `refetch()` for a refresh button; refresh the account's share and stablecoin balances after a successful transaction.
Wagmi's batched action requires a wallet that supports `wallet_sendCalls`, such as Tempo Wallet. The call builders supply the asset or share-token approval and the vault operation together.
## Use your application's signer
Replace the generated test account with your application's [signer](https://tempo.com/developers/docs/accounts/keys), and select a vault on the same network. Check its accepted asset, eligibility, capabilities, fees, and withdrawal behavior before enabling writes.
Ask the customer to confirm the displayed quote before submission. Refresh a stale quote and apply a positive minimum output. A quote doesn't reserve liquidity, and queued withdrawals use the vault's request-and-claim flow.
For hosted API reads with generated request code, use [Balances and earnings](https://tempo.com/developers/docs/earn/balances). The Earn API does not sign deposits or withdrawals.
> Source: [/docs/routes](https://tempo.com/developers/docs/routes.md)
> Section: [Routes](https://tempo.com/developers/docs/routes.md). Move stablecoins between Tempo and other networks: try a route, set up API access, choose a supported route, quote it, accept deposits or make a transfer, and track delivery. Routes is in beta; see the introduction for access.
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
# Tempo Routes
Move stablecoins between Tempo and supported networks. Accept deposits from external wallets or make a transfer your application can authorize.
[Try a live route →](https://tempo.com/developers/docs/routes/test)
[Explore supported routes →](https://tempo.com/developers/docs/routes/networks)
Supported funding paths connect through the Routes API to a Tempo account.
:::warning
Routes is in beta. [Contact Tempo](https://tempo.com/contact) to discuss access and the routes your application needs.
:::
## How Routes works
A route connects a source network and token to a destination network and token. Routes prepares the funding instructions or source-chain calls, then tracks delivery to the recipient. A successful source transaction starts the route; your app confirms completion at the destination.
For payments that stay on Tempo, use [Send payments](https://tempo.com/developers/docs/guide/payments/send-a-payment) or [Swap stablecoins](https://tempo.com/developers/docs/guide/stablecoin-dex/executing-swaps) instead. Routes also swaps stablecoins between currencies on Tempo through [FX routes](https://tempo.com/developers/docs/routes/fx).
## Choose a flow
Choose by who submits the source transaction.
[Accept deposits](https://tempo.com/developers/docs/routes/deposits): The sender pays from any external wallet to an address you show them.
[Make a transfer](https://tempo.com/developers/docs/routes/transfers): Your application signs the source calls through a connected wallet or its own signer.
## Build a Routes integration
Each page in this section covers one step. Read them in order:
1. [Try a route](https://tempo.com/developers/docs/routes/test) in the browser to see every API call from quote to delivery. Without an API key, the demo quotes listed routes and previews 1:1 delivery where a route supports it.
2. [Set up Routes](https://tempo.com/developers/docs/routes/api-setup) with the scopes your backend needs.
3. Pick a pair and funding method from [Supported routes](https://tempo.com/developers/docs/routes/networks).
4. Read [Quotes and fees](https://tempo.com/developers/docs/routes/quotes) to choose the fixed amount and show the payment terms.
5. Build the flow: [Accept deposits](https://tempo.com/developers/docs/routes/deposits) or [Make a transfer](https://tempo.com/developers/docs/routes/transfers).
6. [Track delivery](https://tempo.com/developers/docs/routes/delivery) to completion or refund before you credit a balance.
To run a flow from a terminal, use the [deposit address](https://tempo.com/developers/docs/routes/examples/deposits) or [transfer](https://tempo.com/developers/docs/routes/examples/transfers) cURL example.
## Use funds after delivery
After funds arrive on Tempo, you can deposit them into [Earn](https://tempo.com/developers/docs/earn/integrate) or a [Zone](https://tempo.com/developers/docs/zones/deposit). Those are separate operations; direct Routes transfers into vaults or Zones are not implemented.
For bank funding and payouts, see [Payments & ramps](https://tempo.com/developers/docs/partners/payments-and-ramps).
> Source: [/docs/routes/test](https://tempo.com/developers/docs/routes/test.md)
> Section: [Routes](https://tempo.com/developers/docs/routes.md). Move stablecoins between Tempo and other networks: try a route, set up API access, choose a supported route, quote it, accept deposits or make a transfer, and track delivery. Routes is in beta; see the introduction for access.
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
# Try a route
Run a route end to end in your browser and watch each [Routes API](https://tempo.com/developers/docs/routes) call. Pick a suggested route, or choose a source and destination, to get a quote.
Open the interactive Routes demo (Try a route) at /docs/routes/test. Choose source and destination assets, get a quote (without a key, routes that support subsidies preview 1:1 delivery from a quote-only demo organization), add an API key to create the transfer or deposit address, sign with Tempo (Tempo sources) or a browser wallet, and track delivery. The demo sends API requests directly to api.tempo.xyz; API keys stay in tab memory.
## Before you run it
* **Real funds.** The demo moves real funds on live networks. Start with a small amount.
* **API key.** Creating a route needs a Routes API key from [Tempo Console](https://tempo.com/console?to=/\:org/api-keys) with the `routes:read`, `routes:write`, and `data:read` [scopes](https://tempo.com/developers/docs/routes/api-setup#routes-api-key-scopes).
* **Key storage.** The key stays only in this tab's memory.
* **No key.** Without a key, the demo quotes from a demo organization that can quote but not create routes. Its quotes show the subsidized 1:1 terms an approved organization receives.
To open a specific route, find it in the [supported routes](https://tempo.com/developers/docs/routes/networks#available-routes) table and choose **Try** beside it.
## How each route is funded
Routes funds a route by **transfer**, where your wallet signs the source-chain calls Routes prepares, or by **deposit address**, where the sender pays into an address Routes generates.
| Route | How you fund it |
| --- | --- |
| From Tempo | Sign in with Tempo Wallet and approve every source call in one transaction. |
| From another EVM network | Choose a browser wallet, then sign the calls one at a time. |
| From Tron | Choose a Tron wallet, such as TronLink, then sign the calls one at a time. Each call needs TRX to pay for energy, Tron's resource for contract calls. |
| From Stellar | Choose a Stellar wallet, such as Hana Wallet or OneKey, then sign one payment. The sender needs XLM for the network fee. |
| From Solana, or when you choose **Deposit address** in the demo | Routes generates a deposit address when you create the route. Send the source asset to it with your wallet, or from any wallet. The demo detects the deposit and tracks it. |
With a subsidy, the quote shows the amount Tempo covers to deliver 1:1, where the recipient receives the amount sent. When you add your key, the demo quotes again with your organization's pricing. If your organization isn't [approved for subsidies](https://tempo.com/developers/docs/routes/quotes#offer-11-delivery), the demo quotes the route without 1:1 delivery and says why. The recipient then receives the amount sent minus the route's fees and deductions.
Each create request carries an [idempotency key](https://tempo.com/developers/docs/routes/api-setup#set-idempotency-keys). Retrying a creation resends the same request and key, so it returns the original route instead of a duplicate. If a wallet may have sent a transaction, check its history before trying again.
## Build the same flow
The demo makes the same API calls as the Routes guides. Start with [Set up Routes](https://tempo.com/developers/docs/routes/api-setup) to create a key and configure your backend. Then follow [Accept deposits](https://tempo.com/developers/docs/routes/deposits) for a deposit address, or [Make a transfer](https://tempo.com/developers/docs/routes/transfers) for a transfer.
A route that delivers [USDY](https://tempo.com/developers/docs/partners/rwas), Ondo's tokenized U.S. Treasury token, converts the source token into USDY. It doesn't deposit into an [Earn](https://tempo.com/developers/docs/earn) vault, which uses a separate flow.
> Source: [/docs/routes/api-setup](https://tempo.com/developers/docs/routes/api-setup.md)
> Section: [Routes](https://tempo.com/developers/docs/routes.md). Move stablecoins between Tempo and other networks: try a route, set up API access, choose a supported route, quote it, accept deposits or make a transfer, and track delivery. Routes is in beta; see the introduction for access.
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
# Set up Routes
Bring stablecoins from other networks onto Tempo with a quote and one create call.
:::warning
Routes is in beta. [Contact Tempo](https://tempo.com/contact) to discuss access and the routes your application needs.
:::
[Try a route in your browser](https://tempo.com/developers/docs/routes/test): Quote, create, fund, and track a live route while the demo logs each Routes API call.
## Set up the Routes API
::::steps
### Create a Routes API key
Create a key in [Tempo Console](https://tempo.com/console?to=/\:org/api-keys) with the scopes your flow needs. Keep it on your backend; it authenticates your application and doesn't sign transactions.
| Scope | Allows |
| --- | --- |
| `routes:read` | Quotes, and transfer and deposit status reads |
| `routes:write` | Creating transfers and deposit addresses, and registering source transactions |
| `data:read` | Reading the [route directory](https://tempo.com/developers/docs/routes/networks) with your key, which applies your organization's access policy |
### Configure the client
Set `TEMPO_API_KEY` in your environment. TypeScript uses Node.js with built-in `fetch`. Python uses `requests`. cURL examples require `curl` and `jq`.
:::code-group
```ts [TypeScript (fetch)]
const api = 'https://api.tempo.xyz/v1'
const headers = {
'tempo-api-key': process.env.TEMPO_API_KEY!,
'Content-Type': 'application/json',
}
```
```python [Python (requests)]
import os
import requests
api = "https://api.tempo.xyz/v1"
headers = {
"tempo-api-key": os.environ["TEMPO_API_KEY"],
"Content-Type": "application/json",
}
```
```bash [cURL (API)]
# Set TEMPO_API_KEY in your terminal's environment before running requests.
curl --fail-with-body 'https://api.tempo.xyz/v1/routes' \
--header "tempo-api-key: $TEMPO_API_KEY"
```
:::
### Get a quote
Quote a transfer from your backend. Pick a pair from [supported routes](https://tempo.com/developers/docs/routes/networks). [Quotes and fees](https://tempo.com/developers/docs/routes/quotes) explains the amounts and fees in the response.
`GET /v1/routes/transfers/quote`
Quote transfer
[API reference](https://tempo.com/developers/docs/api/routes/transfers#quoteroutestransfer) — request parameters, authentication, and response schema. The examples below use editable sample values.
Requires a [Tempo API key](https://tempo.com/developers/docs/api/console/api-keys). Replace `YOUR_API_KEY` before running this request.
**cURL**
```bash
curl 'https://api.tempo.xyz/v1/routes/transfers/quote?amount=1000000&destinationChain=base&destinationToken=usdc&mode=exactSource&recipient=0x1111111111111111111111111111111111111111&sender=0x2222222222222222222222222222222222222222&sourceChain=tempo&sourceToken=usdce' \
--header 'tempo-api-key: YOUR_API_KEY'
```
**TypeScript**
```ts
fetch('https://api.tempo.xyz/v1/routes/transfers/quote?amount=1000000&destinationChain=base&destinationToken=usdc&mode=exactSource&recipient=0x1111111111111111111111111111111111111111&sender=0x2222222222222222222222222222222222222222&sourceChain=tempo&sourceToken=usdce', {
headers: {
'tempo-api-key': 'YOUR_API_KEY'
}
})
```
### Create a transfer or a deposit address
Create a [transfer](https://tempo.com/developers/docs/routes/transfers) when your user's wallet signs the source calls. Create a [deposit address](https://tempo.com/developers/docs/routes/deposits) when the sender pays from any wallet or exchange.
Create requests require an `idempotency-key` header. Assign one key per operation, such as one payment or one customer's deposit address, and store it with that record before sending the request:
:::code-group
```ts [TypeScript (fetch)]
const requestKey = crypto.randomUUID() // Persist with your payment record.
```
```python [Python (requests)]
import uuid
requestKey = str(uuid.uuid4()) # Persist with your payment record.
```
```bash [cURL (API)]
# Choose and retain one key per operation, including across retries.
ROUTE_REQUEST_KEY="my-payment-001"
```
:::
Reuse the key when you retry the same request with unchanged inputs. Matching requests replay the successful response for 24 hours. A request with changed inputs conflicts.
::::
## Related
[Make a transfer](https://tempo.com/developers/docs/routes/transfers): Use for sending from a wallet your application controls or connects.
[Accept deposits](https://tempo.com/developers/docs/routes/deposits): Use for letting senders pay from any wallet or exchange.
[Supported routes](https://tempo.com/developers/docs/routes/networks): Covers available networks, tokens, and funding methods.
> Source: [/docs/routes/networks](https://tempo.com/developers/docs/routes/networks.md)
> Section: [Routes](https://tempo.com/developers/docs/routes.md). Move stablecoins between Tempo and other networks: try a route, set up API access, choose a supported route, quote it, accept deposits or make a transfer, and track delivery. Routes is in beta; see the introduction for access.
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
# Supported routes
Read the route directory before offering a network or asset in your application. Each route lists its own tokens, direction, and funding methods.
## Available routes
Every route in the live directory, with its funding methods and whether fee coverage is available. Choose **Try** to open a route in the [Routes demo](https://tempo.com/developers/docs/routes/test). Your organization's access policy can narrow the routes your API key can use; the demo lists them for your key.
The interactive page lists every route in the live directory, read from GET https://api.tempo.xyz/v1/routes, with each route's source and destination asset, funding methods, and whether fee coverage (1:1 delivery) is available. To open a route in the Routes demo, use `/docs/routes/test?route=ROUTE_ID` with the route `id` from the directory.
The directory listed 139 routes when this page was built. Call `GET https://api.tempo.xyz/v1/routes` for the current list.
* alphaUSD on Tempo Testnet to pathUSD on Tempo Testnet: transfer; no fee coverage. Route ID `eip155:42431/alphausd-eip155:42431/pathusd`
* EURC.e on Tempo to OUSD on Tempo: transfer; no fee coverage. Route ID `eip155:4217/eurce-eip155:4217/ousd`
* OUSD on Base to OUSD on Tempo: deposit address; fee coverage available. Route ID `eip155:8453/ousd-eip155:4217/ousd`
* OUSD on Base to USDC.e on Tempo: deposit address; fee coverage available. Route ID `eip155:8453/ousd-eip155:4217/usdce`
* OUSD on Base to USDT0 on Tempo: deposit address; fee coverage available. Route ID `eip155:8453/ousd-eip155:4217/usdt0`
* OUSD on Ethereum to OUSD on Tempo: deposit address; fee coverage available. Route ID `eip155:1/ousd-eip155:4217/ousd`
* OUSD on Tempo Testnet to tARS on Tempo Testnet: transfer; no fee coverage. Route ID `eip155:42431/ousd-eip155:42431/tars`
* OUSD on Tempo to EURC.e on Tempo: transfer; no fee coverage. Route ID `eip155:4217/ousd-eip155:4217/eurce`
* OUSD on Tempo to pathUSD on Tempo: transfer; fee coverage available. Route ID `eip155:4217/ousd-eip155:4217/pathusd`
* OUSD on Tempo to USDC on Base: transfer, deposit address; fee coverage available. Route ID `eip155:4217/ousd-eip155:8453/usdc`
* OUSD on Tempo to USDC on BNB Smart Chain: transfer, deposit address; no fee coverage. Route ID `eip155:4217/ousd-eip155:56/usdc`
* OUSD on Tempo to USDC on Ethereum: transfer, deposit address; fee coverage available. Route ID `eip155:4217/ousd-eip155:1/usdc`
* OUSD on Tempo to USDC on HyperEVM: transfer, deposit address; no fee coverage. Route ID `eip155:4217/ousd-eip155:999/usdc`
* OUSD on Tempo to USDC on Monad: transfer; no fee coverage. Route ID `eip155:4217/ousd-eip155:143/usdc`
* OUSD on Tempo to USDC on Polygon: transfer, deposit address; no fee coverage. Route ID `eip155:4217/ousd-eip155:137/usdc`
* OUSD on Tempo to USDC on Solana: transfer, deposit address; fee coverage available. Route ID `eip155:4217/ousd-solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp/usdc`
* OUSD on Tempo to USDC on Stellar: transfer, deposit address; no fee coverage. Route ID `eip155:4217/ousd-stellar:pubnet/usdc`
* OUSD on Tempo to USDC.e on Tempo: transfer; fee coverage available. Route ID `eip155:4217/ousd-eip155:4217/usdce`
* OUSD on Tempo to USDT on BNB Smart Chain: transfer, deposit address; no fee coverage. Route ID `eip155:4217/ousd-eip155:56/usdt`
* OUSD on Tempo to USDT on Ethereum: transfer, deposit address; fee coverage available. Route ID `eip155:4217/ousd-eip155:1/usdt`
* OUSD on Tempo to USDT on Solana: transfer, deposit address; no fee coverage. Route ID `eip155:4217/ousd-solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp/usdt`
* OUSD on Tempo to USDT on Tron: transfer, deposit address; no fee coverage. Route ID `eip155:4217/ousd-tron:0x2b6653dc/usdt`
* pathUSD on Tempo Testnet to alphaUSD on Tempo Testnet: transfer; no fee coverage. Route ID `eip155:42431/pathusd-eip155:42431/alphausd`
* pathUSD on Tempo Testnet to tEUR on Tempo Testnet: transfer; no fee coverage. Route ID `eip155:42431/pathusd-eip155:42431/teur`
* pathUSD on Tempo to OUSD on Tempo: transfer; fee coverage available. Route ID `eip155:4217/pathusd-eip155:4217/ousd`
* pathUSD on Tempo to USDC.e on Tempo: transfer; fee coverage available. Route ID `eip155:4217/pathusd-eip155:4217/usdce`
* pathUSD on Tempo to USDT0 on Tempo: transfer; fee coverage available. Route ID `eip155:4217/pathusd-eip155:4217/usdt0`
* tARS on Tempo Testnet to OUSD on Tempo Testnet: transfer; no fee coverage. Route ID `eip155:42431/tars-eip155:42431/ousd`
* tEUR on Tempo Testnet to pathUSD on Tempo Testnet: transfer; no fee coverage. Route ID `eip155:42431/teur-eip155:42431/pathusd`
* USDC on Arbitrum to OUSD on Tempo: deposit address; fee coverage available. Route ID `eip155:42161/usdc-eip155:4217/ousd`
* USDC on Arbitrum to pathUSD on Tempo: deposit address; fee coverage available. Route ID `eip155:42161/usdc-eip155:4217/pathusd`
* USDC on Arbitrum to USDC.e on Tempo: deposit address; fee coverage available. Route ID `eip155:42161/usdc-eip155:4217/usdce`
* USDC on Arbitrum to USDT0 on Tempo: deposit address; fee coverage available. Route ID `eip155:42161/usdc-eip155:4217/usdt0`
* USDC on Arc to OUSD on Tempo: deposit address; fee coverage available. Route ID `eip155:5042/usdc-eip155:4217/ousd`
* USDC on Arc to pathUSD on Tempo: deposit address; fee coverage available. Route ID `eip155:5042/usdc-eip155:4217/pathusd`
* USDC on Arc to USDC.e on Tempo: deposit address; fee coverage available. Route ID `eip155:5042/usdc-eip155:4217/usdce`
* USDC on Arc to USDT0 on Tempo: deposit address; fee coverage available. Route ID `eip155:5042/usdc-eip155:4217/usdt0`
* USDC on Avalanche to OUSD on Tempo: deposit address; fee coverage available. Route ID `eip155:43114/usdc-eip155:4217/ousd`
* USDC on Avalanche to pathUSD on Tempo: deposit address; fee coverage available. Route ID `eip155:43114/usdc-eip155:4217/pathusd`
* USDC on Avalanche to USDC.e on Tempo: deposit address; fee coverage available. Route ID `eip155:43114/usdc-eip155:4217/usdce`
* USDC on Avalanche to USDT0 on Tempo: deposit address; fee coverage available. Route ID `eip155:43114/usdc-eip155:4217/usdt0`
* USDC on Base to OUSD on Tempo: transfer, deposit address; fee coverage available. Route ID `eip155:8453/usdc-eip155:4217/ousd`
* USDC on Base to pathUSD on Tempo: transfer, deposit address; fee coverage available. Route ID `eip155:8453/usdc-eip155:4217/pathusd`
* USDC on Base to USDC.e on Tempo: transfer, deposit address; fee coverage available. Route ID `eip155:8453/usdc-eip155:4217/usdce`
* USDC on Base to USDT0 on Tempo: transfer, deposit address; fee coverage available. Route ID `eip155:8453/usdc-eip155:4217/usdt0`
* USDC on BNB Smart Chain to OUSD on Tempo: transfer, deposit address; fee coverage available. Route ID `eip155:56/usdc-eip155:4217/ousd`
* USDC on BNB Smart Chain to pathUSD on Tempo: deposit address; fee coverage available. Route ID `eip155:56/usdc-eip155:4217/pathusd`
* USDC on BNB Smart Chain to USDC.e on Tempo: transfer, deposit address; fee coverage available. Route ID `eip155:56/usdc-eip155:4217/usdce`
* USDC on BNB Smart Chain to USDT0 on Tempo: transfer, deposit address; fee coverage available. Route ID `eip155:56/usdc-eip155:4217/usdt0`
* USDC on Ethereum to OUSD on Tempo: transfer, deposit address; fee coverage available. Route ID `eip155:1/usdc-eip155:4217/ousd`
* USDC on Ethereum to pathUSD on Tempo: deposit address; fee coverage available. Route ID `eip155:1/usdc-eip155:4217/pathusd`
* USDC on Ethereum to USDC.e on Tempo: transfer, deposit address; fee coverage available. Route ID `eip155:1/usdc-eip155:4217/usdce`
* USDC on Ethereum to USDT0 on Tempo: transfer, deposit address; fee coverage available. Route ID `eip155:1/usdc-eip155:4217/usdt0`
* USDC on HyperEVM to OUSD on Tempo: transfer, deposit address; fee coverage available. Route ID `eip155:999/usdc-eip155:4217/ousd`
* USDC on HyperEVM to pathUSD on Tempo: deposit address; fee coverage available. Route ID `eip155:999/usdc-eip155:4217/pathusd`
* USDC on HyperEVM to USDC.e on Tempo: transfer, deposit address; fee coverage available. Route ID `eip155:999/usdc-eip155:4217/usdce`
* USDC on HyperEVM to USDT0 on Tempo: transfer, deposit address; fee coverage available. Route ID `eip155:999/usdc-eip155:4217/usdt0`
* USDC on Monad to OUSD on Tempo: transfer, deposit address; fee coverage available. Route ID `eip155:143/usdc-eip155:4217/ousd`
* USDC on Monad to pathUSD on Tempo: deposit address; fee coverage available. Route ID `eip155:143/usdc-eip155:4217/pathusd`
* USDC on Monad to USDC.e on Tempo: deposit address; fee coverage available. Route ID `eip155:143/usdc-eip155:4217/usdce`
* USDC on Monad to USDT0 on Tempo: deposit address; fee coverage available. Route ID `eip155:143/usdc-eip155:4217/usdt0`
* USDC on Optimism to OUSD on Tempo: deposit address; fee coverage available. Route ID `eip155:10/usdc-eip155:4217/ousd`
* USDC on Optimism to pathUSD on Tempo: deposit address; fee coverage available. Route ID `eip155:10/usdc-eip155:4217/pathusd`
* USDC on Optimism to USDC.e on Tempo: deposit address; fee coverage available. Route ID `eip155:10/usdc-eip155:4217/usdce`
* USDC on Optimism to USDT0 on Tempo: deposit address; fee coverage available. Route ID `eip155:10/usdc-eip155:4217/usdt0`
* USDC on Polygon to OUSD on Tempo: transfer, deposit address; fee coverage available. Route ID `eip155:137/usdc-eip155:4217/ousd`
* USDC on Polygon to pathUSD on Tempo: deposit address; fee coverage available. Route ID `eip155:137/usdc-eip155:4217/pathusd`
* USDC on Polygon to USDC.e on Tempo: transfer, deposit address; fee coverage available. Route ID `eip155:137/usdc-eip155:4217/usdce`
* USDC on Polygon to USDT0 on Tempo: transfer, deposit address; fee coverage available. Route ID `eip155:137/usdc-eip155:4217/usdt0`
* USDC on Solana to OUSD on Tempo: transfer, deposit address; fee coverage available. Route ID `solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp/usdc-eip155:4217/ousd`
* USDC on Solana to pathUSD on Tempo: deposit address; fee coverage available. Route ID `solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp/usdc-eip155:4217/pathusd`
* USDC on Solana to USDC.e on Tempo: transfer, deposit address; fee coverage available. Route ID `solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp/usdc-eip155:4217/usdce`
* USDC on Solana to USDT0 on Tempo: transfer, deposit address; fee coverage available. Route ID `solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp/usdc-eip155:4217/usdt0`
* USDC on Stellar to OUSD on Tempo: transfer, deposit address; fee coverage available. Route ID `stellar:pubnet/usdc-eip155:4217/ousd`
* USDC on Stellar to USDC.e on Tempo: transfer, deposit address; fee coverage available. Route ID `stellar:pubnet/usdc-eip155:4217/usdce`
* USDC on Stellar to USDT0 on Tempo: transfer, deposit address; fee coverage available. Route ID `stellar:pubnet/usdc-eip155:4217/usdt0`
* USDC.e on Tempo to OUSD on Tempo: transfer; fee coverage available. Route ID `eip155:4217/usdce-eip155:4217/ousd`
* USDC.e on Tempo to pathUSD on Tempo: transfer; fee coverage available. Route ID `eip155:4217/usdce-eip155:4217/pathusd`
* USDC.e on Tempo to USDC on Base: transfer, deposit address; fee coverage available. Route ID `eip155:4217/usdce-eip155:8453/usdc`
* USDC.e on Tempo to USDC on BNB Smart Chain: transfer, deposit address; no fee coverage. Route ID `eip155:4217/usdce-eip155:56/usdc`
* USDC.e on Tempo to USDC on Ethereum: transfer, deposit address; fee coverage available. Route ID `eip155:4217/usdce-eip155:1/usdc`
* USDC.e on Tempo to USDC on HyperEVM: transfer, deposit address; no fee coverage. Route ID `eip155:4217/usdce-eip155:999/usdc`
* USDC.e on Tempo to USDC on Polygon: transfer, deposit address; no fee coverage. Route ID `eip155:4217/usdce-eip155:137/usdc`
* USDC.e on Tempo to USDC on Solana: transfer, deposit address; fee coverage available. Route ID `eip155:4217/usdce-solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp/usdc`
* USDC.e on Tempo to USDC on Stellar: transfer, deposit address; no fee coverage. Route ID `eip155:4217/usdce-stellar:pubnet/usdc`
* USDC.e on Tempo to USDT on BNB Smart Chain: transfer, deposit address; no fee coverage. Route ID `eip155:4217/usdce-eip155:56/usdt`
* USDC.e on Tempo to USDT on Ethereum: transfer, deposit address; fee coverage available. Route ID `eip155:4217/usdce-eip155:1/usdt`
* USDC.e on Tempo to USDT on Solana: transfer, deposit address; no fee coverage. Route ID `eip155:4217/usdce-solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp/usdt`
* USDC.e on Tempo to USDT on Tron: transfer, deposit address; no fee coverage. Route ID `eip155:4217/usdce-tron:0x2b6653dc/usdt`
* USDC.e on Tempo to USDY on Tempo: transfer; no fee coverage. Route ID `eip155:4217/usdce-eip155:4217/usdy`
* USDT on Arbitrum to OUSD on Tempo: deposit address; fee coverage available. Route ID `eip155:42161/usdt-eip155:4217/ousd`
* USDT on Arbitrum to pathUSD on Tempo: deposit address; fee coverage available. Route ID `eip155:42161/usdt-eip155:4217/pathusd`
* USDT on Arbitrum to USDC.e on Tempo: deposit address; fee coverage available. Route ID `eip155:42161/usdt-eip155:4217/usdce`
* USDT on Arbitrum to USDT0 on Tempo: deposit address; fee coverage available. Route ID `eip155:42161/usdt-eip155:4217/usdt0`
* USDT on Base to OUSD on Tempo: transfer, deposit address; fee coverage available. Route ID `eip155:8453/usdt-eip155:4217/ousd`
* USDT on Base to pathUSD on Tempo: deposit address; fee coverage available. Route ID `eip155:8453/usdt-eip155:4217/pathusd`
* USDT on Base to USDC.e on Tempo: deposit address; fee coverage available. Route ID `eip155:8453/usdt-eip155:4217/usdce`
* USDT on Base to USDT0 on Tempo: deposit address; fee coverage available. Route ID `eip155:8453/usdt-eip155:4217/usdt0`
* USDT on BNB Smart Chain to OUSD on Tempo: transfer, deposit address; fee coverage available. Route ID `eip155:56/usdt-eip155:4217/ousd`
* USDT on BNB Smart Chain to pathUSD on Tempo: deposit address; fee coverage available. Route ID `eip155:56/usdt-eip155:4217/pathusd`
* USDT on BNB Smart Chain to USDC.e on Tempo: transfer, deposit address; fee coverage available. Route ID `eip155:56/usdt-eip155:4217/usdce`
* USDT on BNB Smart Chain to USDT0 on Tempo: transfer, deposit address; fee coverage available. Route ID `eip155:56/usdt-eip155:4217/usdt0`
* USDT on Ethereum to OUSD on Tempo: transfer, deposit address; fee coverage available. Route ID `eip155:1/usdt-eip155:4217/ousd`
* USDT on Ethereum to pathUSD on Tempo: deposit address; fee coverage available. Route ID `eip155:1/usdt-eip155:4217/pathusd`
* USDT on Ethereum to USDC.e on Tempo: transfer, deposit address; fee coverage available. Route ID `eip155:1/usdt-eip155:4217/usdce`
* USDT on Ethereum to USDT0 on Tempo: transfer, deposit address; fee coverage available. Route ID `eip155:1/usdt-eip155:4217/usdt0`
* USDT on Monad to OUSD on Tempo: deposit address; fee coverage available. Route ID `eip155:143/usdt-eip155:4217/ousd`
* USDT on Monad to pathUSD on Tempo: deposit address; fee coverage available. Route ID `eip155:143/usdt-eip155:4217/pathusd`
* USDT on Monad to USDC.e on Tempo: deposit address; fee coverage available. Route ID `eip155:143/usdt-eip155:4217/usdce`
* USDT on Monad to USDT0 on Tempo: deposit address; fee coverage available. Route ID `eip155:143/usdt-eip155:4217/usdt0`
* USDT on Optimism to OUSD on Tempo: deposit address; fee coverage available. Route ID `eip155:10/usdt-eip155:4217/ousd`
* USDT on Optimism to pathUSD on Tempo: deposit address; fee coverage available. Route ID `eip155:10/usdt-eip155:4217/pathusd`
* USDT on Optimism to USDC.e on Tempo: deposit address; fee coverage available. Route ID `eip155:10/usdt-eip155:4217/usdce`
* USDT on Optimism to USDT0 on Tempo: deposit address; fee coverage available. Route ID `eip155:10/usdt-eip155:4217/usdt0`
* USDT on Polygon to OUSD on Tempo: transfer, deposit address; fee coverage available. Route ID `eip155:137/usdt-eip155:4217/ousd`
* USDT on Polygon to pathUSD on Tempo: deposit address; fee coverage available. Route ID `eip155:137/usdt-eip155:4217/pathusd`
* USDT on Polygon to USDC.e on Tempo: deposit address; fee coverage available. Route ID `eip155:137/usdt-eip155:4217/usdce`
* USDT on Polygon to USDT0 on Tempo: deposit address; fee coverage available. Route ID `eip155:137/usdt-eip155:4217/usdt0`
* USDT on Solana to OUSD on Tempo: transfer, deposit address; fee coverage available. Route ID `solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp/usdt-eip155:4217/ousd`
* USDT on Solana to pathUSD on Tempo: deposit address; fee coverage available. Route ID `solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp/usdt-eip155:4217/pathusd`
* USDT on Solana to USDC.e on Tempo: transfer, deposit address; fee coverage available. Route ID `solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp/usdt-eip155:4217/usdce`
* USDT on Solana to USDT0 on Tempo: transfer, deposit address; fee coverage available. Route ID `solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp/usdt-eip155:4217/usdt0`
* USDT on Tron to OUSD on Tempo: transfer, deposit address; fee coverage available. Route ID `tron:0x2b6653dc/usdt-eip155:4217/ousd`
* USDT on Tron to pathUSD on Tempo: deposit address; fee coverage available. Route ID `tron:0x2b6653dc/usdt-eip155:4217/pathusd`
* USDT on Tron to USDC.e on Tempo: transfer, deposit address; fee coverage available. Route ID `tron:0x2b6653dc/usdt-eip155:4217/usdce`
* USDT on Tron to USDT0 on Tempo: transfer, deposit address; fee coverage available. Route ID `tron:0x2b6653dc/usdt-eip155:4217/usdt0`
* USDT0 on Tempo to pathUSD on Tempo: transfer; fee coverage available. Route ID `eip155:4217/usdt0-eip155:4217/pathusd`
* USDT0 on Tempo to USDC on Base: transfer, deposit address; fee coverage available. Route ID `eip155:4217/usdt0-eip155:8453/usdc`
* USDT0 on Tempo to USDC on BNB Smart Chain: transfer, deposit address; no fee coverage. Route ID `eip155:4217/usdt0-eip155:56/usdc`
* USDT0 on Tempo to USDC on Ethereum: transfer, deposit address; fee coverage available. Route ID `eip155:4217/usdt0-eip155:1/usdc`
* USDT0 on Tempo to USDC on HyperEVM: transfer, deposit address; no fee coverage. Route ID `eip155:4217/usdt0-eip155:999/usdc`
* USDT0 on Tempo to USDC on Polygon: transfer, deposit address; no fee coverage. Route ID `eip155:4217/usdt0-eip155:137/usdc`
* USDT0 on Tempo to USDC on Solana: transfer, deposit address; fee coverage available. Route ID `eip155:4217/usdt0-solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp/usdc`
* USDT0 on Tempo to USDC on Stellar: transfer, deposit address; no fee coverage. Route ID `eip155:4217/usdt0-stellar:pubnet/usdc`
* USDT0 on Tempo to USDT on BNB Smart Chain: transfer, deposit address; no fee coverage. Route ID `eip155:4217/usdt0-eip155:56/usdt`
* USDT0 on Tempo to USDT on Ethereum: transfer, deposit address; fee coverage available. Route ID `eip155:4217/usdt0-eip155:1/usdt`
* USDT0 on Tempo to USDT on Solana: transfer, deposit address; no fee coverage. Route ID `eip155:4217/usdt0-solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp/usdt`
* USDT0 on Tempo to USDT on Tron: transfer, deposit address; fee coverage available. Route ID `eip155:4217/usdt0-tron:0x2b6653dc/usdt`
* USDY on Tempo to USDC.e on Tempo: transfer; no fee coverage. Route ID `eip155:4217/usdy-eip155:4217/usdce`
## Read the route directory
Send the request below to read the directory your application builds its choices from. Filter by source or destination network and token to narrow the results.
`GET /v1/routes`
List routes
[API reference](https://tempo.com/developers/docs/api/routes/routes#listroutes) — request parameters, authentication, and response schema. The examples below use editable sample values.
**cURL**
```bash
curl 'https://api.tempo.xyz/v1/routes?destinationChain=tempo&sourceChain=base'
```
**TypeScript**
```ts
fetch('https://api.tempo.xyz/v1/routes?destinationChain=tempo&sourceChain=base')
```
Requests without a key use the [public rate limit](https://tempo.com/developers/docs/api/rate-limits). To read the routes your organization can use, send a key with `data:read`; see [Set up Routes](https://tempo.com/developers/docs/routes/api-setup).
Use the returned source and destination chain/token pairs, funding methods, and amount modes to build the choices in your application. Pass `nextCursor` as `cursor` to read subsequent pages. Match tokens by network and contract address, not by symbol alone.
## Quote the selected route
Once the user chooses a pair and amount, [request a quote](https://tempo.com/developers/docs/routes/quotes). Availability depends on those inputs and the funding method. Refresh the quote when the user changes them.
Use [deposit addresses](https://tempo.com/developers/docs/routes/deposits) when the sender pays independently, or [transfers](https://tempo.com/developers/docs/routes/transfers) when your app can authorize source transactions.
For current request and response fields, see the [route directory reference](https://tempo.com/developers/docs/api/routes/routes). To integrate a bridge directly, see [bridge providers](https://tempo.com/developers/docs/partners/bridges).
> Source: [/docs/routes/quotes](https://tempo.com/developers/docs/routes/quotes.md)
> Section: [Routes](https://tempo.com/developers/docs/routes.md). Move stablecoins between Tempo and other networks: try a route, set up API access, choose a supported route, quote it, accept deposits or make a transfer, and track delivery. Routes is in beta; see the introduction for access.
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
# Quotes and fees
Quote the payment before requesting a signature or showing deposit instructions. The route directory lists possible paths; the quote gives terms for the selected amount and recipient.
## Request a quote
Each flow starts with a quote request that needs `routes:read`:
| Flow | Endpoint | Request builder |
| --- | --- | --- |
| Deposit address | `GET /v1/routes/deposit-addresses/quote` | [Quote the deposit](https://tempo.com/developers/docs/routes/deposits#quote-the-deposit) |
| Transfer | `GET /v1/routes/transfers/quote` | [Get a quote](https://tempo.com/developers/docs/routes/transfers#get-a-quote) |
## Choose which amount to fix
For a transfer, choose which side the `mode` parameter fixes:
| Your application specifies | Amount mode | `amount` uses |
| --- | --- | --- |
| How much to send | `exactSource` | Source token base units |
| How much the recipient should receive | `exactDestination` | Destination token base units |
Review the returned amounts and minimum destination amount before continuing.
For a deposit address, quote the source chain, source token, destination token, and amount. Check the [endpoint reference](https://tempo.com/developers/docs/api/routes/deposit-addresses) for the supported parameters.
## Show the payment terms
Show the source asset and amount, destination asset and amount, minimum destination amount where returned, and fees. Show the network next to each asset, since the same symbol exists on several networks.
`destinationAmount` already includes route deductions. The `fees` array lists only separately charged fees, so an empty array can still come with deductions.
A quote doesn't create or reserve a transfer. Check the terms returned when you create the transfer before asking the signer to sign.
## Offer 1:1 delivery
Where your organization is approved for subsidies, send `subsidize: true` on the quote and the create request. Tempo then guarantees normalized 1:1 delivery: the recipient receives the amount sent, and `destinationAmountRequired` shows that guaranteed amount. Transfers support this for `exactSource` only.
The route directory's `subsidies` field shows which funding methods accept a subsidy on each route. Without approval, the API rejects the request with a `routes_subsidy_*` error code. [Try a route](https://tempo.com/developers/docs/routes/test) with your key to see whether a subsidy applies.
## Refresh expired quotes
Read `quote.expiresAt` when it is returned. If the quote expires before submission, request a new one and show any changed terms to the user.
Continue with [Accept deposits](https://tempo.com/developers/docs/routes/deposits) or [Make a transfer](https://tempo.com/developers/docs/routes/transfers).
> Source: [/docs/routes/deposits](https://tempo.com/developers/docs/routes/deposits.md)
> Section: [Routes](https://tempo.com/developers/docs/routes.md). Move stablecoins between Tempo and other networks: try a route, set up API access, choose a supported route, quote it, accept deposits or make a transfer, and track delivery. Routes is in beta; see the introduction for access.
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
# Accept deposits
Give customers a reusable address to fund from an external wallet.
A deposit address is a [Tempo Routes](https://tempo.com/developers/docs/routes) address on another network, such as Ethereum or Tron. Routes moves stablecoins between Tempo and supported networks along a route, a source network and token paired with a destination token. Each deposit address accepts the networks and tokens of its route and delivers funds to your chosen Tempo recipient.
For payments already on Tempo, use [Receive payments](https://tempo.com/developers/docs/guide/payments/accept-a-payment). [Virtual addresses](https://tempo.com/developers/docs/guide/payments/virtual-addresses) attribute those Tempo payments to one shared balance; they don't accept funds from other networks.
## Prepare a deposit route
Before you start, have:
* A Tempo API key on your backend, created in [Set up Routes](https://tempo.com/developers/docs/routes/api-setup). `routes:read` covers quotes and deposit reads; `routes:write` covers creating deposit addresses. Keep the key on the backend; show customers only the returned funding instructions.
* A route with deposit-address support from [Supported routes](https://tempo.com/developers/docs/routes/networks).
* A Tempo recipient, and a refund address on the source network. Routes sends refunds to this address; a refunded deposit's status moves from `refunding` to `refunded`.
Each step in the deposit flow has a request builder that generates cURL and TypeScript. To see the flow first, [try a route](https://tempo.com/developers/docs/routes/test) and choose **Deposit address**. The [cURL example](https://tempo.com/developers/docs/routes/examples/deposits) runs every step from a terminal.
## Accept a deposit
:::steps
### Quote the deposit
`GET /v1/routes/deposit-addresses/quote`
Quote deposit
[API reference](https://tempo.com/developers/docs/api/routes/deposit-addresses#quoteroutesdepositaddress) — request parameters, authentication, and response schema. The examples below use editable sample values.
Requires a [Tempo API key](https://tempo.com/developers/docs/api/console/api-keys). Replace `YOUR_API_KEY` before running this request.
**cURL**
```bash
curl 'https://api.tempo.xyz/v1/routes/deposit-addresses/quote?amount=1000000&destinationChain=ethereum&destinationToken=usdt0&sourceChain=tron&sourceToken=usdt' \
--header 'tempo-api-key: YOUR_API_KEY'
```
**TypeScript**
```ts
fetch('https://api.tempo.xyz/v1/routes/deposit-addresses/quote?amount=1000000&destinationChain=ethereum&destinationToken=usdt0&sourceChain=tron&sourceToken=usdt', {
headers: {
'tempo-api-key': 'YOUR_API_KEY'
}
})
```
Set `recipient` to the Tempo recipient and `refundAddress` to the refund address you'll use when creating the address. Without them the quote prices the route alone, and some routes, including those from Ethereum, Polygon, BNB Smart Chain, and Tron, return the `quote_not_available` error.
Show the destination amount and fees as described in [Quotes and fees](https://tempo.com/developers/docs/routes/quotes). When the response includes `quote.expiresAt`, request a new quote once that time passes. A quote prices the supplied amount; it doesn't mean funds arrived.
### Create a deposit address
Send an [idempotency key](https://tempo.com/developers/docs/routes/api-setup#set-idempotency-keys) in the `idempotency-key` header. Create one key for this customer's address and store it with the customer record before the request, so a retry returns the same address instead of creating another.
`POST /v2/routes/deposit-addresses`
Create deposit address
[API reference](https://tempo.com/developers/docs/api/routes/deposit-addresses#createroutesdepositaddressv2) — request parameters, authentication, and response schema. The examples below use editable sample values.
Requires a [Tempo API key](https://tempo.com/developers/docs/api/console/api-keys). Replace `YOUR_API_KEY` before running this request.
**cURL**
```bash
curl https://api.tempo.xyz/v2/routes/deposit-addresses \
--request POST \
--header 'idempotency-key: routes_01k1c5j8q8p0be6j5v9m6d1e4r' \
--header 'tempo-api-key: YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data '{
"amount": "1000000",
"destinationToken": "usdt0",
"recipient": "0x1111111111111111111111111111111111111111",
"refundAddresses": {
"evm": "0x2222222222222222222222222222222222222222"
}
}'
```
**TypeScript**
```ts
fetch('https://api.tempo.xyz/v2/routes/deposit-addresses', {
method: 'POST',
headers: {
'idempotency-key': 'routes_01k1c5j8q8p0be6j5v9m6d1e4r',
'tempo-api-key': 'YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
amount: '1000000',
destinationToken: 'usdt0',
recipient: '0x1111111111111111111111111111111111111111',
refundAddresses: {
evm: '0x2222222222222222222222222222222222222222'
}
})
})
```
Send the refund address in `refundAddresses`, keyed by chain family, such as `evm`. The response lists one entry in `addresses` per chain family. Save the top-level `id` and each entry's `address` and `id` (`rda_…`) with your customer record. The response carries no quote terms, so show terms from a fresh quote with the funding instructions.
### Show funding instructions
Display each entry's `address` together with the networks and tokens in its `sources` list. Check that its `status` is `active`, not `action-required`, before inviting deposits. Don't present it as an address for other assets or networks.
### Track deposits
Set `depositAddress` to the returned source-chain `address`. To filter by the address's `rda_…` ID instead, use `depositAddressId`.
`GET /v1/routes/deposits`
List deposits
[API reference](https://tempo.com/developers/docs/api/routes/deposit-addresses#listroutesdeposits) — request parameters, authentication, and response schema. The examples below use editable sample values.
Requires a [Tempo API key](https://tempo.com/developers/docs/api/console/api-keys). Replace `YOUR_API_KEY` before running this request.
**cURL**
```bash
curl 'https://api.tempo.xyz/v1/routes/deposits?sourceChain=tron' \
--header 'tempo-api-key: YOUR_API_KEY'
```
**TypeScript**
```ts
fetch('https://api.tempo.xyz/v1/routes/deposits?sourceChain=tron', {
headers: {
'tempo-api-key': 'YOUR_API_KEY'
}
})
```
The response lists deposits in `data`, newest first. Pass `nextCursor` as `cursor` to read later pages. Read one deposit by its `id` from `data` with `GET /v1/routes/deposits/{id}`. A deposit moves through `detected`, `bridging`, and `settling` to `completed`, or to `action-required`, `refunding`, or `refunded`.
:::
## Send from Tempo to another network
Some routes take deposits on Tempo and deliver to another network, such as Tempo USDC.e to USDC on Ethereum. Use them when your custody setup can only send plain token transfers. Check [Supported routes](https://tempo.com/developers/docs/routes/networks) for which routes support deposit addresses.
Quote and create the address as above, with:
* `sourceChain` set to `tempo` and `sourceToken` to the Tempo token, such as `USDC.e`.
* `destinationChain` set to the destination network, such as `ethereum`, with `destinationToken` and a `recipient` on that network.
* `refundAddresses.evm` set to your Tempo account.
Send the token to the returned address with a plain transfer; no approval or contract call is needed. Each deposit is priced when it's swept, so the quote has no guaranteed minimum (`destinationAmountMin` is `0`). Quote with the same parameters before large transfers. Subsidies don't apply to these routes.
## Reconcile delivery and refunds
Save the customer, deposit-address ID, and individual deposit IDs together. The same address can receive multiple deposits, so reconcile each deposit's `destinationAmount` and `destinationTransactionHashes` separately. An active address can receive funds; only a completed deposit confirms delivery to Tempo.
Continue with [Track delivery](https://tempo.com/developers/docs/routes/delivery) before crediting a balance or treating a refund as complete. See the [Deposit addresses API reference](https://tempo.com/developers/docs/api/routes/deposit-addresses) for the full lifecycle.
> Source: [/docs/routes/transfers](https://tempo.com/developers/docs/routes/transfers.md)
> Section: [Routes](https://tempo.com/developers/docs/routes.md). Move stablecoins between Tempo and other networks: try a route, set up API access, choose a supported route, quote it, accept deposits or make a transfer, and track delivery. Routes is in beta; see the introduction for access.
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
# Make a transfer
Move stablecoins between networks when your application can sign the source transaction through a wallet or its own signer.
[Tempo Routes](https://tempo.com/developers/docs/routes) moves stablecoins between Tempo and supported networks. A route connects a source network and token to a destination network and token. For a transfer, Routes prepares the source-chain calls that send the funds; your application signs them and tracks delivery.
## Prepare a transfer route
Before you start, have:
* A Tempo API key on your backend, created in [Set up Routes](https://tempo.com/developers/docs/routes/api-setup). `routes:read` covers quotes and status reads; `routes:write` covers creating transfers and registering source transactions.
* A route with transfer support from [Supported routes](https://tempo.com/developers/docs/routes/networks). This guide sets the quote's `mode` to `exactSource`, which fixes the amount sent; `exactDestination` fixes the amount received instead ([Quotes and fees](https://tempo.com/developers/docs/routes/quotes#choose-which-amount-to-fix)). Check that the route lists `exactSource`.
* A signer for the sender account on the source network, such as a connected wallet or your own signing service. The API key doesn't sign transactions.
Each step in the transfer flow has a request builder that generates cURL and TypeScript. To see the flow first, [try a route](https://tempo.com/developers/docs/routes/test). The [cURL example](https://tempo.com/developers/docs/routes/examples/transfers) runs every step from a terminal.
## Transfer funds
:::steps
### Get a quote
`GET /v1/routes/transfers/quote`
Quote transfer
[API reference](https://tempo.com/developers/docs/api/routes/transfers#quoteroutestransfer) — request parameters, authentication, and response schema. The examples below use editable sample values.
Requires a [Tempo API key](https://tempo.com/developers/docs/api/console/api-keys). Replace `YOUR_API_KEY` before running this request.
**cURL**
```bash
curl 'https://api.tempo.xyz/v1/routes/transfers/quote?amount=1000000&destinationChain=base&destinationToken=usdc&mode=exactSource&recipient=0x1111111111111111111111111111111111111111&sender=0x2222222222222222222222222222222222222222&sourceChain=tempo&sourceToken=usdce' \
--header 'tempo-api-key: YOUR_API_KEY'
```
**TypeScript**
```ts
fetch('https://api.tempo.xyz/v1/routes/transfers/quote?amount=1000000&destinationChain=base&destinationToken=usdc&mode=exactSource&recipient=0x1111111111111111111111111111111111111111&sender=0x2222222222222222222222222222222222222222&sourceChain=tempo&sourceToken=usdce', {
headers: {
'tempo-api-key': 'YOUR_API_KEY'
}
})
```
Show the source amount, destination amount, minimum destination amount, and fees as described in [Quotes and fees](https://tempo.com/developers/docs/routes/quotes). The minimum destination amount is what a transfer created now guarantees the recipient. Request a new quote when the response's `quote.expiresAt` time passes.
### Create the transfer
Send an [idempotency key](https://tempo.com/developers/docs/routes/api-setup#set-idempotency-keys) in the `idempotency-key` header. Create one key for this payment and store it with the payment record before the request, so a retry returns the same transfer instead of creating another.
`POST /v1/routes/transfers`
Create transfer
[API reference](https://tempo.com/developers/docs/api/routes/transfers#createroutestransfer) — request parameters, authentication, and response schema. The examples below use editable sample values.
Requires a [Tempo API key](https://tempo.com/developers/docs/api/console/api-keys). Replace `YOUR_API_KEY` before running this request.
**cURL**
```bash
curl https://api.tempo.xyz/v1/routes/transfers \
--request POST \
--header 'idempotency-key: routes_01k1c5j8q8p0be6j5v9m6d1e4r' \
--header 'tempo-api-key: YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data '{
"amount": "1000000",
"destinationToken": "usdc",
"mode": "exactSource",
"recipient": "0x1111111111111111111111111111111111111111",
"sender": "0x2222222222222222222222222222222222222222",
"sourceToken": "usdce"
}'
```
**TypeScript**
```ts
fetch('https://api.tempo.xyz/v1/routes/transfers', {
method: 'POST',
headers: {
'idempotency-key': 'routes_01k1c5j8q8p0be6j5v9m6d1e4r',
'tempo-api-key': 'YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
amount: '1000000',
destinationToken: 'usdc',
mode: 'exactSource',
recipient: '0x1111111111111111111111111111111111111111',
sender: '0x2222222222222222222222222222222222222222',
sourceToken: 'usdce'
})
})
```
Save the returned transfer `id` (`rtr_…`) and keep its `action`, the unsigned source-chain calls the sender signs. Review the returned terms before requesting a signature. Only this create response includes `action`; later transfer reads don't return it.
### Sign and submit
Use the source account's signer to submit the calls in `action` in order. Calls can include token approvals, and each call can be its own transaction. `action.type` names the call format, such as `evm:calls`. Handle it using the [EVM or Tron action format](https://tempo.com/developers/docs/api/routes/transfers).
For an `evm:calls` action, pass each call's `to`, `data`, and `value` to your source-chain wallet client. Wait for successful execution before the next call, and retain all hashes as `transactionHashes`. If submission stops partway through, inspect the transactions already sent before resuming.
When the source network is Tempo, [Tempo Wallet](https://tempo.com/developers/docs/accounts/wallets#connect-tempo-wallet) instead submits every call as one atomic transaction, so the sender signs once. [Try a route](https://tempo.com/developers/docs/routes/test) to compare one-call-at-a-time and atomic submission.
### Register the source transactions
Send the transfer `id` from creation, and the hashes your signer produced in the request body's `transactionHashes` array (up to 10). For a single source transaction, send the `transactionHash` string field instead.
`POST /v1/routes/transfers/{id}/source-transactions`
Register source transaction
[API reference](https://tempo.com/developers/docs/api/routes/transfers#registerroutestransfersourcetransaction) — request parameters, authentication, and response schema. The examples below use editable sample values.
Requires a [Tempo API key](https://tempo.com/developers/docs/api/console/api-keys). Replace `YOUR_API_KEY` before running this request.
**cURL**
```bash
curl https://api.tempo.xyz/v1/routes/transfers/rtr_001785729600000_2ZPE2gvateYEQ0dQslgvkhjx/source-transactions \
--request POST \
--header 'tempo-api-key: YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data '{
"transactionHash": "0x5151515151515151515151515151515151515151515151515151515151515151"
}'
```
**TypeScript**
```ts
fetch('https://api.tempo.xyz/v1/routes/transfers/rtr_001785729600000_2ZPE2gvateYEQ0dQslgvkhjx/source-transactions', {
method: 'POST',
headers: {
'tempo-api-key': 'YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
transactionHash: '0x5151515151515151515151515151515151515151515151515151515151515151'
})
})
```
The API verifies the transactions onchain and links them to the transfer. Until you register them, the transfer stays in `awaiting-source`.
### Confirm the transfer
`GET /v1/routes/transfers/{id}`
Get transfer
[API reference](https://tempo.com/developers/docs/api/routes/transfers#getroutestransfer) — request parameters, authentication, and response schema. The examples below use editable sample values.
Requires a [Tempo API key](https://tempo.com/developers/docs/api/console/api-keys). Replace `YOUR_API_KEY` before running this request.
**cURL**
```bash
curl https://api.tempo.xyz/v1/routes/transfers/rtr_001785729600000_2ZPE2gvateYEQ0dQslgvkhjx \
--header 'tempo-api-key: YOUR_API_KEY'
```
**TypeScript**
```ts
fetch('https://api.tempo.xyz/v1/routes/transfers/rtr_001785729600000_2ZPE2gvateYEQ0dQslgvkhjx', {
headers: {
'tempo-api-key': 'YOUR_API_KEY'
}
})
```
Keep the payment pending until `status` is `completed`. Other statuses are `awaiting-source`, `processing`, `action-required`, `expired`, `refunding`, and `refunded`. Once completed, reconcile `destinationAmount` and the destination transactions in `destinationTransactionHashes`.
:::
Continue with [Track delivery](https://tempo.com/developers/docs/routes/delivery) for every status, failures, and refunds.
> Source: [/docs/routes/delivery](https://tempo.com/developers/docs/routes/delivery.md)
> Section: [Routes](https://tempo.com/developers/docs/routes.md). Move stablecoins between Tempo and other networks: try a route, set up API access, choose a supported route, quote it, accept deposits or make a transfer, and track delivery. Routes is in beta; see the introduction for access.
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
# Track delivery
A successful source-chain transaction starts a route. The route completes when the destination receives funds or the refund lands. Keep the Routes object ID with your payment record and follow its status.
## Read the status
Read status with a key that has `routes:read`:
| Flow | Read | Request builder |
| --- | --- | --- |
| Deposit address | `GET /v1/routes/deposits?depositAddress=…`, then `GET /v1/routes/deposits/{id}` for each deposit | [Track deposits](https://tempo.com/developers/docs/routes/deposits#track-deposits) |
| Transfer | `GET /v1/routes/transfers/{id}`, after you register the source transaction hashes | [Confirm the transfer](https://tempo.com/developers/docs/routes/transfers#confirm-the-transfer) |
An `active` deposit address can receive deposits. Each deposit has its own status.
## Delivery states
| State | Applies to | Application behavior |
| --- | --- | --- |
| `awaiting-source` | Transfers | Source funding has not been registered. |
| `detected`, `bridging`, `settling` | Deposits | Funds are moving through delivery. Keep the deposit pending. |
| `processing` | Transfers | Keep the payment pending. |
| `completed` | Both | Reconcile the delivered amount and destination transaction references. |
| `action-required` | Both | Inspect `statusReason` and the endpoint's instructions. |
| `expired` | Transfers | Inspect source funding before starting a replacement. |
| `refunding` | Both | Keep the refund pending. |
| `refunded` | Both | Reconcile the refund amount and transaction references. |
Use the full [transfer](https://tempo.com/developers/docs/api/routes/transfers) or [deposit](https://tempo.com/developers/docs/api/routes/deposit-addresses) reference for the lifecycle and response fields. Do not automatically send the payment again when it is pending or being refunded.
## Track refunds
Keep `refunding` separate from `refunded`. Reconcile the returned refund amount and transaction references before updating the customer's balance.
## Retry without duplicates
If a create request gets no response, the object may still exist. Retry with the same [idempotency key](https://tempo.com/developers/docs/routes/api-setup#set-idempotency-keys) and unchanged inputs to receive the original result before creating a replacement.
## Use funds after delivery
After the destination account receives stablecoins, it can [send a payment](https://tempo.com/developers/docs/guide/payments/send-a-payment), [deposit into Earn](https://tempo.com/developers/docs/earn/integrate), or [deposit into a Zone](https://tempo.com/developers/docs/zones/deposit). Each is a separate operation. Direct Routes transfers into a vault or Zone are not implemented; their endpoints return HTTP `501`.
> Source: [/docs/routes/fx](https://tempo.com/developers/docs/routes/fx.md)
> Section: [Routes](https://tempo.com/developers/docs/routes.md). Move stablecoins between Tempo and other networks: try a route, set up API access, choose a supported route, quote it, accept deposits or make a transfer, and track delivery. Routes is in beta; see the introduction for access.
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
# Swap currencies
Swap a stablecoin in one currency for a stablecoin in another on Tempo, such as OUSD for EURC.e.
An FX route is a [Routes](https://tempo.com/developers/docs/routes) route with both ends on Tempo and a different currency on each end. You quote it, create a transfer, and sign the returned calls, as in [Make a transfer](https://tempo.com/developers/docs/routes/transfers). The source transaction is the swap, so the sender receives the destination stablecoin when it confirms.
:::warning
FX routes fill swaps only from listed accounts. [Contact Tempo](https://tempo.com/contact) to enable a route and set up your organization's account list.
:::
## How FX routes differ
* **Listed senders.** Only accounts on your organization's [account list](https://tempo.com/developers/docs/routes/fx#account-lists-on-fx-routes) can swap. A quote for an unlisted `sender` returns `404`.
* **Same sender and recipient.** The swap pays the account that sends it. Set `recipient` to the `sender` address.
* **Short quotes.** A quote expires within seconds. The swap call carries that expiry and reverts after it.
* **Price in the amounts.** The quoted source and destination amounts include the price. The route adds no separate fee.
## Account lists on FX routes
An account list names the accounts that can swap on one pair of a pool. The pool is the contract that fills an FX route's swaps. A pair is the two stablecoins it swaps.
* **Default list.** Every pool has a default list with sponsor ID `0`. The pool's owner manages it.
* **Organization lists.** A pool can have further lists. Each has its own sponsor ID and its own admin account.
A swap runs under exactly one list, and the sender must be on that list. Your organization uses either the pool's default list or its own list. Tempo saves that choice for each pool and pair when it enables your access. You can't change it through the API.
Routes quotes and creates swaps for your organization's API keys under the saved list. Quote and transfer requests take no list parameter. An organization with no saved list uses the pool's default list.
Once your organization has its own list on a pair, the default list no longer applies to your keys there. An account that's only on the default list gets no quote through your keys on that pair.
## Prepare an FX swap
Before you start, have:
* A Tempo API key with `routes:read`, `routes:write`, and `data:read` from [Set up Routes](https://tempo.com/developers/docs/routes/api-setup).
* An FX route from [Supported routes](https://tempo.com/developers/docs/routes/networks), such as OUSD to EURC.e on Tempo, and its two token addresses.
* The route's pool address. Tempo provides it when it enables your access.
* A signer for a listed account that holds the source stablecoin and a fee token.
Every step also runs from a terminal with curl and jq, as the [FX swap example](https://tempo.com/developers/docs/routes/examples/fx) shows.
## Swap one stablecoin for another
:::steps
### Check the account
Send your pool address and listed account in place of the example's `0xbe05…039e` and `0x2222…2222`. Name the pair by its two token addresses, in either order.
`GET /v1/prop-amms/{address}/accounts/{account}/access`
Read account access by tokens
[API reference](https://tempo.com/developers/docs/api/propamms#getpropammtokensaccountaccess) — request parameters, authentication, and response schema. The examples below use editable sample values.
Requires a [Tempo API key](https://tempo.com/developers/docs/api/console/api-keys). Replace `YOUR_API_KEY` before running this request.
**cURL**
```bash
curl 'https://api.tempo.xyz/v1/prop-amms/0xbe058e1c4df8a4366a387bf595b284246a93039e/accounts/0x2222222222222222222222222222222222222222/access?tokens=0x20c0000000000000000000006a37da5c996874be,0x20c0000000000000000000001621e21f71cf12fb' \
--header 'tempo-api-key: YOUR_API_KEY'
```
**TypeScript**
```ts
fetch('https://api.tempo.xyz/v1/prop-amms/0xbe058e1c4df8a4366a387bf595b284246a93039e/accounts/0x2222222222222222222222222222222222222222/access?tokens=0x20c0000000000000000000006a37da5c996874be,0x20c0000000000000000000001621e21f71cf12fb', {
headers: {
'tempo-api-key': 'YOUR_API_KEY'
}
})
```
The API checks the account against your organization's saved list. A listed account returns `"member": true`, `"allowed": true`, and `"reason": "allowed"`. Routes runs the same check when it quotes. Otherwise `reason` and `explanation` name what's missing, such as `notListed`.
Without a saved list, the request returns `400` with code `propamm_invalid`. If your organization uses the pool's default list, add `sponsorId=0`.
### Get a quote
Send your listed account as both `sender` and `recipient`, in place of the example's `0x2222…2222`. Amounts are in base units. Routes quotes under your organization's list, so the request names no pool or list.
`GET /v1/routes/transfers/quote`
Quote transfer
[API reference](https://tempo.com/developers/docs/api/routes/transfers#quoteroutestransfer) — request parameters, authentication, and response schema. The examples below use editable sample values.
Requires a [Tempo API key](https://tempo.com/developers/docs/api/console/api-keys). Replace `YOUR_API_KEY` before running this request.
**cURL**
```bash
curl 'https://api.tempo.xyz/v1/routes/transfers/quote?amount=1000000&destinationChain=tempo&destinationToken=0x20c0000000000000000000001621e21f71cf12fb&mode=exactSource&recipient=0x2222222222222222222222222222222222222222&sender=0x2222222222222222222222222222222222222222&sourceChain=tempo&sourceToken=0x20c0000000000000000000006a37da5c996874be' \
--header 'tempo-api-key: YOUR_API_KEY'
```
**TypeScript**
```ts
fetch('https://api.tempo.xyz/v1/routes/transfers/quote?amount=1000000&destinationChain=tempo&destinationToken=0x20c0000000000000000000001621e21f71cf12fb&mode=exactSource&recipient=0x2222222222222222222222222222222222222222&sender=0x2222222222222222222222222222222222222222&sourceChain=tempo&sourceToken=0x20c0000000000000000000006a37da5c996874be', {
headers: {
'tempo-api-key': 'YOUR_API_KEY'
}
})
```
Show the source amount, the destination amount, and `destinationAmountMin`. Create the transfer before `quote.expiresAt`.
### Create the transfer
Send the same inputs with an [idempotency key](https://tempo.com/developers/docs/routes/api-setup#set-idempotency-keys).
`POST /v1/routes/transfers`
Create transfer
[API reference](https://tempo.com/developers/docs/api/routes/transfers#createroutestransfer) — request parameters, authentication, and response schema. The examples below use editable sample values.
Requires a [Tempo API key](https://tempo.com/developers/docs/api/console/api-keys). Replace `YOUR_API_KEY` before running this request.
**cURL**
```bash
curl https://api.tempo.xyz/v1/routes/transfers \
--request POST \
--header 'idempotency-key: routes_01k1c5j8q8p0be6j5v9m6d1e4r' \
--header 'tempo-api-key: YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data '{
"sourceChain": "tempo",
"sourceToken": "0x20c0000000000000000000006a37da5c996874be",
"destinationChain": "tempo",
"destinationToken": "0x20c0000000000000000000001621e21f71cf12fb",
"sender": "0x2222222222222222222222222222222222222222",
"recipient": "0x2222222222222222222222222222222222222222",
"amount": "1000000",
"mode": "exactSource"
}'
```
**TypeScript**
```ts
fetch('https://api.tempo.xyz/v1/routes/transfers', {
method: 'POST',
headers: {
'idempotency-key': 'routes_01k1c5j8q8p0be6j5v9m6d1e4r',
'tempo-api-key': 'YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
sourceChain: 'tempo',
sourceToken: '0x20c0000000000000000000006a37da5c996874be',
destinationChain: 'tempo',
destinationToken: '0x20c0000000000000000000001621e21f71cf12fb',
sender: '0x2222222222222222222222222222222222222222',
recipient: '0x2222222222222222222222222222222222222222',
amount: '1000000',
mode: 'exactSource'
})
})
```
This request swaps 1 OUSD for EURC.e from one account to itself.
Save the transfer `id` and its `action`. For an exact-source swap, `action.calls` holds two calls. The first approves the source stablecoin. The second swaps it.
### Sign and submit
Submit both calls from the sender account before the transfer's `quote.expiresAt`. Send them as one [Tempo Transaction](https://tempo.com/developers/docs/guide/tempo-transaction) so the approval and the swap land together. [Tempo Wallet](https://tempo.com/developers/docs/accounts/wallets#connect-tempo-wallet) does this for you.
If the swap call reverts after the expiry, create a new transfer from a new quote.
### Register the source transaction
`POST /v1/routes/transfers/{id}/source-transactions`
Register source transaction
[API reference](https://tempo.com/developers/docs/api/routes/transfers#registerroutestransfersourcetransaction) — request parameters, authentication, and response schema. The examples below use editable sample values.
Requires a [Tempo API key](https://tempo.com/developers/docs/api/console/api-keys). Replace `YOUR_API_KEY` before running this request.
**cURL**
```bash
curl https://api.tempo.xyz/v1/routes/transfers/rtr_001785729600000_2ZPE2gvateYEQ0dQslgvkhjx/source-transactions \
--request POST \
--header 'tempo-api-key: YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data '{
"transactionHash": "0x5151515151515151515151515151515151515151515151515151515151515151"
}'
```
**TypeScript**
```ts
fetch('https://api.tempo.xyz/v1/routes/transfers/rtr_001785729600000_2ZPE2gvateYEQ0dQslgvkhjx/source-transactions', {
method: 'POST',
headers: {
'tempo-api-key': 'YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
transactionHash: '0x5151515151515151515151515151515151515151515151515151515151515151'
})
})
```
The API checks the swap onchain and links it to the transfer.
### Confirm the swap
`GET /v1/routes/transfers/{id}`
Get transfer
[API reference](https://tempo.com/developers/docs/api/routes/transfers#getroutestransfer) — request parameters, authentication, and response schema. The examples below use editable sample values.
Requires a [Tempo API key](https://tempo.com/developers/docs/api/console/api-keys). Replace `YOUR_API_KEY` before running this request.
**cURL**
```bash
curl https://api.tempo.xyz/v1/routes/transfers/rtr_001785729600000_2ZPE2gvateYEQ0dQslgvkhjx \
--header 'tempo-api-key: YOUR_API_KEY'
```
**TypeScript**
```ts
fetch('https://api.tempo.xyz/v1/routes/transfers/rtr_001785729600000_2ZPE2gvateYEQ0dQslgvkhjx', {
headers: {
'tempo-api-key': 'YOUR_API_KEY'
}
})
```
Keep the payment pending until `status` is `completed`. Reconcile `destinationAmount` against the account's balance change.
:::
## Manage the account list
A list has one admin account. The admin adds or removes up to 50 accounts in one request. The key needs `propamm:write`, which an organization owner issues.
:::steps
### Prepare the change
Send the list's admin account as `sender`, in place of the example's `0x1111…1111`. Name the pair by its two token addresses, in either order.
`POST /v1/prop-amms/{address}/access/prepare`
Prepare access change
[API reference](https://tempo.com/developers/docs/api/propamms#preparepropammaccess) — request parameters, authentication, and response schema. The examples below use editable sample values.
Requires a [Tempo API key](https://tempo.com/developers/docs/api/console/api-keys). Replace `YOUR_API_KEY` before running this request.
**cURL**
```bash
curl https://api.tempo.xyz/v1/prop-amms/0xbe058e1c4df8a4366a387bf595b284246a93039e/access/prepare \
--request POST \
--header 'tempo-api-key: YOUR_API_KEY' \
--header 'Content-Type: application/json' \
--data '{
"sender": "0x1111111111111111111111111111111111111111",
"action": {
"type": "setMembers",
"tokens": [
"0x20c0000000000000000000006a37da5c996874be",
"0x20c0000000000000000000001621e21f71cf12fb"
],
"accounts": [
"0x2222222222222222222222222222222222222222"
],
"allowed": true
}
}'
```
**TypeScript**
```ts
fetch('https://api.tempo.xyz/v1/prop-amms/0xbe058e1c4df8a4366a387bf595b284246a93039e/access/prepare', {
method: 'POST',
headers: {
'tempo-api-key': 'YOUR_API_KEY',
'Content-Type': 'application/json'
},
body: JSON.stringify({
sender: '0x1111111111111111111111111111111111111111',
action: {
type: 'setMembers',
tokens: ['0x20c0000000000000000000006a37da5c996874be', '0x20c0000000000000000000001621e21f71cf12fb'],
accounts: ['0x2222222222222222222222222222222222222222'],
allowed: true
}
})
})
```
The API applies the change to your organization's saved list. It simulates the change and returns an unsigned `transaction`. `effect` names the resolved pair index and sponsor ID, such as `List 1 account(s) on pair 0 under sponsor 5.`
To remove accounts, send the same request with `"allowed": false`.
### Sign and send the transaction
The admin account sends a transaction to `transaction.to` with `transaction.data`. The API doesn't sign or send it.
### Confirm the listing
Repeat the [account check](https://tempo.com/developers/docs/routes/fx#check-the-account) after the transaction confirms. A listed account returns `"allowed": true`.
:::
## Name a pair or list
Requests that omit `sponsorId` use your organization's saved list. Requests with `tokens` resolve the pair from its two token addresses. Name either explicitly when the API can't resolve it, such as a pool with two pairs for the same tokens.
* **Sponsor ID.** Pass `sponsorId` as a decimal string to name a list, such as `"0"` for the pool's default list. The account check takes it as a query parameter. The access change takes it in `action`.
* **Pair index.** Pass `pairIndex` in place of `tokens` in the access change. Send exactly one of the two. The account check takes the pair index in its path.
`GET /v1/prop-amms/{address}/pairs/{pairIndex}/accounts/{account}/access`
Read account access
[API reference](https://tempo.com/developers/docs/api/propamms#getpropammaccountaccess) — request parameters, authentication, and response schema. The examples below use editable sample values.
Requires a [Tempo API key](https://tempo.com/developers/docs/api/console/api-keys). Replace `YOUR_API_KEY` before running this request.
**cURL**
```bash
curl 'https://api.tempo.xyz/v1/prop-amms/0xbe058e1c4df8a4366a387bf595b284246a93039e/pairs/0/accounts/0x2222222222222222222222222222222222222222/access?sponsorId=0' \
--header 'tempo-api-key: YOUR_API_KEY'
```
**TypeScript**
```ts
fetch('https://api.tempo.xyz/v1/prop-amms/0xbe058e1c4df8a4366a387bf595b284246a93039e/pairs/0/accounts/0x2222222222222222222222222222222222222222/access?sponsorId=0', {
headers: {
'tempo-api-key': 'YOUR_API_KEY'
}
})
```
## Account list errors
An access change the API can't resolve or simulate returns one of these errors. The account check returns the same `400` when your organization has no saved list.
| Status | Code | Cause | Fix |
| --- | --- | --- | --- |
| `400` | `propamm_invalid` | The request omits `sponsorId`, and your organization has no saved list on that pool and pair. | Pass `sponsorId`, or ask Tempo to set the list. |
| `404` | `propamm_not_found` | The pool has no active pair for the two tokens. | Check both token addresses against the route. |
| `409` | `propamm_conflict` | More than one pair swaps the two tokens. | Pass `pairIndex` in place of `tokens`. |
| `409` | `propamm_rejected` | `sender` isn't the list's admin account. | Send the list's admin account as `sender`. |
## FX quote errors
A refused quote returns `404` with code `quote_not_available`. Its `details` name the field to change.
| `details` path | Cause | Fix |
| --- | --- | --- |
| `sender` | The account isn't on your organization's list. | Check the account, then ask the list admin to add it. |
| `recipient` | The recipient differs from the sender. | Set `recipient` to the `sender` address. |
| `amount` | The pool can't fill that size now. | Lower the amount or retry later. |
An FX transfer reports the same [transfer statuses](https://tempo.com/developers/docs/routes/delivery) as other Routes transfers, such as `action-required` when it needs attention.
> Source: [/docs/routes/examples/deposits](https://tempo.com/developers/docs/routes/examples/deposits.md)
> Section: [Routes](https://tempo.com/developers/docs/routes.md). Move stablecoins between Tempo and other networks: try a route, set up API access, choose a supported route, quote it, accept deposits or make a transfer, and track delivery. Routes is in beta; see the introduction for access.
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
# Deposit address example
Run every step of [Accept deposits](https://tempo.com/developers/docs/routes/deposits) from a terminal. That guide explains each step; this page keeps the commands together with shell variables for every input.
## Set the example variables
Set `TEMPO_API_KEY` to a key with `routes:read` and `routes:write` from [Set up Routes](https://tempo.com/developers/docs/routes/api-setup). Choose a route with deposit-address support from [Supported routes](https://tempo.com/developers/docs/routes/networks), then set:
| Variable | Value |
| --- | --- |
| `SOURCE_CHAIN`, `SOURCE_TOKEN` | Accepted source network and token. |
| `DESTINATION_TOKEN` | Token the recipient receives on Tempo. |
| `ROUTE_RECIPIENT` | Recipient account on Tempo. |
| `ROUTE_REFUND_ADDRESS` | Account on the source network that receives refunds. |
| `ROUTE_AMOUNT` | Source amount in base units to use for the quote. |
## Accept a deposit
:::steps
### Quote the deposit
```bash
curl --get 'https://api.tempo.xyz/v1/routes/deposit-addresses/quote' \
--header "tempo-api-key: ${TEMPO_API_KEY}" \
--data-urlencode "sourceChain=${SOURCE_CHAIN}" \
--data-urlencode "sourceToken=${SOURCE_TOKEN}" \
--data-urlencode "destinationToken=${DESTINATION_TOKEN}" \
--data-urlencode "recipient=${ROUTE_RECIPIENT}" \
--data-urlencode "refundAddress=${ROUTE_REFUND_ADDRESS}" \
--data-urlencode "amount=${ROUTE_AMOUNT}"
```
Review the terms as described in [Quotes and fees](https://tempo.com/developers/docs/routes/quotes).
### Create a deposit address
Set `ROUTE_REQUEST_KEY` to the [idempotency key](https://tempo.com/developers/docs/routes/api-setup#set-idempotency-keys) for this address.
```bash
jq -n \
--arg sourceChain "$SOURCE_CHAIN" \
--arg sourceToken "$SOURCE_TOKEN" \
--arg destinationToken "$DESTINATION_TOKEN" \
--arg recipient "$ROUTE_RECIPIENT" \
--arg refundAddress "$ROUTE_REFUND_ADDRESS" \
--arg amount "$ROUTE_AMOUNT" \
'$ARGS.named' > deposit-address-request.json
curl --fail-with-body 'https://api.tempo.xyz/v1/routes/deposit-addresses' \
--header "tempo-api-key: ${TEMPO_API_KEY}" \
--header "idempotency-key: ${ROUTE_REQUEST_KEY}" \
--header 'Content-Type: application/json' \
--data @deposit-address-request.json
```
Save the returned address and `id` with your customer record.
### Show funding instructions
Confirm the address status is `active`, then show the source network, token, and address together.
### Track deposits
Set `ROUTE_DEPOSIT_ADDRESS` to the returned source-chain address, not the `rda_…` object ID:
```bash
curl --get 'https://api.tempo.xyz/v1/routes/deposits' \
--header "tempo-api-key: ${TEMPO_API_KEY}" \
--data-urlencode "depositAddress=${ROUTE_DEPOSIT_ADDRESS}"
```
Read `GET /v1/routes/deposits/{id}` for each deposit, and reconcile each one separately.
:::
Follow [Track delivery](https://tempo.com/developers/docs/routes/delivery) before crediting a balance or treating a refund as complete. See the [Deposit addresses API reference](https://tempo.com/developers/docs/api/routes/deposit-addresses) for request fields and pagination.
> Source: [/docs/routes/examples/transfers](https://tempo.com/developers/docs/routes/examples/transfers.md)
> Section: [Routes](https://tempo.com/developers/docs/routes.md). Move stablecoins between Tempo and other networks: try a route, set up API access, choose a supported route, quote it, accept deposits or make a transfer, and track delivery. Routes is in beta; see the introduction for access.
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
# Transfer example
Run every step of [Make a transfer](https://tempo.com/developers/docs/routes/transfers) from a terminal. That guide explains each step; this page keeps the commands together with shell variables for every input. You sign the source calls with your own wallet or signer.
## Set the example variables
Set `TEMPO_API_KEY` to a key with `routes:read` and `routes:write` from [Set up Routes](https://tempo.com/developers/docs/routes/api-setup). Choose a pair from [Supported routes](https://tempo.com/developers/docs/routes/networks), then set:
| Variable | Value |
| --- | --- |
| `SOURCE_CHAIN`, `DESTINATION_CHAIN` | Chain IDs or slugs from the directory. |
| `SOURCE_TOKEN`, `DESTINATION_TOKEN` | Token addresses or keys on those networks. |
| `ROUTE_SENDER`, `ROUTE_RECIPIENT` | The source signing account and destination account. |
| `ROUTE_AMOUNT` | Source token amount in base units. |
This example uses `exactSource`; check that the route supports it. See [Quotes and fees](https://tempo.com/developers/docs/routes/quotes) for `exactDestination`.
## Transfer funds
:::steps
### Get a quote
```bash
curl --get 'https://api.tempo.xyz/v1/routes/transfers/quote' \
--header "tempo-api-key: ${TEMPO_API_KEY}" \
--data-urlencode "sourceChain=${SOURCE_CHAIN}" \
--data-urlencode "sourceToken=${SOURCE_TOKEN}" \
--data-urlencode "destinationChain=${DESTINATION_CHAIN}" \
--data-urlencode "destinationToken=${DESTINATION_TOKEN}" \
--data-urlencode "sender=${ROUTE_SENDER}" \
--data-urlencode "recipient=${ROUTE_RECIPIENT}" \
--data-urlencode "amount=${ROUTE_AMOUNT}" \
--data-urlencode 'mode=exactSource'
```
Review the terms as described in [Quotes and fees](https://tempo.com/developers/docs/routes/quotes).
### Create the transfer
Write the same inputs to a request file. Set `ROUTE_REQUEST_KEY` to the [idempotency key](https://tempo.com/developers/docs/routes/api-setup#set-idempotency-keys) for this payment.
```bash
jq -n \
--arg sourceChain "$SOURCE_CHAIN" \
--arg sourceToken "$SOURCE_TOKEN" \
--arg destinationChain "$DESTINATION_CHAIN" \
--arg destinationToken "$DESTINATION_TOKEN" \
--arg sender "$ROUTE_SENDER" \
--arg recipient "$ROUTE_RECIPIENT" \
--arg amount "$ROUTE_AMOUNT" \
'$ARGS.named + {mode: "exactSource"}' > route-request.json
curl --fail-with-body 'https://api.tempo.xyz/v1/routes/transfers' \
--header "tempo-api-key: ${TEMPO_API_KEY}" \
--header "idempotency-key: ${ROUTE_REQUEST_KEY}" \
--header 'Content-Type: application/json' \
--data @route-request.json \
--output route-transfer.json
```
Save the returned `id` and unsigned `action`; transfer reads do not return the action.
### Sign and submit
Submit the calls in `route-transfer.json` in order with the sender's signer, waiting for each to succeed, and keep every transaction hash. [Make a transfer](https://tempo.com/developers/docs/routes/transfers#sign-and-submit-the-source-calls) covers the `evm:calls` and Tron action formats and partial submissions.
### Register the source transactions
Set `ROUTE_TRANSFER_ID` to the returned `id`. Save the hashes produced by your signer in `source-transactions.json`, using `transactionHash` for one transaction or `transactionHashes` for multiple:
```json
{
"transactionHashes": [
"0x5151515151515151515151515151515151515151515151515151515151515151"
]
}
```
Replace the example hash with the actual source transaction hashes, then register them:
```bash
curl --fail-with-body \
"https://api.tempo.xyz/v1/routes/transfers/${ROUTE_TRANSFER_ID}/source-transactions" \
--header "tempo-api-key: ${TEMPO_API_KEY}" \
--header 'Content-Type: application/json' \
--data @source-transactions.json
```
The API verifies and associates them with the transfer.
### Confirm the transfer
```bash
curl "https://api.tempo.xyz/v1/routes/transfers/${ROUTE_TRANSFER_ID}" \
--header "tempo-api-key: ${TEMPO_API_KEY}"
```
Keep the payment pending until the transfer reaches `completed`. Follow [Track delivery](https://tempo.com/developers/docs/routes/delivery) for pending, failed, and refund outcomes.
:::
> Source: [/docs/routes/examples/fx](https://tempo.com/developers/docs/routes/examples/fx.md)
> Section: [Routes](https://tempo.com/developers/docs/routes.md). Move stablecoins between Tempo and other networks: try a route, set up API access, choose a supported route, quote it, accept deposits or make a transfer, and track delivery. Routes is in beta; see the introduction for access.
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
# FX swap example
Run every step of [Swap currencies](https://tempo.com/developers/docs/routes/fx) from a terminal. That guide explains each step; this page keeps the commands together. You sign the source calls with your own signer.
## Set the FX example variables
Set `TEMPO_API_KEY` to a key with `routes:read`, `routes:write`, and `data:read` from [Set up Routes](https://tempo.com/developers/docs/routes/api-setup). Then set:
| Variable | Value |
| --- | --- |
| `SOURCE_TOKEN`, `DESTINATION_TOKEN` | Token addresses on Tempo from the [route directory](https://tempo.com/developers/docs/routes/networks). OUSD is `0x20c0000000000000000000006a37da5c996874be`. EURC.e is `0x20c0000000000000000000001621e21f71cf12fb`. |
| `FX_ACCOUNT` | The listed account that sends and receives the swap. |
| `FX_AMOUNT` | Source amount in base units. `1000000` is 1 OUSD. |
| `POOL_ADDRESS` | The route's pool. Tempo provides it. |
## Swap OUSD for EURC.e
:::steps
### Check the account
```bash
curl --get \
"https://api.tempo.xyz/v1/prop-amms/${POOL_ADDRESS}/accounts/${FX_ACCOUNT}/access" \
--header "tempo-api-key: ${TEMPO_API_KEY}" \
--data-urlencode "tokens=${SOURCE_TOKEN},${DESTINATION_TOKEN}" \
--data-urlencode 'chainId=4217'
```
Continue when the response has `"allowed": true`. The request checks your organization's saved list. If your organization uses the pool's default list, add `--data-urlencode 'sponsorId=0'`.
### Get a quote
```bash
curl --get 'https://api.tempo.xyz/v1/routes/transfers/quote' \
--header "tempo-api-key: ${TEMPO_API_KEY}" \
--data-urlencode 'sourceChain=tempo' \
--data-urlencode "sourceToken=${SOURCE_TOKEN}" \
--data-urlencode 'destinationChain=tempo' \
--data-urlencode "destinationToken=${DESTINATION_TOKEN}" \
--data-urlencode "sender=${FX_ACCOUNT}" \
--data-urlencode "recipient=${FX_ACCOUNT}" \
--data-urlencode "amount=${FX_AMOUNT}" \
--data-urlencode 'mode=exactSource'
```
The quote expires within seconds. Run the next two steps right after it.
### Create the transfer
Set `ROUTE_REQUEST_KEY` to the [idempotency key](https://tempo.com/developers/docs/routes/api-setup#set-idempotency-keys) for this swap.
```bash
jq -n \
--arg sourceToken "$SOURCE_TOKEN" \
--arg destinationToken "$DESTINATION_TOKEN" \
--arg sender "$FX_ACCOUNT" \
--arg recipient "$FX_ACCOUNT" \
--arg amount "$FX_AMOUNT" \
'$ARGS.named + {sourceChain: "tempo", destinationChain: "tempo", mode: "exactSource"}' \
> fx-request.json
curl --fail-with-body 'https://api.tempo.xyz/v1/routes/transfers' \
--header "tempo-api-key: ${TEMPO_API_KEY}" \
--header "idempotency-key: ${ROUTE_REQUEST_KEY}" \
--header 'Content-Type: application/json' \
--data @fx-request.json \
--output fx-transfer.json
jq '{id, expiresAt: .quote.expiresAt, calls: .action.calls}' fx-transfer.json
```
The output lists the transfer `id`, its expiry, and the two calls to sign.
### Sign and submit
Submit both calls from `FX_ACCOUNT` before that expiry, as one Tempo Transaction. Keep the transaction hash.
### Register the source transaction
Set `ROUTE_TRANSFER_ID` to the returned `id` and `SOURCE_TRANSACTION` to the hash.
```bash
jq -n --arg transactionHash "$SOURCE_TRANSACTION" '$ARGS.named' > fx-source.json
curl --fail-with-body \
"https://api.tempo.xyz/v1/routes/transfers/${ROUTE_TRANSFER_ID}/source-transactions" \
--header "tempo-api-key: ${TEMPO_API_KEY}" \
--header 'Content-Type: application/json' \
--data @fx-source.json
```
### Confirm the swap
```bash
curl "https://api.tempo.xyz/v1/routes/transfers/${ROUTE_TRANSFER_ID}" \
--header "tempo-api-key: ${TEMPO_API_KEY}"
```
The swap is done when `status` is `completed`.
:::
## Add accounts to the list
The list's admin account adds `FX_ACCOUNT` before its first swap. Set `LIST_ADMIN` to the admin account's address. The key also needs `propamm:write`.
:::steps
### Prepare the change
```bash
jq -n \
--arg sender "$LIST_ADMIN" \
--arg account "$FX_ACCOUNT" \
--arg sourceToken "$SOURCE_TOKEN" \
--arg destinationToken "$DESTINATION_TOKEN" \
'{sender: $sender, action: {type: "setMembers", tokens: [$sourceToken, $destinationToken], accounts: [$account], allowed: true}}' \
> fx-access.json
curl --fail-with-body \
"https://api.tempo.xyz/v1/prop-amms/${POOL_ADDRESS}/access/prepare" \
--header "tempo-api-key: ${TEMPO_API_KEY}" \
--header 'Content-Type: application/json' \
--data @fx-access.json \
--output fx-access-change.json
jq '{effect, transaction}' fx-access-change.json
```
The output states the change and the unsigned transaction. The change applies to your organization's saved list.
### Sign and send the transaction
Send `transaction.data` to `transaction.to` from `LIST_ADMIN`. The API doesn't sign or send it. Run the account check again after the transaction confirms.
:::
> Source: [/docs/zones](https://tempo.com/developers/docs/zones.md)
> Section: [Zones](https://tempo.com/developers/docs/zones.md). Connect to a Zone and work with private balances, deposits, and withdrawals. Zones is live on Mainnet; see the introduction to set up a Zone. Earlier testnet sandbox guides describe a separate integration.
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
# Tempo Zones
Keep stablecoin balances and account activity in a private ledger connected to Tempo.
[Read the privacy model →](https://tempo.com/developers/docs/zones/privacy)
A public deposit enters a private Zone account through a controlled boundary; the Zone operator can view its ledger.
## Overview
A Zone is a private stablecoin ledger connected to Tempo. Use one when other Tempo users shouldn't see your customers' balances and payments, such as payroll or treasury accounts.
:::info
Zones is live on Tempo Mainnet. Tempo sets up each Zone with its operator: [contact Tempo](https://tempo.com/contact) to plan the deployment your application needs.
:::
Each Zone runs its own network. Its portal (`ZonePortal`) on Tempo holds the backing assets. Each account reads only its own balances and activity. The operator can read the whole ledger, and deposit and withdrawal amounts stay public. Read [Privacy](https://tempo.com/developers/docs/zones/privacy) before you choose a deployment.
With a Zone, your application can:
* **Fund Private Accounts:** Deposit stablecoins from Tempo into an account in the Zone.
* **Read Private Activity:** Read an account's balances and transfers with its authorization token.
* **Withdraw to Tempo:** Return funds to a Tempo address, or call a contract on Tempo.
The current permissioned runtime moves tokens only through deposits and withdrawals. It disables general TIP-20 transfers and user contract deployment. Confirm the assets, signing tools, read access, and funding rules with the operator. Execution-proof enforcement depends on the deployed verifier and network configuration, as [proving and settlement](https://tempo.com/developers/docs/protocol/zones/proving) describes.
## Start Building
Read the Build pages in order. Each page uses the connection and client from the pages before it.
[Connect to a Zone](https://tempo.com/developers/docs/zones/connect): Get deployment details and sign the authorization token.
[Client Setup](https://tempo.com/developers/docs/zones/examples): Configure the Zone chain and Wagmi client the guides import.
[Deposit Into a Zone](https://tempo.com/developers/docs/zones/deposit): Fund a private account through the portal on Tempo.
[Balances and Activity](https://tempo.com/developers/docs/zones/balances): Read the account's balances and filtered history.
[Withdraw From a Zone](https://tempo.com/developers/docs/zones/withdraw): Return funds to Tempo and track delivery.
To try these flows with test funds, use the [Testnet Sandbox](https://tempo.com/developers/docs/guide/private-zones). It runs an earlier deployment with different interfaces. Use its guides only with the sandbox.
## Related
[Privacy](https://tempo.com/developers/docs/zones/privacy): Covers what account holders, operators, and public observers can see.
[How Zones Work](https://tempo.com/developers/docs/protocol/zones): Covers portals, private accounts, issuer policies, and settlement on Tempo.
[Architecture](https://tempo.com/developers/docs/protocol/zones/architecture): Covers contract layout, sequencer management, chain IDs, and the trust model.
[Proving and Settlement](https://tempo.com/developers/docs/protocol/zones/proving): Covers settlement certificates and the current onchain verification limits.
[Zones API](https://tempo.com/developers/docs/api/zones): Use for reading deposit and withdrawal outcomes.
> Source: [/docs/zones/privacy](https://tempo.com/developers/docs/zones/privacy.md)
> Section: [Zones](https://tempo.com/developers/docs/zones.md). Connect to a Zone and work with private balances, deposits, and withdrawals. Zones is live on Mainnet; see the introduction to set up a Zone. Earlier testnet sandbox guides describe a separate integration.
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
# Privacy
A Zone keeps balances and account activity in a private ledger that its operator can read.
## Overview
Four parties see different Zone data:
* **Account Holder:** Reads its own balances and activity through the Zone RPC.
* **Operator:** Runs the deployment and can read the whole private ledger.
* **Public Observers:** See deposits and withdrawals on Tempo, but not activity inside the Zone.
* **Your Application:** Reads only the accounts whose authorization tokens it holds.
## Who Can See What
| Data | Visibility |
| --- | --- |
| Private balances and account activity | The Zone RPC limits each account to its own data. The operator can inspect the ledger. |
| Deposit recipient and memo | Encrypted to the operator when submitted on Tempo. |
| Deposit token, amount, depositor, and refund recipient | Public on Tempo. |
| Withdrawal token, amount, destination, and settlement commitments | Public on Tempo. |
## Public Deposits and Withdrawals
Deposit and withdrawal amounts and timing stay public on Tempo. A Zone doesn't hide them, and its operator can read the private ledger.
## Scope Application Access
The Zone RPC authenticates each caller with an [authorization token](https://tempo.com/developers/docs/zones/connect#authorize-access). It scopes results to that account and redacts shared data. If your application uses a hosted provider instead, confirm which accounts its credentials can read.
Enforce customer access in your backend, caches, logs, and user interface. A public Tempo explorer doesn't show private Zone activity.
Read access is separate from transaction-signing authority and from the portal's funding rules.
## Trust Assumptions
Each Zone has a portal (`ZonePortal`) on Tempo that holds its backing assets. Execution-proof enforcement depends on the deployed verifier and network configuration. Forced exits aren't a generally available recovery path.
Review [proving and settlement](https://tempo.com/developers/docs/protocol/zones/proving) with the operator before you integrate.
## Related
[Connect to a Zone](https://tempo.com/developers/docs/zones/connect): Use for getting deployment details and signing the authorization token.
[Accounts and Privacy](https://tempo.com/developers/docs/protocol/zones/accounts): Covers the account privacy rules and read restrictions.
[RPC Reference](https://tempo.com/developers/docs/protocol/zones/rpc): Covers per-account scoping and response redaction.
[Proving and Settlement](https://tempo.com/developers/docs/protocol/zones/proving): Covers settlement certificates and the current onchain verification limits.
> Source: [/docs/guide/private-zones](https://tempo.com/developers/docs/guide/private-zones.md)
> Section: [Zones](https://tempo.com/developers/docs/zones.md). Connect to a Zone and work with private balances, deposits, and withdrawals. Zones is live on Mainnet; see the introduction to set up a Zone. Earlier testnet sandbox guides describe a separate integration.
> Earlier testnet sandbox: use [Zones](https://tempo.com/developers/docs/zones.md) for current Mainnet deployments.
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
# Testnet Sandbox
Try deposits, transfers, swaps, and withdrawals with test funds on Zone A and Zone B.
## Overview
The testnet sandbox is an earlier Tempo Zones deployment with two example Zones, Zone A and Zone B. It's a separate integration from current deployments. Use it to try Zone flows with test funds, and build your application against [Tempo Zones](https://tempo.com/developers/docs/zones).
A Zone keeps a private ledger of stablecoin balances and account activity. A portal (`ZonePortal`) on public Tempo holds its backing assets. The deposit, withdrawal, and cross-Zone guides show each flow settle in stages, from accepted transaction to credited balance.
The public Tempo portal holds backing assets while a Zone operator runs the private account ledger. Deposits, withdrawals, and signed settlement commitments connect the two chains.
## Sandbox Guides
The guides use two example Zones on Tempo Testnet. Deposits and withdrawals start in Zone A. Zone B is the destination for cross-Zone transfers and swaps. The examples use the test tokens `OUSD` and `betaUSD`.
Each demo signs you in with a passkey and gets you test funds. It then signs an [authorization token](https://tempo.com/developers/docs/zones/connect#authorize-access) for your Zone account and handles the RPC connection. To call the sandbox from your own code, start with Connect to the Sandbox.
[Connect to the Sandbox](https://tempo.com/developers/docs/guide/private-zones/connect-to-a-zone): Use for setting up a Zone client, authorizing your account, and making a first RPC request.
[Deposit OUSD](https://tempo.com/developers/docs/guide/private-zones/deposit-to-a-zone): Use for moving test funds from Tempo into a private balance.
[Send Within a Zone](https://tempo.com/developers/docs/guide/private-zones/send-tokens-within-a-zone): Use for a private transfer between accounts in Zone A.
[Send Across Zones](https://tempo.com/developers/docs/guide/private-zones/send-tokens-across-zones): Use for moving test funds from Zone A to Zone B through Tempo.
[Swap Across Zones](https://tempo.com/developers/docs/guide/private-zones/swap-across-zones): Use for combining a withdrawal, a swap on Tempo, and a deposit into another Zone.
[Withdraw OUSD](https://tempo.com/developers/docs/guide/private-zones/withdraw-from-a-zone): Use for withdrawing test funds from Zone A back to your Tempo balance.
## Sandbox Compatibility
The sandbox runs the legacy Zone A and Zone B interfaces in `viem/tempo`. Its code doesn't carry over to current deployments. It differs in these ways:
* **Deposits:** The sandbox accepts plaintext and encrypted deposits. Current portals accept only encrypted deposits with a Tempo refund recipient.
* **Transfers:** The sandbox allows direct TIP-20 transfers inside a Zone. The current permissioned runtime disables `transfer`, `transferFrom`, and their memo variants.
* **Routed Withdrawals:** The sandbox router takes a plaintext destination recipient in its callback payload. Current routers require an encrypted deposit payload and a Tempo refund recipient.
* **Callback Interface:** The sandbox router uses an older callback signature than current routers.
* **SDK Version:** The sandbox examples use `viem@2.54.6`, which matches the deployed portal and outbox (`ZoneOutbox`) interfaces. New deployments use the current SDK.
* **Chain IDs:** The chain IDs `4217000006` and `4217000007` belong to the sandbox. Other deployments have their own.
For another Zone, get the endpoint, access credentials, chain configuration, and supported SDK version from its operator.
## Sandbox Router Deployment
Use this `SwapAndDepositRouter` deployment for the Zone A and Zone B sandbox on **Tempo Moderato testnet**. It supports both same-token transfers and swaps. The [shared demo configuration](https://github.com/tempoxyz/docs/blob/main/src/lib/private-zones.ts) supplies these addresses to the interactive guides.
| Contract | Moderato address |
| --- | --- |
| `SwapAndDepositRouter` | [`0xf9b794e0dca9bc12ac90067df792d7aad33436e4`](https://explore.testnet.tempo.xyz/address/0xf9b794e0dca9bc12ac90067df792d7aad33436e4) |
| `ZoneFactory` | `0x7Cc496Dc634b718289c192b59CF90262C5228545` |
| `StablecoinDEX` | `0xDEc0000000000000000000000000000000000000` |
| Zone A portal (Zone ID `6`) | `0x7069DeC4E64Fd07334A0933eDe836C17259c9B23` |
| Zone B portal (Zone ID `7`) | `0x3F5296303400B56271b476F5A0B9cBF74350D6Ac` |
The deployed router receives `onWithdrawalReceived(bytes32,address,uint128,bytes)` callbacks, with selector `0xbfea9490`. The Zone messenger invokes this callback. Your application passes the router address and callback data in the source Zone's withdrawal request. In the [swap](https://tempo.com/developers/docs/guide/private-zones/swap-across-zones#code-example) and [same-token transfer](https://tempo.com/developers/docs/guide/private-zones/send-tokens-across-zones#code-example) examples, the six-field `(bool,address,address,address,bytes32,uint128)` payload selects a plaintext destination recipient.
:::warning
Older demo copies use `0x7ebaa4E28fbD892f5B0F152d40173034adE94714`. That deployment expects `onWithdrawalReceived(address,address,uint128,bytes)` (`0x0e9110a5`) and points to a different factory. It's incompatible with these sandbox portals. Use the router in the deployment table for both transfers and swaps. Match the ABI and payload to the deployed contracts, and don't combine versions.
:::
### Check the Full Routed Result
Before sending funds, check the router's `zoneFactory()` and `stablecoinDEX()` against the table. Confirm that the factory recognizes the portals. Confirm that the target portal enables the output token. A swap also needs a fresh DEX quote and a minimum output bound.
A successful source Zone withdrawal receipt confirms submission only. Wait for the portal's `WithdrawalProcessed` event on Tempo and check `callbackSuccess`. Then confirm the destination balance. A rejected callback can still produce a successful processing receipt on Tempo. In that case, the principal returns to the source Zone's `fallbackRecipient`, so check that balance as well.
Two sandbox transactions show the routed flow end to end. One is a [1 PathUSD transfer from Zone A to Zone B](https://explore.testnet.tempo.xyz/tx/0x8ab7e4fbbbd1e26a8400b111c5726fd05c04359be7a858d62e134a6d600807d9). The other is a [1 PathUSD swap into 0.994035 AlphaUSD, deposited back into Zone A](https://explore.testnet.tempo.xyz/tx/0x7d95a62c3e94e1f1382c287967d1d7bb13cfc3a3e3b54b5cd32dad240b8b7ec5). Both credited their destination balances. They use the sandbox's plaintext recipient flow.
## Related
[Tempo Zones](https://tempo.com/developers/docs/zones): Covers current Mainnet Zones to use for your integration.
[Connect to a Zone](https://tempo.com/developers/docs/zones/connect): Use for connecting your application to a current Zone deployment.
[How Zones Work](https://tempo.com/developers/docs/protocol/zones): Covers the current Zone protocol design, from portals to settlement.
[RPC Reference](https://tempo.com/developers/docs/protocol/zones/rpc): Covers the authorization token format and the methods it scopes.
> Source: [/docs/guide/private-zones/connect-to-a-zone](https://tempo.com/developers/docs/guide/private-zones/connect-to-a-zone.md)
> Section: [Zones](https://tempo.com/developers/docs/zones.md). Connect to a Zone and work with private balances, deposits, and withdrawals. Zones is live on Mainnet; see the introduction to set up a Zone. Earlier testnet sandbox guides describe a separate integration.
> Earlier testnet sandbox: use [Zones](https://tempo.com/developers/docs/zones.md) for current Mainnet deployments.
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
# Connect to the Sandbox
Connect a Viem client to Zone A or Zone B and sign the token that scopes RPC reads to you.
## Overview
A Zone client reads private balances and submits Zone transactions. This guide connects one to Zone A or Zone B in the [testnet sandbox](https://tempo.com/developers/docs/guide/private-zones#testnet-compatibility), which differs from current deployments. Your account signs an [authorization token](https://tempo.com/developers/docs/zones/connect#authorize-access), so the Zone RPC scopes requests to you.
To connect directly, you need a Tempo account, RPC access, and the sandbox connection details. The interactive guides handle the connection and authorization for you.
## Create a Viem Client
Use `zoneModerato(6)` or `zoneModerato(7)` from `viem/tempo/zones` for these examples. They need `viem@2.54.6`, which matches the sandbox's portal and outbox interfaces. Install it with `pnpm add viem@2.54.6`.
Get [RPC access from Tempo](https://tempo.com/contact) before connecting to the shared endpoints directly. The server-side example reads the operator-provided HTTP `Authorization` header from `ZONE_RPC_AUTHORIZATION`. This endpoint access is separate from the signed `X-Authorization-Token`. The Zone RPC requires that token even for chain metadata reads.
The example signs that token with an ephemeral account for metadata reads. Use your actual account when reading private balances. Confirm that the endpoint's `eth_chainId` matches the sandbox chain ID before signing.
```ts
import { createClient } from 'viem'
import { generatePrivateKey } from 'viem/accounts'
import { Account, tempoActions } from 'viem/tempo'
import { http, zoneModerato } from 'viem/tempo/zones'
const rpcUrl = 'https://rpc-zone-a.testnet.tempo.xyz'
const authorization = process.env.ZONE_RPC_AUTHORIZATION
if (!authorization) throw new Error('Set ZONE_RPC_AUTHORIZATION from your zone operator.')
const zoneClient = createClient({
account: Account.fromSecp256k1(generatePrivateKey()),
chain: zoneModerato(6),
transport: http(rpcUrl, {
fetchOptions: { headers: { Authorization: authorization } },
}),
}).extend(tempoActions())
await zoneClient.zone.signAuthorizationToken({ zoneId: 6 })
const chainId = await zoneClient.getChainId()
if (chainId !== zoneClient.chain.id) throw new Error('Zone chain ID does not match the client.')
const blockNumber = await zoneClient.getBlockNumber()
console.log(blockNumber)
```
For browser integrations, the Zone RPC gateway must allow `X-Authorization-Token` in its CORS headers. The shared testnet gateways don't currently allow that header in browsers. These demos relay requests through the docs server instead. The relay preserves your signed token and account-scoped access.
## Sandbox Connection Details
### Zone A
| **Property** | **Value** |
|-------------------|-------|
| **Network Name** | Zone A |
| **Zone ID** | `6` |
| **Chain ID** | `4217000006` |
| **HTTP URL** | `https://rpc-zone-a.testnet.tempo.xyz` |
| **Portal Address** | `0x7069DeC4E64Fd07334A0933eDe836C17259c9B23` |
| **Outbox Address** | `0x1c00000000000000000000000000000000000002` |
### Zone B
| **Property** | **Value** |
|-------------------|-------|
| **Network Name** | Zone B |
| **Zone ID** | `7` |
| **Chain ID** | `4217000007` |
| **HTTP URL** | `https://rpc-zone-b.testnet.tempo.xyz` |
| **Portal Address** | `0x3F5296303400B56271b476F5A0B9cBF74350D6Ac` |
| **Outbox Address** | `0x1c00000000000000000000000000000000000002` |
Zones don't expose a public block explorer for private activity. Use authenticated Zone RPC reads instead.
## Related
[Deposit OUSD](https://tempo.com/developers/docs/guide/private-zones/deposit-to-a-zone): Use for moving testnet OUSD from Tempo into a Zone A balance.
[Connect to a Zone](https://tempo.com/developers/docs/zones/connect): Use for connecting your application to a current Zone deployment.
[Testnet Sandbox](https://tempo.com/developers/docs/guide/private-zones): Covers the sandbox Zones, router deployment, and compatibility limits.
[RPC Reference](https://tempo.com/developers/docs/protocol/zones/rpc): Covers the authorization token format and the methods it scopes.
> Source: [/docs/guide/private-zones/deposit-to-a-zone](https://tempo.com/developers/docs/guide/private-zones/deposit-to-a-zone.md)
> Section: [Zones](https://tempo.com/developers/docs/zones.md). Connect to a Zone and work with private balances, deposits, and withdrawals. Zones is live on Mainnet; see the introduction to set up a Zone. Earlier testnet sandbox guides describe a separate integration.
> Earlier testnet sandbox: use [Zones](https://tempo.com/developers/docs/zones.md) for current Mainnet deployments.
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
# Deposit OUSD
Move `OUSD` test tokens from public Tempo into a private balance on Zone A.
## Overview
This guide deposits `OUSD` test tokens from public Tempo into **Zone A**. It uses the [testnet sandbox](https://tempo.com/developers/docs/guide/private-zones#testnet-compatibility), which differs from current deployments. You submit a deposit on Tempo, then wait for the Zone to credit the net amount after fees.
A public account signs a plaintext or encrypted deposit, the Zone A portal locks OUSD, and Zone A later imports the deposit and credits the private balance.
The portal (`ZonePortal`) on Tempo accepts the deposit. Reading the resulting balance needs an [authorization token](https://tempo.com/developers/docs/zones/connect#authorize-access), which scopes Zone RPC reads to your account.
## Deposit OUSD to Zone A
**Interactive demo: Deposit to Zone A**
1. Deposit to zone
## Code Examples
These snippets assume a signed-in `rootClient` on Tempo and the usual token and Zone constants in scope.
Use the plaintext flow when revealing the recipient and memo is acceptable. Use the encrypted flow to hide those fields from public observers on Tempo.
### Plaintext
```ts
import { parseUnits } from 'viem'
const depositAmount = parseUnits('100', 6)
const { receipt } = await rootClient.zone.depositSync({
account: rootClient.account,
amount: depositAmount,
token: ousd,
zoneId: ZONE_A.id,
})
console.log(receipt.blockNumber)
```
### Encrypted
```ts
import { parseUnits } from 'viem'
const depositAmount = parseUnits('100', 6)
const { receipt } = await rootClient.zone.encryptedDepositSync({ // [!code focus]
account: rootClient.account,
amount: depositAmount,
token: ousd,
zoneId: ZONE_A.id,
})
console.log(receipt.blockNumber)
```
## Deposit Settlement
A deposit settles in two phases. The Tempo receipt confirms that the portal accepted the deposit. The Zone balance changes later, when the Zone sequencer [imports the deposit](https://tempo.com/developers/docs/protocol/zones/bridging#deposits).
The Zone mints `amount - depositFee`, not the full amount you passed to `deposit(...)`. The portal deducts the [deposit fee](https://tempo.com/developers/docs/protocol/zones/execution#deposit-fees) in the deposited token. To land a specific net amount in the Zone, add the deposit fee first.
## Related
[Deposit Into a Zone](https://tempo.com/developers/docs/zones/deposit): Use for depositing into a current Zone deployment.
[Send Within a Zone](https://tempo.com/developers/docs/guide/private-zones/send-tokens-within-a-zone): Use for a private transfer between accounts in Zone A.
[Withdraw OUSD](https://tempo.com/developers/docs/guide/private-zones/withdraw-from-a-zone): Use for moving OUSD from Zone A back to your public balance.
[Testnet Sandbox](https://tempo.com/developers/docs/guide/private-zones): Covers the sandbox Zones, router deployment, and compatibility limits.
> Source: [/docs/guide/private-zones/send-tokens-within-a-zone](https://tempo.com/developers/docs/guide/private-zones/send-tokens-within-a-zone.md)
> Section: [Zones](https://tempo.com/developers/docs/zones.md). Connect to a Zone and work with private balances, deposits, and withdrawals. Zones is live on Mainnet; see the introduction to set up a Zone. Earlier testnet sandbox guides describe a separate integration.
> Earlier testnet sandbox: use [Zones](https://tempo.com/developers/docs/zones.md) for current Mainnet deployments.
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
# Send Within a Zone
Send `OUSD` test tokens between accounts in Zone A without leaving the Zone.
## Overview
A Zone is a private stablecoin ledger connected to Tempo, the public chain. A Zone transfer moves `OUSD` test tokens between two accounts inside one Zone, here **Zone A**.
This guide uses the [testnet sandbox](https://tempo.com/developers/docs/guide/private-zones), an earlier deployment with two example Zones (Zone A and Zone B) on Tempo Moderato testnet. The sandbox allows direct [TIP-20](https://tempo.com/developers/docs/protocol/tip20/overview) transfers inside a Zone, so the transfer never passes through Tempo. [Current deployments](https://tempo.com/developers/docs/guide/private-zones#testnet-compatibility) disable direct transfers and move tokens only through deposits and withdrawals, so this guide works only in the sandbox.
## Send OUSD Within Zone A
**Interactive demo: Send tokens within Zone A**
1. Send tokens within zone
## Code Example
The snippet needs two Viem clients that share one account:
* **`rootClient`:** Your signed-in client on Tempo. Its `account` signs the transfer.
* **`zoneAClient`:** A Zone A client for the same account, built as in [Connect to the Sandbox](https://tempo.com/developers/docs/guide/private-zones/connect-to-a-zone#create-a-viem-client).
The snippet first signs an [authorization token](https://tempo.com/developers/docs/zones/connect#authorize-access) for Zone ID `6` (Zone A), which the Zone RPC requires on every request. It then sends 25 `OUSD` and pays the network fee in `OUSD`. `transferSync` waits for the Zone receipt.
```ts
import { parseUnits, type Address } from 'viem'
const ousd = '0x20c0000000000000000000006a37da5c996874be' as Address // OUSD test token
const transferAmount = parseUnits('25', 6) // 25 OUSD in base units
const demoRecipient = '0xbeefcafe54750903ac1c8909323af7beb21ea2cb' as Address // any address
await zoneAClient.zone.signAuthorizationToken({ zoneId: 6 })
const { receipt } = await zoneAClient.token.transferSync({
account: rootClient.account,
amount: transferAmount,
feeToken: ousd,
to: demoRecipient,
token: ousd,
})
```
## Transfer Settlement
The transfer stays inside Zone A. Deposits and withdrawals move funds between Tempo and a Zone through the Zone's portal, and their amounts are public on Tempo. This transfer creates neither, so Tempo shows no record of it. Each account reads its updated balance through the Zone RPC with its own authorization token.
## Related
[Send Across Zones](https://tempo.com/developers/docs/guide/private-zones/send-tokens-across-zones): Use for moving OUSD from Zone A into Zone B through Tempo.
[Withdraw OUSD](https://tempo.com/developers/docs/guide/private-zones/withdraw-from-a-zone): Use for moving OUSD from Zone A back to your public balance.
[Balances and Activity](https://tempo.com/developers/docs/zones/balances): Use for reading private balances and activity on a current Zone deployment.
[Testnet Sandbox](https://tempo.com/developers/docs/guide/private-zones): Covers the sandbox Zones, router deployment, and compatibility limits.
> Source: [/docs/guide/private-zones/send-tokens-across-zones](https://tempo.com/developers/docs/guide/private-zones/send-tokens-across-zones.md)
> Section: [Zones](https://tempo.com/developers/docs/zones.md). Connect to a Zone and work with private balances, deposits, and withdrawals. Zones is live on Mainnet; see the introduction to set up a Zone. Earlier testnet sandbox guides describe a separate integration.
> Earlier testnet sandbox: use [Zones](https://tempo.com/developers/docs/zones.md) for current Mainnet deployments.
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
# Send Across Zones
Send `OUSD` test tokens from Zone A to Zone B through Tempo.
## Overview
A cross-Zone send moves `OUSD` test tokens from **Zone A** to **Zone B**. It uses the [testnet sandbox](https://tempo.com/developers/docs/guide/private-zones#testnet-compatibility), which differs from current deployments. The transfer settles on Tempo before Zone B credits the balance.
The flow uses the sandbox's [SwapAndDepositRouter deployment](https://tempo.com/developers/docs/guide/private-zones#sandbox-router-deployment) on Tempo in same-token mode. It withdraws from `Zone A` and skips the swap, since the asset stays `OUSD`. Then it deposits that `OUSD` into `Zone B`.
Zone A withdraws OUSD to a public router, which skips the swap and deposits OUSD into the Zone B portal. Zone B imports the deposit and credits its private balance later.
## Send OUSD to Zone B
**Interactive demo: Send tokens across zones**
1. Send tokens across zones
## Code Example
This snippet assumes a signed-in `rootClient` on Tempo and a `zoneAClient`. It also assumes the shared token and portal constants used throughout the Zone guides. The router address and callback encoding are specific to Moderato's Zone A and Zone B sandbox.
This code covers the routed send submission. Use the demo to watch the routed deposit settle into Zone B.
```ts
import { encodeAbiParameters, parseUnits } from 'viem'
const swapAndDepositRouter = '0xf9b794e0dca9bc12ac90067df792d7aad33436e4' as const
const transferAmount = parseUnits('25', 6)
await zoneAClient.zone.signAuthorizationToken({ zoneId: 6 })
const callbackData = encodeAbiParameters(
[
{ type: 'bool' },
{ type: 'address' },
{ type: 'address' },
{ type: 'address' },
{ type: 'bytes32' },
{ type: 'uint128' },
],
[false, ousd, ZONE_B.portalAddress, rootClient.account.address, zeroBytes32, 0n],
)
const { receipt } = await zoneAClient.zone.requestWithdrawalSync({
account: rootClient.account,
amount: transferAmount,
data: callbackData,
feeToken: ousd,
fallbackRecipient: rootClient.account.address,
gas: routerCallbackGasLimit,
to: swapAndDepositRouter,
token: ousd,
})
// This receipt confirms source submission. Verify L1 processing and destination credit next.
console.log(receipt.blockNumber)
```
## Routed Send Settlement
The token leaves `Zone A`, briefly lands on Tempo, and arrives in `Zone B` as the same asset. The routed send:
1. Withdraws `OUSD` from `Zone A` through the outbox (`ZoneOutbox`).
2. Routes that withdrawal to `swapAndDepositRouter` on Tempo.
3. Skips the DEX swap because the input and output token are both `OUSD`.
4. Deposits the routed `OUSD` into `Zone B` through its portal (`ZonePortal`).
The target deposit pays the normal [deposit fee](https://tempo.com/developers/docs/protocol/zones/execution#deposit-fees). `Zone B` receives the routed `OUSD` minus that fee.
The transfer completes when the destination Zone credits the recipient. Follow the [routed-result checks](https://tempo.com/developers/docs/guide/private-zones#check-the-full-routed-result) to confirm destination credit.
:::warning
If the routed withdrawal fails on Tempo, the amount [bounces back](https://tempo.com/developers/docs/protocol/zones/bridging#withdrawal-failure-and-bounce-back) to the withdrawal's `fallbackRecipient` inside `Zone A`. Failures include a reverting callback or a target deposit that can't complete. The sequencer still collects the fee.
:::
## Related
[Swap Across Zones](https://tempo.com/developers/docs/guide/private-zones/swap-across-zones): Use for trading OUSD in Zone A for betaUSD in Zone B.
[Send Within a Zone](https://tempo.com/developers/docs/guide/private-zones/send-tokens-within-a-zone): Use for a private transfer between accounts in Zone A.
[Withdraw From a Zone](https://tempo.com/developers/docs/zones/withdraw): Use for withdrawals and contract callbacks on a current Zone deployment.
[Testnet Sandbox](https://tempo.com/developers/docs/guide/private-zones): Covers the sandbox router deployment and the routed-result checks.
> Source: [/docs/guide/private-zones/swap-across-zones](https://tempo.com/developers/docs/guide/private-zones/swap-across-zones.md)
> Section: [Zones](https://tempo.com/developers/docs/zones.md). Connect to a Zone and work with private balances, deposits, and withdrawals. Zones is live on Mainnet; see the introduction to set up a Zone. Earlier testnet sandbox guides describe a separate integration.
> Earlier testnet sandbox: use [Zones](https://tempo.com/developers/docs/zones.md) for current Mainnet deployments.
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
# Swap Across Zones
Swap `OUSD` in Zone A for `betaUSD` in Zone B through the Stablecoin DEX.
## Overview
A cross-Zone swap trades `OUSD` test tokens in **Zone A** for `betaUSD` in **Zone B**. It uses the [testnet sandbox](https://tempo.com/developers/docs/guide/private-zones#testnet-compatibility), which differs from current deployments. The swap settles on Tempo before Zone B credits the balance.
The route uses the sandbox's [SwapAndDepositRouter deployment](https://tempo.com/developers/docs/guide/private-zones#sandbox-router-deployment) on Tempo. It withdraws from `Zone A` and swaps on the Stablecoin DEX. Then it deposits the output token into `Zone B`.
Zone A withdraws OUSD. The router swaps it for betaUSD on the Stablecoin DEX and deposits into Zone B in one public transaction. Zone B imports the deposit and credits betaUSD later.
## Swap OUSD for betaUSD
The demo runs the full route:
1. Withdraws `OUSD` from `Zone A`.
2. Routes it through Tempo and swaps it on the Stablecoin DEX.
3. Deposits the output token into `Zone B` through its portal (`ZonePortal`).
4. Confirms the credited `betaUSD` balance in `Zone B`.
**Interactive demo: Swap across zones**
1. Swap across zones
## Code Example
This snippet assumes a signed-in `rootClient` on Tempo and a `zoneAClient`. It also assumes the shared token and portal constants used throughout the Zone guides. The router address and callback encoding are specific to Moderato's Zone A and Zone B sandbox.
This code covers the routed swap submission. Use the demo to watch the output deposit settle into Zone B.
```ts
import { encodeAbiParameters, parseUnits } from 'viem'
const swapAndDepositRouter = '0xf9b794e0dca9bc12ac90067df792d7aad33436e4' as const
const swapAmount = parseUnits('25', 6)
await zoneAClient.zone.signAuthorizationToken({ zoneId: 6 })
const quotedBetaOut = await rootClient.dex.getSellQuote({
amountIn: swapAmount,
tokenIn: ousd,
tokenOut: betaUsd,
})
const minimumBetaOut = quotedBetaOut - quotedBetaOut / 100n
const callbackData = encodeAbiParameters(
[
{ type: 'bool' },
{ type: 'address' },
{ type: 'address' },
{ type: 'address' },
{ type: 'bytes32' },
{ type: 'uint128' },
],
[false, betaUsd, ZONE_B.portalAddress, rootClient.account.address, zeroBytes32, minimumBetaOut],
)
const { receipt } = await zoneAClient.zone.requestWithdrawalSync({
account: rootClient.account,
amount: swapAmount,
data: callbackData,
feeToken: ousd,
fallbackRecipient: rootClient.account.address,
gas: routerCallbackGasLimit,
to: swapAndDepositRouter,
token: ousd,
})
// This receipt confirms source submission. Verify L1 processing and destination credit next.
console.log(receipt.blockNumber)
```
## Swap Settlement
The swap is asynchronous because the trade temporarily leaves the Zone.
The source token exits through the outbox (`ZoneOutbox`) and transfers to `SwapAndDepositRouter` on Tempo. The router optionally swaps it on the Stablecoin DEX. It then deposits the output token through the destination portal. That routed deposit pays the normal [deposit fee](https://tempo.com/developers/docs/protocol/zones/execution#deposit-fees), so the destination Zone receives the post-fee output.
The swap completes when the destination Zone credits the recipient. Follow the [routed-result checks](https://tempo.com/developers/docs/guide/private-zones#check-the-full-routed-result) to tell destination credit apart from a callback failure and bounce-back.
:::warning
If the routed withdrawal fails on Tempo, the amount [bounces back](https://tempo.com/developers/docs/protocol/zones/bridging#withdrawal-failure-and-bounce-back) to the withdrawal's `fallbackRecipient` inside the source Zone. Failures include a failed swap or transfer, a reverting router callback, or a target deposit that can't complete. The sequencer still collects the fee, so a failed routed swap still costs the sender fees.
:::
## Related
[Send Across Zones](https://tempo.com/developers/docs/guide/private-zones/send-tokens-across-zones): Use for moving OUSD from Zone A into Zone B without a swap.
[Withdraw OUSD](https://tempo.com/developers/docs/guide/private-zones/withdraw-from-a-zone): Use for moving OUSD from Zone A back to your public balance.
[Withdraw From a Zone](https://tempo.com/developers/docs/zones/withdraw): Use for withdrawals and contract callbacks on a current Zone deployment.
[Testnet Sandbox](https://tempo.com/developers/docs/guide/private-zones): Covers the sandbox router deployment and the routed-result checks.
> Source: [/docs/guide/private-zones/withdraw-from-a-zone](https://tempo.com/developers/docs/guide/private-zones/withdraw-from-a-zone.md)
> Section: [Zones](https://tempo.com/developers/docs/zones.md). Connect to a Zone and work with private balances, deposits, and withdrawals. Zones is live on Mainnet; see the introduction to set up a Zone. Earlier testnet sandbox guides describe a separate integration.
> Earlier testnet sandbox: use [Zones](https://tempo.com/developers/docs/zones.md) for current Mainnet deployments.
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
# Withdraw OUSD
Move `OUSD` test tokens from Zone A back to your public Tempo balance.
## Overview
A direct withdrawal moves `OUSD` test tokens from **Zone A** back to your public Tempo balance. It uses the [testnet sandbox](https://tempo.com/developers/docs/guide/private-zones#testnet-compatibility), which differs from current deployments. The withdrawal exits through the outbox (`ZoneOutbox`) on the Zone. You submit the request in the Zone, then wait for your Tempo balance to increase after the batch settles.
A signed Zone A outbox request reduces the private balance. Tempo accepts the batch, then processes the withdrawal to deliver OUSD to the public recipient.
## Withdraw OUSD From Zone A
**Interactive demo: Withdraw from Zone A**
1. Withdraw from zone
## Code Examples
These snippets assume a signed-in `rootClient` on Tempo, a derived `zoneAClient`, and the usual token constants in scope. The calls target the sandbox's SDK interfaces.
Standard withdrawals omit an encrypted sender disclosure. Authenticated withdrawals attach sender details encrypted to the holder of the `revealTo` public key. Both flows keep the public recipient and amount visible.
### Standard
```ts
import { parseUnits } from 'viem'
const withdrawalAmount = parseUnits('100', 6)
await zoneAClient.zone.signAuthorizationToken({ zoneId: 6 })
const { receipt } = await zoneAClient.zone.requestWithdrawalSync({
account: rootClient.account,
feeToken: ousd,
amount: withdrawalAmount,
token: ousd,
to: rootClient.account.address,
})
console.log(receipt.blockNumber)
```
### Authenticated
```ts
import { parseUnits } from 'viem'
const withdrawalAmount = parseUnits('100', 6)
const revealTo = '0x031dc147467e8f106eb22850fef549dc74b8f6634aeac554ebdd4ab896b67cdf68' // [!code focus]
await zoneAClient.zone.signAuthorizationToken({ zoneId: 6 })
const { receipt } = await zoneAClient.zone.requestVerifiableWithdrawalSync({ // [!code focus]
account: rootClient.account,
feeToken: ousd,
amount: withdrawalAmount,
revealTo, // [!code focus]
token: ousd,
to: rootClient.account.address,
})
console.log(receipt.blockNumber)
```
## Withdrawal Settlement
A direct withdrawal is the most direct way out of a Zone. The outbox burns the Zone balance and includes the request in the next withdrawal batch. Tempo then settles the amount to a public Tempo address.
The Zone accepts the request first. Your Tempo balance changes later, when the sequencer submits and processes the batch on Tempo.
A failed withdrawal doesn't stay stuck. If processing on Tempo fails, the protocol [re-deposits the amount](https://tempo.com/developers/docs/protocol/zones/bridging#withdrawal-failure-and-bounce-back) into the Zone to the request's `fallbackRecipient`. The fee is still consumed.
:::warning
A direct withdrawal can fail on Tempo even with `gas: 0n`, such as on a token transfer or policy check. The amount then bounces back to `fallbackRecipient` on the Zone. The public balance doesn't increase.
:::
## Related
[Withdraw From a Zone](https://tempo.com/developers/docs/zones/withdraw): Use for withdrawing from a current Zone deployment.
[Deposit OUSD](https://tempo.com/developers/docs/guide/private-zones/deposit-to-a-zone): Use for moving testnet OUSD from Tempo into a Zone A balance.
[Send Across Zones](https://tempo.com/developers/docs/guide/private-zones/send-tokens-across-zones): Use for moving OUSD from Zone A into Zone B through Tempo.
[Testnet Sandbox](https://tempo.com/developers/docs/guide/private-zones): Covers the sandbox Zones, router deployment, and compatibility limits.
> Source: [/docs/zones/connect](https://tempo.com/developers/docs/zones/connect.md)
> Section: [Zones](https://tempo.com/developers/docs/zones.md). Connect to a Zone and work with private balances, deposits, and withdrawals. Zones is live on Mainnet; see the introduction to set up a Zone. Earlier testnet sandbox guides describe a separate integration.
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
# Connect to a Zone
Authenticate your application's access to one Zone deployment.
## Overview
To connect, get the deployment details from the operator, sign an authorization token, and check the chain ID. A Zone is its own network with its own chain ID, not a privacy setting on a Tempo account.
You need a [Tempo account signer](https://tempo.com/developers/docs/accounts/keys). The Viem and Wagmi examples import `zoneChain` and `zoneConfig` from [Client Setup](https://tempo.com/developers/docs/zones/examples).
## Setup
::::steps
### Get the Deployment Details
Get the configuration from the operator, or [contact Tempo](https://tempo.com/contact). Ask for the Zone RPC endpoint, chain ID, Zone ID, portal address, enabled assets, supported SDK or contract interfaces, and endpoint access credentials.
Ask the operator or your wallet provider about three controls:
| Control | What to ask |
| --- | --- |
| **Signing authority** | Which account keys or provider interface sign deposits and withdrawals. |
| **Read access** | Which credentials let your application read balances and activity, and which accounts they expose. |
| **Funding rules** | Which assets, depositors, withdrawal recipients, refunds, and callbacks the deployment permits. |
These steps use the account-scoped, redacted Zone RPC. Operator RPC is a separate interface.
The current permissioned runtime moves tokens only through deposits and withdrawals. It disables general TIP-20 transfer calls and user contract deployment, as the [execution rules](https://tempo.com/developers/docs/protocol/zones/execution) describe.
### Authorize Access
An authorization token is a signed credential that proves control of the account. Sign it with the account key and send it in the `X-Authorization-Token` header on every Zone RPC request. It authenticates RPC requests only. Transactions still need their own signatures, and the endpoint still needs its access credentials.
With Viem, sign with your account and the Zone chain from [Client Setup](https://tempo.com/developers/docs/zones/examples). Set `ZONE_ID` to the operator-provided Zone ID. The code signs locally and submits no transaction.
```ts [Viem]
import { createClient } from 'viem/tempo'
import { zoneChain } from './zone.config'
const client = createClient({ account, chain: zoneChain })
const { token } = await client.zone.signAuthorizationToken({
zoneId: Number(process.env.ZONE_ID),
expiresAt: Math.floor(Date.now() / 1000) + 3600,
})
```
Use the returned `token` as `ZONE_AUTH_TOKEN`. Keep it private and renew it before expiry. Other signers must follow the [authorization token format](https://tempo.com/developers/docs/protocol/zones/rpc#authorization-tokens). The operator sets the maximum token lifetime.
### Check the Connection
Set `ZONE_RPC_URL` to the deployment's endpoint and `ZONE_AUTH_TOKEN` to the signed token. TypeScript uses `viem` (`pnpm add viem`). Python uses `requests` (`pip install requests`). CLI examples use [Foundry](https://tempo.com/developers/docs/sdk/foundry).
These examples run on your backend. The Wagmi example uses core actions with `zoneConfig`. Keep shared operator credentials out of browser code.
:::code-group
```ts [Viem]
import { createPublicClient, http } from 'viem'
import { tempoActions } from 'viem/tempo'
const zone = createPublicClient({
transport: http(process.env.ZONE_RPC_URL, {
fetchOptions: { headers: { 'X-Authorization-Token': process.env.ZONE_AUTH_TOKEN! } },
}),
}).extend(tempoActions())
console.log(await zone.getChainId())
```
```ts [Wagmi]
import { getPublicClient } from '@wagmi/core'
import { zoneConfig } from './zone.config'
const chainId = await getPublicClient(zoneConfig)!.getChainId()
```
```python [Python]
import os, requests
zone_rpc_url = os.environ["ZONE_RPC_URL"]
zone = requests.Session()
zone.headers["X-Authorization-Token"] = os.environ["ZONE_AUTH_TOKEN"]
response = zone.post(zone_rpc_url, json={
"jsonrpc": "2.0", "id": 1, "method": "eth_chainId", "params": []
})
response.raise_for_status()
print(response.json())
```
```bash [CLI]
cast chain-id --rpc-url "$ZONE_RPC_URL" \
--rpc-headers "X-Authorization-Token: $ZONE_AUTH_TOKEN"
```
:::
Reuse `zone` in the TypeScript and Python [balance examples](https://tempo.com/developers/docs/zones/balances). A successful HTTP request can still contain a JSON-RPC error, so check raw responses for `error` before you use `result`.
Compare the returned chain ID with the operator-provided configuration. Keep separate clients for public Tempo and the Zone's private ledger. Use the correct chain ID when you prepare signatures and calls.
::::
## Related
[Client Setup](https://tempo.com/developers/docs/zones/examples): Use for configuring the Zone chain and Wagmi client that the guides import.
[RPC Reference](https://tempo.com/developers/docs/protocol/zones/rpc): Covers per-account scoping, response redaction, and the authorization token format.
[Connect to the Sandbox](https://tempo.com/developers/docs/guide/private-zones/connect-to-a-zone): Use for trying the connection with test funds in the testnet sandbox.
[Deposit Into a Zone](https://tempo.com/developers/docs/zones/deposit): Use for funding the private account through the portal on Tempo.
[Testnet Sandbox](https://tempo.com/developers/docs/guide/private-zones): Covers the earlier testnet deployment and how it differs from current deployments.
> Source: [/docs/zones/examples](https://tempo.com/developers/docs/zones/examples.md)
> Section: [Zones](https://tempo.com/developers/docs/zones.md). Connect to a Zone and work with private balances, deposits, and withdrawals. Zones is live on Mainnet; see the introduction to set up a Zone. Earlier testnet sandbox guides describe a separate integration.
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
# Client Setup
Configure the Zone chain and authenticated Wagmi client that the Build examples import.
## Overview
`zone.config.ts` defines the Zone chain and an authenticated Wagmi config that the Build examples import. It needs the chain ID, Zone RPC URL, and authorization token from [Connect to a Zone](https://tempo.com/developers/docs/zones/connect).
These examples run on your backend. Have browser applications call your account-scoped backend. Don't give them shared operator credentials.
## Configure Wagmi for a Zone
Install `@wagmi/core` and `viem` with `pnpm add @wagmi/core viem`. Set `ZONE_CHAIN_ID`, `ZONE_PARENT_CHAIN_ID`, `ZONE_RPC_URL`, and `ZONE_AUTH_TOKEN` in your environment.
`ZONE_PARENT_CHAIN_ID` is the chain ID of the Tempo network that hosts the portal. It's `4217` for mainnet or `42431` for Moderato.
Save this file as `zone.config.ts` in an ESM project. It configures reads against the Zone, with no wallet connector or signing account.
```ts [zone.config.ts]
import { createConfig, http } from '@wagmi/core'
import { Zone } from 'viem/tempo'
const rpcUrl = process.env.ZONE_RPC_URL!
export const zoneChain = Zone.from({
sourceId: Number(process.env.ZONE_PARENT_CHAIN_ID),
id: Number(process.env.ZONE_CHAIN_ID),
name: 'Tempo Zone',
rpcUrls: { default: { http: [rpcUrl] } },
})
export const zoneConfig = createConfig({
chains: [zoneChain],
transports: {
[zoneChain.id]: http(rpcUrl, {
fetchOptions: {
headers: { 'X-Authorization-Token': process.env.ZONE_AUTH_TOKEN! },
},
}),
},
})
```
Import `zoneChain` or `zoneConfig` into each example. Set `account` to the authenticated address and `token` to the enabled token address. Set `decimals` to the token's configured precision. The Zone RPC scopes every read to the account that the authorization token represents.
## Use the Zone in React
For React applications, use your backend's authenticated, account-scoped RPC proxy as the browser transport. Configure its chain in your [Wagmi provider](https://tempo.com/developers/docs/guide/payments/send-a-payment/examples#wagmi-client). On every request, the server must authenticate the current user and select that user's Zone token. Don't use one shared account token for all customers.
## Related
[Deposit Into a Zone](https://tempo.com/developers/docs/zones/deposit): Use for funding a private account through the portal on Tempo.
[RPC Reference](https://tempo.com/developers/docs/protocol/zones/rpc): Covers per-account scoping and authorization tokens.
[Connect to the Sandbox](https://tempo.com/developers/docs/guide/private-zones/connect-to-a-zone): Use for trying a Viem Zone client with test funds in the testnet sandbox.
[Balances and Activity](https://tempo.com/developers/docs/zones/balances): Use for reading balances and transfers with this config.
> Source: [/docs/zones/deposit](https://tempo.com/developers/docs/zones/deposit.md)
> Section: [Zones](https://tempo.com/developers/docs/zones.md). Connect to a Zone and work with private balances, deposits, and withdrawals. Zones is live on Mainnet; see the introduction to set up a Zone. Earlier testnet sandbox guides describe a separate integration.
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
# Deposit Into a Zone
Deposit stablecoins through the Zone's portal on Tempo, then confirm the private account's credit.
## Overview
A deposit moves stablecoins from Tempo into a [Zone](https://tempo.com/developers/docs/zones), a private stablecoin ledger connected to Tempo. You send them to the Zone's portal (`ZonePortal`), a contract on Tempo that locks the backing assets. After Tempo finality, the Zone mints the same amount, less fees, to a private account. Only that account and the operator can read its balance.
This page uses an authenticated Zone RPC connection and the deployment details from [Connect to a Zone](https://tempo.com/developers/docs/zones/connect): the Zone ID, chain ID, portal address, and enabled assets. The Zone's operator, who runs the deployment, also supplies the tooling that encrypts deposits and calls the portal.
## Setup
:::steps
### Prepare the Deposit
Confirm that the deployment accepts the token. Confirm that its access rules, which the operator sets, permit the depositor and recipient. Choose the private recipient and memo. Also choose a public refund recipient (`tempoRefundRecipient`), a Tempo address that gets the funds back if the Zone can't credit the deposit.
#### Calculate Deposit Fees
Call the deployed portal's `calculateDepositFee()` and `calculateBouncebackFee()`. The deposit fee is a fixed processing fee that comes out of the amount sent. The bounce-back fee is deducted only if a failed deposit is refunded to Tempo, and the deposit must be large enough to cover it. Show the expected net credit before the depositor signs. The [deposit fee rules](https://tempo.com/developers/docs/protocol/zones/execution#deposit-fees) define the exact calculation.
### Submit the Deposit
Use the operator's supported tooling to encrypt the private recipient and memo with the operator's published encryption key. Approve the portal to spend the token if your tooling requires an approval. Then call `ZonePortal.depositEncrypted` on Tempo with the token, amount, encrypted payload, and refund recipient. The portal appends each deposit to a queue that the Zone processes in order. Save the queue hash the call returns, which identifies this deposit in [Track the Deposit](https://tempo.com/developers/docs/zones/deposit#track-the-deposit).
The token, amount, depositor, and refund recipient stay public, as the [privacy model](https://tempo.com/developers/docs/zones/privacy) describes.
### Confirm the Credit
After the Tempo transaction finalizes, [check the Zone credit](https://tempo.com/developers/docs/zones/balances) with the recipient's authenticated connection. Store the queue hash with the private balance change it produced, so you can match each public deposit to its credit.
:::
## Track the Deposit
Read the deposit outcome with the hosted [Zone status API](https://tempo.com/developers/docs/api/zones). Look it up by the queue hash that `ZonePortal.depositEncrypted` returns, not by its transaction hash.
The API needs a Tempo API key with `data:read` and access to that Zone, created in [Tempo Console](https://tempo.com/developers/docs/api/authentication#api-keys). In the playground, select **Try**. Enter the queue hash and the Zone's numeric `chainId` from the operator. The request tool includes language examples and the response.
`GET /v1/zones/deposits/{depositHash}`
Get Zone deposit
[API reference](https://tempo.com/developers/docs/api/zones#getzonedeposit) — request parameters, authentication, and response schema. The examples below use editable sample values.
Requires a [Tempo API key](https://tempo.com/developers/docs/api/console/api-keys). Replace `YOUR_API_KEY` before running this request.
**cURL**
```bash
curl 'https://api.tempo.xyz/v1/zones/deposits/0x1111111111111111111111111111111111111111111111111111111111111111?chainId=1424310003' \
--header 'tempo-api-key: YOUR_API_KEY'
```
**TypeScript**
```ts
fetch('https://api.tempo.xyz/v1/zones/deposits/0x1111111111111111111111111111111111111111111111111111111111111111?chainId=1424310003', {
headers: {
'tempo-api-key': 'YOUR_API_KEY'
}
})
```
The response `status` is `pending`, `completed` (the Zone credited the recipient), or `failed`. For a `failed` deposit, `refund` names the refund recipient, and `refund.status` is `pending` while the refund's delivery is unverified. Confirm the refund before you retry. Read the private account's ledger with authenticated [balance and activity reads](https://tempo.com/developers/docs/zones/balances).
## Handle Deposit Failures
A deposit fails in the Zone when decryption fails or the Zone can't mint to the recipient, such as when a token policy blocks it. The inbox (`ZoneInbox`) then queues a refund to the refund recipient on Tempo, less the bounce-back fee. If that Tempo transfer also fails, the portal records a refund that the refund recipient claims with `claimRefund(token)`. The [encrypted deposit rules](https://tempo.com/developers/docs/protocol/zones/bridging#encrypted-deposits) cover each case. Confirm the eventual credit or refund before you retry a deposit.
If funds start on another network, [route them to Tempo](https://tempo.com/developers/docs/routes) first. Then deposit through the portal.
## Related
[Balances and Activity](https://tempo.com/developers/docs/zones/balances): Use for confirming the private credit with an authenticated read.
[Bridging](https://tempo.com/developers/docs/protocol/zones/bridging): Covers encrypted deposits, the deposit lifecycle, and refunds.
[Deposit OUSD](https://tempo.com/developers/docs/guide/private-zones/deposit-to-a-zone): Use for trying a deposit with OUSD test funds in the testnet sandbox.
[Withdraw From a Zone](https://tempo.com/developers/docs/zones/withdraw): Use for returning funds to Tempo and tracking delivery.
> Source: [/docs/zones/balances](https://tempo.com/developers/docs/zones/balances.md)
> Section: [Zones](https://tempo.com/developers/docs/zones.md). Connect to a Zone and work with private balances, deposits, and withdrawals. Zones is live on Mainnet; see the introduction to set up a Zone. Earlier testnet sandbox guides describe a separate integration.
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
# Balances and Activity
Read a private account's token balances and transfer history from a Zone.
## Overview
Balance and activity reads go through the [account-scoped, redacted Zone RPC](https://tempo.com/developers/docs/zones/connect), which scopes results to the authenticated account.
The examples use the authenticated `zone` client from [Connect to a Zone](https://tempo.com/developers/docs/zones/connect#check-the-connection) and `zoneConfig` from [Client Setup](https://tempo.com/developers/docs/zones/examples). With a hosted provider, use its read API instead.
## Read Balances
Use the Zone token's `balanceOf` through `eth_call`. The Zone RPC executes the call as the authenticated account. Execution-level privacy restricts which balances it can read. Don't substitute `eth_getBalance` for a token balance query.
Set `ZONE_ACCOUNT` to the authenticated account, `ZONE_TOKEN` to the enabled token, and `ZONE_TOKEN_DECIMALS` to its configured precision.
:::code-group
```ts [Viem]
const account = process.env.ZONE_ACCOUNT as `0x${string}`
const token = process.env.ZONE_TOKEN as `0x${string}`
const decimals = Number(process.env.ZONE_TOKEN_DECIMALS)
const balance = await zone.token.getBalance({ account, token, decimals })
console.log(balance.formatted)
```
```ts [Wagmi]
import { Actions } from '@wagmi/core/tempo'
const balance = await Actions.token.getBalance(zoneConfig, { account, token, decimals })
console.log(balance.formatted)
```
```python [Python]
account, token = os.environ["ZONE_ACCOUNT"], os.environ["ZONE_TOKEN"]
data = "0x70a08231" + account[2:].rjust(64, "0")
response = zone.post(zone_rpc_url, json={
"jsonrpc": "2.0", "id": 1, "method": "eth_call",
"params": [{"to": token, "data": data}, "latest"],
})
response.raise_for_status()
print(int(response.json()["result"], 16))
```
```bash [CLI]
cast erc20 balance "$ZONE_TOKEN" "$ZONE_ACCOUNT" \
--rpc-url "$ZONE_RPC_URL" \
--rpc-headers "X-Authorization-Token: $ZONE_AUTH_TOKEN"
```
:::
Viem and Wagmi return a formatted decimal string. Python and Cast return integer base units, which you format with `ZONE_TOKEN_DECIMALS`. The Python example encodes `balanceOf(address)` with selector `0x70a08231` and the account as a 32-byte word. Check raw JSON-RPC responses for `error` before you read `result`.
Some restricted reads about another account return an empty, zero, or `null` value, so they don't expose that account's data. [Method access control](https://tempo.com/developers/docs/protocol/zones/rpc#method-access-control) lists which reads do this.
## Read Activity
Use account-scoped `eth_getLogs` filters or log subscriptions for supported token events. Filters must name the authenticated account in an indexed topic. The Zone RPC rejects broad filters, as [event filtering](https://tempo.com/developers/docs/protocol/zones/rpc#event-filtering) describes.
Continue with the same `zone`, `account`, and `token`. Set `ZONE_FROM_BLOCK` to the first Zone block you need to reconcile. These examples read incoming transfers:
:::code-group
```ts [Viem]
import { parseAbiItem } from 'viem'
const incoming = await zone.getLogs({
address: token,
event: parseAbiItem('event Transfer(address indexed from, address indexed to, uint256 amount)'),
args: { to: account },
fromBlock: BigInt(process.env.ZONE_FROM_BLOCK!),
toBlock: 'latest',
})
```
```ts [Wagmi]
import { getPublicClient } from '@wagmi/core'
import { Abis } from 'viem/tempo'
const incoming = await getPublicClient(zoneConfig)!.getContractEvents({
address: token, abi: Abis.tip20, eventName: 'Transfer',
args: { to: account },
fromBlock: BigInt(process.env.ZONE_FROM_BLOCK!),
toBlock: 'latest',
})
```
```python [Python]
transfer = "0xddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef"
query = {"address": token, "topics": [transfer, None, "0x" + account[2:].rjust(64, "0")],
"fromBlock": hex(int(os.environ["ZONE_FROM_BLOCK"])), "toBlock": "latest"}
response = zone.post(zone_rpc_url, json={
"jsonrpc": "2.0", "id": 1, "method": "eth_getLogs", "params": [query]
})
response.raise_for_status()
print(response.json())
```
```bash [CLI]
cast logs 'Transfer(address indexed from, address indexed to, uint256 amount)' \
'' "$ZONE_ACCOUNT" --address "$ZONE_TOKEN" \
--from-block "$ZONE_FROM_BLOCK" --to-block latest \
--rpc-url "$ZONE_RPC_URL" \
--rpc-headers "X-Authorization-Token: $ZONE_AUTH_TOKEN"
```
:::
For outgoing transfers, use `args: { from: account }` in Viem and Wagmi. In Cast, swap the arguments to `"$ZONE_ACCOUNT" ''`. In Python, put the account in `topics[1]` instead of `topics[2]`.
Query incoming and outgoing transfers separately and deduplicate shared events. Save the last processed block, and use bounded ranges for repeated history reads.
Transaction and receipt reads are scoped to the sender. To verify an incoming deposit, use the recipient's permitted token events and balance reads. Don't rely on access to the sender's receipt.
## Preserve the Privacy Boundary
Tie cached responses and saved history to the authenticated customer, as [Privacy](https://tempo.com/developers/docs/zones/privacy#keep-application-access-scoped) describes. Show a withdrawal as pending until Tempo delivers it, as [Withdraw From a Zone](https://tempo.com/developers/docs/zones/withdraw) describes.
## Related
[Withdraw From a Zone](https://tempo.com/developers/docs/zones/withdraw): Use for returning funds to Tempo and tracking delivery.
[RPC Reference](https://tempo.com/developers/docs/protocol/zones/rpc): Covers method access control, event filtering, and response redaction.
[Client Setup](https://tempo.com/developers/docs/zones/examples): Use for setting up the Wagmi client in these examples.
[Connect to a Zone](https://tempo.com/developers/docs/zones/connect): Use for authenticating the Zone RPC client.
> Source: [/docs/zones/withdraw](https://tempo.com/developers/docs/zones/withdraw.md)
> Section: [Zones](https://tempo.com/developers/docs/zones.md). Connect to a Zone and work with private balances, deposits, and withdrawals. Zones is live on Mainnet; see the introduction to set up a Zone. Earlier testnet sandbox guides describe a separate integration.
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
# Withdraw From a Zone
Withdraw through the Zone's outbox, then track delivery to a Tempo recipient.
## Overview
A withdrawal moves funds from a [Zone](https://tempo.com/developers/docs/zones), a private stablecoin ledger, back to a recipient on Tempo. You submit it to the Zone's outbox (`ZoneOutbox`), a contract that burns the Zone-side tokens and queues the withdrawal. The sequencer, which orders Zone blocks, groups queued withdrawals into a batch. The Zone's portal (`ZonePortal`), which holds the backing assets on Tempo, accepts the batch and releases the tokens.
So the source transaction, the accepted batch, and the recipient's token receipt are three separate events. Track each one.
This page uses an authenticated Zone RPC connection and the deployment details from [Connect to a Zone](https://tempo.com/developers/docs/zones/connect): the Zone ID, chain ID, and outbox and portal addresses.
## Setup
:::steps
### Prepare the Withdrawal
Confirm the token, amount, Tempo recipient, and fallback recipient with the operator's tooling. The fallback recipient (`zoneFallbackRecipient`) is a Zone account that gets the funds back if delivery on Tempo fails. Confirm that the deployment's funding rules permit the token, the recipient, and any callback.
A callback is a contract call on Tempo that runs with the withdrawal, such as a swap. If you use one, confirm the target and its callback interface before you sign. A portal can restrict callbacks to registered targets, which is called gateway enforcement. Then the portal admin must grant the target the `CallbackGateway` role.
#### Calculate Withdrawal Fees
Read `calculateWithdrawalFee(gasLimit)` from the deployed outbox. `gasLimit` is the gas you reserve for a callback, and `0` for a plain withdrawal. Reserve this fee and the Zone transaction fee on top of the amount withdrawn. The [withdrawal fee rules](https://tempo.com/developers/docs/protocol/zones/execution#withdrawal-fees) define the calculation.
### Submit the Withdrawal
Submit the withdrawal to the outbox with the SDK or contract interface the operator supports for your deployment. Interfaces differ between deployments. Save the source transaction hash and the withdrawal's `senderTag`. Tempo shows the `senderTag` instead of the sender's address, which keeps the sender private. You use it to look up the withdrawal in [Track the Withdrawal](https://tempo.com/developers/docs/zones/withdraw#track-the-withdrawal). Its [derivation](https://tempo.com/developers/docs/protocol/zones/bridging#verifiable-withdrawals) uses the sender, the transaction hash, and a per-withdrawal `fallbackNonce`.
### Confirm Delivery
The sequencer includes the withdrawal in a batch. The portal accepts the batch, then processes the withdrawal and transfers the tokens on Tempo. Keep it pending until the recipient's delivery is confirmed, as [Track the Withdrawal](https://tempo.com/developers/docs/zones/withdraw#track-the-withdrawal) describes.
:::
## Track the Withdrawal
Read Tempo outcomes with the hosted [Zone withdrawal status API](https://tempo.com/developers/docs/api/zones), part of the Tempo API. It looks up withdrawals by `senderTag` and returns each processed withdrawal in `data`. Use the tag of this withdrawal, since withdrawals in one transaction can have different tags.
Each outcome has two status fields:
* **`status`:** `completed` or `failed`, for delivery on Tempo. `transactionHash` is the Tempo transaction that processed the withdrawal.
* **`zoneStatus`:** `completed` once the Zone has proven it imported the Tempo block that processed the withdrawal. It says nothing about delivery or a refund.
The API needs a Tempo API key with `data:read` and access to that Zone, created in [Tempo Console](https://tempo.com/developers/docs/api/authentication#api-keys). In the playground, select **Try**. Enter the `senderTag` and the Zone's numeric `chainId` from the operator. The request tool includes language examples and the response.
`GET /v1/zones/withdrawals/{senderTag}`
List Zone withdrawals
[API reference](https://tempo.com/developers/docs/api/zones#listzonewithdrawals) — request parameters, authentication, and response schema. The examples below use editable sample values.
Requires a [Tempo API key](https://tempo.com/developers/docs/api/console/api-keys). Replace `YOUR_API_KEY` before running this request.
**cURL**
```bash
curl 'https://api.tempo.xyz/v1/zones/withdrawals/0x61fc42a734cb44acef497ea0bed612c691195623244136e0739e1929569e2487?chainId=1424310003' \
--header 'tempo-api-key: YOUR_API_KEY'
```
**TypeScript**
```ts
fetch('https://api.tempo.xyz/v1/zones/withdrawals/0x61fc42a734cb44acef497ea0bed612c691195623244136e0739e1929569e2487?chainId=1424310003', {
headers: {
'tempo-api-key': 'YOUR_API_KEY'
}
})
```
An empty `data` array means no outcome is indexed yet. Keep the withdrawal pending until `status` is `completed`, or until a `failed` withdrawal's funds return to the fallback recipient, as [Handle Withdrawal Failures](https://tempo.com/developers/docs/zones/withdraw#handle-withdrawal-failures) describes.
## Handle Withdrawal Failures
A withdrawal fails when its token transfer or callback reverts on Tempo, such as from a token pause or a TIP-403 policy. The portal then bounces back the funds, which means it deposits them into the source Zone again, to the fallback recipient. The withdrawal fee isn't refunded.
The bounce-back is a deposit, so the sequencer processes it like any other. If a policy or pause blocks minting in the Zone, the inbox (`ZoneInbox`) records a pending refund instead. The fallback recipient claims it with `ZoneInbox.claimRefund(token)` once minting is permitted. [Withdrawal failure and bounce-back](https://tempo.com/developers/docs/protocol/zones/bridging#withdrawal-failure-and-bounce-back) covers each case.
## Call a Contract on Tempo
A withdrawal with a callback calls a contract on Tempo through `ZoneMessenger`, subject to the deployment's access rules. The token transfer and the call succeed or revert together. If the call deposits into a Zone, that Zone credit settles separately, after the Tempo call. The [composable withdrawal specification](https://tempo.com/developers/docs/protocol/zones/bridging#composable-withdrawals) defines the callback interface and limits.
## Related
[Bridging](https://tempo.com/developers/docs/protocol/zones/bridging): Covers withdrawals, composable callbacks, and bounce-back refunds.
[Withdraw OUSD](https://tempo.com/developers/docs/guide/private-zones/withdraw-from-a-zone): Use for trying a withdrawal with OUSD test funds in the testnet sandbox.
[Balances and Activity](https://tempo.com/developers/docs/zones/balances): Use for reading the private balance before and after a withdrawal.
[Deposit Into a Zone](https://tempo.com/developers/docs/zones/deposit): Use for funding a private account through the portal on Tempo.
> Source: [/docs/protocol/zones](https://tempo.com/developers/docs/protocol/zones.md)
> Section: [Zones](https://tempo.com/developers/docs/zones.md). Connect to a Zone and work with private balances, deposits, and withdrawals. Zones is live on Mainnet; see the introduction to set up a Zone. Earlier testnet sandbox guides describe a separate integration.
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
# How Zones Work
Zones are private stablecoin ledgers that use Tempo for deposits, withdrawals, and settlement.
## Overview
A Zone keeps balances and account activity private. Each Zone has a portal (`ZonePortal`) on Tempo and a private ledger. The portal holds the Zone's backing assets. The Zone's operator maintains the ledger. A deposit locks tokens in the portal and credits a private account. A withdrawal moves tokens back to a Tempo address.
The Technical Reference specifies each part of this model:
* **[Architecture](https://tempo.com/developers/docs/protocol/zones/architecture):** Covers contracts, chain IDs, sequencer management, and the trust model.
* **[Accounts and Privacy](https://tempo.com/developers/docs/protocol/zones/accounts):** Covers read restrictions on balances, allowances, and other account data.
* **[Bridging](https://tempo.com/developers/docs/protocol/zones/bridging):** Covers deposits, withdrawals, encrypted deposits, and withdrawal callbacks.
* **[RPC Reference](https://tempo.com/developers/docs/protocol/zones/rpc):** Covers authorization tokens, method access, redaction, and event filtering.
* **[Execution and Gas](https://tempo.com/developers/docs/protocol/zones/execution):** Covers fee tokens, bridge fees, fixed gas costs, and token management.
* **[Proving and Settlement](https://tempo.com/developers/docs/protocol/zones/proving):** Covers batch submission, verification, and current enforcement limits.
A public ZonePortal holds backing assets and bridge queues on Tempo. The operator runs a separate private account ledger. Deposits and withdrawals cross the boundary, while settlement submits commitments and sequencer certificates.
## Private Accounts
Accounts read their own balances and activity through the authenticated Zone RPC. Other users and public block explorers can't browse the Zone's ledger. The operator can see its full state. Bridge activity stays public on Tempo, as the [Zone visibility model](https://tempo.com/developers/docs/zones/privacy) describes.
Public observers see bridge amounts, withdrawal destinations, and settlement checkpoints. An authenticated account can read its own private balance and history. The operator can see the entire Zone state.
The Zone restricts [account reads](https://tempo.com/developers/docs/protocol/zones/accounts), such as private balances and allowances. Its [RPC](https://tempo.com/developers/docs/protocol/zones/rpc) scopes each response to the authenticated account.
## Issuer Policies
Tokens keep their issuer's transfer policies inside a Zone. Zone execution reads those policies from a finalized Tempo checkpoint. The same issuer rules govern which accounts can send or receive tokens.
The issuer updates its TIP-403 policy on Tempo. The Zone imports a finalized checkpoint through TempoState and applies the policy at that checkpoint during token execution.
The [TIP-403 registry](https://tempo.com/developers/docs/protocol/tip403/overview) defines the policies. Zone [execution](https://tempo.com/developers/docs/protocol/zones/execution) applies them.
## Settlement on Tempo
The sequencer groups Zone blocks into batches and submits their commitments to the portal. When the portal accepts a batch, it records the Zone's progress. It then makes the batch's withdrawals available for processing on Tempo. [Proving and settlement](https://tempo.com/developers/docs/protocol/zones/proving) defines the checks and their current limits.
## Access to Tempo Liquidity
Withdrawals can call Tempo contracts through [composable withdrawals](https://tempo.com/developers/docs/protocol/zones/bridging#composable-withdrawals). An application can combine token delivery with a Stablecoin DEX swap or a deposit into another Zone. The public part of the route uses Tempo's liquidity. The destination Zone then processes its deposit into a private balance.
## Source and Specification
The [Zones repository](https://github.com/tempoxyz/zones) contains the implementation and [protocol specification](https://github.com/tempoxyz/zones/blob/main/specs/spec.md).
## Related
[Tempo Zones](https://tempo.com/developers/docs/zones): Covers what a Zone is, who it's for, and the reading path through Build.
[Privacy](https://tempo.com/developers/docs/zones/privacy): Covers who can see Zone data and the trust assumptions behind it.
[Connect to a Zone](https://tempo.com/developers/docs/zones/connect): Use for authorizing your application's access to a Zone deployment.
[Testnet Sandbox](https://tempo.com/developers/docs/guide/private-zones): Use for trying Zone flows with test funds on earlier testnet deployments.
> Source: [/docs/protocol/zones/architecture](https://tempo.com/developers/docs/protocol/zones/architecture.md)
> Section: [Zones](https://tempo.com/developers/docs/zones.md). Connect to a Zone and work with private balances, deposits, and withdrawals. Zones is live on Mainnet; see the introduction to set up a Zone. Earlier testnet sandbox guides describe a separate integration.
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
# Architecture
A Zone is a private ledger of stablecoin balances and account activity, connected to a `ZonePortal` contract on Tempo.
## Overview
The portal holds the backing assets. The Zone executes transactions and tracks balances privately. Deposits move funds into this ledger. Withdrawals release funds back on Tempo.
## Fund Flow
* **Deposit:** A user deposits TIP-20 tokens into the portal on Tempo. After the deposit's Tempo block finalizes, `ZoneInbox` processes the deposit. It mints the corresponding tokens to the recipient inside the Zone.
* **Execute:** Users submit transactions to the Zone RPC. The Zone updates its own account state. Its transaction history and balances aren't published on Tempo.
* **Withdraw:** `ZoneOutbox` burns the user's Zone tokens and queues a withdrawal. Tempo then accepts the batch containing that withdrawal. The portal processes it and releases the backing tokens to the Tempo recipient.
ZoneFactory deploys ZonePortal on Tempo. Finalized deposits flow from the portal to ZoneInbox; ZoneOutbox queues withdrawals back to the portal. ZoneMessenger executes callback withdrawals. TempoState provides the imported public checkpoint to Zone precompiles.
Withdrawals can also call a Tempo contract through `ZoneMessenger` with a [withdrawal callback](https://tempo.com/developers/docs/protocol/zones/bridging). This enables a DEX swap or a deposit into another Zone. The portal's access and gateway settings must permit it.
`TempoState` records the finalized Tempo checkpoint used by Zone execution. Deposit queues and issuer policies are read at that checkpoint. A policy update becomes visible when the Zone imports its finalized Tempo block.
## Batches and Settlement
The sequencer groups Zone blocks into batches and submits their commitments to the portal. A batch records the Zone's progress, processed deposits, and withdrawal queue. Before accepting a batch, the portal checks:
* Continuity with the previous batch.
* Signatures from the configured sequencer quorum.
* The result of its configured verifier.
Accepting the batch makes its withdrawals available for processing on Tempo. Bridge activity and settlement commitments are public. The private ledger isn't published.
Sequencer certificates authenticate batch commitments but don't independently prove correct execution. Enforcement depends on the deployed verifier and its configuration, as the [proving implementation status](https://tempo.com/developers/docs/protocol/zones/proving#implementation-status) describes.
## Contract Architecture
The public contracts manage backing assets and settlement. Zone precompiles maintain the private ledger and its connection to Tempo.
### Tempo Contracts
* **`ZoneFactory`:** Creates Zones and installs a deterministic `ZonePortal` proxy for each one. All portals use the same protocol-managed implementation, verifier, and messenger.
* **`ZonePortal`:** The central bridge contract. It locks deposited tokens, checks settlement certificates, calls the configured verifier, and processes withdrawals. It maintains the authoritative state: deposits made, batches accepted, and withdrawals pending.
* **`ZoneMessenger`:** Handles withdrawals that include callbacks, shared by all Zones. A user can withdraw tokens and trigger a contract call atomically. The messenger executes both operations together. If the callback fails, the token delivery and callback revert together. The portal then enqueues a bounce-back to the Zone.
The protocol manages the shared Tempo contracts at these addresses:
| Component | Address |
|-----------|---------|
| `ZoneFactory` | `0x5AF2000000000000000000000000000000000000` |
| `ZonePortal` implementation | `0x5AD1000000000000000000000000000000000000` |
| Zone verifier | `0x5a56000000000000000000000000000000000000` |
| `ZoneMessenger` | `0x5A4d000000000000000000000000000000000000` |
### Zone Predeploys
Zones expose these Zone-native system precompiles at fixed addresses:
| Contract | Address | Purpose |
|----------|---------|---------|
| `TempoState` | `0x1c00...0000` | Stores finalized Tempo block headers so Zone execution can read deposit queues and issuer policies at the imported checkpoint. |
| `ZoneInbox` | `0x1c00...0001` | Processes incoming deposits. Mints tokens to recipients and validates that processed deposits match what the portal expects. |
| `ZoneOutbox` | `0x1c00...0002` | Handles withdrawal requests. Users burn their Zone tokens here and specify a Tempo recipient. |
| `ZoneFeeManager` | `0xfeec...0001` | Resolves the default fee token and settles gas charges directly in the selected token. |
The portal admin enables TIP-20 tokens on the Zone. Any enabled, initialized TIP-20 token can pay for Zone gas, as described in [execution and gas](https://tempo.com/developers/docs/protocol/zones/execution).
## Creating a Zone
Zone creation is currently restricted to `ZoneFactory.owner()`. The factory assigns a Zone ID. It initializes a deterministic `ZonePortal` proxy using the shared implementation, verifier, and messenger.
[TIP-1091](https://tips.sh/1091) specifies the factory. [T11](https://tempo.com/developers/docs/protocol/upgrades/t11#duplicate-checks) sets the role-list validation requirements.
### Chain ID
Each Zone has a unique EIP-155 chain ID derived deterministically from its onchain Zone ID:
```text
chain_id = 421700000 + zone_id
```
This is the mainnet formula. Moderato Zones instead use `1424310000 + zone_id`. Local networks use `(parent_chain_id << 32) | zone_id`. Read `eth_chainId` from your Zone RPC rather than applying the mainnet formula to testnet. These separate ranges prevent replay between Zones and the Tempo networks they connect to.
## Sequencer Management
An operator runs a Tempo node alongside its Zone nodes. The active leader produces Zone blocks. The configured sequencer set signs settlement commitments. The operator imports finalized Tempo checkpoints, processes deposits, and submits batches and withdrawals to Tempo.
The portal admin calls `ZonePortal.setSequencerSet(newSequencers, newThreshold)`. This replaces the sequencer set and settlement threshold atomically. A replacement increments the configuration nonce. It invalidates settlement certificates from the previous configuration. Each certificate requires at least `threshold` distinct signatures from the active set.
Use the portal ABI for the runtime installed on your network when updating this configuration. The factory's `sequencers` and `threshold` fields describe the initial settlement configuration. The portal supports up to eight sequencers.
`setLeader(newLeader, expectedEpoch)` changes the active block producer. Leader epochs and finalized Tempo activation blocks fence the previous leader.
## Trust Model
Zones make explicit tradeoffs between trust and performance:
| What You Trust | What Could Go Wrong |
|---|---|
| Operator nodes for liveness | Block production halts without an active leader; settlement stalls without the configured signature quorum. |
| Sequencer for inclusion and ordering | Transactions (including withdrawals) can be excluded or reordered. |
| Sequencer for privacy | The sequencer can see all transactions on the Zone. |
| Sequencer for data | Reconstructing the state of the Zone without the sequencer is impossible. |
| Settlement quorum and deployed verifier for correctness | A signature quorum doesn't prove correct execution. Enforcement depends on the active verifier, approved enclave measurements, and attestation verification. |
Failed withdrawal deliveries [bounce back](https://tempo.com/developers/docs/protocol/zones/bridging#withdrawal-failure-and-bounce-back) to the private `zoneFallbackRecipient`. If Zone minting is also blocked, the inbox records a pending refund for later claiming. Token restrictions can delay recovery. They don't make a failed delivery block the withdrawal queue.
## Portal Access and Pausing
Portal admins manage account membership and callback gateways separately from sequencer membership. These settings determine whether a particular cross-Zone flow is allowed:
* **Closed Access:** Enforces account membership at the bridge. It requires callbacks to deposit back into the source portal.
* **Gateway Enforcement:** Restricts callbacks to registered targets.
The admin, a sequencer, or a registered pause guardian can pause the portal for 30 days. The pause blocks deposits, withdrawal requests, and withdrawal processing. Settlement submissions remain available. The admin can resume it earlier. The admin can also schedule permanent abdication of individual configuration capabilities after a 30-day delay.
## Related
[Bridging](https://tempo.com/developers/docs/protocol/zones/bridging): Covers deposits, withdrawals, encrypted deposits, and composable withdrawal callbacks.
[Proving and Settlement](https://tempo.com/developers/docs/protocol/zones/proving): Covers batch acceptance, execution validation, and verification guarantees.
[Execution and Gas](https://tempo.com/developers/docs/protocol/zones/execution): Covers fee tokens, deposit and withdrawal fees, fixed gas costs, and token management.
[Accounts and Privacy](https://tempo.com/developers/docs/protocol/zones/accounts): Covers private balances, private allowances, and account-scoped access control.
> Source: [/docs/protocol/zones/accounts](https://tempo.com/developers/docs/protocol/zones/accounts.md)
> Section: [Zones](https://tempo.com/developers/docs/zones.md). Connect to a Zone and work with private balances, deposits, and withdrawals. Zones is live on Mainnet; see the introduction to set up a Zone. Earlier testnet sandbox guides describe a separate integration.
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
# Accounts and Privacy
A Zone keeps your balance and account activity private from other users.
## Overview
Zone privacy has two layers. RPC requests authenticate your Tempo account. Contract execution then restricts which balances and allowances that caller can read. Together, they enforce the account-level part of the [Zone visibility model](https://tempo.com/developers/docs/zones/privacy).
An account signs an authorization token for account-scoped RPC access. The RPC sends contract calls from that account. At the token contract, balance reads require the balance owner; allowance reads require the owner or spender.
The [RPC](https://tempo.com/developers/docs/protocol/zones/rpc) scopes transactions and event logs to your account. It blocks raw storage reads such as `eth_getStorageAt`. Contract-level caller checks prevent an `eth_call` from exposing another account's balance.
## Private Balances
Anyone can read any account's balance on public Tempo. A Zone enforces caller restrictions on TIP-20 `balanceOf(address)`:
* If `msg.sender == account`, the call succeeds and returns the balance.
* Otherwise, the call reverts with `Unauthorized()`.
These checks also apply to sequencer-signed getter calls. The Zone operator can still inspect the underlying node state. Account privacy doesn't hide balances from your operator. A contract on the Zone can't read and emit another account's balance.
## Private Allowances
The `allowance(owner, spender)` function is similarly restricted:
* If `msg.sender == owner` or `msg.sender == spender`, the call succeeds.
* Otherwise, the call reverts with `Unauthorized()`.
A non-zero allowance reveals a relationship between `owner` and `spender`. Restricting reads to those two parties preserves TIP-20 approval flows. It doesn't expose the allowance to other accounts.
## Other Account Reads
Public views like `totalSupply()`, `name()`, `symbol()`, and `decimals()` remain unrestricted. Some account-specific reads are restricted to their account owner:
* Permit nonces.
* `NonceManager` nonces.
* `AccountKeychain` key and spending-limit reads.
## Execution Rules
Zones reject public TIP-20 transfer calls with `Unauthorized()`. Token movement uses the inbox and outbox. Approval and permit calls remain available.
Zones also charge [fixed gas costs](https://tempo.com/developers/docs/protocol/zones/execution#fixed-gas-costs) for selected TIP-20 operations. These prevent gas-based side channels.
Zones currently [disable contract creation](https://tempo.com/developers/docs/protocol/zones/execution#contract-creation-disabled) (`CREATE` and `CREATE2`).
## Related
[Privacy](https://tempo.com/developers/docs/zones/privacy): Covers who can see Zone data and the trust assumptions behind it.
[RPC Reference](https://tempo.com/developers/docs/protocol/zones/rpc): Covers authorization tokens, method scoping, response redaction, and event filtering.
[Execution and Gas](https://tempo.com/developers/docs/protocol/zones/execution): Covers fee tokens, deposit and withdrawal fees, fixed gas costs, and token management.
> Source: [/docs/protocol/zones/bridging](https://tempo.com/developers/docs/protocol/zones/bridging.md)
> Section: [Zones](https://tempo.com/developers/docs/zones.md). Connect to a Zone and work with private balances, deposits, and withdrawals. Zones is live on Mainnet; see the introduction to set up a Zone. Earlier testnet sandbox guides describe a separate integration.
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
# Bridging
The portal (`ZonePortal`) connects a Zone's private ledger to tokens on Tempo.
## Overview
Deposits lock tokens in the portal and credit a private account. Withdrawals burn the Zone-side tokens and release the backing assets to a Tempo recipient.
Both flows settle in stages. Deposits enter the Zone after Tempo finality. Withdrawals reach Tempo after their batch is accepted. Bridge amounts are public, and the account ledger stays private.
## Deposits
A deposit moves tokens from Tempo into a Zone. It starts on Tempo and finishes when `ZoneInbox` processes it inside the Zone. The recipient and memo are encrypted to the operator. The token, amount, and public depositor stay visible on Tempo.
A Tempo account encrypts recipient details and submits a deposit. ZonePortal checks the request, locks backing assets, and queues the net deposit. After Tempo finality, ZoneInbox decrypts and processes it, then credits the recipient’s private balance.
1. User calls `ZonePortal.depositEncrypted(token, amount, keyIndex, encryptedPayload, tempoRefundRecipient)` on Tempo. `deposit` is an alias with the same encrypted-only arguments. There's no plaintext recipient entry point.
2. The portal validates the token, encryption key, refund recipient, and configured access rules. It checks that deposits are active and deducts the [deposit fee](https://tempo.com/developers/docs/protocol/zones/execution#deposit-fees). It then locks the funds and appends a deposit to the queue.
3. The sequencer observes `DepositMade` events and processes deposits in order via `ZoneInbox.advanceTempo()`. This mints the corresponding Zone-side TIP-20 token to the recipient.
4. Batch submission confirms deposit progress on the portal. The stateless proof function replays deposit processing against witnessed Tempo state, within the [current settlement verification limits](https://tempo.com/developers/docs/protocol/zones/proving).
### Encrypted Deposits
All user deposits encrypt the recipient and memo using the operator's published encryption key. Nodes that hold the corresponding private key can decrypt the deposit. They then credit its recipient on the Zone.
The deposit fields have this visibility:
| Field | Visibility | Reason |
|-------|------------|--------|
| `token` | Public | Needed for locked token accounting |
| `sender` | Public | Tempo account or gateway making the deposit |
| `tempoRefundRecipient` | Public | Receives a failed-deposit refund on Tempo |
| `amount` | Public | Needed for onchain locked token accounting |
| `to` | Encrypted | Only holders of the decryption key know the recipient |
| `memo` | Encrypted | Only holders of the decryption key know the payment context |
The encryption uses ECIES with secp256k1:
1. Sequencer publishes a secp256k1 encryption public key via `setSequencerEncryptionKey()` with a proof of possession.
2. User generates an ephemeral keypair and derives a shared secret via ECDH.
3. User encrypts `(to || memo)` with AES-256-GCM using the derived key.
4. User calls `depositEncrypted(token, amount, keyIndex, encryptedPayload, tempoRefundRecipient)` on the portal.
The inbox verifies a Chaum–Pedersen proof of the ECDH shared secret before decrypting. Ciphertext authentication can fail, or the Zone can be unable to mint to the recipient. In either case, the inbox queues a refund to `tempoRefundRecipient` on Tempo. The refund deducts the configured bounce-back fee when that fee can be collected.
If the Tempo transfer fails, the portal records `refunds(token, owner)`. The recipient recovers it through `claimRefund(token)` once the applicable restrictions permit it.
## Withdrawals
A withdrawal moves tokens from a Zone back to Tempo. It starts with a request to `ZoneOutbox`, which burns the Zone-side amount and records the public recipient. The sequencer includes the request in a batch before the portal can deliver the tokens on Tempo.
ZoneOutbox burns the Zone tokens and queues a withdrawal. The operator finalizes the withdrawal queue and submits signed batch commitments. ZonePortal checks the certificate, continuity, and configured verifier before accepting the batch. The queued withdrawal is then processed to deliver tokens or invoke a callback on Tempo.
1. **Batch submission:** The sequencer calls `finalizeWithdrawalBatch()` at the end of the final block in a batch. This constructs the withdrawal hash chain. It writes the `withdrawalQueueHash` and `withdrawalBatchIndex` to state. An accepted portal batch commits this state and adds withdrawals to Tempo's queue. The [verifier interface](https://tempo.com/developers/docs/protocol/zones/proving#verifier-interface) sets the certificate checks, execution validation, and current verifier behavior.
2. **Withdrawal processing:** The sequencer calls `processWithdrawals(withdrawals, remainingQueue)` on Tempo to process withdrawals in FIFO order.
### Composable Withdrawals
Withdrawals support callbacks to Tempo contracts via `ZoneMessenger`. When `gasLimit > 0`, the messenger:
1. Receives tokens from the portal, then transfers them to the target.
2. Calls the target with the provided `callbackData`.
Both operations are atomic. If the callback reverts, the transfer reverts too. Receiving contracts:
* Implement `IWithdrawalReceiver`.
* Verify `msg.sender == zoneMessenger`.
* Validate `zoneId` and `sourcePortal` against the intended source Zone.
This enables direct composition with DEX swaps, staking, or cross-Zone deposits.
```solidity
interface IWithdrawalReceiver {
function onWithdrawalReceived(
uint32 zoneId,
address sourcePortal,
bytes32 senderTag,
address token,
uint128 amount,
bytes calldata callbackData
) external returns (bytes4);
}
```
Callback data is limited to 1,024 bytes and callback gas to 10,000,000. When gateway enforcement is enabled, the target must have the portal's `CallbackGateway` role. In closed-access mode, a successful callback must append a deposit to the source portal. Registered gateways are trusted to return the intended assets and amounts. Cross-Zone callbacks therefore depend on the source Zone's access configuration.
### Withdrawal Failure and Bounce-Back
A withdrawal fails if the token transfer or callback reverts. Causes include running out of gas, a TIP-403 policy, or a token pause. When a withdrawal fails, the portal bounces back the funds. It re-deposits them into the same Zone to the withdrawal's Zone-side `zoneFallbackRecipient`. Tempo sees only a `fallbackNonce`. The outbox resolves that nonce to the private recipient:
* The withdrawal is **popped unconditionally** from the queue, even on failure.
* A new deposit is enqueued carrying the fallback nonce. The inbox resolves it and attempts to mint to the Zone recipient.
* The withdrawal fee isn't refunded on a failed delivery.
* If policy or a pause blocks the bounce-back mint, the inbox records a pending refund. The recipient can call `ZoneInbox.claimRefund(token)` once minting is permitted.
Delivery failures don't block subsequent withdrawals. Processing can still wait for deposit-queue capacity. The T13 portal limits outstanding deposits and reserves capacity for callback deposits and bounce-backs. Refund claims remain subject to the applicable token and account restrictions.
### Verifiable Withdrawals
Zone transactions are private, so transaction data isn't published on Tempo. Withdrawal processing on Tempo replaces the plaintext `sender` with a commitment. This protects sender privacy:
```solidity
senderTag = keccak256(abi.encodePacked(sender, txHash, fallbackNonce))
```
The `txHash` acts as a blinding factor, a secret value that hides `sender` inside the commitment. Only the sender and sequencer know it. The sender can selectively disclose their identity by revealing `txHash` to any party. That party verifies it against the `senderTag` using the withdrawal's public `fallbackNonce`.
For automated disclosure, the sender can specify a `revealTo` public key. The sequencer encrypts `(sender, txHash)` to that key using ECDH. This populates the `encryptedSender` field in the Tempo-facing withdrawal struct. The destination Zone's sequencer can then attribute incoming cross-Zone deposits automatically.
## Related
[Deposit Into a Zone](https://tempo.com/developers/docs/zones/deposit): Use for funding a private account through the portal on Tempo.
[Withdraw From a Zone](https://tempo.com/developers/docs/zones/withdraw): Use for moving funds from a Zone back to Tempo.
[Execution and Gas](https://tempo.com/developers/docs/protocol/zones/execution): Covers fee tokens, deposit and withdrawal fees, fixed gas costs, and token management.
[Proving and Settlement](https://tempo.com/developers/docs/protocol/zones/proving): Covers batch acceptance, execution validation, and verification guarantees.
[Architecture](https://tempo.com/developers/docs/protocol/zones/architecture): Covers portals, private ledgers, contract roles, and the settlement lifecycle.
> Source: [/docs/protocol/zones/rpc](https://tempo.com/developers/docs/protocol/zones/rpc.md)
> Section: [Zones](https://tempo.com/developers/docs/zones.md). Connect to a Zone and work with private balances, deposits, and withdrawals. Zones is live on Mainnet; see the introduction to set up a Zone. Earlier testnet sandbox guides describe a separate integration.
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
# RPC Reference
The Zone RPC is an account-scoped, redacted Ethereum JSON-RPC interface.
## Overview
The Zone RPC reads Zone data and submits transactions. Every request includes an authorization token proving control of a Tempo account. Responses are scoped to that account. Shared data, such as block headers, is redacted. Operator RPC and hosted provider APIs have separate access rules.
## Authorization Tokens
Authorization tokens are credentials signed by the caller's Tempo account key. They expire after at most 30 days, or a shorter operator-configured limit. Tempo accounts support multiple signature types (secp256k1, P256, WebAuthn). Accounts with access keys via the `AccountKeychain` precompile can use those keys to authenticate.
The signed message includes:
* `"TempoZoneRPC"` magic prefix for domain separation
* Spec version, Zone ID, and chain ID for replay protection. Zone ID `0` skips the Zone ID check, but the chain ID must still match.
* Issuance and expiry timestamps
Tokens are sent via the `X-Authorization-Token` HTTP header on every request. WebSocket clients supply the token when opening the connection. Subscriptions remain scoped to that account.
## Method Access Control
The redacted RPC exposes an explicit method allowlist. Authenticating with a sequencer key doesn't bypass its privacy rules. Operator methods belong on the separate operator RPC.
Available to any authenticated caller:
| Method | Access Type | Notes |
|--------|-------------|-------|
| `eth_chainId` | Allowed | Zone chain ID |
| `eth_blockNumber` | Allowed | Latest block number |
| `eth_gasPrice` | Allowed | Current gas price |
| `eth_maxPriorityFeePerGas` | Allowed | Current priority fee |
| `eth_feeHistory` | Allowed | Redacted fee history with fixed base fee, zero rewards, and zero gas-usage ratios |
| `eth_getBlockByNumber` | Allowed | Block headers **without transaction details** |
| `eth_getBlockByHash` | Allowed | Block headers **without transaction details** |
| `eth_subscribe("newHeads")` | Allowed | Redacted block headers (see [Block Responses](https://tempo.com/developers/docs/protocol/zones/rpc#block-responses)) |
| `eth_syncing` | Allowed | Sync status |
| `eth_coinbase` | Allowed | Sequencer address |
| `net_version` | Allowed | Network ID |
| `net_listening` | Allowed | Node status |
| `web3_clientVersion` | Allowed | Client version |
| `web3_sha3` | Allowed | Pure Keccak-256 hash |
| `eth_getBalance` | Scoped | Returns balance for the authenticated account only. Queries for other accounts return `0x0`. |
| `eth_getTransactionCount` | Scoped | Returns nonce for the authenticated account only. Other accounts return `0x0`. |
| `eth_call` | Scoped | Executes with `from` set to the authenticated account. [Execution-level privacy](https://tempo.com/developers/docs/protocol/zones/accounts) enforces `balanceOf` access control at the contract level. |
| `eth_estimateGas` | Scoped | Defaults an omitted `from` to the authenticated account; rejects a mismatch and state overrides. |
| `eth_fillTransaction` | Scoped | Prepares a transaction for the authenticated account using deterministic fee defaults. |
| `eth_getTransactionByHash` | Scoped | Returns the transaction only if the authenticated account is the sender. Returns `null` otherwise. |
| `eth_getTransactionReceipt` | Scoped | Returns the receipt only if the authenticated account is the sender. Logs are filtered (see [Event Filtering](https://tempo.com/developers/docs/protocol/zones/rpc#event-filtering)). |
| `eth_sendRawTransaction` | Scoped | Validates that the transaction sender matches the authenticated account. |
| `eth_sendRawTransactionSync` | Scoped | Same sender check; returns a filtered receipt after inclusion. |
| `eth_getLogs` | Scoped | Filtered to TIP-20 events where the authenticated account is a relevant party (see [Event Filtering](https://tempo.com/developers/docs/protocol/zones/rpc#event-filtering)). |
| `eth_getFilterLogs` | Scoped | Same filtering as `eth_getLogs`. |
| `eth_getFilterChanges` | Scoped | Same filtering. Only returns new events since last poll. |
| `eth_newFilter` | Scoped | Creates an account-owned filter; the supplied topics must include the authenticated account. |
| `eth_subscribe("logs")` | Scoped | Subscription scoped to the authenticated account. |
| `eth_newBlockFilter` | Scoped | Returns new block hashes. |
| `eth_uninstallFilter` | Scoped | Removes a previously created filter. |
Scoped methods either return an error or a silent dummy value:
* **Explicit Errors:** Methods where the user explicitly provides a mismatched parameter return explicit errors. Examples are `eth_sendRawTransaction` with wrong sender and `eth_call` with wrong `from`. The user already knows the address they supplied, so the error leaks nothing.
* **Silent Responses:** Methods that query *about* other accounts return silent dummy values (`0x0`, `null`, empty results) instead of errors. An error would reveal "this data exists but you can't see it."
### Restricted and Unavailable Methods
`eth_getBlockByNumber` and `eth_getBlockByHash` with `full=true` return `-32005` on the redacted RPC, including for sequencer accounts.
The redacted RPC doesn't expose these methods. They return `-32601` (method not found):
* Raw storage and code reads.
* Access-list creation.
* Transaction-count and transaction-by-index block methods.
* `eth_getProof`.
* Pending-transaction filters.
* Mining methods.
* The `debug_*`, `admin_*`, and `txpool_*` namespaces.
Operators use a separate RPC endpoint.
### Disabled Subscriptions
`eth_subscribe("newPendingTransactions")`, `eth_subscribe("syncing")`, and transaction-receipt subscriptions return `-32006` (method disabled). The supported subscriptions are `newHeads` and account-scoped `logs`.
## Timing Side Channels
The Zone RPC doesn't enforce a fixed minimum response time. Silent `null` or zero responses prevent direct disclosure through result values. They don't guarantee indistinguishable timings. Log filters must include the caller in an eligible indexed topic before retrieval. This limits the scope of backend queries.
## Block Responses
All block headers returned through the redacted RPC are sanitized:
* `transactions` is always an empty array.
* `logsBloom`, `stateRoot`, `transactionsRoot`, and `receiptsRoot` are zeroed.
* `gasUsed` and block size are zeroed, and `extraData` is empty. Optional blob-gas fields and the withdrawals root are also zeroed when present.
* Public identifiers such as `number` and `hash` remain available.
Transaction and receipt ordering fields are also redacted:
* Receipt logs include only visible events.
* `transactionIndex` is zero.
* `cumulativeGasUsed` is replaced with that transaction's gas usage.
## Event Filtering
Log queries are restricted to enabled Zone tokens and the receive-policy guard. Filters must include the authenticated address, padded to 32 bytes. It goes in `topics[1]` or `topics[2]` as appropriate for the event. Broad filters without an eligible caller topic return `-32602`. To find both outgoing and incoming transfers, query each indexed position separately.
Returned events are restricted to those where the authenticated account is a relevant party:
| Event | Visible if |
|-------|-----------|
| `Transfer` | `from == caller` OR `to == caller` |
| `Approval` | `owner == caller` OR `spender == caller` |
| `TransferWithMemo` | `from == caller` OR `to == caller` |
| `Mint` | `to == caller` |
| `Burn` | `from == caller` |
| `TransferBlocked` | Caller is the receiver, originator, or recovery authority in the claim receipt. Log queries require the indexed receiver topic; transaction receipts can also expose the event to the other eligible parties. |
All other event topics, such as system, role, and configuration events, are filtered out. Visible `logIndex` values restart at zero for each transaction, hiding the number of preceding private events.
## Zone-Specific RPC Methods
| Method | Access | Description |
|--------|--------|-------------|
| `zone_getAuthorizationTokenInfo` | Any authenticated | Returns the authenticated account address and token expiry |
| `zone_getZoneInfo` | Any authenticated | Returns `zoneId`, `zoneTokens`, `sequencers`, `chainId`, `tempoBlockNumber`, `isAccessEnforced`, and `isGatewayOpen` |
| `zone_getEncryptionKey` | Any authenticated | Returns the portal’s active encryption key from finalized Tempo state |
`zone_getDepositStatus` isn't implemented. For settlement progress, compare a deposit’s number from `DepositMade` with `ZonePortal.lastProcessedDepositNumber()` on Tempo.
## Error Codes
Authentication fails at the HTTP transport layer. These responses have no JSON-RPC error body:
* A missing token returns HTTP `401`.
* An invalid or expired token returns HTTP `403`.
* An internal authentication failure returns HTTP `500`.
Authenticated requests can return:
| Code | Message | Meaning |
|------|---------|---------|
| `-32003` | Transaction rejected | Transaction sender does not match authenticated account |
| `-32004` | Account mismatch | The `from` field does not match the authenticated account |
| `-32005` | Sequencer only | Full-block request rejected on the redacted RPC |
| `-32006` | Method disabled | Method is not available on Zones |
| `-32601` | Method not found | Method is outside the redacted RPC allowlist |
| `-32602` | Invalid params | Unsupported filter, state override, or other invalid argument |
## Related
[Connect to a Zone](https://tempo.com/developers/docs/zones/connect): Use for authorizing your application's access to a Zone deployment.
[Balances and Activity](https://tempo.com/developers/docs/zones/balances): Use for reading private balances and activity with the authenticated client.
[Accounts and Privacy](https://tempo.com/developers/docs/protocol/zones/accounts): Covers private balances, private allowances, and account-scoped access control.
[Bridging](https://tempo.com/developers/docs/protocol/zones/bridging): Covers deposits, withdrawals, encrypted deposits, and composable withdrawal callbacks.
> Source: [/docs/protocol/zones/execution](https://tempo.com/developers/docs/protocol/zones/execution.md)
> Section: [Zones](https://tempo.com/developers/docs/zones.md). Connect to a Zone and work with private balances, deposits, and withdrawals. Zones is live on Mainnet; see the introduction to set up a Zone. Earlier testnet sandbox guides describe a separate integration.
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
# Execution and Gas
A Zone executes transactions against its private state with Tempo's gas accounting.
## Overview
A Zone is a private ledger of stablecoin balances connected to a `ZonePortal` contract on Tempo. The portal holds the backing tokens. The portal admin, the account that controls a portal's [configuration](https://tempo.com/developers/docs/protocol/zones/architecture), sets Zone fees and enabled tokens.
Inside the Zone, fixed system contracts handle token movement. `ZoneInbox` mints tokens for [deposits](https://tempo.com/developers/docs/protocol/zones/bridging) from Tempo. `ZoneOutbox` burns tokens for withdrawals back to Tempo. Zone transactions pay gas in an enabled [TIP-20 token](https://tempo.com/developers/docs/protocol/tip20/spec), Tempo's stablecoin standard. Deposits and withdrawals pay separate processing fees.
## Fee Tokens
Zones use the same fee units and gas accounting as [Tempo transaction fees](https://tempo.com/developers/docs/protocol/fees/spec-fee). A transaction selects its fee token through `feeToken`. The token must be enabled by the portal admin and initialized, meaning a Zone block has processed its enablement. If `feeToken` is omitted, the Zone uses the default token set when the Zone was created.
On Tempo, the [Fee AMM](https://tempo.com/developers/docs/protocol/fees/spec-fee-amm) converts the user's fee token into the validator's preferred stablecoin. The Zone fee manager (`ZoneFeeManager`) skips that conversion and collects the selected token directly. So a Zone fee token doesn't need to be USD-denominated, as Tempo fee tokens must be. The token's pause state and [TIP-403](https://tempo.com/developers/docs/protocol/tip403/spec) transfer policy still apply.
## Deposit Fees
Deposits charge a fixed processing fee in the deposited token:
```text
fee = FIXED_DEPOSIT_GAS × zoneGasRate
```
`FIXED_DEPOSIT_GAS` is fixed at 100,000 gas. `zoneGasRate` is the price per unit of gas, in the deposited token. The portal admin sets it through `ZonePortal.setZoneGasRate()`. The portal deducts the fee from the deposit amount and pays it to the admin on Tempo.
Deposits must also cover the bounce-back fee. The Zone deducts it when a [failed deposit](https://tempo.com/developers/docs/protocol/zones/bridging#encrypted-deposits) is refunded to Tempo. To read both amounts, call `calculateDepositFee()` and `calculateBouncebackFee()` on the portal.
## Withdrawal Fees
Withdrawals charge a processing fee in the withdrawn token:
```text
fee = (WITHDRAWAL_BASE_GAS + gasLimit) × tempoGasRate
```
`WITHDRAWAL_BASE_GAS` is 50,000 gas. `gasLimit` is the gas the user reserves for a [withdrawal callback](https://tempo.com/developers/docs/protocol/zones/bridging), a contract call on Tempo that runs with the withdrawal. It's `0` for a plain withdrawal, with a maximum of 10,000,000.
The sequencer, which orders Zone blocks and submits them to the portal, sets `tempoGasRate` through `ZoneOutbox.setTempoGasRate()`. It can't exceed the `maxTempoGasRate` that the portal admin sets. Call `calculateWithdrawalFee(gasLimit)` to read the fee. The withdrawal fee is charged on top of the requested withdrawal amount. It's separate from the Zone transaction gas fee.
## Fixed Gas Costs
On a Zone, each public TIP-20 transfer and approval function in the table charges a fixed 100,000 gas. This charge is separate from transaction intrinsic gas. Fixed charges prevent gas-based information leaks tied to storage state. On a standard EVM chain, gas varies when a transfer writes to a previously empty storage slot. That reveals whether the recipient has received tokens before.
The current permissioned runtime moves tokens only through deposits and withdrawals. In it, public transfer calls revert with `Unauthorized()`.
| Function | Gas Cost |
|----------|----------|
| `transfer(to, amount)` | 100,000 |
| `transferFrom(from, to, amount)` | 100,000 |
| `transferWithMemo(to, amount, memo)` | 100,000 |
| `transferFromWithMemo(from, to, amount, memo)` | 100,000 |
| `approve(spender, amount)` | 100,000 |
| `permit(...)` | 100,000 |
`ZoneInbox` minting, `ZoneOutbox` burning, and fee collection don't call these public functions, so they don't pay these charges.
## Contract Creation Disabled
Contract creation is restricted to deployers on a protocol allowlist. The allowlist is currently empty, so users can't submit deployment transactions or execute `CREATE` or `CREATE2`. Each Zone runs only its fixed [system contracts and predeploys](https://tempo.com/developers/docs/protocol/zones/architecture#zone-predeploys).
## Token Management
Issuer TIP-403 policy is anchored by the finalized Tempo checkpoint imported into TempoState. Zone execution reads and applies that checkpoint's policy to token operations.
Each token on a Zone follows its issuer's [TIP-403](https://tempo.com/developers/docs/protocol/tip403/spec) policy from Tempo, the registry rule that decides who may send and receive it. The `TempoState` precompile stores the finalized Tempo checkpoint the Zone has imported. Zone execution applies the policy as of that checkpoint.
The portal admin manages which TIP-20 tokens are available on a Zone:
| Function | Behavior |
|----------|----------|
| `enableToken(token)` | Enables a TIP-20 token for bridging and gas payment. Irreversible. |
| `pauseDeposits(token)` | Stops new deposits for the token. Withdrawal processing remains available unless the portal is paused. |
| `resumeDeposits(token)` | Restarts deposits for a previously paused token. |
From [T13](https://tempo.com/developers/docs/protocol/upgrades/t13), the network upgrade active on testnet and mainnet, a token enablement takes effect when a Zone block processes it. The sequencer then submits that progress to the portal in a batch. `enableToken` reverts while eight enablements are pending, meaning no Zone block has processed them yet. Before T13, other admission limits apply.
Once enabled, a token can't be disabled. Withdrawals still depend on whether the [portal is paused](https://tempo.com/developers/docs/protocol/zones/architecture#portal-access-and-pausing), its access controls, and the token's TIP-403 policy. A token on a Zone uses the same address as the TIP-20 token it represents on Tempo. `ZoneInbox` mints it on deposit, and `ZoneOutbox` burns it on withdrawal. No mechanism exists to create new tokens on a Zone.
## Related
[Bridging](https://tempo.com/developers/docs/protocol/zones/bridging): Covers deposits, withdrawals, encrypted deposits, and composable withdrawal callbacks.
[Accounts and Privacy](https://tempo.com/developers/docs/protocol/zones/accounts): Covers private balances, private allowances, and account-scoped access control.
[Architecture](https://tempo.com/developers/docs/protocol/zones/architecture): Covers portals, private ledgers, contract roles, and the settlement lifecycle.
> Source: [/docs/protocol/zones/proving](https://tempo.com/developers/docs/protocol/zones/proving.md)
> Section: [Zones](https://tempo.com/developers/docs/zones.md). Connect to a Zone and work with private balances, deposits, and withdrawals. Zones is live on Mainnet; see the introduction to set up a Zone. Earlier testnet sandbox guides describe a separate integration.
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
# Proving and Settlement
Settlement records commitments to private Zone execution on Tempo and queues accepted withdrawals.
## Overview
Zone settlement queues accepted withdrawals for processing on Tempo. The stateless proof function (SPF) validates batch execution. It replays batches against witnessed Zone and Tempo state.
## Implementation Status
The Zones Solidity reference verifier still returns `true` without checking execution. Tempo also implements a native Nitro attestation verifier activated by T13. In the current Tempo source, its approved enclave measurements are unset, so it rejects Nitro proofs.
During rollout, T13 also accepts the `NoProof` mode. This mode keeps the quorum and continuity checks but skips attestation. A later upgrade removes it. Before relying on execution-proof enforcement, check the network's active hardfork, verifier, and approved enclave measurements.
The sequencer implementation can be configured to wait for a Nitro-attested batch before submitting it. This node-side requirement is separate from onchain enforcement. Forced exits remain unfinished. Withdrawal settlement depends on the operator continuing to process and submit batches.
## Batch Submission
The sequencer calls `ZonePortal.submitBatch` on Tempo. Each batch covers one or more Zone blocks and includes:
| Field | Description |
|-------|-------------|
| `tempoBlockNumber` | Tempo checkpoint committed by the Zone |
| `recentTempoBlockNumber` | Recent anchor for ancestry mode (`0` for direct lookup) |
| `blockTransition` | Zone block hash transition (`prevBlockHash` → `nextBlockHash`) |
| `depositQueueTransition` | Previous and next deposit hashes and deposit numbers |
| `tokenEnablementTransition` | Previous and next processed enabled-token counts (T13) |
| `withdrawalQueueHash` | Hash chain of withdrawals for this batch (`0` if none) |
| `verifierConfig` | `0x01` for the Nitro verifier policy; `0x02` for the temporary T13 `NoProof` fallback, which requires an empty `proof` |
| `proof` | Nitro attestation when a settlement prover is configured; empty on the unconfigured compatibility path |
| `zoneHeight` | Height of the submitted Zone tip |
| `signatures` | Distinct sequencer signatures forming the settlement certificate |
The portal checks these before calling the verifier:
* Continuity with its stored `blockHash`.
* An increasing Zone height.
* Deposit progress.
* Processed token-enablement progress under T13.
* The active sequencer quorum.
The EIP-712 certificate binds the Zone ID, sequencer-set version, batch index, and verifier. It also binds the Tempo anchor, state transitions, withdrawal hash, and verifier configuration. Replacing the sequencer set invalidates certificates from the old configuration.
The portal then calls the configured verifier. On acceptance, it updates the Zone tip and the processed deposit and enabled-token counts. It also updates the Tempo checkpoint and withdrawal batch index, then enqueues any withdrawals. A signature quorum authenticates the submitted commitments. It doesn't independently prove correct execution.
The sequencer prepares a signed batch and waits for Nitro attestation when configured. The portal checks quorum and continuity, then calls the active verifier. The Solidity reference is a stub; the T13 native verifier checks attestations and requires approved enclave measurements.
## Verifier Interface
The T13 portal calls its configured verifier through this interface. Earlier runtimes use older interfaces, so use the ABI for your network:
```solidity
interface IVerifier {
function verify(
uint32 zoneId,
uint64 tempoBlockNumber,
uint64 anchorBlockNumber,
bytes32 anchorBlockHash,
uint64 expectedWithdrawalBatchIndex,
uint256 nextZoneHeight,
BlockTransition calldata blockTransition,
DepositQueueTransition calldata depositQueueTransition,
TokenEnablementTransition calldata tokenEnablementTransition,
bytes32 withdrawalQueueHash,
bytes calldata verifierConfig,
bytes calldata proof
) external view returns (bool);
}
```
The native T13 verifier binds the attested result to the parent chain, canonical portal, Zone ID, verifier, and batch inputs. It checks the Nitro certificate chain, document signature, enclave measurements, and batch digest. The Solidity reference verifier doesn't perform these checks.
## State Transition Function
The SPF is implemented as a Rust verifier. It accepts trusted network configuration separately from the batch witness:
```rust
pub fn prove_zone_batch(
config: &SpfConfig,
witness: BatchWitness,
) -> Result
```
### Execution Flow
The stateless validator takes trusted configuration and a batch witness, checks and replays state, recomputes roots and queue commitments, validates the Tempo anchor, and returns BatchOutput or an error.
1. **Bind the Starting State:** Validate the Zone chain ID and portal against trusted configuration. Use the parent header's state root for Zone reads. Verify that the initial Tempo witness matches the checkpoint stored in Zone state.
2. **Replay Blocks:** Check parent hashes, block numbers, and timestamps. Execute the supplied system and user transactions through the Zone EVM. This includes deposit processing and withdrawal finalization when present.
3. **Recompute Commitments:** Rebuild state roots and canonical Tempo-format Zone headers. Then read deposit progress, enabled-token progress, and withdrawal batch commitments from the resulting state.
4. **Validate the Anchor:** Match the final Tempo checkpoint to the public inputs, directly or through the supplied ancestry headers.
The SPF can replay an open Zone tip without withdrawal finalization. Settlement policy imposes its batch boundaries separately.
### Validation Deployment Modes
On a sequencer, `--sequencer.enable-prover` requires `--sequencer.prover-address HOST:PORT`. The sequencer waits for the remote prover's successful batch result and nonempty Nitro attestation before submission. It collects the settlement certificate in parallel.
On an `rpc_only` follower, the same flag enables observational validation. Without a remote address, this runs in-process. A follower's observational results don't control settlement. The unconfigured sequencer compatibility path submits empty proof bytes. It can't satisfy an enforcing verifier.
The remote service runs inside AWS Nitro Enclaves over AF\_VSOCK. After replay, it places the canonical batch digest in a Nitro attestation document's `user_data`. It returns `BatchOutput` with a proof bundle. The bundle sets `verifierConfig = 0x01` and the raw COSE/CBOR document as `proof`.
TCP mode supports local transport testing, but successful replay still requires the Nitro Secure Module. Outside an enclave, the service returns `attestation_unavailable` rather than an unattested success. ZK proof generation isn't implemented.
## Ancestry Proofs
Tempo's EIP-2935 history exposes an 8,191-block lookup window. If a Zone’s checkpoint is older, the submitter chooses a recent Tempo anchor and collects the intervening headers. The SPF validates their consecutive block numbers and parent hashes against that anchor.
| Mode | Condition | Behavior |
|------|-----------|----------|
| Direct | `recentTempoBlockNumber = 0` | Portal reads the `tempoBlockNumber` hash from EIP-2935 |
| Ancestry | `recentTempoBlockNumber > tempoBlockNumber` | Portal reads the recent hash; SPF checks the intervening header chain |
Both modes can carry the Nitro attestation. The SPF validates ancestry during replay. An enforcing verifier must authenticate the resulting attestation and bind it to the submitted anchor. The Solidity stub doesn't enforce that check.
## Tempo State Access
The Zone accesses its finalized Tempo checkpoint through the `TempoState` precompile (`0x1c00...0000`). During execution:
1. `ZoneInbox` calls `TempoState.finalizeTempo(headers)` when advancing the checkpoint.
2. Zone system execution reads Tempo state at that checkpoint.
3. SPF replay requires witnessed account and storage proofs for those reads.
The Zone imports finalized Tempo headers in order. Policy updates become visible after the corresponding checkpoint is imported. They don't arrive as unrestricted reads of the latest Tempo state.
## Related
[Architecture](https://tempo.com/developers/docs/protocol/zones/architecture): Covers portals, private ledgers, contract roles, and the settlement lifecycle.
[Bridging](https://tempo.com/developers/docs/protocol/zones/bridging): Covers deposits, withdrawals, encrypted deposits, and composable withdrawal callbacks.
[Privacy](https://tempo.com/developers/docs/zones/privacy): Covers who can see Zone data and the trust assumptions behind it.
> Source: [/docs/agents](https://tempo.com/developers/docs/agents.md)
> Section: [Machine Payments](https://tempo.com/developers/docs/agents.md). Pay for APIs, accept API payments over MPP or x402, find services, and use MPP (https://mpp.dev).
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
# Machine payments
Pay for an API as part of the HTTP request, or charge for your own service. The [Machine Payments Protocol](https://mpp.dev) (MPP) lets a server request payment and a client retry with payment authorization.
[Pay for an API →](https://tempo.com/developers/docs/agents#pay-for-an-api) · [Accept API payments →](https://tempo.com/developers/docs/agents#accept-api-payments)
An agent pays for a service through a machine payment on Tempo.
## Pay for an API
Install `mppx` and `viem`, plus `wagmi` and `accounts@alpha` for the Wagmi tab, then [configure the payer account](https://tempo.com/developers/docs/guide/machine-payments/client#define-the-mpp-payer-account). For the CLI, [connect Tempo Wallet](https://tempo.com/developers/docs/cli/wallet#download-the-tempo-wallet-cli). Set `PAID_API_URL` in the CLI or `paidUrl` in TypeScript to the service's endpoint. The [MPP client setup](https://tempo.com/developers/docs/network/examples#machine-payment-clients) supplies `Mppx`, `tempo`, and a mainnet Wagmi configuration. These clients pay with real funds unless both client and service use testnet.
:::code-group
```ts [Viem]
const mppx = Mppx.create({
polyfill: false,
methods: [tempo({ account })],
})
const response = await mppx.fetch(paidUrl)
console.log(await response.text())
```
```bash [CLI]
tempo request --max-spend 0.10 "$PAID_API_URL"
```
```ts [Wagmi]
const paymentMethod = tempo({
getClient: ({ chainId }) => {
if (chainId !== undefined && chainId !== tempoMainnet.id)
throw new Error('This wallet configuration supports Tempo Mainnet only')
return getConnectorClient(mppConfig, { chainId: tempoMainnet.id })
},
})
const mppx = Mppx.create({ polyfill: false, methods: [paymentMethod] })
const response = await mppx.fetch(paidUrl)
console.log(await response.text())
```
:::
The example calls a GET endpoint. Use the method and request body from the service's documentation for other requests. Preview payment terms with `tempo request --dry-run "$PAID_API_URL"` before paying.
Choose the complete integration for your application:
[Pay from your application](https://tempo.com/developers/docs/guide/machine-payments/client): Handle payment challenges with an MPP client.
[Pay from a terminal](https://tempo.com/developers/docs/guide/machine-payments/agent): Find services and make paid requests with the Tempo CLI.
[Use Mercator](https://tempo.com/developers/docs/guide/mercator): Give an agent service discovery, quotes, and paid execution.
Account access is separate from an API payment. Use [access keys](https://tempo.com/developers/docs/accounts/automations/give-an-agent-a-wallet) to give an agent defined spending permissions and an expiry; use the client guides above to make requests.
## Accept API payments
Configure `mppx` with your payment token, recipient address, and server secret using the [server quickstart](https://tempo.com/developers/docs/guide/machine-payments/server). Then protect a route with a fixed price per request:
:::code-group
```ts [Next.js]
export const GET = mppx.charge({ amount: '0.10' })(
() => Response.json({ data: 'Your paid resource' }),
)
```
```ts [Hono]
app.get('/resource',
mppx.charge({ amount: '0.10' }),
(c) => c.json({ data: 'Your paid resource' }),
)
```
:::
Each tab uses the framework-specific `mppx` instance from the server quickstart. `amount` is in the configured token's decimal units. Follow [One-time payments](https://tempo.com/developers/docs/guide/machine-payments/one-time-payments) for a complete service.
If you already sell over x402, the [Tempo x402 facilitator](https://tempo.com/developers/docs/guide/machine-payments/x402-facilitator) pays you on Tempo with no change for buyers.
The server returns a `402 Payment Required` challenge. The client authorizes payment and retries; the server verifies it before returning the resource and receipt. Inspect an endpoint's HTTP challenge without paying:
```bash [API (HTTP)]
curl -i "$PAID_API_URL"
```
The [`WWW-Authenticate` challenge](https://tempo.com/developers/docs/guide/machine-payments#mpp-payment-flow) describes the payment terms. A plain cURL request does not sign or pay the challenge. The [payment flow demo](https://tempo.com/developers/docs/guide/machine-payments#mpp-payment-flow) shows the complete exchange.
## Payment sessions
Use a session when charges accumulate during service usage. The client funds a payment channel and signs vouchers as it consumes the service, without sending an onchain transaction for every request. With the [Next.js session configuration](https://tempo.com/developers/docs/guide/machine-payments/pay-as-you-go), charge per resource:
```ts [Next.js]
export const GET = mppx.session({ amount: '0.01', unitType: 'photo' })(
() => Response.json({ url: 'https://your-service.example/photo.jpg' }),
)
```
* [Pay-as-you-go payments](https://tempo.com/developers/docs/guide/machine-payments/pay-as-you-go) for metered API usage.
* [Streamed payments](https://tempo.com/developers/docs/guide/machine-payments/streamed-payments) for charges during a streaming response.
Use [How MPP works](https://tempo.com/developers/docs/guide/machine-payments) for payment intents and the request lifecycle, and the [MPP documentation](https://mpp.dev) for protocol and SDK references. [Build with AI](https://tempo.com/developers/docs/guide/using-tempo-with-ai) connects your coding agent to Tempo documentation.
> Source: [/docs/guide/machine-payments/client](https://tempo.com/developers/docs/guide/machine-payments/client.md)
> Section: [Machine Payments](https://tempo.com/developers/docs/agents.md). Pay for APIs, accept API payments over MPP or x402, find services, and use MPP (https://mpp.dev).
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
# Pay for services
Use an MPP client to pay for an API request from your application. The client handles the payment challenge and retries with a credential using the account you configure. The examples below use a funded Tempo Mainnet account; use a testnet account only with a testnet service.
::::steps
### Install MPP client dependencies
:::code-group
```bash [npm]
npm install mppx viem
```
```bash [pnpm]
pnpm add mppx viem
```
```bash [bun]
bun add mppx viem
```
:::
### Define the MPP payer account
Keep the signing key on your server. Load it from an environment variable instead of putting it in application code.
```ts
import { privateKeyToAccount } from 'viem/accounts'
const account = privateKeyToAccount(process.env.PRIVATE_KEY as `0x${string}`)
```
:::tip
With Tempo, you can also use passkey or WebCrypto signing.
:::
Pass this account to the Tempo method as `tempo({ account })`, or on each request as shown in [per-request payer accounts](https://tempo.com/developers/docs/guide/machine-payments/client#use-per-request-payer-accounts). `Mppx.create` takes no top-level `account`.
### Create the MPP payment handler
Call `Mppx.create` at startup. This polyfills `fetch` to automatically handle `402` payment challenges.
```ts
import { privateKeyToAccount } from 'viem/accounts'
import { Mppx, tempo } from 'mppx/client'
const account = privateKeyToAccount(process.env.PRIVATE_KEY as `0x${string}`)
Mppx.create({
methods: [tempo({ account, allowedChainIds: [4217] })],
})
```
`tempo()` handles one-time charges and payment sessions. If the service uses sessions, set [`maxDeposit`](https://mpp.dev/sdk/typescript/client/Method.tempo#maxdeposit-optional) to cap the amount locked in a channel.
:::tip
If you want to avoid polyfilling, use the bound `fetch` instead.
```ts
const mppx = Mppx.create({
polyfill: false,
methods: [tempo({ account, allowedChainIds: [4217] })],
})
const response = await mppx.fetch('https://api.example.com/resource')
```
:::
### Request MPP-protected resources
Use `fetch`. Payment happens when a server returns `402`.
```ts
const response = await fetch('https://api.example.com/resource')
```
In browsers, the fetch polyfill sends `Accept-Payment` to same-origin requests by default. For a paid API on another origin, configure [`acceptPaymentPolicy`](https://mpp.dev/sdk/typescript/client/Mppx.create#acceptpaymentpolicy-optional) for that origin if it supports the header.
::::
## Advanced MPP client patterns
### Use MPP with Wagmi
You can inject a [Wagmi](https://wagmi.sh) connector into Mppx by passing the `getConnectorClient` function. This example connects to Tempo Mainnet; connect the wallet before making a paid request.
:::code-group
```ts [example.ts]
import { Mppx, tempo } from 'mppx/client'
import { getConnectorClient } from 'wagmi/actions'
import { tempo as tempoMainnet } from 'viem/chains'
import { config } from './config'
Mppx.create({
methods: [tempo({
allowedChainIds: [tempoMainnet.id],
getClient: ({ chainId }) => {
if (chainId !== undefined && chainId !== tempoMainnet.id)
throw new Error('This wallet supports Tempo Mainnet only')
return getConnectorClient(config, { chainId: tempoMainnet.id })
},
})],
})
```
```ts [config.ts]
import { createConfig, http } from 'wagmi'
import { tempo as tempoMainnet } from 'viem/chains'
import { tempoWallet } from 'wagmi/connectors'
export const config = createConfig({
connectors: [tempoWallet()],
chains: [tempoMainnet],
transports: {
[tempoMainnet.id]: http(),
},
})
```
:::
### Use per-request payer accounts
Pass accounts on individual requests instead of at setup:
```ts
import { privateKeyToAccount } from 'viem/accounts'
import { Mppx, tempo } from 'mppx/client'
const mppx = Mppx.create({
polyfill: false,
methods: [tempo({ allowedChainIds: [4217] })],
})
const response = await mppx.fetch('https://api.example.com/resource', {
context: {
account: privateKeyToAccount(process.env.PRIVATE_KEY as `0x${string}`),
},
})
```
### Handle MPP payments manually
Use `Mppx.create` for full control over the payment flow:
* Present payment UI before paying
* Implement custom retry logic
* Handle credentials manually
```ts
import { Mppx, tempo } from 'mppx/client'
import { privateKeyToAccount } from 'viem/accounts'
const mppx = Mppx.create({
polyfill: false,
methods: [tempo({ allowedChainIds: [4217] })],
})
const url = 'https://api.example.com/resource'
const request: RequestInit = { method: 'GET' }
const response = await mppx.rawFetch(url, request)
if (response.status === 402) {
const payment = await mppx.preparePayment(response, { request })
console.log(payment.challenge.request)
// Review the payment terms before signing.
const credential = await payment.createCredential({
account: privateKeyToAccount(process.env.PRIVATE_KEY as `0x${string}`),
})
const paidRequest = payment.setCredential(request, credential)
const paidResponse = await mppx.rawFetch(url, { ...paidRequest, redirect: 'manual' })
}
```
### Read MPP payment receipts
On success, the server returns a `Payment-Receipt` header:
```ts
import { Receipt } from 'mppx'
const response = await fetch('https://api.example.com/resource')
if (!response.ok) throw new Error(`Request failed: ${response.status}`)
const receipt = Receipt.fromResponse(response)
console.log(receipt.status)
// success
console.log(receipt.reference)
// 0x...
```
For a one-time charge, `reference` is the transaction hash. For a session, it is the channel ID; settlement has a separate transaction hash when the channel closes.
## Next steps for MPP clients
[Accept payments for an API](https://tempo.com/developers/docs/guide/machine-payments/server): Add payment gating to your HTTP endpoints
[Accept one-time payments](https://tempo.com/developers/docs/guide/machine-payments/one-time-payments): Charge per request with on-chain settlement
[Full SDK reference](https://mpp.dev/sdk/typescript/client/Mppx.create): Complete mppx client API documentation
> Source: [/docs/guide/machine-payments/server](https://tempo.com/developers/docs/guide/machine-payments/server.md)
> Section: [Machine Payments](https://tempo.com/developers/docs/agents.md). Pay for APIs, accept API payments over MPP or x402, find services, and use MPP (https://mpp.dev).
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
# Accept payments for an API
Add payment verification to an API endpoint. Use the `mppx` middleware for your framework, or call `mppx/server` with the Fetch API.
Every server needs three settings:
* **`MPP_SECRET_KEY`**: a secret that authenticates payment challenges.
* **`currency`**: the TIP-20 token to charge in, such as [OUSD](https://tempo.com/developers/docs/guide/ousd) (`0x20c0000000000000000000006a37da5c996874be`) on Tempo Mainnet.
* **`recipient`**: the address that receives payments.
## Set the server secret
`Mppx.create()` requires a server secret to authenticate payment challenges. Generate one before starting the server:
```bash
export MPP_SECRET_KEY="$(openssl rand -base64 32)"
```
Store this value in your deployment's secret manager and reuse it across server instances. It is separate from the account's signing key.
## MPP server framework middleware
Use the framework-specific middleware from `mppx` to integrate payment into your server. Each middleware handles the `402` challenge/credential flow and attaches receipts automatically.
:::code-group
```ts [Next.js]
import { Mppx, tempo } from 'mppx/nextjs'
const mppx = Mppx.create({
methods: [tempo({
currency: '0x20c0000000000000000000006a37da5c996874be',
recipient: '0xa726a1CD723409074DF9108A2187cfA19899aCF8',
})],
})
export const GET =
mppx.charge({ amount: '0.1' })
(() => Response.json({ data: '...' }))
```
```ts [Hono]
import { Hono } from 'hono'
import { Mppx, tempo } from 'mppx/hono'
const app = new Hono()
const mppx = Mppx.create({
methods: [tempo({
currency: '0x20c0000000000000000000006a37da5c996874be',
recipient: '0xa726a1CD723409074DF9108A2187cfA19899aCF8',
})],
})
app.get(
'/resource',
mppx.charge({ amount: '0.1' }),
(c) => c.json({ data: '...' }),
)
```
```ts [Express]
import express from 'express'
import { Mppx, tempo } from 'mppx/express'
const app = express()
const mppx = Mppx.create({
methods: [tempo({
currency: '0x20c0000000000000000000006a37da5c996874be',
recipient: '0xa726a1CD723409074DF9108A2187cfA19899aCF8',
})],
})
app.get(
'/resource',
mppx.charge({ amount: '0.1' }),
(req, res) => res.json({ data: '...' }))
```
:::
:::tip
You can override `currency` and `recipient` per call if different routes need different payment configurations.
```ts
mppx.charge({
amount: '0.1',
currency: '0x...',
recipient: '0x...',
})
```
:::
## Manual MPP server mode
If you prefer full control over the payment flow, use `mppx/server` directly with the Fetch API.
```ts
import { Mppx, tempo } from 'mppx/server'
const mppx = Mppx.create({
methods: [tempo({
currency: '0x20c0000000000000000000006a37da5c996874be',
recipient: '0xa726a1CD723409074DF9108A2187cfA19899aCF8',
})],
})
export async function handler(request: Request) {
const response = await mppx.charge({ amount: '0.1' })(request)
// Payment required: send 402 response with challenge
if (response.status === 402) return response.challenge
// Payment verified: attach receipt and return resource
return response.withReceipt(Response.json({ data: '...' }))
}
```
:::info[Currency and recipient values]
`currency` is the TIP-20 token contract address — [`0x20c0000000000000000000006a37da5c996874be`](https://explore.tempo.xyz/address/0x20c0000000000000000000006a37da5c996874be?live=false) is OUSD on Tempo. `recipient` is the address that receives payment. See the [Tempo payment method](https://mpp.dev/payment-methods/tempo) for supported tokens.
:::
## MPP payment realm
The `realm` identifies your server in payment challenges and onchain attribution. `mppx` resolves it from `MPP_REALM` or supported hosting variables such as `VERCEL_URL`, then falls back to the request URL's hostname. Configure it explicitly when a proxy or deployment exposes an internal hostname.
Set `realm` explicitly to your public domain:
```ts
const mppx = Mppx.create({
realm: 'api.example.com', // [!code hl]
methods: [tempo({
currency: '0x20c0000000000000000000006a37da5c996874be',
recipient: '0xa726a1CD723409074DF9108A2187cfA19899aCF8',
})],
})
```
You can also set the `MPP_REALM` environment variable instead of passing it in code.
## MPP push and pull modes
Non-zero Tempo charges support two transaction submission modes, determined by the client:
* **`pull` mode (default)**: the client signs the transaction and sends the serialized transaction to the server. The server broadcasts it and verifies on-chain. This enables the server to sponsor gas fees via a `feePayer`.
* **`push` mode**: the client builds, signs, and broadcasts the transaction itself (for example, via a browser wallet). It sends the transaction hash to the server, which verifies the payment by fetching the receipt.
Your server handles both modes automatically — no configuration required. The server inspects the credential payload type (`transaction` for pull, `hash` for push) and verifies accordingly. A zero-amount charge uses a `proof` credential and does not submit a transaction.
### MPP fee sponsorship
To sponsor gas fees for pull-mode clients, pass a `feePayer` account to `tempo()`:
```ts
import { Mppx, tempo } from 'mppx/server'
import { Account } from 'viem/tempo'
const mppx = Mppx.create({
methods: [tempo({
currency: '0x20c0000000000000000000006a37da5c996874be',
feePayer: Account.fromSecp256k1('0x...'),
recipient: '0xa726a1CD723409074DF9108A2187cfA19899aCF8',
})],
})
```
When a pull-mode client submits a signed transaction, the server co-signs with the fee payer account before broadcasting. Push-mode clients pay their own gas, so `feePayer` is ignored for those requests.
## Test your MPP server
These examples charge mainnet OUSD. Configure the `mppx` CLI with a funded mainnet account before calling the endpoint; testnet faucet tokens cannot pay a mainnet challenge.
```bash
npx mppx https://your-server.example/resource
```
:::tip
Use `curl -i https://your-server.example/resource` to inspect the `402` Challenge without paying. Run `npx mppx validate https://your-server.example` for an end-to-end server check.
:::
To test on Moderato, add `testnet: true` to the server's `tempo({ ... })` configuration. The OUSD address above exists on both networks; `testnet: true` selects chain `42431`. Fund the payer with [testnet OUSD](https://tempo.com/developers/docs/quickstart/faucet), and connect the client to the same network. For a browser client, select `tempoModerato` instead of `tempoMainnet` in the [Wagmi example](https://tempo.com/developers/docs/guide/machine-payments/client#use-mpp-with-wagmi).
## Next steps for MPP servers
[Pay for services](https://tempo.com/developers/docs/guide/machine-payments/client): Handle payment-gated resources automatically
[Accept one-time payments](https://tempo.com/developers/docs/guide/machine-payments/one-time-payments): End-to-end guide with the charge intent
[Full SDK reference](https://mpp.dev/sdk/typescript/server/Mppx.create): Complete mppx server API documentation
> Source: [/docs/guide/machine-payments/x402-facilitator](https://tempo.com/developers/docs/guide/machine-payments/x402-facilitator.md)
> Section: [Machine Payments](https://tempo.com/developers/docs/agents.md). Pay for APIs, accept API payments over MPP or x402, find services, and use MPP (https://mpp.dev).
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
# Tempo x402 facilitator
Keep selling over [x402](https://x402.org) and get paid in stablecoins on Tempo. Point your x402 middleware at Tempo's facilitator: buyers pay USDC on Base as usual, and each payment arrives as OUSD at your Tempo address.
* **No change for buyers.** Any x402 client pays, such as `@x402/fetch` or `mppx`.
* **No registration.** An API key and a payout address in `extra.tempoSettlement` are all you need.
* **No minimum.** Price routes at any amount above 0, up to the maximum per payment that Tempo sets.
```mermaid
sequenceDiagram
participant Buyer
participant Seller as Your server
participant Tempo as Tempo facilitator
Buyer->>Seller: Request resource
Seller-->>Buyer: 402 Payment Required
Buyer->>Seller: Retry with signed USDC
Seller->>Tempo: Verify and settle
Note over Tempo: Settle USDC on Base, send OUSD on Tempo
Tempo-->>Seller: Base and Tempo hashes
Seller-->>Buyer: Resource
```
## Supported payment networks
| Direction | Network | Chain ID | Token | Schemes |
| --- | --- | --- | --- | --- |
| Pay in | Base mainnet | `eip155:8453` | [USDC](https://basescan.org/token/0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913) | `exact` (EIP-3009 or Permit2) |
| Pay out | Tempo mainnet | `eip155:4217` | [OUSD](https://explore.tempo.xyz/address/0x20c0000000000000000000006a37da5c996874be) | — |
Testnet: use `https://api.tempo-dev.workers.dev/v1/x402` with a sandbox key (Base Sepolia USDC in, Moderato OUSD out).
## Accept x402 payments on Tempo
:::steps
### Create an API key
Create an API key in [Tempo Console](https://tempo.com/console?to=/\:org/api-keys) with the `mpp:write` scope, and keep it on your server.
```bash [Terminal]
export TEMPO_API_KEY="tempo:sk:..."
export TEMPO_PAYOUT_ADDRESS="0x..." # any Tempo address you control
export MPP_SECRET_KEY=$(openssl rand -hex 32) # mppx and pympp only
```
### Point your middleware at Tempo
Use `tempoX402()` from `mppx` with the x402 SDK. It points the SDK at `https://api.tempo.xyz/v1/x402` with your API key, pays to Tempo's deposit address, and names your payout address in `extra.tempoSettlement`.
```bash [Terminal]
npm i mppx @x402/core @x402/evm @x402/hono hono
```
```ts [server.ts]
import { paymentMiddleware } from '@x402/hono'
import { Hono } from 'hono'
import { tempoX402 } from 'mppx/x402/tempo'
const tempo = tempoX402() // reads TEMPO_API_KEY and TEMPO_PAYOUT_ADDRESS // [!code hl]
const app = new Hono()
app.use(paymentMiddleware({ 'GET /weather': tempo.route({ price: '$0.01' }) }, tempo.server)) // [!code hl]
app.get('/weather', (c) => c.json({ forecast: 'sunny' }))
export default app
```
Using another framework or SDK:
### Next.js
```bash [Terminal]
npm i mppx @x402/core @x402/evm @x402/next
```
```ts [app/weather/route.ts]
import { withX402 } from '@x402/next'
import { tempoX402 } from 'mppx/x402/tempo'
import { NextResponse } from 'next/server'
const tempo = tempoX402()
export const GET = withX402(
async () => NextResponse.json({ forecast: 'sunny' }),
tempo.route({ price: '$0.01' }), // [!code hl]
tempo.server,
)
```
### Express
```bash [Terminal]
npm i mppx @x402/core @x402/evm @x402/express express
```
```ts [server.ts]
import { paymentMiddleware } from '@x402/express'
import express from 'express'
import { tempoX402 } from 'mppx/x402/tempo'
const tempo = tempoX402()
const app = express()
app.use(paymentMiddleware({ 'GET /weather': tempo.route({ price: '$0.01' }) }, tempo.server)) // [!code hl]
app.get('/weather', (req, res) => {
res.json({ forecast: 'sunny' })
})
app.listen(4021)
```
### mppx
```bash [Terminal]
npm i mppx hono
```
```ts [server.ts]
import { Hono } from 'hono'
import { Mppx, evm } from 'mppx/hono'
const facilitator = 'https://api.tempo.xyz/v1/x402'
const mppx = Mppx.create({
methods: [
evm.charge({
currency: evm.assets.base.USDC,
// [!code hl:start]
// Tempo's deposit address on Base, read from GET /supported at startup
recipient: await evm.facilitatorPayTo(facilitator, { network: 'eip155:8453' }),
x402: {
extra: { tempoSettlement: process.env.TEMPO_PAYOUT_ADDRESS! },
facilitator,
headers: { 'tempo-api-key': process.env.TEMPO_API_KEY! },
routeBinding: 'resource', // accept any x402 client
},
// [!code hl:end]
}),
],
})
const app = new Hono()
app.get('/weather', mppx.evm.charge({ amount: '0.01' }), (c) => c.json({ forecast: 'sunny' }))
export default app
```
### Python
```bash [Terminal]
pip install "pympp[x402]" uvicorn
```
```python [main.py]
import os
import httpx
from fastapi import FastAPI, Request
from fastapi.responses import JSONResponse
from mpp import Credential, Receipt
from mpp.methods.evm import BASE_USDC
from mpp.methods.evm import server as evm
from mpp.server import Mpp, pay
from mpp.x402 import HttpFacilitator
FACILITATOR_URL = "https://api.tempo.xyz/v1/x402"
# [!code hl:start]
facilitator = HttpFacilitator(
FACILITATOR_URL,
headers={"tempo-api-key": os.environ["TEMPO_API_KEY"]},
)
# Tempo's deposit address on Base, read from GET /supported at startup
kinds = httpx.get(f"{FACILITATOR_URL}/supported").raise_for_status().json()["kinds"]
deposit_address = next(k["extra"]["payTo"] for k in kinds if k["network"] == "eip155:8453")
# [!code hl:end]
mpp = Mpp(
methods=evm.charge(
currency=BASE_USDC,
# [!code hl:start]
recipient=deposit_address,
facilitator=facilitator,
x402_extra={"tempoSettlement": os.environ["TEMPO_PAYOUT_ADDRESS"]},
route_binding="resource", # accept any x402 client
# [!code hl:end]
),
)
app = FastAPI()
@app.get("/weather")
@pay(mpp.charge(amount="0.01"))
async def weather(request: Request, credential: Credential, receipt: Receipt) -> JSONResponse:
return JSONResponse({"forecast": "sunny"})
```
* `payTo` is Tempo's deposit address on Base, from the public `GET /v1/x402/supported`. `tempoX402()` and `evm.facilitatorPayTo()` read it for you when the server starts (`facilitator_pay_to()` does the same from async code in Python), so there's no address to copy into your environment.
* A route can send its payout to its own address, such as a platform's seller: `tempo.route({ price: '$0.10', payoutAddress: seller.tempoAddress })`.
* `mppx` and `pympp` need `routeBinding: 'resource'` (`route_binding="resource"`) to accept buyers that use the x402 SDK.
:::
## Check the payout
Settle waits for the Base receipt, then returns the Base hash in `transaction` and the Tempo payout in `extensions.tempoSettlement`:
```json
{
"success": true,
"transaction": "0x",
"network": "eip155:8453",
"extensions": {
"tempoSettlement": {
"status": "pending",
"amount": "10000",
"to": "",
"payoutId": "x402pay_..."
}
}
}
```
The OUSD arrives a few minutes later, once Base is final: poll `GET /v1/x402/payouts/{payoutId}` until `status` is `confirmed`.
## Tempo x402 facilitator API
Base URL: `https://api.tempo.xyz/v1/x402`. Send the API key in the `tempo-api-key` header.
| Route | Auth | Description |
| --- | --- | --- |
| `GET /supported` | Public | Networks and the deposit address (`extra.payTo`) |
| `POST /verify` | `mpp:write` | Checks a payment without settling it |
| `POST /settle` | `mpp:write` | Settles on Base and sends the Tempo payout |
| `GET /payouts/{id}` | `mpp:write` | A payout: `pending`, `submitted`, `confirmed`, or `failed` |
| `GET /settlements/{transaction}` | `mpp:write` | The same payout, by its Base hash |
## Errors you can fix
Verify and settle answer HTTP `200` with `isValid: false` or `success: false` and a reason:
| Reason | Fix |
| --- | --- |
| `payto_not_deposit_address` | Pay to `extra.payTo` from `GET /supported`. |
| `missing_tempo_settlement` | Set `extra.tempoSettlement` to a valid Tempo address. |
| `amount_above_maximum` | Lower the route's price. |
| `settlement_pending` | Retry settle with the same payload. Buyers resend the same signed payment. It never pays twice. |
| HTTP `429` | Settle is rate-limited per API key. Retry after `Retry-After`. |
> Source: [/docs/guide/machine-payments/agent](https://tempo.com/developers/docs/guide/machine-payments/agent.md)
> Section: [Machine Payments](https://tempo.com/developers/docs/agents.md). Pay for APIs, accept API payments over MPP or x402, find services, and use MPP (https://mpp.dev).
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
# Pay with the CLI
Use `tempo request` to call a paid API from a terminal, script, or agent. The CLI handles the MPP challenge and payment retry.
First [install the CLI and connect Tempo Wallet](https://tempo.com/developers/docs/cli/wallet#download-the-tempo-wallet-cli). Confirm the wallet's network and balance with `tempo wallet whoami`; paid requests use real funds unless the service and wallet are explicitly configured for testnet.
:::steps
### Find a service
Search by task, then inspect a service's endpoint, HTTP method, and request schema:
```bash
tempo wallet services --search image
tempo wallet services
```
### Preview the request cost
The example uses an image-generation endpoint.
```bash
tempo request --dry-run -X POST \
--json '{"prompt":"a sunset over the ocean"}' \
https://fal.mpp.tempo.xyz/fal-ai/flux/dev
```
`--dry-run` requests the payment terms without paying.
### Pay for the request
After reviewing the price, run the request:
```bash
tempo request -X POST \
--json '{"prompt":"a sunset over the ocean"}' \
https://fal.mpp.tempo.xyz/fal-ai/flux/dev
```
Use [`--max-spend`](https://tempo.com/developers/docs/cli/request#tempo-request-flags) to cap payment spending for the command. Check the service response for the result or job ID.
:::
## Set up an AI agent
Follow [Let an agent pay for services](https://tempo.com/developers/docs/wallet/recipes#let-an-agent-pay-for-services) for skills and spending controls. If you are integrating your own agent account, start with [Access keys](https://tempo.com/developers/docs/accounts/automations/give-an-agent-a-wallet).
## Continue with paid requests
* [Find services](https://tempo.com/developers/docs/guide/machine-payments/discover-services) covers the catalog API and read-only discovery MCP server.
* [Tempo Wallet CLI](https://tempo.com/developers/docs/cli/wallet) covers funding, access keys, and payment sessions.
* [`tempo request`](https://tempo.com/developers/docs/cli/request) lists request flags.
* [Accept payments for an API](https://tempo.com/developers/docs/guide/machine-payments/server) covers the service side.
> Source: [/docs/guide/machine-payments/discover-services](https://tempo.com/developers/docs/guide/machine-payments/discover-services.md)
> Section: [Machine Payments](https://tempo.com/developers/docs/agents.md). Pay for APIs, accept API payments over MPP or x402, find services, and use MPP (https://mpp.dev).
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
# Find services
Find an MPP service, inspect its endpoint and request schema, then make a paid request. Use the directory for browsing, the catalog API for scripts, or MCP for an agent.
Discovery is advisory. The runtime `402 Payment Required` challenge from the target service is always the authoritative source of current payment terms.
## Discovery surfaces
| Surface | URL | Use it for |
| --- | --- | --- |
| Web directory | [`https://mpp.dev/services`](https://mpp.dev/services) | Browse live services, categories, providers, endpoints, and examples. |
| Public catalog API | [`https://mpp.dev/api/services`](https://mpp.dev/api/services) | Fetch the JSON catalog directly from scripts, CLIs, or custom agents. |
| Services MCP | [`https://mpp.dev/mcp/services`](https://mpp.dev/mcp/services) | Let an MCP-capable agent rank services, inspect offers, get usage recipes, and fetch advisory OpenAPI summaries. |
| Protocol reference | [`https://mpp.dev/advanced/discovery`](https://mpp.dev/advanced/discovery) | Learn how service providers publish discovery metadata. |
Use `mpp.dev` for the live catalog, protocol reference, and service-provider discovery docs.
The services MCP server is read-only. It does not register services, execute payments, sign transactions, or proxy paid API calls.
## Connect over MCP
Use the Streamable HTTP endpoint:
```text
https://mpp.dev/mcp/services
```
:::code-group
```bash [Claude Code]
claude mcp add --transport http mpp-services https://mpp.dev/mcp/services
```
```bash [Codex]
codex mcp add mpp-services --url https://mpp.dev/mcp/services
```
```bash [Amp]
amp mcp add mpp-services https://mpp.dev/mcp/services
```
```json [Cursor]
{
"mcpServers": {
"mpp-services": {
"url": "https://mpp.dev/mcp/services"
}
}
}
```
```json [Manual]
{
"mcpServers": {
"mpp-services": {
"url": "https://mpp.dev/mcp/services"
}
}
}
```
:::
For AWS AgentCore, Bedrock agents, or another managed agent runtime, configure a remote MCP server with Streamable HTTP transport, no authentication, and the endpoint above.
## Smoke test with Inspector
Use the MCP Inspector when you want to verify the server from the same environment as your agent:
```bash
npx -y @modelcontextprotocol/inspector \
--cli \
--transport http \
--server-url https://mpp.dev/mcp/services \
--method tools/list
```
You can also smoke test with plain JSON-RPC:
```bash
curl https://mpp.dev/mcp/services \
-H 'content-type: application/json' \
-H 'accept: application/json, text/event-stream' \
--data '{
"jsonrpc": "2.0",
"id": 1,
"method": "initialize",
"params": {
"protocolVersion": "2025-06-18",
"capabilities": {},
"clientInfo": { "name": "my-agent", "version": "1.0.0" }
}
}'
```
Expected result: `serverInfo.name` is `mpp-services-mcp`, `instructions` mention that discovery is advisory, and `tools/list` includes `recommend_services`, `get_usage_recipe`, `search_offers`, and `get_catalog_status`.
## Recommended agent workflow
::::steps
### Rank services for the task
Start with `recommend_services` when the agent has a task but not a provider.
```json
{
"name": "recommend_services",
"arguments": {
"task": "send a transactional email from an agent",
"constraints": {
"category": "ai",
"method": "tempo",
"limit": 5
}
}
}
```
The response includes ranked services, matched task terms, reasons, top payment offers, and suggested next MCP calls.
### Get a usage recipe
After choosing a service, call `get_usage_recipe` to get payable endpoint candidates, target URLs, and the HTTP steps the agent should follow.
```json
{
"name": "get_usage_recipe",
"arguments": {
"service": "agentmail"
}
}
```
Use `route` when the agent already knows the endpoint:
```json
{
"name": "get_usage_recipe",
"arguments": {
"service": "agentmail",
"route": "POST /v0/inboxes"
}
}
```
### Inspect payment offers
Use `search_offers` or `get_offers` when the agent needs endpoint-level payment terms.
```json
{
"name": "search_offers",
"arguments": {
"query": "web search",
"category": "search",
"method": "tempo",
"dynamic": false,
"limit": 10
}
}
```
### Inspect the API shape
Fetch an advisory OpenAPI summary or registry-derived endpoint view before constructing the request body.
```json
{
"name": "get_openapi",
"arguments": {
"service": "agentmail"
}
}
```
### Make the paid request
Call the target service directly with an MPP-capable client such as [`tempo request`](https://tempo.com/developers/docs/cli/request). The service returns a `402` challenge if payment is required, and the client pays and retries.
```bash
tempo request -X POST \
--json '{"prompt":"a sunset over the ocean"}' \
https://fal.mpp.tempo.xyz/fal-ai/flux/dev
```
:::warning
The MCP server only helps with discovery and planning. The target service's runtime `402` challenge controls the final amount, currency, recipient, method, and credential flow.
:::
::::
## MPP service discovery example recipes
| Agent task | Start with | Then call |
| --- | --- | --- |
| Send email or create an agent inbox | `recommend_services` with `task: "send email from an agent"` | `get_usage_recipe` for the selected service, then `get_openapi` |
| Find an LLM or image model endpoint | `recommend_services` with `category: "ai"` | `search_offers` to compare fixed vs dynamic pricing |
| Search the web or crawl pages | `recommend_services` with `category: "search"` | `get_usage_recipe` for the chosen search provider |
| Map a `402` recipient back to services | `get_services_by_recipient` | `get_offers` and `get_service` for the matching provider |
| Build custom catalog analytics | `get_facets` and `get_catalog_status` | Fetch [`https://mpp.dev/api/services`](https://mpp.dev/api/services) directly |
## Agent prompts for MPP discovery
Give your agent a task and tell it to use the services MCP server first:
```txt
Use the mpp-services MCP server to find a paid API for sending email from an agent.
Rank options with recommend_services, inspect the best service with get_usage_recipe,
then tell me the target endpoint and what the runtime 402 challenge will confirm.
Do not execute payment.
```
```txt
Use the mpp-services MCP server to find AI model APIs that support Tempo payments.
Compare endpoint offers, prefer active services with OpenAPI metadata, and summarize
which route I should call with tempo request. Discovery is advisory.
```
```txt
Use the mpp-services MCP server to find web search or crawl APIs. Show the top three
services, why each matched, whether pricing is fixed or dynamic, and the next MCP
tool call you would make before constructing the HTTP request.
```
## MCP tools for MPP service discovery
| Tool | Purpose |
| --- | --- |
| `list_services` | List catalog services with id, name, URL, categories, integration, status, and description. |
| `search_services` | Search services by text query and exact filters. |
| `search_offers` | Search endpoint-level payment offers by task, method, currency, amount, recipient, and category. |
| `recommend_services` | Rank paid API services for a natural-language agent task with optional exact constraints. |
| `get_usage_recipe` | Turn a selected service into endpoint candidates, follow-up MCP calls, and target HTTP/`402` steps. |
| `get_facets` | Discover valid filter values and counts before narrowing a search. |
| `get_services_by_recipient` | Identify services that publish offers for a payment recipient. |
| `get_catalog_status` | Inspect catalog version, source URL, cache age, refresh time, and service count. |
| `get_service` | Fetch the full service record by id or name. |
| `get_offers` | Fetch payment offers for one service, optionally filtered by route. |
| `get_openapi` | Fetch a live OpenAPI summary when available, otherwise return the registry endpoint view. |
## Choosing a discovery surface
Use the web directory when a human is exploring the catalog. Use the public API when you are building your own service browser, CLI, or analytics job. Use the MCP server when an agent needs tool-callable discovery inside its planning loop.
For execution, call services directly with [`tempo request`](https://tempo.com/developers/docs/cli/request), the [Pay for services](https://tempo.com/developers/docs/guide/machine-payments/client), or another MPP-capable client.
## Next steps for MPP service discovery
[Pay with the CLI](https://tempo.com/developers/docs/guide/machine-payments/agent): Use the Tempo CLI to discover services, preview costs, and make paid requests
[tempo request](https://tempo.com/developers/docs/cli/request): Make HTTP requests that handle MPP payment automatically
[MPP discovery docs](https://mpp.dev/advanced/discovery): Publish provider discovery metadata on mpp.dev
> Source: [/docs/guide/mercator](https://tempo.com/developers/docs/guide/mercator.md)
> Section: [Machine Payments](https://tempo.com/developers/docs/agents.md). Pay for APIs, accept API payments over MPP or x402, find services, and use MPP (https://mpp.dev).
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
# Mercator
[Mercator](https://mercator.sh/docs) connects AI agents to paid tools and services through one interface. Your agent can search the web, research companies, enrich records, or call a model without you integrating each provider separately. Connect it to your agent through the Model Context Protocol (MCP), or build an integration with its REST API.
Give your agent a task and a budget. For example, ask it to research three competitors and turn the findings into a sourced brief. The agent uses Mercator to find services, get a price for the selected tool calls, and pay for and run them as one job. You can retrieve the results later, even if the agent disconnects.
Mercator coordinates discovery, payment, and execution across independently operated services. It uses the [Machine Payments Protocol](https://mpp.dev) (MPP) for payments on Tempo and also supports providers using x402. Discovery and quotes are free; paid execution stays within your authorized wallet limits and any additional budget you give the agent. See [How MPP works](https://tempo.com/developers/docs/guide/machine-payments) for the Tempo integration.
## Connect Mercator to your agent
For an installed coding agent, follow these steps. For web apps or managed environments, use [Mercator's agent setup guide](https://mercator.sh/setup).
:::steps
### Install Mercator
Run the installer on the computer where your agent runs, then select the clients you want to connect:
```bash
curl -fsSL https://mercator.sh/install.sh | sh
```
If you already use the Tempo plugin marketplace, you can [install `mercator@tempo` directly](https://tempo.com/developers/docs/guide/using-tempo-with-ai#install-the-mercator-plugin).
### Authorize your agent
Load the installed configuration and complete authorization in your agent. Choose the wallet access and spending limits for that connection. Follow the [client-specific setup instructions](https://mercator.sh/setup#agent-setup) if Mercator's tools are not available.
### Verify the connection
Ask your agent:
```text
Search Mercator for web research services and check my Mercator connection status. Do not run a paid job.
```
The agent checks `search_services` and `get_connection_status`. These calls are free. Complete any authorization or funding steps before starting paid work.
:::
## Run a quoted workflow
Describe the result you need and how much the agent may spend. For example:
```text
Use Mercator to find Apple's latest 10-Q filing. Return the filing date, an official source link, and a short summary. Show me the quote before running a paid job.
```
Discovery and quotes are free. Paid jobs use the wallet and spending limits approved during authorization. You can manage access and funding in [Mercator Account](https://mercator.sh/account).
If a job is still running, keep its job ID and ask your agent to resume checking it. See [Mercator's job guide](https://mercator.sh/docs#run-your-first-job) for the complete flow.
## Integrate or publish a Mercator service
Use the [Mercator documentation](https://mercator.sh/docs) for MCP tools, REST endpoints, quotes, and job status. If you operate a paid API, follow the [service-owner guide](https://mercator.sh/docs#mercator-for-service-owners) to make it discoverable.
To add MPP payments to your service first, use the [Accept payments for an API](https://tempo.com/developers/docs/guide/machine-payments/server).
> Source: [/docs/guide/machine-payments](https://tempo.com/developers/docs/guide/machine-payments.md)
> Section: [Machine Payments](https://tempo.com/developers/docs/agents.md). Pay for APIs, accept API payments over MPP or x402, find services, and use MPP (https://mpp.dev).
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
# How MPP works
The [Machine Payments Protocol](https://mpp.dev/protocol) (MPP) lets a service request payment as part of an HTTP request. An application or agent handles the payment challenge and retries the request with payment authorization.
## MPP payment flow
```mermaid
sequenceDiagram
participant Client
participant Server
Client->>Server: Request resource
Server-->>Client: 402 Payment Required + Challenge
Note over Client: Authorize payment
Client->>Server: Retry request + Credential
Note over Server: Verify payment
Server-->>Client: Resource + Receipt
```
* **Challenge:** the server describes the payment terms in `WWW-Authenticate: Payment`.
* **Credential:** the client supplies the payment proof in `Authorization: Payment` when it retries.
* **Receipt:** the server acknowledges payment with `Payment-Receipt`.
The payment method defines the proof and settlement rules. On Tempo, a credential can carry a signed transaction, a transaction reference, or a payment-channel voucher, depending on the intent.
## MPP payment intents on Tempo
These guides cover two payment patterns:
| Pattern | Use it for | Guide |
| --- | --- | --- |
| One-time payment (`charge`) | A fixed price for a request or resource. | [Accept one-time payments](https://tempo.com/developers/docs/guide/machine-payments/one-time-payments) |
| Payment session (`session`) | Metered usage, including streamed responses, using a funded channel and signed vouchers. | [Accept pay-as-you-go payments](https://tempo.com/developers/docs/guide/machine-payments/pay-as-you-go) |
See the [MPP intent reference](https://mpp.dev/protocol#payment-intents) for other patterns and their supported payment methods.
## See the payment flow
This simulation illustrates the challenge, payment, and retry sequence for a paid photo request. The account, funds, and transaction are simulated.
The interactive terminal simulates the challenge, payment, and retry sequence for a paid request.
## Implement paid requests
Use [Pay for services](https://tempo.com/developers/docs/guide/machine-payments/client) for an application, [Pay with the CLI](https://tempo.com/developers/docs/guide/machine-payments/agent) for terminal requests, or [Accept payments for an API](https://tempo.com/developers/docs/guide/machine-payments/server) for a service. The [Machine Payments overview](https://tempo.com/developers/docs/agents) helps you choose an integration.
Payment authorization is separate from account access. Use [Access keys](https://tempo.com/developers/docs/accounts/automations/give-an-agent-a-wallet) to control which account an agent can spend from.
## Learn more about MPP
Use the [MPP documentation](https://mpp.dev) for SDKs, transport details, and payment methods, and the [protocol specification](https://paymentauth.org/) for normative behavior.
> Source: [/docs/guide/machine-payments/one-time-payments](https://tempo.com/developers/docs/guide/machine-payments/one-time-payments.md)
> Section: [Machine Payments](https://tempo.com/developers/docs/agents.md). Pay for APIs, accept API payments over MPP or x402, find services, and use MPP (https://mpp.dev).
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
# Accept one-time payments
Build a payment-gated API that charges $0.01 per request using `mppx`. The server returns a random photo from [Picsum](https://github.com/DMarby/picsum-photos) behind a paywall.
## One-time payment server setup
::::steps
### Install one-time payment dependencies
:::code-group
```bash [npm]
npm install mppx viem
```
```bash [pnpm]
pnpm add mppx viem
```
```bash [bun]
bun add mppx viem
```
:::
### Set up an `Mppx` charge instance
[Set `MPP_SECRET_KEY`](https://tempo.com/developers/docs/guide/machine-payments/server#set-the-server-secret) before starting the server.
Set up an `Mppx` instance with the `tempo` method.
* `recipient` is the address where you receive payments.
* `currency` is the token address for payments (in this case, `OUSD`).
```ts
import { Mppx, tempo } from 'mppx/server'
const mppx = Mppx.create({
methods: [tempo({
currency: '0x20c0000000000000000000006a37da5c996874be',
recipient: '0xa726a1CD723409074DF9108A2187cfA19899aCF8',
})],
})
```
### Add a one-time payment route
Add payment verification using `mppx.charge` as route middleware. The handler only runs after payment is verified.
:::code-group
```ts [Next.js]
import { Mppx, tempo } from 'mppx/nextjs'
const mppx = Mppx.create({
methods: [tempo({
currency: '0x20c0000000000000000000006a37da5c996874be',
recipient: '0xa726a1CD723409074DF9108A2187cfA19899aCF8',
})],
})
export const GET =
mppx.charge({ amount: '0.01', description: 'Random stock photo' })
(async () => {
const res = await fetch('https://picsum.photos/1024/1024')
return Response.json({ url: res.url })
})
```
```ts [Hono]
import { Hono } from 'hono'
import { Mppx, tempo } from 'mppx/hono'
const app = new Hono()
const mppx = Mppx.create({
methods: [tempo({
currency: '0x20c0000000000000000000006a37da5c996874be',
recipient: '0xa726a1CD723409074DF9108A2187cfA19899aCF8',
})],
})
app.get(
'/api/photo',
mppx.charge({ amount: '0.01', description: 'Random stock photo' }),
async (c) => {
const res = await fetch('https://picsum.photos/1024/1024')
return c.json({ url: res.url })
},
)
```
```ts [Express]
import express from 'express'
import { Mppx, tempo } from 'mppx/express'
const app = express()
const mppx = Mppx.create({
methods: [tempo({
currency: '0x20c0000000000000000000006a37da5c996874be',
recipient: '0xa726a1CD723409074DF9108A2187cfA19899aCF8',
})],
})
app.get(
'/api/photo',
mppx.charge({ amount: '0.01', description: 'Random stock photo' }),
async (req, res) => {
const response = await fetch('https://picsum.photos/1024/1024')
res.json({ url: response.url })
},
)
```
```ts [Fetch API]
import { Mppx, tempo } from 'mppx/server'
const mppx = Mppx.create({
methods: [tempo({
currency: '0x20c0000000000000000000006a37da5c996874be',
recipient: '0xa726a1CD723409074DF9108A2187cfA19899aCF8',
})],
})
Bun.serve({
async fetch(request) {
const result = await mppx.charge({
amount: '0.01',
description: 'Random stock photo',
})(request)
if (result.status === 402) return result.challenge
const res = await fetch('https://picsum.photos/1024/1024')
return result.withReceipt(Response.json({ url: res.url }))
},
})
```
:::
### Test the one-time payment endpoint
These examples charge mainnet OUSD. Configure the `mppx` CLI with a funded mainnet account before calling the endpoint; testnet faucet tokens cannot pay a mainnet challenge. To use test funds, [configure the server and client for Moderato](https://tempo.com/developers/docs/guide/machine-payments/server#test-your-mpp-server).
```bash
npx mppx http://localhost:3000/api/photo
```
::::
## Next steps for one-time payments
[Accept pay-as-you-go payments](https://tempo.com/developers/docs/guide/machine-payments/pay-as-you-go): Session-based billing with payment channels
[Accept payments for an API](https://tempo.com/developers/docs/guide/machine-payments/server): Framework middleware reference
[Full charge reference](https://mpp.dev/payment-methods/tempo/charge): Complete tempo.charge API documentation
> Source: [/docs/guide/machine-payments/pay-as-you-go](https://tempo.com/developers/docs/guide/machine-payments/pay-as-you-go.md)
> Section: [Machine Payments](https://tempo.com/developers/docs/agents.md). Pay for APIs, accept API payments over MPP or x402, find services, and use MPP (https://mpp.dev).
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
# Accept pay-as-you-go payments
Use pay-as-you-go sessions when a customer should pay a small amount each time they use an API or service, without sending an on-chain transaction for every request.
The example is a photo API: the client opens one `mppx` session, then pays $0.01 each time it asks for a photo. `mppx` is the library that manages the MPP session; [Picsum](https://github.com/DMarby/picsum-photos) only supplies sample images for the demo.
:::info
Unlike [one-time payments](https://tempo.com/developers/docs/guide/machine-payments/one-time-payments), a session opens a payment channel once. Each later request is paid with a signed voucher that the server verifies off-chain.
:::
## How pay-as-you-go sessions work
```mermaid
sequenceDiagram
participant Client
participant Server
participant Tempo
Client->>Tempo: (1) Deposit tokens
Tempo-->>Client: Channel created
Client->>Server: (2) Open credential
Note over Server: Verify on-chain deposit
Server-->>Client: 200 OK (session established)
loop Per request
Client->>Server: (3) Request + voucher
Note over Server: Verify voucher signature and amount
Server-->>Client: 200 OK + Receipt
end
Note over Server: (4) Periodic settlement
Server->>Tempo: settle(channelId, voucher)
Client->>Server: (5) Close
Server->>Tempo: close(channelId, voucher)
Tempo-->>Client: Refund remaining deposit
```
1. **Open** — Client deposits funds into an on-chain reserve contract, creating a payment channel
2. **Session** — Client signs vouchers with increasing cumulative amounts as service is consumed
3. **Top up** — If the channel runs low, the client deposits additional tokens without closing the channel
4. **Close** — Either party closes the channel, settling the final balance on-chain and refunding unused deposit
:::info[T7 payment-channel savings]
The [T7 network upgrade](https://tempo.com/developers/docs/protocol/upgrades/t7) can make repeated sessions cheaper for the same payer. When a payer closes or withdraws a finished channel, Tempo records a channel storage credit for that payer. If the same payer opens another channel later, Tempo can use that payer's credit. Other payers cannot use it.
:::
The channel-reserve gas snapshot for the credited reopen path is:
| Channel reserve snapshot | T7 gas |
|--------------------------|-------:|
| `open_new_channel_with_storage_credit` | 60,225 |
This is a call-level gas number and excludes separate approval gas. It matters most for session services where the same payer opens, closes or withdraws, and later opens channels again.
## Pay-as-you-go server setup
::::steps
### Install pay-as-you-go dependencies
:::code-group
```bash [npm]
npm install mppx viem
```
```bash [pnpm]
pnpm add mppx viem
```
```bash [bun]
bun add mppx viem
```
:::
### Set up an `Mppx` session instance
[Set `MPP_SECRET_KEY`](https://tempo.com/developers/docs/guide/machine-payments/server#set-the-server-secret) before starting the server.
Set up an `Mppx` instance with the `tempo` method.
* `recipient` is the address where you receive payments.
* `currency` is the token address for payments (in this case, `OUSD`).
```ts
import { Mppx, tempo } from 'mppx/server'
const mppx = Mppx.create({
methods: [tempo({
currency: '0x20c0000000000000000000006a37da5c996874be',
recipient: '0xa726a1CD723409074DF9108A2187cfA19899aCF8',
})],
})
```
#### Use prepaid credits
You can accept recipient-restricted TIP-20 tokens, such as prepaid service credits, using the same session setup:
* Set `currency` to your credit token's address.
* Set `recipient` to your service's payment address, which must be permitted by the token's transfer policy.
* Ensure the customer holds enough credits to fund the session and is permitted to send them.
The issuer does not need to allowlist the channel reserve. Funding and settlement check the token's transfer policy against the customer and your service. When the channel closes, unused credits return to the customer and remain subject to the token's spending restrictions.
Token pauses and account receive policies still apply. No additional session configuration is required.
See [Configure stablecoin transfer policies](https://tempo.com/developers/docs/guide/issuance/manage-stablecoin#configure-stablecoin-transfer-policies) for token-policy configuration.
### Add a pay-as-you-go route
Add payment verification using `mppx.session` as route middleware. The handler only runs after payment is verified.
:::code-group
```ts [Next.js]
import { Mppx, tempo } from 'mppx/nextjs'
const mppx = Mppx.create({
methods: [tempo({
currency: '0x20c0000000000000000000006a37da5c996874be',
recipient: '0xa726a1CD723409074DF9108A2187cfA19899aCF8',
})],
})
export const GET =
mppx.session({ amount: '0.01', unitType: 'photo' })
(async () => {
const res = await fetch('https://picsum.photos/200/200')
return Response.json({ url: res.url })
})
```
```ts [Hono]
import { Hono } from 'hono'
import { Mppx, tempo } from 'mppx/hono'
const app = new Hono()
const mppx = Mppx.create({
methods: [tempo({
currency: '0x20c0000000000000000000006a37da5c996874be',
recipient: '0xa726a1CD723409074DF9108A2187cfA19899aCF8',
})],
})
app.get(
'/api/sessions/photo',
mppx.session({ amount: '0.01', unitType: 'photo' }),
async (c) => {
const res = await fetch('https://picsum.photos/200/200')
return c.json({ url: res.url })
},
)
```
```ts [Express]
import express from 'express'
import { Mppx, tempo } from 'mppx/express'
const app = express()
const mppx = Mppx.create({
methods: [tempo({
currency: '0x20c0000000000000000000006a37da5c996874be',
recipient: '0xa726a1CD723409074DF9108A2187cfA19899aCF8',
})],
})
app.get(
'/api/sessions/photo',
mppx.session({ amount: '0.01', unitType: 'photo' }),
async (req, res) => {
const response = await fetch('https://picsum.photos/200/200')
res.json({ url: response.url })
},
)
```
```ts [Fetch API]
import { Mppx, tempo } from 'mppx/server'
const mppx = Mppx.create({
methods: [tempo({
currency: '0x20c0000000000000000000006a37da5c996874be',
recipient: '0xa726a1CD723409074DF9108A2187cfA19899aCF8',
})],
})
Bun.serve({
async fetch(request) {
const result = await mppx.session({
amount: '0.01',
unitType: 'photo',
})(request)
if (result.status === 402) return result.challenge
const res = await fetch('https://picsum.photos/200/200')
return result.withReceipt(Response.json({ url: res.url }))
},
})
```
:::
### Test the pay-as-you-go endpoint
These examples charge mainnet OUSD. Configure the `mppx` CLI with a funded mainnet account before calling the endpoint; testnet faucet tokens cannot pay a mainnet challenge. To use test funds, [configure the server and client for Moderato](https://tempo.com/developers/docs/guide/machine-payments/server#test-your-mpp-server).
```bash
npx mppx http://localhost:3000/api/sessions/photo
```
::::
## Pay-as-you-go client setup
When using sessions from a client, set `maxDeposit` to enable automatic channel management. This is the maximum amount of tokens the client locks into the payment channel's reserve contract. Any unspent deposit is refunded when the channel closes.
```ts
import { Mppx, tempo } from 'mppx/client'
import { Account } from 'viem/tempo'
const mppx = Mppx.create({
methods: [tempo({
account: Account.fromSecp256k1('0x...'),
maxDeposit: '1', // Lock up to 1 OUSD per channel
})],
})
// Mppx.create wraps global fetch by default:
// Each fetch handles session payments:
// 1st request: opens channel on-chain, sends initial voucher
// 2nd+ requests: sends off-chain vouchers (no on-chain tx)
const res = await fetch('http://localhost:3000/api/sessions/photo')
```
* **`maxDeposit: '1'`** — Locks up to 1 OUSD into the payment channel. At $0.01/photo, this covers up to 100 requests before the channel runs out.
* The client opens channels, signs vouchers, and retries `402` responses. Channels do not close automatically; use the [session manager and call `close()`](https://tempo.com/developers/docs/guide/machine-payments/streamed-payments#streamed-payment-client-setup) to release unused funds.
* If the server sets `suggestedDeposit`, the client uses `min(suggestedDeposit, maxDeposit)`.
## Configurable account payers
Under T14, a [configurable account](https://tempo.com/developers/docs/development/configurable-accounts) can't sign its own vouchers: set a separate single-key `authorizedSigner` for its channels. From [T15](https://tempo.com/developers/docs/protocol/upgrades/t15), which isn't scheduled yet, [TIP-1166](https://tips.sh/1166) lets the account's signers sign vouchers under the [channel reserve rules](https://tempo.com/developers/docs/protocol/tip20/spec#configurable-voucher-signers), which list the [errors](https://tempo.com/developers/docs/protocol/tip20/spec#channel-reserve-errors) to handle:
* **Payers:** open the channel with the signer's configuration commitment as `salt`, keep that configuration until the channel closes, and sign vouchers with it. If the signer's configuration changes, the channel still settles but can't be topped up: close it and open a new one.
* **Servers:** before serving, check a voucher with the reserve's `verifyVoucher` view. To skip the state read when the channel emitted `OpeningCommitmentRecorded` at open, apply every `settle` check yourself: a `0x05` signature whose account is the signer, whose configuration hashes to `descriptor.salt`, and whose owner signatures over the voucher digest reach the threshold.
* **Migrating to a configurable account:** close open channels first, then reopen them afterwards. A channel opened before the migration accepts vouchers only from the original key or version-0 configuration, never from a configuration registered later, and it can't be topped up.
## Next steps for pay-as-you-go payments
[Accept streamed payments](https://tempo.com/developers/docs/guide/machine-payments/streamed-payments): Per-token billing over Server-Sent Events
[Accept payments for an API](https://tempo.com/developers/docs/guide/machine-payments/server): Framework middleware reference
[Full session reference](https://mpp.dev/payment-methods/tempo/session): Complete tempo.session API documentation
> Source: [/docs/guide/machine-payments/streamed-payments](https://tempo.com/developers/docs/guide/machine-payments/streamed-payments.md)
> Section: [Machine Payments](https://tempo.com/developers/docs/agents.md). Pay for APIs, accept API payments over MPP or x402, find services, and use MPP (https://mpp.dev).
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
# Accept streamed payments
Build a payment-gated API that streams content word-by-word and charges $0.001 per word using `mppx` sessions with Server-Sent Events (SSE).
:::info
Streamed payments extend [pay-as-you-go sessions](https://tempo.com/developers/docs/guide/machine-payments/pay-as-you-go) with SSE. The server charges per word as content streams. When it needs authorization for more usage, the client sends a new voucher and the stream resumes. If the channel deposit itself is exhausted, more funds must be deposited before usage can continue.
:::
## How streamed payment sessions work
```mermaid
sequenceDiagram
participant Client
participant Server
participant Tempo
Client->>Tempo: (1) Deposit tokens
Tempo-->>Client: Channel created
Client->>Server: (2) Open credential
Note over Server: Verify on-chain deposit
Server-->>Client: 200 OK (SSE stream begins)
loop Per word streamed
Server-->>Client: (3) SSE data event + charge
Note over Server: Verify authorized amount
end
alt More usage authorization needed
Server-->>Client: (4) payment-need-voucher event
Client->>Server: New voucher
Note over Server: Resume streaming
end
Note over Server: (5) Periodic settlement
Server->>Tempo: settle(channelId, voucher)
Client->>Server: (6) Close
Server->>Tempo: close(channelId, voucher)
Tempo-->>Client: Refund remaining deposit
```
1. **Open** — Client deposits funds into an on-chain reserve contract, creating a payment channel
2. **Stream** — Server calls `stream.charge()` before sending each word to meter usage against the authorized voucher amount
3. **Authorize more usage** — The server emits `payment-need-voucher` when it needs a higher authorized amount; the client signs a new voucher within the funded channel
4. **Close** — Either party closes the channel, settling the final balance on-chain and refunding unused deposit
## Streamed payment server setup
::::steps
### Install streamed payment dependencies
:::code-group
```bash [npm]
npm install mppx viem
```
```bash [pnpm]
pnpm add mppx viem
```
```bash [bun]
bun add mppx viem
```
:::
### Set up an `Mppx` streaming instance
[Set `MPP_SECRET_KEY`](https://tempo.com/developers/docs/guide/machine-payments/server#set-the-server-secret) before starting the server.
Configure `tempo.session` directly with `sse: true` to enable SSE support for this session method.
```ts
import { Mppx, tempo } from 'mppx/server'
const mppx = Mppx.create({
methods: [tempo.session({
currency: '0x20c0000000000000000000006a37da5c996874be',
recipient: '0xa726a1CD723409074DF9108A2187cfA19899aCF8',
sse: true,
})],
})
```
### Add a streamed payment route
Use the standard `Request` / `Response` handler below in a Fetch-compatible server. For Next.js, export it as `GET`. The generator charges each word before sending it; the title is unmetered metadata.
```ts
import { Mppx, tempo } from 'mppx/server'
const mppx = Mppx.create({
methods: [tempo.session({
currency: '0x20c0000000000000000000006a37da5c996874be',
recipient: '0xa726a1CD723409074DF9108A2187cfA19899aCF8',
sse: true,
})],
})
export async function GET(request: Request) {
const result = await mppx.session({
amount: '0.001',
unitType: 'word',
})(request)
if (result.status === 402) return result.challenge
return result.withReceipt(async function* (stream) {
yield JSON.stringify({ title: 'Payment confirmation' })
for (const word of 'Your payment has been received.'.split(' ')) {
await stream.charge()
yield word
}
})
}
```
### Test the streamed payment endpoint
For Next.js App Router, save the handler as `app/api/sessions/poem/route.ts`, then use the client below. A successful request streams the title metadata followed by the words “Your payment has been received.” This example charges mainnet OUSD. Use a funded mainnet account; testnet faucet tokens cannot pay a mainnet challenge. To use test funds, [configure the server and client for Moderato](https://tempo.com/developers/docs/guide/machine-payments/server#test-your-mpp-server).
::::
## Streamed payment client setup
Use [`tempo.session.manager()`](https://mpp.dev/sdk/typescript/client/Method.tempo.session-manager) from `mppx/client` to create a session manager. The `.sse()` method connects to the SSE endpoint and handles voucher renewal automatically — if the server requests a new voucher mid-stream, the client signs and sends one without interrupting the stream.
```ts
import { tempo } from 'mppx/client'
import { Account } from 'viem/tempo'
const session = tempo.session.manager({
account: Account.fromSecp256k1('0x...'),
maxDeposit: '1', // Lock up to 1 OUSD per channel
})
try {
const stream = await session.sse('http://localhost:3000/api/sessions/poem')
for await (const word of stream) {
process.stdout.write(word + ' ')
}
} finally {
await session.close()
}
```
* **`tempo.session.manager()`** — Creates a session manager that handles the full channel lifecycle: open, voucher signing, and close.
* **`.sse()`** — Connects to an SSE endpoint. Automatically sends new vouchers when the server emits `payment-need-voucher` events.
* **`maxDeposit: '1'`** — Locks up to 1 OUSD. At $0.001/word, this covers ~1,000 words before the channel needs a top-up.
## Next steps for streamed payments
[Accept one-time payments](https://tempo.com/developers/docs/guide/machine-payments/one-time-payments): Charge per request with on-chain settlement
[Accept pay-as-you-go payments](https://tempo.com/developers/docs/guide/machine-payments/pay-as-you-go): Session-based billing without streaming
[Full session reference](https://mpp.dev/payment-methods/tempo/session): Complete tempo.session API documentation
> Source: [/docs/development](https://tempo.com/developers/docs/development.md)
> Section: [Tempo EVM](https://tempo.com/developers/docs/development.md). Build on Tempo EVM: wallets and keys, payments, transactions and fees, TIP-20 Tokens, contracts, exchange, network details, nodes, protocol specifications, and changelog.
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
# Tempo EVM
Tempo is a blockchain for payments. Tempo EVM is its Ethereum-compatible execution environment: use Solidity contracts, Ethereum JSON-RPC, and familiar tools like Foundry, Viem, and Wagmi to build with stablecoins.
[Send your first test payment →](https://tempo.com/developers/get-started/quickstart) · [RPC endpoints and chain IDs →](https://tempo.com/developers/docs/quickstart/connection-details)
Transaction calls pass through Tempo EVM and become entries in the ledger.
Build wallets, payment applications, and financial services on Tempo EVM. It combines Ethereum’s smart contract model with infrastructure designed for moving money: stablecoin fees, fast finality, and dedicated capacity for eligible payments. Use it to accept customer deposits, send payouts, issue stablecoins, or build your own onchain application.
Accounts, tokens, and transactions come with payment capabilities built in. Give customers passkey-based accounts, cover their fees, and automate payments with limited signing permissions. Issue tokens with configurable controls and exchange stablecoins through shared onchain liquidity. Start with these native capabilities, then use Solidity to add the logic your application needs.
## Build on Tempo
Start with a wallet integration, an interactive token walkthrough, or a Solidity contract. Use the setup guides to connect your application to Tempo.
### Build a wallet integration
Add wallet support and try a browser payment with Wagmi.
[Accounts and keys](https://tempo.com/developers/docs/accounts/keys)
[Integrate a wallet](https://tempo.com/developers/docs/quickstart/wallet-developers)
[Browser payments](https://tempo.com/developers/docs/guide/payments/send-a-payment/browser)
### Create and exchange tokens
Create a test stablecoin, then try a swap on Moderato.
[Create a TIP-20 token](https://tempo.com/developers/docs/guide/issuance/create-a-stablecoin)
[Swap stablecoins](https://tempo.com/developers/docs/guide/stablecoin-dex/executing-swaps)
### Deploy smart contracts
Use Foundry to deploy Solidity contracts and verify their source.
[Deploy a contract](https://tempo.com/developers/docs/network/contracts)
[Verify a contract](https://tempo.com/developers/docs/quickstart/verify-contracts)
### Connect your application
Choose your tools and check what changes when moving an Ethereum application to Tempo.
[RPC endpoints and chain IDs](https://tempo.com/developers/docs/quickstart/connection-details)
[SDKs](https://tempo.com/developers/docs/sdk)
[CLI](https://tempo.com/developers/docs/cli)
[EVM differences](https://tempo.com/developers/docs/quickstart/evm-compatibility)
Read the [protocol specifications](https://tempo.com/developers/docs/protocol) for the underlying execution rules.
## Payment features
Start with a transfer or contract call, then add the capabilities your application needs. Standard EVM transactions work for basic transfers and calls; use [Tempo Transactions](https://tempo.com/developers/docs/guide/tempo-transaction) for features such as batching, fee sponsorship, and access keys.
[Payment lanes](https://tempo.com/developers/docs/protocol/blockspace/payment-lane-specification): Reserved capacity for eligible payment calls when other applications are busy. Qualifying transactions use it automatically; payment capacity is still finite.
[Stablecoin fees](https://tempo.com/developers/docs/network/fees): Pay fees in supported USD stablecoins or sponsor them for customers. The base fee stays within fixed bounds; total cost depends on gas usage and priority fees.
[Fast finality](https://tempo.com/developers/docs/protocol/blockspace/consensus): Transactions normally reach deterministic finality in less than a second. Once finalized, they need no additional confirmation blocks.
[Payment operations](https://tempo.com/developers/docs/guide/tempo-transaction): Batch calls atomically, send payments concurrently, and set validity windows. Choose whether payments succeed together or each has its own outcome.
[Accounts and keys](https://tempo.com/developers/docs/accounts/keys): Use secp256k1, P-256, or WebAuthn signatures. Authorize access keys with spending limits and call scopes.
[Payment reconciliation](https://tempo.com/developers/docs/guide/payments/accept-a-payment): Attach payment references with memos. Attribute incoming TIP-20 deposits to customers through virtual addresses that credit one account, without wallet sweeps.
[TIP-20 Tokens](https://tempo.com/developers/docs/network/tokens): Create stablecoins with minting, burning, supply caps, issuer roles, and transfer policies built in. Configure controls without writing a custom token contract.
[Stablecoin exchange](https://tempo.com/developers/docs/guide/stablecoin-dex): Swap supported stablecoins through a shared orderbook. Set slippage limits and trade against available liquidity.
Explore [Earn](https://tempo.com/developers/docs/earn) for vault deposits, [Routes](https://tempo.com/developers/docs/routes) for transfers across networks, [Zones](https://tempo.com/developers/docs/zones) for private balances, and [Machine payments](https://tempo.com/developers/docs/agents) for paid APIs.
> Source: [/docs/accounts/keys](https://tempo.com/developers/docs/accounts/keys.md)
> Section: [Tempo EVM](https://tempo.com/developers/docs/development.md). Build on Tempo EVM: wallets and keys, payments, transactions and fees, TIP-20 Tokens, contracts, exchange, network details, nodes, protocol specifications, and changelog.
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
# Account Model
Every Tempo EVM account is either a single-key account or a configurable account.
## Overview
The two account types differ in who approves transactions. One key approves a single-key account's transactions, as on Ethereum. Weighted owners approve a configurable account's transactions. The Accounts guides call them signers. A transaction runs once the approving owners' weights reach the account's threshold. Either type can also authorize access keys, which sign alone within limits.
Two account types: a single-key account, which can upgrade in place to a configurable account. Both use the Account Keychain for access keys.
## Single-Key and Configurable Accounts
| | [Single-key account](https://tempo.com/developers/docs/development/single-key-accounts) | [Configurable account](https://tempo.com/developers/docs/development/configurable-accounts) |
| --- | --- | --- |
| Approved by | Its one key, the root key | Owners whose weights reach the threshold |
| Address comes from | One public key: secp256k1, P-256, or WebAuthn (passkey) | The first configuration of owners, weights, threshold, and salt, or the original key if upgraded |
| Changing keys | A new key means a new address. [Upgrade to a configurable account](https://tempo.com/developers/docs/development/single-key-accounts#upgrade-to-a-configurable-account) to change keys and keep the address. | `updateConfig` replaces the owners and threshold. The address stays. |
| Running contract code (EIP-7702 delegation) | Allowed, but a delegated account can't upgrade | Not allowed |
:::warning
**Multiple signers arrive on mainnet with the [T14 network upgrade](https://tempo.com/developers/docs/protocol/upgrades/t14).** They are live on [testnet](https://tempo.com/developers/docs/accounts/create#connect-to-testnet) since T14 activated there on November 24, 2026. Mainnet activation is scheduled for December 8, 2026.
:::
Single-key accounts work on mainnet and testnet. The upgrade to a configurable account runs on testnet now and reaches mainnet with T14 on December 8, 2026.
## Access Keys
An [access key](https://tempo.com/developers/docs/accounts/access-keys) is an extra key that signs for the account on its own, within the limits you set:
* **Spending Limits:** A limit per TIP-20 token, which can reset each period.
* **Expiry:** An optional time after which the key stops working.
* **Scopes:** Restrictions on which contracts it calls and whom it pays.
The [Account Keychain](https://tempo.com/developers/docs/development/account-keychain), a contract built into Tempo (a precompile), stores every account's access keys. It enforces those limits on each transaction they sign.
The account itself authorizes and revokes access keys, through its root key or owners whose weights reach the threshold. Access keys never count toward a threshold.
## Tempo Transaction Signature Types
| Signature | Prefix | Used by |
| --- | --- | --- |
| secp256k1 | None (65 bytes) | A root key, owner, access key, or fee payer |
| P-256 | `0x01` | A root key, owner, or access key |
| WebAuthn | `0x02` | A root key, owner, or access key |
| Keychain | `0x04` | An access key, wrapping its own signature with the account's address |
| Multisig | `0x05` | A configurable account's owners, bundling their signatures with the [account's configuration](https://tempo.com/developers/docs/development/configurable-accounts#multisig-signature-format) |
Viem's `Account` helpers encode every [format](https://tempo.com/developers/docs/protocol/transactions/spec-tempo-transaction#signature-types).
## Logins and API Keys
Only these keys sign transactions. Your app's login session controls access to your app. A Tempo API key authenticates requests to Tempo's hosted APIs. Neither signs for an account.
## Related
[Access Keys](https://tempo.com/developers/docs/accounts/access-keys): Covers keys that sign for an account within spending limits, expiry, and scopes.
[Single-Key Accounts](https://tempo.com/developers/docs/development/single-key-accounts): Covers the protocol reference for accounts approved by one key.
[Configurable Accounts](https://tempo.com/developers/docs/development/configurable-accounts): Covers the protocol reference for accounts approved by weighted owners.
[Account Keychain](https://tempo.com/developers/docs/development/account-keychain): Covers the precompile that stores and enforces access keys.
> Source: [/docs/development/single-key-accounts](https://tempo.com/developers/docs/development/single-key-accounts.md)
> Section: [Tempo EVM](https://tempo.com/developers/docs/development.md). Build on Tempo EVM: wallets and keys, payments, transactions and fees, TIP-20 Tokens, contracts, exchange, network details, nodes, protocol specifications, and changelog.
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
# Single-key accounts
A single-key account is an address derived from one public key, its root key, which has full control of the account.
Single-key accounts are live on mainnet and testnet. They work like an Ethereum account (an EOA), except the root key can also be a P-256 key or a passkey. A secp256k1 key has the same address on Tempo as on Ethereum and other EVM chains, but balances don't carry over between chains.
A single-key account's private key derives its address and can authorize access keys, extra keys that sign for the account.
## Single-key address derivation
The address is the last 20 bytes of `keccak256(x ‖ y)`, the hash of the root key's public key coordinates, the same rule Ethereum uses ([specification](https://tempo.com/developers/docs/protocol/transactions/spec-tempo-transaction#address-derivation)).
| Root key | Viem account |
| --- | --- |
| secp256k1 | `Account.fromSecp256k1(privateKey)` |
| P-256 | `Account.fromP256(privateKey)` |
| WebAuthn (passkey) | `Account.fromWebAuthnP256(credential)` |
Because the key fixes the address, you can't replace the root key: a new key is a new address. To change keys and keep the address, [upgrade to a configurable account](https://tempo.com/developers/docs/development/single-key-accounts#upgrade-to-a-configurable-account). A [configurable account](https://tempo.com/developers/docs/development/configurable-accounts) is one address controlled by weighted owner keys. Configurable accounts run on [testnet](https://tempo.com/developers/docs/accounts/create#connect-to-testnet) now. [T14](https://tempo.com/developers/docs/protocol/upgrades/t14) brings them to mainnet on December 8, 2026.
## Signing with the root key
The root key signs transactions directly, in the [signature format](https://tempo.com/developers/docs/accounts/keys#tempo-transaction-signature-types) for its key type. The example sends 10 test stablecoins from the account to `RECIPIENT`. Set `ROOT_KEY` to the account's private key. Its `client.ts` is a Viem client for [testnet](https://tempo.com/developers/docs/accounts/create#connect-to-testnet), whose public RPC needs no key.
On mainnet or Moderato, Tempo's testnet, which need no RPC key, use `createClient({ chain: tempo })` or `createClient({ chain: tempoModerato })` instead, with the chain from `viem/chains`, and pay network fees in that network's stablecoins, since Tempo has no native gas token. [Network details](https://tempo.com/developers/docs/quickstart/connection-details) lists both networks.
:::code-group
```ts [sign.ts]
import { parseUnits } from 'viem'
import { Account } from 'viem/tempo'
import { client } from './client'
// A test stablecoin on testnet
const stablecoin = '0x20c0000000000000000000000000000000000001'
const account = Account.fromSecp256k1(process.env.ROOT_KEY as `0x${string}`) // [!code hl]
await client.token.transferSync({ // [!code hl]
account, // [!code hl]
amount: parseUnits('10', 6), // [!code hl]
to: process.env.RECIPIENT as `0x${string}`, // [!code hl]
token: stablecoin, // [!code hl]
}) // [!code hl]
```
```ts [client.ts]
import { http } from 'viem'
import { tempoModerato } from 'viem/chains'
import { createClient } from 'viem/tempo'
// Tempo testnet. The public RPC needs no key.
export const client = createClient({
chain: tempoModerato,
transport: http(),
})
```
:::
Any of the three key types can also sign EIP-7702 authorizations, which let the account run a contract's code as its own ([Tempo and EIP-7702](https://tempo.com/developers/docs/protocol/transactions/eip-7702)). An account with an EIP-7702 delegation can't [upgrade](https://tempo.com/developers/docs/development/single-key-accounts#upgrade-to-a-configurable-account).
## Access keys on a single-key account
The root key can authorize [access keys](https://tempo.com/developers/docs/development/account-keychain), extra keys that sign for the account within the spending limits, expiry, and call scopes you set. Scopes list the contracts, functions, and recipients a key can use. The root key keeps full authority and can revoke any of them. To choose limits for a task, follow the [Access keys](https://tempo.com/developers/docs/accounts/access-keys) guide.
## Upgrade to a configurable account
An upgrade turns a single-key account into a [configurable account](https://tempo.com/developers/docs/development/configurable-accounts) at the same address, so you can add a backup key or rotate keys without moving funds. Owners approve instead of the root key, with weights that must reach a threshold. The upgrade is permanent.
:::warning
**Multiple signers arrive on mainnet with the [T14 network upgrade](https://tempo.com/developers/docs/protocol/upgrades/t14).** They are live on [testnet](https://tempo.com/developers/docs/accounts/create#connect-to-testnet) since T14 activated there on November 24, 2026. Mainnet activation is scheduled for December 8, 2026.
:::
The upgrade ([TIP-1113](https://tips.sh/1113)) takes effect on testnet now and on mainnet once T14 activates there on December 8, 2026. On mainnet until then, the upgrade transaction does nothing. It succeeds and charges its fee, but the root key still approves alone. For a walkthrough with a demo that runs in your browser, follow [Account upgrade](https://tempo.com/developers/docs/accounts/account-configuration/account-upgrade).
| Property | Rule |
| --- | --- |
| Call | `upgradeAccount(threshold, owners)` on the native multisig precompile, a contract built into testnet at `0xAACC000000000000000000000000000000000000` |
| Signed by | The root key, directly. Access keys can't upgrade. A [fee payer](https://tempo.com/developers/docs/accounts/fees/fee-sponsorship) can sponsor it. |
| Transaction | `upgradeAccount` is a top-level call, anywhere in a batch, with no EIP-7702 authorization list. Calls after it see the new owners. |
| Eligible accounts | No contract code, no EIP-7702 delegation, and no configuration yet |
| Installed configuration | The owners and threshold, as version `1`, with salt `keccak256("tempo:configurable-account:upgrade" ‖ account)` |
| Kept | Address, balances, contract storage, token approvals, nonce, and access keys with their limits |
| Root key afterward | Retired on Tempo: it can't sign transactions, TIP-20 permits, or fee sponsorships for the account. It approves only if listed as an owner, with its weight. Other chains, and contracts that try `ecrecover` before or instead of ERC-1271, such as OpenZeppelin `SignatureChecker` before v5.1, still accept it. |
| Event | `AccountUpgraded(account, commitment, salt, threshold, owners)` |
Viem 2.57.5 has no upgrade action, so call the precompile with `writeContractSync`, as in [Account upgrade](https://tempo.com/developers/docs/accounts/account-configuration/account-upgrade#send-the-upgrade). Every approval carries the configuration, so [save it](https://tempo.com/developers/docs/development/configurable-accounts#keep-the-current-configuration) with the account record.
> Source: [/docs/development/configurable-accounts](https://tempo.com/developers/docs/development/configurable-accounts.md)
> Section: [Tempo EVM](https://tempo.com/developers/docs/development.md). Build on Tempo EVM: wallets and keys, payments, transactions and fees, TIP-20 Tokens, contracts, exchange, network details, nodes, protocol specifications, and changelog.
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
# Configurable accounts
A configurable account is one address controlled by a set of weighted owner keys.
A transaction runs once the weights of the owners who sign it reach the account's threshold: with three owners at weight 1 and a threshold of 2, any two can approve. The address never changes, so you can add, remove, or replace owners without moving funds.
:::warning
**Multiple signers arrive on mainnet with the [T14 network upgrade](https://tempo.com/developers/docs/protocol/upgrades/t14).** They are live on [testnet](https://tempo.com/developers/docs/accounts/create#connect-to-testnet) since T14 activated there on November 24, 2026. Mainnet activation is scheduled for December 8, 2026.
:::
The same applies to a configurable account with one owner.
The version-0 configuration of signers, threshold, and salt derives the address. A transaction runs once the weights of the signers who approve it reach the threshold.
## Account configuration fields
| Field | Type | Rule |
| --- | --- | --- |
| `owners` | `(address, uint8 weight)[]` | 1–48 owners with unique, nonzero addresses in ascending order. Each weight is at least 1, and the weights total at most 255. |
| `threshold` | `uint8` | 1–255, and at most the eight largest weights combined, since an approval carries at most eight signatures |
| `salt` | `bytes32` | Any 32 bytes, fixed for the account's lifetime. A different salt gives the same owners a different address. |
| `version` | `uint64` | `0` at creation, then `+1` per update |
Each owner is the address of one secp256k1 (standard Ethereum), P-256, or WebAuthn (passkey) key. A configurable account can't be another account's owner, but it can be another account's [access key](https://tempo.com/developers/docs/development/account-keychain#access-keys-on-each-account-type).
Tempo stores only a 32-byte hash of the configuration, not the owners themselves. Every approval carries the full configuration, which Tempo checks against that hash, so your app must [keep the configuration](https://tempo.com/developers/docs/development/configurable-accounts#keep-the-current-configuration).
## Configurable account address
The address is the last 20 bytes of a hash of the version-0 configuration, with no chain ID ([TIP-1107](https://tips.sh/1107)). You know it before the account ever transacts, and it can receive stablecoins right away. It can't hold an EIP-7702 delegation or deployed contract code. `client.ts` connects to [testnet](https://tempo.com/developers/docs/accounts/create#connect-to-testnet).
:::code-group
```ts [account.ts]
import { Account } from 'viem/tempo'
export const env = (name: string) => process.env[name] as `0x${string}`
// Owner keys on this machine, so viem can sign with them
export const finance = Account.fromSecp256k1(env('FINANCE_KEY'))
export const operations = Account.fromSecp256k1(env('OPERATIONS_KEY'))
// 2 of 3: the two local keys and the controller's passkey, which stays on the controller's device
export const account = Account.fromConfig({ // [!code hl]
address: 'infer', // [!code hl]
owners: [ // [!code hl]
{ owner: finance, weight: 1 }, // [!code hl]
{ owner: operations, weight: 1 }, // [!code hl]
{ owner: env('CONTROLLER_PASSKEY_ADDRESS'), weight: 1 }, // [!code hl]
], // [!code hl]
threshold: 2, // [!code hl]
}) // [!code hl]
// Save both with the account record: Tempo keeps only a hash of the configuration.
export const saved = { address: account.address, config: account.config } // [!code hl]
```
```ts [client.ts]
import { http } from 'viem'
import { tempoModerato } from 'viem/chains'
import { createClient } from 'viem/tempo'
// Tempo testnet. The public RPC needs no key.
export const client = createClient({
chain: tempoModerato,
transport: http(),
})
```
:::
`address: 'infer'` derives the address from this configuration, so creating the account sends nothing. `Account.fromConfig` sorts owners by address, defaults each weight and the threshold to `1`, and defaults the salt to zero. An owner given as a local account, like `finance`, is a key Viem signs with. An owner given as an address, like the controller's passkey, signs on its own device.
The address is the same on other EVM chains, but nothing controls it there, so funds sent to it on another chain are lost. To keep a way to recover them, [create the account from a fresh key](https://tempo.com/developers/docs/accounts/account-configuration#recover-funds-sent-on-another-chain) instead.
### Account registration
The account's first transaction registers it: Tempo stores the version-0 hash before running any call. Registration sticks even if the calls revert, and an invalid transaction registers nothing. An existing single-key account skips this step: it [upgrades in place](https://tempo.com/developers/docs/development/single-key-accounts#upgrade-to-a-configurable-account) and starts at version 1.
## Owner approvals
Owners approve a whole transaction, including every call in a batch. The transaction comes from the account's address, which pays the fees unless a [fee payer](https://tempo.com/developers/docs/accounts/fees/fee-sponsorship) sponsors them.
An approval carries 1–8 owner signatures, sorted by owner address, whose weights must reach the threshold. Tempo rejects an approval that includes a signature the threshold doesn't need. Each signature covers the account and the configuration version, so it can't be reused on another account or after an update. Access keys never count toward the threshold.
In Viem, a payment is an ordinary action with this account, such as `client.token.transferSync({ account, amount, to, token })`. Viem signs with the local owners, highest weight first, until their weights reach the threshold, so `finance` and `operations` approve it. If the local owners can't reach the threshold, the action throws `Local owners do not meet the threshold.` and sends nothing.
To collect approvals from separate devices, see [Signing thresholds](https://tempo.com/developers/docs/accounts/policies/signing-thresholds#approvers-on-separate-devices).
### `0x05` multisig signature
Viem builds this signature for you. You need its format ([TIP-1107](https://tips.sh/1107)) only to build or check approvals yourself:
```text
signature = 0x05 || rlp([account, config, signatures])
config = [salt, version, threshold, owners]
owner = [address, weight]
digest = keccak256("tempo:configurable-account:signature" || inner_digest || account || uint64(version))
```
Each owner signs `digest`. For a transaction, `inner_digest` is the transaction's signing hash; for a contract check, it's the `hash` passed to [`verifyConfigurableAccount`](https://tempo.com/developers/docs/development/configurable-accounts#verify-owner-approvals-in-a-contract) or `isValidSignature`. Tempo checks the configuration against the stored hash (before registration, it derives the address from the configuration instead), then adds up the signers' weights.
The `0x05` signature also approves [access-key grants](https://tempo.com/developers/docs/development/account-keychain#access-keys-on-each-account-type). It isn't valid as a fee payer signature, in subblock transactions, or in authorization lists.
## Configuration updates
`updateConfig` ([TIP-1107](https://tips.sh/1107)) replaces the owners and threshold. The address, salt, balances, and access keys stay the same. An update doesn't revoke access keys, so [revoke](https://tempo.com/developers/docs/development/account-keychain#revoke-an-access-key) any you no longer want.
| Property | Rule |
| --- | --- |
| Called by | The account, in a transaction its owners approve at the current threshold. Access keys and contracts can't call it. |
| Version | Increments by 1, which invalidates approvals collected for the old version |
| Batches | Several updates in one transaction must form consecutive versions |
| Event | `ConfigurableAccountConfigUpdated(account, salt, version, threshold, owners)`, also emitted at registration with version 0 |
```ts [update.ts]
import { AccountConfig, Actions } from 'viem/tempo'
import { account, env, finance, operations, saved } from './account'
import { client } from './client'
const nextConfig = { // [!code hl]
owners: [ // [!code hl]
{ owner: finance.address, weight: 1 }, // [!code hl]
{ owner: operations.address, weight: 1 }, // [!code hl]
{ owner: env('NEW_PASSKEY_ADDRESS'), weight: 1 }, // [!code hl]
], // [!code hl]
threshold: 2, // [!code hl]
} // [!code hl]
await client.writeContractSync({ // [!code hl]
account, // [!code hl]
...Actions.accounts.updateConfig.call({ currentConfig: saved.config, nextConfig }), // [!code hl]
throwOnReceiptRevert: true, // [!code hl]
}) // [!code hl]
// Save only after the update succeeds. Version 1 replaces version 0.
saved.config = AccountConfig.update(saved.config, nextConfig) // [!code hl]
```
Viem sorts the new owners and signs with `finance` and `operations`, whose weights reach the current threshold of 2. `AccountConfig.update` builds version 1 with the same salt. Save it after the transaction succeeds, then [rebuild the account](https://tempo.com/developers/docs/development/configurable-accounts#keep-the-current-configuration) before the next action. [Configuration updates](https://tempo.com/developers/docs/accounts/account-configuration/configuration-updates#add-a-signer) walks through a full update.
Viem 2.57.5's `updateConfigSync` expects the old event name and throws after a successful testnet update. Use `writeContractSync` as above until Viem supports `ConfigurableAccountConfigUpdated`.
### Keep the current configuration
The stored hash can't be turned back into the owners and threshold. Save the address and configuration when you create the account (`saved` in `account.ts`), and replace the configuration with the returned `config` after each update. The configuration's `version` is a bigint, which `JSON.stringify` can't encode, so store `AccountConfig.toRpc(config)` and read it back with `AccountConfig.fromRpc`.
To act from the account, rebuild it from that record. Attach the keys that approve this time as local accounts, and leave the other owners as addresses. A version-0 configuration derives the address, so pass the saved address only after the first update:
```ts [config.ts]
import { isAddressEqual } from 'viem'
import { Account } from 'viem/tempo'
import { finance, operations, saved } from './account'
const { address, config } = saved // the stored account record
const approvers = [finance, operations] // the keys signing this time
const owners = config.owners.map(({ owner, weight }) => ({ // [!code hl]
owner: approvers.find((key) => isAddressEqual(key.address, owner)) ?? owner, // [!code hl]
weight, // [!code hl]
})) // [!code hl]
// never updated: the configuration derives the address
export const account = // [!code hl]
config.version === 0n // [!code hl]
? Account.fromConfig({ address: 'infer', owners, salt: config.salt, threshold: config.threshold }) // [!code hl]
: Account.fromConfig({ ...config, address, owners }) // [!code hl]
```
Rebuild after every update. An account object carries the configuration it was built from, and Tempo checks that against the stored hash, so an object from before the update fails with `multisig configuration commitment mismatch`.
To check that a saved configuration is still current, compare its hash with the stored one, which any node returns:
```ts [check-config.ts]
import { AccountConfig } from 'viem/tempo'
import { saved } from './account'
import { client } from './client'
const stored = await client.accounts.getConfigCommitment({ account: saved.address }) // [!code hl]
const isCurrent = stored === AccountConfig.getCommitment(saved.config) // [!code hl]
```
The stored hash is zero before registration. A mismatch means another update landed, and approvals built on the saved configuration fail.
### Rebuild a lost configuration
Chain history holds the configuration only once the account has used it:
| Account state | Where the configuration is onchain |
| --- | --- |
| Never transacted | Nowhere. Your saved copy, including the salt, is the only record. |
| Version 0, transacted | In the registration's `ConfigurableAccountConfigUpdated` event, and in each transaction's [`0x05` signature](https://tempo.com/developers/docs/development/configurable-accounts#multisig-signature-format), which carries the full configuration |
| Updated or upgraded | In the latest `ConfigurableAccountConfigUpdated` or `AccountUpgraded` event, which carries the salt, threshold, and owners. An upgrade installs version 1. |
If an update landed but your app failed to save the new configuration, rebuild it with `AccountConfig.update(saved.config, nextConfig)`, or from the account's latest `ConfigurableAccountConfigUpdated` event. Before you use the rebuilt configuration, check it against `getConfigCommitment` as above.
## Verify owner approvals in a contract
A registered account answers ERC-1271 `isValidSignature(hash, signature)` through its code marker. It returns `0x1626ba7e` when the owners approved `hash`, so Permit2 and `SignatureChecker`-style contracts work unchanged. An unregistered account has no code, so those contracts fall back to `ecrecover` and reject the `0x05` signature. Have it send one transaction first.
A contract can also call the signature verifier precompile directly, a contract built into Tempo at `0x5165300000000000000000000000000000000000`. This works before registration too:
```solidity
interface ISignatureVerifier {
function verifyConfigurableAccount(address account, bytes32 hash, bytes calldata signature) external view returns (bool); // [!code hl]
}
```
| Result | When |
| --- | --- |
| `true` | Owners at the current version signed the [`0x05` digest](https://tempo.com/developers/docs/development/configurable-accounts#multisig-signature-format) of `hash`, and their weights reached the threshold |
| `false` | The configuration doesn't match the stored hash or derive the address, or the account has code other than the marker, such as an EIP-7702 delegation |
| Reverts `InvalidFormat()` | The encoding or configuration is invalid |
| Reverts `InvalidSignature()` | The owner approvals are invalid |
An unregistered account verifies against its version-0 configuration, and the check doesn't register it. Include your chain ID, contract address, and the account in `hash` so an approval can't be replayed elsewhere. [Verify approvals in a contract](https://tempo.com/developers/docs/accounts/policies/signing-thresholds#verify-approvals-in-a-contract) has a full contract.
## Native multisig precompile
The native multisig precompile is at `0xAACC000000000000000000000000000000000000` on testnet. Viem's `Actions.accounts.updateConfig.call` builds calls to it, and `getConfigCommitment` reads its stored configuration hash.
| Function | Purpose |
| --- | --- |
| `deriveAccount(salt, threshold, owners)` | Returns the address for a version-0 configuration |
| `getConfigCommitment(account)` | Returns the stored hash, or zero before registration |
| `updateConfig(current, threshold, owners)` | Replaces the owners and threshold |
| `upgradeAccount(threshold, owners)` | [Upgrades a single-key account](https://tempo.com/developers/docs/development/single-key-accounts#upgrade-to-a-configurable-account) |
> Source: [/docs/development/account-keychain](https://tempo.com/developers/docs/development/account-keychain.md)
> Section: [Tempo EVM](https://tempo.com/developers/docs/development.md). Build on Tempo EVM: wallets and keys, payments, transactions and fees, TIP-20 Tokens, contracts, exchange, network details, nodes, protocol specifications, and changelog.
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
# Account Keychain
The Account Keychain holds each account's access keys and checks every transaction they sign against the limits you set.
Access keys are extra keys that sign for an account, and they are live on mainnet and testnet. An access key works within its spending limits, expiry, and scopes. The Account Keychain is a precompile, a contract built into Tempo, at `0xAAAAAAAA00000000000000000000000000000000`. To build with access keys, start with the [Access keys](https://tempo.com/developers/docs/accounts/access-keys) guide.
Both [account types](https://tempo.com/developers/docs/accounts/keys) use access keys. A [single-key account](https://tempo.com/developers/docs/development/single-key-accounts) is controlled by one root key, the key its address derives from. A [configurable account](https://tempo.com/developers/docs/development/configurable-accounts) is controlled by owner keys, whose weights must reach a threshold to approve. Configurable accounts run on [testnet](https://tempo.com/developers/docs/accounts/create#connect-to-testnet) now. [T14](https://tempo.com/developers/docs/protocol/upgrades/t14) brings them to mainnet on December 8, 2026.
An account authorizes an access key, which then signs within its spending limits, expiry, and scopes.
## Access key types
Each access key has a signature type, the `signatureType` value you pass when you authorize it. The Account Keychain identifies each of an account's keys by its key ID, an address.
| Key type | `signatureType` | Key ID |
| --- | --- | --- |
| secp256k1 | `0` | The key's address |
| P-256 | `1` | The key's address |
| WebAuthn | `2` | The address derived from the passkey's public key |
| Configurable account | `3` | The account's address. Its owners sign for it. Testnet until T14 reaches mainnet ([TIP-1111](https://tips.sh/1111)). |
## Access key restrictions
| Restriction | Rule |
| --- | --- |
| Spending limits | One per [TIP-20 token](https://tempo.com/developers/docs/protocol/tip20/overview), Tempo's stablecoin standard, in base units. Each limit's `period` of `0` sets a one-time limit; a positive `period` resets it every `period` seconds. |
| What limits count | Direct TIP-20 transfers, approval increases, fees the account pays, and and tokens that protocol precompiles pull, such as a Stablecoin DEX swap's input. A `transferFrom` that spends an allowance the account already granted doesn't count, and neither do non-TIP-20 assets. |
| Expiry | A Unix timestamp. The key stops working at that second. Omit it for no expiry; a direct [`authorizeKey`](https://tempo.com/developers/docs/development/account-keychain#authorize-an-access-key) call passes `type(uint64).max` instead. |
| Scopes | Any call, or an allowlist of `(target, selector, recipients)`: the contracts, functions, and payees the key can use. An empty allowlist denies every call; a target with no selector rules allows any function. Only the calls the key signs directly are checked, not calls those contracts make in turn. |
| Contract creation | A key can't deploy a contract directly, but it can call a permitted factory that does. |
| Key management | Access keys can't authorize, change, or revoke keys, including themselves. |
Tempo rejects an expired key with [`KeyExpired`](https://tempo.com/developers/docs/protocol/transactions/AccountKeychain#error-keyexpired), a transaction over a limit with [`SpendingLimitExceeded`](https://tempo.com/developers/docs/protocol/transactions/AccountKeychain#error-spendinglimitexceeded), and a call outside the scopes with [`CallNotAllowed`](https://tempo.com/developers/docs/protocol/transactions/AccountKeychain#error-callnotallowed).
## Access keys on each account type
| | [Single-key account](https://tempo.com/developers/docs/development/single-key-accounts) | [Configurable account](https://tempo.com/developers/docs/development/configurable-accounts) |
| --- | --- | --- |
| Authorizes, changes, and revokes keys | The root key | Owners whose weights reach the threshold, with a `0x05` [multisig signature](https://tempo.com/developers/docs/development/configurable-accounts#multisig-signature-format) |
| Acts as another account's access key | As type `0`, `1`, or `2`, matching its root key | As type `3`, signed by its owners |
Any account can also be another account's access key, as the second row shows. Access keys never count toward a threshold.
## Authorize an access key
An account authorizes a key in one of two ways: a `key_authorization` field on a [Tempo Transaction](https://tempo.com/developers/docs/protocol/transactions/spec-tempo-transaction), or a direct call to the precompile.
| Path | Behavior |
| --- | --- |
| `key_authorization` on a transaction | The account signs the authorization, and the new key can sign the transaction that carries it. The key stays authorized even if the calls revert. |
| `authorizeKey` call | The account calls the precompile. The authorization rolls back if the transaction reverts. |
Viem's `client.accessKey.signAuthorization` and `authorize` both use the `key_authorization` path. An optional `witness`, an application-defined `bytes32`, binds the authorization to an offchain challenge, such as a sign-in nonce. To cancel an authorization that hasn't landed yet, the account burns its witness with `client.accessKey.burnWitness`. Tempo then rejects any authorization signed with that witness.
## `0x04` keychain signature
An access key signs a transaction with a `0x04` keychain signature. Viem builds this signature for any access-key account, such as `Account.fromP256(privateKey, { access: account })`. To build it yourself:
```text
signature = 0x04 || account || access_key_signature
inner_digest = keccak256(0x04 || tx_signature_hash || account)
```
The access key signs `inner_digest`; a configurable account acting as an access key signs it with its owners, as a `0x05` multisig signature. `tx_signature_hash` is the transaction's signing hash ([keychain signature format](https://tempo.com/developers/docs/protocol/transactions/spec-tempo-transaction#keychain-variable-length)). Tempo checks that the key is authorized for `account`, unexpired, unrevoked, and of the stored type, then enforces its limits and scopes. Since the T1C network upgrade, Tempo rejects the legacy `0x03` keychain format.
## Revoke an access key
`revokeKey(keyId)` is permanent: that key ID can never be authorized again for the account. Configuration updates (owner changes) and [account upgrades](https://tempo.com/developers/docs/development/single-key-accounts#upgrade-to-a-configurable-account) leave every other key in place, so revoke each key separately.
## Account Keychain functions
| Function | Purpose | Viem action |
| --- | --- | --- |
| `authorizeKey` | Authorize an access key | `client.accessKey.authorize` |
| `revokeKey` | Revoke a key | `client.accessKey.revoke` |
| `updateSpendingLimit` | Set one token's limit; resets the remaining amount to the new limit and keeps the period | `client.accessKey.updateLimit` |
| `setAllowedCalls`, `removeAllowedCalls` | Replace or remove a target's scope | `writeContract` |
| `getKey` | Read a key's type, expiry, and status | `client.accessKey.getMetadata` |
| `getRemainingLimitWithPeriod` | Read the remaining limit and period end | `client.accessKey.getRemainingLimit` |
| `getAllowedCalls` | Read a key's scopes | `readContract` |
| `getTransactionKey` | Read the key signing the current transaction; `address(0)` means the root key | None; call it from a contract |
For `writeContract` and `readContract`, pass `Abis.accountKeychain` and `Addresses.accountKeychain` from `viem/tempo`. Functions that change keys must be called directly by the account's transaction (`msg.sender == tx.origin`). The [specification](https://tempo.com/developers/docs/protocol/transactions/AccountKeychain) lists every function, event, and error.
> Source: [/docs/quickstart/wallet-developers](https://tempo.com/developers/docs/quickstart/wallet-developers.md)
> Section: [Tempo EVM](https://tempo.com/developers/docs/development.md). Build on Tempo EVM: wallets and keys, payments, transactions and fees, TIP-20 Tokens, contracts, exchange, network details, nodes, protocol specifications, and changelog.
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
# Integrating wallet support for Tempo
Tempo is EVM-compatible, so standard transactions work out of the box. However, Tempo has [no native gas token](https://tempo.com/developers/docs/quickstart/evm-compatibility#handling-eth-native-token-balance-checks), which means wallet behaviors like balance display and gas quoting need adjustment.
To deliver the best experience for your users, integrate [Tempo Transactions](https://tempo.com/developers/docs/guide/tempo-transaction) — a protocol-native [EIP-2718](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-2718.md) transaction type (type byte `0x76`) that provides fee token selection, fee sponsorship, call batching, concurrent nonces, passkey signing, and transaction validity windows — without requiring a bundler, paymaster, or third-party vendor.
[SDKs](https://tempo.com/developers/docs/guide/tempo-transaction#integration-guides) are available for TypeScript, Rust, Go, Python, and Foundry.
## Wallet integration steps
The examples use Moderato testnet and its test stablecoins, with a funded test account.
::::steps
### Integrate Tempo Transactions
Replace your wallet's transaction construction with Tempo Transactions. The minimum change is switching from a type-2 (EIP-1559) envelope to a type-`0x76` Tempo Transaction envelope using one of the [Tempo SDKs](https://tempo.com/developers/docs/guide/tempo-transaction#integration-guides).
:::code-group
```ts twoslash [example.ts]
// @noErrors
import { client } from './viem.config'
// Sends a Tempo Transaction (type 0x76)
const { receipt } = await client.token.transferSync({
amount: { formatted: '100' },
to: '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEbb',
token: '0x20c0000000000000000000000000000000000001',
})
```
```ts twoslash [viem.config.ts] filename="viem.config.ts"
import { tempoModerato } from 'viem/chains'
import { Account, createClient } from 'viem/tempo'
const privateKey = process.env.TEMPO_PRIVATE_KEY
if (!privateKey || !/^0x[0-9a-fA-F]{64}$/.test(privateKey)) {
throw new Error('Set TEMPO_PRIVATE_KEY to your funded test account private key')
}
export const client = createClient({
account: Account.fromSecp256k1(privateKey as `0x${string}`),
chain: tempoModerato,
feeToken: '0x20c0000000000000000000000000000000000001',
})
```
:::
:::tip
With Tempo Transactions, you can also:
* Set the fee token for your users' transactions ([guide](https://tempo.com/developers/docs/guide/payments/pay-fees-in-any-stablecoin))
* Sponsor transaction fees for your users ([guide](https://tempo.com/developers/docs/api/fee-payer))
* Send concurrent transactions with independent nonces ([guide](https://tempo.com/developers/docs/guide/payments/send-parallel-transactions))
* Use expiring nonces for cheaper transactions that don't require nonce tracking ([guide](https://tempo.com/developers/docs/guide/tempo-transaction#expiring-nonces))
:::
### Handle the absence of a native token
If you use `eth_getBalance` to validate a user's balance, you should instead check the user's account fee token balance on Tempo. Additionally, you should not display any "native balance" in your UI for Tempo users.
:::info
In testnet, `eth_getBalance` [returns a large placeholder value](https://tempo.com/developers/docs/quickstart/evm-compatibility#handling-eth-native-token-balance-checks) for the native token balance to unblock existing assumptions wallets have about the native token balance.
:::
:::code-group
```ts twoslash [example.ts]
// @noErrors
import { client } from './viem.config'
const userFeeToken = await client.fee.getUserToken({
account: '0x...'
})
// A missing preference does not mean the account has no spendable stablecoins.
const balance = userFeeToken
? await client.token.getBalance({
account: '0x...',
token: userFeeToken.address,
})
: null
```
```ts twoslash [viem.config.ts] filename="viem.config.ts"
import { tempoModerato } from 'viem/chains'
import { Account, createClient } from 'viem/tempo'
const privateKey = process.env.TEMPO_PRIVATE_KEY
if (!privateKey || !/^0x[0-9a-fA-F]{64}$/.test(privateKey)) {
throw new Error('Set TEMPO_PRIVATE_KEY to your funded test account private key')
}
export const client = createClient({
account: Account.fromSecp256k1(privateKey as `0x${string}`),
chain: tempoModerato,
feeToken: '0x20c0000000000000000000000000000000000001',
})
```
:::
### Configure native currency symbol
If you need to display a native token symbol, such as showing how much gas a transaction requires, you can set the currency symbol to `USD` for Tempo as fees are denominated in USD.
### Use fee token preferences to quote gas prices
On Tempo, users can pay fees in any supported stablecoin. You should quote gas/fee prices in your UI based on a transaction's fee token.
:::info
As a wallet developer, you can set the fee token for your user at the account level.
If you don't, Tempo uses a cascading fee token selection algorithm to determine the fee token for a transaction – learn more about [Fee Token Preferences](https://tempo.com/developers/docs/protocol/fees/spec-fee#fee-token-preferences).
:::
### Add fee token selection to your UI
Your wallet should provide a way for users to choose which stablecoin they pay fees in. This can be a dropdown in the transaction confirmation screen or a setting in account preferences.
To set the fee token on a per-transaction basis, pass the `feeToken` parameter when submitting a Tempo Transaction:
:::code-group
```ts twoslash [example.ts]
// @noErrors
import { client } from './viem.config'
const { receipt } = await client.token.transferSync({
amount: { formatted: '100' },
feeToken: '0x20c0000000000000000000000000000000000002', // [!code hl]
to: '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEbb',
token: '0x20c0000000000000000000000000000000000001',
})
```
```ts twoslash [viem.config.ts] filename="viem.config.ts"
import { tempoModerato } from 'viem/chains'
import { Account, createClient } from 'viem/tempo'
const privateKey = process.env.TEMPO_PRIVATE_KEY
if (!privateKey || !/^0x[0-9a-fA-F]{64}$/.test(privateKey)) {
throw new Error('Set TEMPO_PRIVATE_KEY to your funded test account private key')
}
export const client = createClient({
account: Account.fromSecp256k1(privateKey as `0x${string}`),
chain: tempoModerato,
feeToken: '0x20c0000000000000000000000000000000000001',
})
```
:::
To set a persistent default so users don't need to select on every transaction, use `setUserToken`:
```ts
await client.fee.setUserTokenSync({
token: '0x20c0000000000000000000000000000000000001',
})
```
See [Fee Token Preferences](https://tempo.com/developers/docs/protocol/fees/spec-fee#fee-token-preferences) for the full cascading resolution order.
### Display token and network assets
Tempo provides a public tokenlist service that hosts token and network assets. You can pull these assets from our public tokenlist service to display in your UI.
* **GitHub**: [tempoxyz/tempo-apps/apps/tokenlist](https://github.com/tempoxyz/tempo-apps/tree/main/apps/tokenlist)
* **Tokenlist JSON**: [tokenlist.tempo.xyz/list/42431](https://tokenlist.tempo.xyz/list/42431)
::::
## Already using EIP-7702 or EIP-4337?
If you've integrated a third-party account abstraction provider for batching, sponsorship, or smart accounts, Tempo Transactions provide these features natively at the protocol level. See the [feature comparison](https://tempo.com/developers/docs/protocol/transactions/eip-7702#feature-comparison) for details.
## Wallet integration recipes
### Get user's fee token
Retrieve the user's configured fee token preference:
```ts
import { client } from './viem.config'
const feeToken = await client.fee.getUserToken({
account: '0x742d35cc6634c0532925a3b844bc9e7595f0bebb',
})
// null means this account has not configured a fee token preference.
```
See [`getUserToken`](https://viem.sh/tempo/actions/fee.getUserToken) for full documentation.
### Get token balance
Check a user's balance for a specific token:
```ts
import { client } from './viem.config'
const balance = await client.token.getBalance({
account: '0x742d35cc6634c0532925a3b844bc9e7595f0bebb',
token: '0x20c0000000000000000000000000000000000001',
})
// ^? { amount: bigint; decimals: number; formatted: string }
```
See [`getBalance`](https://viem.sh/tempo/actions/token.getBalance) for full documentation.
### Set user fee token
Set the user's default fee token preference. This will be used for all transactions unless a different fee token is specified at the transaction level.
```ts
import { client } from './viem.config'
await client.fee.setUserTokenSync({
token: '0x20c0000000000000000000000000000000000001',
})
```
See [`setUserToken`](https://viem.sh/tempo/actions/fee.setUserToken) for full documentation.
## Checklist
Before launching Tempo support, ensure your wallet:
* \[ ] Integrates Tempo Transactions for transaction submission
* \[ ] Checks fee token balance instead of native balance
* \[ ] Hides or removes native balance display for Tempo
* \[ ] Displays `USD` as the currency symbol for gas
* \[ ] Quotes gas prices in the user's fee token
* \[ ] Provides fee token selection in the UI (dropdown or account setting)
* \[ ] Pulls token/network assets from Tempo's tokenlist
* \[ ] (Recommended) Sponsors fees for your users via [fee sponsorship](https://tempo.com/developers/docs/api/fee-payer)
* \[ ] (Recommended) Uses [expiring nonces](https://tempo.com/developers/docs/guide/tempo-transaction#expiring-nonces) for lower-cost transactions that don't require nonce management
## Learning Resources
[Tempo Transactions](https://tempo.com/developers/docs/guide/tempo-transaction): Integrate Tempo Transactions for full control over transaction parameters
[Fee Token Preferences](https://tempo.com/developers/docs/protocol/fees/spec-fee#fee-token-preferences): Learn how fee token preferences work in the protocol
[Sponsor fees](https://tempo.com/developers/docs/api/fee-payer): Sponsor user fees to enable feeless transaction experiences in your application
[EIP-7702 Comparison](https://tempo.com/developers/docs/protocol/transactions/eip-7702): How Tempo Transactions compare to EIP-7702 delegation
[Choose a fee token](https://tempo.com/developers/docs/guide/payments/pay-fees-in-any-stablecoin): Pay fees in any supported stablecoin
> Source: [/docs/protocol/transactions/AccountKeychain](https://tempo.com/developers/docs/protocol/transactions/AccountKeychain.md)
> Section: [Tempo EVM](https://tempo.com/developers/docs/development.md). Build on Tempo EVM: wallets and keys, payments, transactions and fees, TIP-20 Tokens, contracts, exchange, network details, nodes, protocol specifications, and changelog.
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
[**Specification**](https://tempo.com/developers/docs/protocol)
# Account Keychain Precompile
**Address:** `0xAAAAAAAA00000000000000000000000000000000`
:::warning[T14 removes admin access keys]
From [T14](https://tempo.com/developers/docs/protocol/upgrades/t14), Tempo rejects new admin access keys. Existing ones can no longer manage keys but keep spending without limits, so revoke any you don't need.
:::
## Account Keychain overview
The Account Keychain precompile manages authorized Access Keys for accounts, enabling Root Keys (e.g., passkeys) and admin access keys to provision secondary keys. Limited access keys can have expiry timestamps, recurring or one-time per-TIP20 token spending limits, and explicit call scopes that restrict which targets, selectors, and recipients an Access Key may invoke.
`authorizeKey(...)` takes a `KeyRestrictions` tuple that bundles expiry, spending limits, and call scopes. `authorizeAdminKey(...)` provisions an admin key for account key management. Access keys cannot submit transaction-level contract-creation calls (`to` omitted). Calls to permitted factory contracts can still create contracts internally.
See [gas parameters](https://tempo.com/developers/docs/protocol/fees/spec-fee#gas-parameters) for calldata requirements and gas charges.
## Motivation
The Tempo Transaction type adds new signature schemes, including WebAuthn (Passkeys). However, for an Account using a Passkey as its Root Key, the sender will subsequently be prompted with passkey prompts for every signature request. This can be a poor user experience for highly interactive or multi-step flows. Additionally, users would also see "Sign In" copy in prompts for signing transactions which is confusing. This proposal introduces the concept of the Root Key being able to provision a scoped Access Key that can be used for subsequent transactions, without the need for repetitive end-user prompting. T6 extends this model with admin access keys for key management. Recurring spending budgets and explicit call scoping make limited keys suitable for subscriptions, connected apps, and session-key-style flows.
## Concepts
### Access Keys
Access Keys are secondary signing keys authorized by an account's Root Key or an admin key. Limited access keys can sign transactions on behalf of the account with the following restrictions:
* **Expiry**: Unix timestamp when the key becomes invalid. A non-expiring `key_authorization` omits `expiry` at the transaction RLP layer; the protocol translates that omission to `u64::MAX` before calling the precompile. Direct precompile callers should pass `u64::MAX` for a non-expiring key. Literal `0` is treated as past expiry and rejected.
* **Spending Limits**: Per-TIP20 token limits that deplete as tokens are spent
* Limits are one-time (`period = 0`) or recurring (`period > 0`, in seconds). Recurring limits roll over to `max` when `current_timestamp >= periodEnd`.
* Limits can be updated by the Root Key or an active admin access key via `updateSpendingLimit()`. An update resets `remaining` and `max` to `newLimit` but preserves the configured `period` and current `periodEnd`.
* Spending limits cover direct TIP-20 transfers, increases in approvals, fee payments by the account, and token pulls by approved protocol precompiles. T12 also charges `burnAt` when it burns the transaction originator's tokens.
* Direct token-call enforcement applies when `msg.sender == tx.origin`; protocol fee and implicit-approval paths enforce their own checks against the account.
* Native value transfers and `transferFrom()` are NOT limited
* **Call Scopes**: An Access Key is either unrestricted (`allowAnyCalls = true`) or restricted to an explicit allowlist of `(target, selector, recipients)` tuples. An empty allowlist with `allowAnyCalls = false` means scoped deny-all.
* **No transaction-level creation**: An access-key transaction cannot include a creation call (`TxKind::Create`). This does not prohibit `CREATE` or `CREATE2` inside a permitted factory call.
* **Privilege Restrictions**: Limited access keys cannot authorize new keys or modify their own limits or scopes. Admin access keys can manage keys, but cannot carry spending limits, call scopes, or expiry.
### Authorization Hierarchy
The protocol enforces a strict hierarchy at validation time:
1. **Root Key**: The account's original signing authority; its public key determines the account address
* Can call all precompile functions, including the key-management mutators (`authorizeKey`, `authorizeAdminKey`, `revokeKey`, `updateSpendingLimit`, `setAllowedCalls`, `removeAllowedCalls`)
* Has no spending limits or call-scope restrictions
2. **Admin Access Keys**: Secondary authorized keys for account administration
* Can call key-management mutators, including `authorizeKey`, `authorizeAdminKey`, and `revokeKey`
* Cannot carry spending limits, call scopes, or expiry
* Cannot submit transaction-level creation calls
3. **Limited Access Keys**: Secondary authorized keys for scoped transactions
* Cannot call Account Keychain mutators (only its view functions are allowed)
* Subject to per-TIP20 token spending limits
* Subject to call-scope checks during execution
* Cannot submit transaction-level creation calls
* Can have expiry timestamps
## Storage
The precompile uses a `keyId` (address) to uniquely identify each access key for an account.
**Storage Mappings:**
* `keys[account][keyId]` → Packed `AuthorizedKey` struct (signature type, expiry, enforce\_limits, is\_revoked, is\_admin)
* `spendingLimits[keccak256(account || keyId)][token]` → `SpendingLimitState { remaining, max, period, periodEnd }`
* `keyScopes[keccak256(account || keyId)]` → Tree of `(target, selector, recipients)` allowlists used during call-scope checks
* `transactionKey` → Transient storage for the key ID that signed the current transaction (slot 0)
**AuthorizedKey Storage Layout (packed into single slot):**
* byte 0: signature\_type (u8)
* bytes 1-8: expiry (u64, little-endian)
* byte 9: enforce\_limits (bool)
* byte 10: is\_revoked (bool)
* byte 11: is\_admin (bool)
## Interface
```solidity
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.13;
interface IAccountKeychain {
enum SignatureType {
Secp256k1,
P256,
WebAuthn
}
struct TokenLimit {
address token;
uint256 amount;
uint64 period;
}
struct SelectorRule {
bytes4 selector;
address[] recipients;
}
struct CallScope {
address target;
SelectorRule[] selectorRules;
}
struct KeyRestrictions {
uint64 expiry;
bool enforceLimits;
TokenLimit[] limits;
bool allowAnyCalls;
CallScope[] allowedCalls;
}
struct KeyInfo {
SignatureType signatureType;
address keyId;
uint64 expiry;
bool enforceLimits;
bool isRevoked;
}
event KeyAuthorized(address indexed account, address indexed publicKey, uint8 signatureType, uint64 expiry);
event AdminKeyAuthorized(address indexed account, address indexed publicKey);
event KeyAuthorizationWitness(address indexed account, bytes32 indexed witness);
event KeyAuthorizationWitnessBurned(address indexed account, bytes32 indexed witness);
event KeyRevoked(address indexed account, address indexed publicKey);
event SpendingLimitUpdated(address indexed account, address indexed publicKey, address indexed token, uint256 newLimit);
event AccessKeySpend(address indexed account, address indexed publicKey, address indexed token, uint256 amount, uint256 remainingLimit);
error UnauthorizedCaller();
error KeyAlreadyExists();
error KeyNotFound();
error KeyExpired();
error SpendingLimitExceeded();
error InvalidSpendingLimit();
error InvalidSignatureType();
error ZeroPublicKey();
error ExpiryInPast();
error KeyAlreadyRevoked();
error SignatureTypeMismatch(uint8 expected, uint8 actual);
error CallNotAllowed();
error InvalidCallScope();
error InvalidKeyId();
error KeyAuthorizationWitnessAlreadyBurned();
error LegacyAuthorizeKeySelectorChanged(bytes4 newSelector);
function authorizeKey(
address keyId,
SignatureType signatureType,
KeyRestrictions calldata config
) external;
function authorizeKey(
address keyId,
SignatureType signatureType,
KeyRestrictions calldata config,
bytes32 witness
) external;
function burnKeyAuthorizationWitness(bytes32 witness) external;
function isKeyAuthorizationWitnessBurned(address account, bytes32 witness)
external view returns (bool);
function revokeKey(address keyId) external;
function authorizeAdminKey(
address keyId,
SignatureType signatureType,
bytes32 witness
) external;
function updateSpendingLimit(
address keyId,
address token,
uint256 newLimit
) external;
function setAllowedCalls(
address keyId,
CallScope[] calldata scopes
) external;
function removeAllowedCalls(address keyId, address target) external;
function getKey(address account, address keyId) external view returns (KeyInfo memory);
function getRemainingLimitWithPeriod(
address account,
address keyId,
address token
) external view returns (uint256 remaining, uint64 periodEnd);
function getAllowedCalls(
address account,
address keyId
) external view returns (bool isScoped, CallScope[] memory scopes);
function isAdminKey(address account, address keyId) external view returns (bool);
function getTransactionKey() external view returns (address);
}
```
## Account Keychain errors
Each error links to where the precompile raises it.
| Error | Tempo returns it when |
| --- | --- |
| [`UnauthorizedCaller`](https://github.com/tempoxyz/tempo/blob/7d4fd03fc0/crates/precompiles/src/account_keychain/mod.rs#L1114) | A key-management call (authorize, revoke, change a limit or scopes) is signed by a limited access key, or doesn't come directly from the account as the transaction's sender. |
| [`ZeroPublicKey`](https://github.com/tempoxyz/tempo/blob/7d4fd03fc0/crates/precompiles/src/account_keychain/mod.rs#L269) | The key's address is the zero address. |
| [`ExpiryInPast`](https://github.com/tempoxyz/tempo/blob/7d4fd03fc0/crates/precompiles/src/account_keychain/mod.rs#L280) | An authorization sets an expiry at or before the current block time. |
| [`KeyAlreadyExists`](https://github.com/tempoxyz/tempo/blob/7d4fd03fc0/crates/precompiles/src/account_keychain/mod.rs#L287) | The account already has an access key at this address. |
| [`KeyAlreadyRevoked`](https://github.com/tempoxyz/tempo/blob/7d4fd03fc0/crates/precompiles/src/account_keychain/mod.rs#L292) | The key at this address was revoked. An account can never authorize a revoked address again. |
| [`KeyNotFound`](https://github.com/tempoxyz/tempo/blob/7d4fd03fc0/crates/precompiles/src/account_keychain/mod.rs#L432) | The account never authorized this key, or its authorization hasn't landed yet. |
| [`KeyExpired`](https://github.com/tempoxyz/tempo/blob/7d4fd03fc0/crates/precompiles/src/account_keychain/mod.rs#L1204) | Block time has reached the key's expiry. |
| [`SpendingLimitExceeded`](https://github.com/tempoxyz/tempo/blob/7d4fd03fc0/crates/precompiles/src/account_keychain/mod.rs#L1379) | A transaction the key signs would spend more of a token than the key's remaining limit. |
| [`InvalidSpendingLimit`](https://github.com/tempoxyz/tempo/blob/7d4fd03fc0/crates/precompiles/src/account_keychain/mod.rs#L303) | An authorization lists the same token twice, or sets a limit above the maximum. |
| [`CallNotAllowed`](https://github.com/tempoxyz/tempo/blob/7d4fd03fc0/crates/precompiles/src/account_keychain/mod.rs#L817) | A call the key signs matches none of its scopes: another contract, another function, a recipient that isn't listed, or a contract deployment. |
| [`InvalidCallScope`](https://github.com/tempoxyz/tempo/blob/7d4fd03fc0/crates/precompiles/src/account_keychain/mod.rs#L587) | A scope update is empty or malformed, or an authorization passes scopes while allowing every call. |
| [`InvalidKeyId`](https://github.com/tempoxyz/tempo/blob/7d4fd03fc0/crates/precompiles/src/account_keychain/mod.rs#L470) | The request changes an admin key's limit or scopes, which it doesn't have, or makes the account's own address an admin key. |
## Behavior
### Key Authorization
* `key_authorization` includes an optional trailing `witness: bytes32` field. When present, the witness is included in the signing hash, checked against the account's burned-witness set, and emitted when the key authorization is registered. The protocol otherwise treats it as opaque and application-defined, so apps can bind a single access-key authorization signature to an offchain challenge.
:::info[T6 behavior — SDK encoders/decoders]
The [T6 network upgrade](https://tempo.com/developers/docs/protocol/upgrades/t6) added [admin access keys](https://tempo.com/developers/docs/protocol/upgrades/t6#admin-access-keys). For partners maintaining transaction tooling, the wire-level change is two new trailing optional fields on the `KeyAuthorization` RLP payload:
```text
rlp([chain_id, key_type, key_id, expiry?, limits?, allowed_calls?, witness?, is_admin?, account?])
```
SDK encoders/decoders and hardware-wallet firmware that strictly check field count MUST handle the new optionals on T6 networks. The packed `AuthorizedKey` slot also gains an `is_admin` byte at offset 11. The existing `KeyAuthorized` event is **unchanged**; an additional `AdminKeyAuthorized` event is emitted alongside it when `is_admin == true`, so existing indexers continue to work without changes. Provisioning admin keys uses `authorizeAdminKey(keyId, signatureType, witness)`. See the [admin access keys section of the T6 page](https://tempo.com/developers/docs/protocol/upgrades/t6#admin-access-keys) for the full surface.
:::
* Creates a new key entry with the specified `signatureType`, `config.expiry`, `config.enforceLimits`, and `isRevoked` set to `false`
* If `enforceLimits` is `true`, initializes spending limits for each specified token. Each `TokenLimit` carries a `period` (0 = one-time, non-zero = recurring in seconds).
* If `allowAnyCalls` is `false`, stores the `allowedCalls` allowlist in `keyScopes`. `allowAnyCalls = false` with `allowedCalls = []` means scoped deny-all.
* Recipient-constrained selector rules are validated before any state is written.
* Emits `KeyAuthorized` event
**Requirements:**
* MUST be called by the Root Key or an active admin access key
* MUST use one of the two `authorizeKey` overloads above: `(address,uint8,KeyRestrictions)` or `(address,uint8,KeyRestrictions,bytes32)`. The first has selector `0x980a6025`; the second additionally checks and emits the supplied witness. Both use the same `KeyRestrictions` tuple and authorization requirements.
* `keyId` MUST NOT be `address(0)` (reverts with `ZeroPublicKey`)
* `keyId` MUST NOT already be authorized with `expiry > 0` (reverts with `KeyAlreadyExists`)
* `keyId` MUST NOT have been previously revoked (reverts with `KeyAlreadyRevoked` - prevents replay attacks)
* `signatureType` MUST be `0` (Secp256k1), `1` (P256), or `2` (WebAuthn) (reverts with `InvalidSignatureType`)
* `config.expiry` MUST be strictly greater than the current block timestamp (reverts with `ExpiryInPast`)
* To authorize a non-expiring key, omit `key_authorization.expiry` in the transaction RLP or pass `u64::MAX` when calling the precompile ABI directly. Do not pass `0`.
* `enforceLimits` determines whether spending limits are enforced for this key
* `limits` are only processed if `enforceLimits` is `true`. Duplicate token entries revert with `InvalidSpendingLimit`.
* Invalid call-scope shapes (zero targets, duplicate targets, duplicate selectors, duplicate recipients, malformed recipient-bound rules) revert with `InvalidCallScope`.
### Admin Key Authorization
* Creates a new key entry with `is_admin = true`.
* Emits the existing `KeyAuthorized` event and the additional `AdminKeyAuthorized` event.
* Checks that the account has not burned the provided `witness` and emits `KeyAuthorizationWitness`. `bytes32(0)` is valid. Successful authorization MUST NOT burn the witness; it remains usable for other authorizations until explicitly burned.
* Admin keys can authorize and revoke keys, including other admin keys.
* Admin keys cannot carry expiry, spending limits, or call scopes.
**Requirements:**
* MUST be called by the Root Key or an active admin access key.
* `keyId` MUST NOT be the account address (reverts with `InvalidKeyId`).
* `keyId` MUST NOT already be authorized (reverts with `KeyAlreadyExists`).
* `keyId` MUST NOT have been previously revoked (reverts with `KeyAlreadyRevoked`).
* `signatureType` MUST be `0` (Secp256k1), `1` (P256), or `2` (WebAuthn) (reverts with `InvalidSignatureType`).
### Witness revocation
The Root Key or an active admin access key can call `burnKeyAuthorizationWitness(witness)` to permanently invalidate future key authorizations carrying that witness for the account. The call requires `msg.sender == tx.origin` and emits `KeyAuthorizationWitnessBurned`. `isKeyAuthorizationWitnessBurned(account, witness)` queries this state. Witness-bearing access-key and admin-key authorization MUST revert with `KeyAuthorizationWitnessAlreadyBurned` when that account/witness pair is burned.
Burning a witness does not revoke keys already authorized with it; use `revokeKey` to revoke those keys. Successful authorization emits `KeyAuthorizationWitness` without changing the burned-witness set.
### Key Revocation
* Marks the key as revoked by setting `isRevoked` to `true` and `expiry` to `0`
* Once revoked, a `keyId` can NEVER be re-authorized for this account (prevents replay attacks)
* Any stored call-scope and periodic-limit state becomes inaccessible. `getAllowedCalls(...)` returns scoped deny-all (`isScoped = true, scopes = []`) for revoked keys.
* Key can no longer be used for transactions
* Emits `KeyRevoked` event
**Requirements:**
* MUST be called by the Root Key or an active admin access key
* `keyId` MUST exist (key with `expiry > 0`) (reverts with `KeyNotFound` if not found)
### Spending Limit Update
* Updates the spending limit for a specific token on an authorized key
* Allows the Root Key or an active admin access key to modify limits without revoking and re-authorizing the key
* If the key had unlimited spending (`enforceLimits == false`), enables limits
* Sets both `remaining` and `max` to `newLimit`. The configured `period` and current `periodEnd` are preserved.
* `newLimit` MUST fit within TIP20's `u128` supply range.
* Emits `SpendingLimitUpdated` event
**Requirements:**
* MUST be called by the Root Key or an active admin access key
* `keyId` MUST exist and not be revoked (reverts with `KeyNotFound` or `KeyAlreadyRevoked`)
* `keyId` MUST not be expired (reverts with `KeyExpired`)
* `keyId` MUST not be an admin access key, because admin keys do not carry spending limits (reverts with `InvalidKeyId`)
### Allowed Call Updates
* `setAllowedCalls(...)` creates or replaces one or more target scopes for an existing key.
* `removeAllowedCalls(...)` removes one stored target scope.
* An empty `selectorRules` array means any selector on that target is allowed.
* `setAllowedCalls(...)` rejects an empty scope batch, zero targets, duplicate targets, duplicate selectors, duplicate recipients, and invalid recipient-constrained rules (reverts with `InvalidCallScope`).
**Requirements:**
* MUST be called by the Root Key or an active admin access key
* `keyId` MUST exist and not be revoked
* `keyId` MUST not be an admin access key, because admin keys do not carry call scopes (reverts with `InvalidKeyId`)
### View Behavior
* `getKey(...)` returns key metadata.
* `getRemainingLimitWithPeriod(...)` returns the effective `remaining` amount and current `periodEnd` for a key-token pair, accounting for periodic rollover.
* `getAllowedCalls(...)` returns `(isScoped, scopes)`. Unrestricted keys return `isScoped = false`. Scoped keys return `isScoped = true` with their `CallScope[]`. Missing, revoked, or expired access keys return `isScoped = true, scopes = []` (scoped deny-all).
* `isAdminKey(...)` returns `true` for the Root Key and for active, non-revoked, non-expired admin access keys.
* `getTransactionKey()` returns the key used in the current transaction. `address(0)` means the Root Key.
* Missing, revoked, or expired keys return zeroed limit values.
## Security Considerations
### Access Key Storage
Access Keys should be securely stored to prevent unauthorized access. Call scopes make per-app and per-device key isolation more important, because a mis-scoped key may have a broader allowlist than intended.
* **Device and Application Scoping**: Access Keys SHOULD be scoped to a specific client device AND application combination. Access Keys SHOULD NOT be shared between devices or applications, even if they belong to the same user.
* **Non-Extractable Keys**: Access Keys SHOULD be generated and stored in a non-extractable format to prevent theft. For example, use WebCrypto API with `extractable: false` when generating Keys in web browsers.
* **Secure Storage**: Private Keys MUST never be stored in plaintext. Private Keys SHOULD be encrypted and stored in a secure manner. For web applications, use browser-native secure storage mechanisms like IndexedDB with non-extractable WebCrypto keys rather than storing raw key material.
### Privilege Escalation Prevention
Limited access keys cannot escalate their own privileges because:
1. Management functions (`authorizeKey`, `authorizeAdminKey`, `revokeKey`, `updateSpendingLimit`, `setAllowedCalls`, `removeAllowedCalls`) are restricted to Root Key or active admin-key transactions
2. The protocol sets `transactionKey[account]` during transaction validation to indicate which key signed the transaction
3. These management functions check that the caller is the Root Key or an active admin key before executing
4. Mutable precompile calls also require `msg.sender == tx.origin`, which prevents contract-mediated confused-deputy patterns
5. Limited access keys cannot bypass these checks - transactions will revert with `UnauthorizedCaller`
### Spending Limit Enforcement
* Spending limits are only enforced if `enforceLimits == true` for the key
* Keys with `enforceLimits == false` have unlimited spending (no limits checked)
* Spending limits are enforced by the protocol internally calling `verify_and_update_spending()` during execution
* Limits are per-TIP20 token and deplete as TIP20 tokens are spent
* Recurring limits (`period > 0`) roll over to `max` when `current_timestamp >= periodEnd`. Callers can observe rollover state via `getRemainingLimitWithPeriod(...)`.
* Limits track direct TIP-20 transfers and approval increases, account-paid fees, and token pulls by approved protocol precompiles. T12 adds same-origin `burnAt` accounting.
* For approvals: only increases in approval amount count against the spending limit. This means approvals indirectly control `transferFrom` spending, since `transferFrom` requires a prior approval
* Non-TIP20 asset movements (ETH, NFTs) are not subject to spending limits
* Root keys (`keyId == address(0)`) have no spending limits - the function returns immediately
* Missing, revoked, or expired keys have an effective remaining limit of zero
* Failed limit checks revert the entire transaction with `SpendingLimitExceeded`
### Call Scope Enforcement
* Call-scope checks run on top-level calls signed by an Access Key.
* If a key is scoped and a call does not match the stored target, selector, and recipient rules, execution reverts with `CallNotAllowed`.
* Access-key-signed transactions cannot contain transaction-level creation calls. Internal `CREATE` and `CREATE2` remain possible when an allowed target invokes them; call scopes constrain top-level targets and do not sandbox a factory's internals.
### Key Expiry
* Keys with `expiry > 0` are checked against the current timestamp during validation
* Expired keys cause transaction rejection with `KeyExpired` error (checked via `validate_keychain_authorization()`)
* New authorizations require a future expiry timestamp
* Expiry is checked as: `current_timestamp >= expiry` (key is expired when current time reaches or exceeds expiry)
* Expired keys return zeroed limit and call-scope reads.
## Usage Patterns
### First-Time Access Key Authorization
1. User signs Passkey prompt → signs over `key_authorization` for a new Access Key (e.g., WebCrypto P256 key). The signed authorization carries `KeyRestrictions`, allowing the same first-use flow to provision recurring limits and call scopes.
2. User's Access Key signs the transaction
3. Transaction includes the `key_authorization` AND the Access Key `signature`
4. Protocol validates Passkey signature on `key_authorization`, sets `transactionKey[account] = 0`, calls `AccountKeychain.authorizeKey()`, then validates Access Key signature
5. Transaction executes with Access Key's spending limits enforced via internal `verify_and_update_spending()`, plus call-scope checks if the key is scoped
### Subsequent Access Key Usage
1. User's Access Key signs the transaction (no `key_authorization` needed)
2. Protocol validates the Access Key via `validate_keychain_authorization()`, sets `transactionKey[account] = keyId`
3. Transaction executes with spending limit enforcement via internal `verify_and_update_spending()` and call-scope enforcement. Contract creation is rejected.
### Root Key or Admin Key Revoking or Updating an Access Key
1. User signs with the Root Key or an active admin key → signs transaction calling `revokeKey(keyId)`, `updateSpendingLimit(...)`, `setAllowedCalls(...)`, or `removeAllowedCalls(...)`
2. Transaction executes, marking the Access Key as inactive or updating its restrictions
3. Future transactions signed by that Access Key are rejected (after revocation) or evaluated against the updated restrictions
> Source: [/docs/guide/payments](https://tempo.com/developers/docs/guide/payments.md)
> Section: [Tempo EVM](https://tempo.com/developers/docs/development.md). Build on Tempo EVM: wallets and keys, payments, transactions and fees, TIP-20 Tokens, contracts, exchange, network details, nodes, protocol specifications, and changelog.
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
# Integrate stablecoin payments
Send stablecoins, collect deposits, and confirm payments in your application. If you are still deciding where funds should live and who signs, start with [How accounts work](https://tempo.com/developers/docs/accounts/how-it-works).
## Send and receive payments
| Task | Guide |
| --- | --- |
| Fund an account | [Choose a funding path](https://tempo.com/developers/docs/guide/getting-funds). |
| Send stablecoins | [Send payments](https://tempo.com/developers/docs/guide/payments/send-a-payment), including references and batches. |
| Collect and reconcile payments | [Receive payments](https://tempo.com/developers/docs/guide/payments/accept-a-payment), verify delivery, and record each payment once. |
| Identify customer deposits | [Customer deposit addresses](https://tempo.com/developers/docs/guide/payments/virtual-addresses) attribute payments into a shared account. |
| Move funds between networks | [Routes](https://tempo.com/developers/docs/routes) connects Tempo with other networks. |
## Configure payment behavior
* [Sponsor fees](https://tempo.com/developers/docs/api/fee-payer) or [choose a fee token](https://tempo.com/developers/docs/guide/payments/pay-fees-in-any-stablecoin).
* [Send independent payments in parallel](https://tempo.com/developers/docs/guide/payments/send-parallel-transactions) when each payment needs its own receipt.
* [Configure receive policies](https://tempo.com/developers/docs/accounts/policies/receive-policies) to choose which tokens and senders an account accepts.
> Source: [/docs/api/fee-payer](https://tempo.com/developers/docs/api/fee-payer.md)
> Section: [API reference](https://tempo.com/developers/docs/api.md). Tempo API reference: authentication, conventions, endpoints grouped by product, Console management endpoints, JSON-RPC, and the indexer. An API key authenticates API requests; an account signing key authorizes transactions.
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
# Sponsor your users' fees
Pay network fees for your users so they only hold the stablecoins they send.
## Fee sponsorship demo
Send a testnet payment whose fee Tempo's public fee payer covers.
**Interactive demo: Sponsor User Fees**
1. Connect
2. Add funds
3. Send relayer sponsored payment
## Set up fee sponsorship
::::steps
### Create an API key
Sign in to [Tempo Console](https://tempo.com/console?to=/\:org/projects), create an organization and project, add a payment method in [**Billing**](https://tempo.com/console?to=/\:org/billing), and create a key in [**API Keys**](https://tempo.com/console?to=/\:org/api-keys/new). Console shows the key once.
The key's environment picks the network. A production key (`tempo:sk:...`) sponsors mainnet transactions. A sandbox key (`tempo_sandbox:sk:...`) sponsors testnet transactions, and the examples on this page use one. Switch environments in the organization picker. To try sponsorship without a key, use the [public testnet fee payer](https://tempo.com/developers/docs/api/fee-payer#public-testnet-fee-payer).
### Point your client at the fee payer
The hosted fee payer is a JSON-RPC relay at `https://api.tempo.xyz/rpc/sponsor`. It fills, sponsors, and broadcasts Tempo Transactions. Send your key in the `tempo-api-key` header and wrap your transport with Viem's [`withRelay`](https://viem.sh/tempo/transports/withRelay).
:::code-group
```ts twoslash [Viem]
import { Account, createClient, http, withRelay } from 'viem/tempo'
const client = createClient({
account: Account.fromSecp256k1('0x...'),
testnet: true,
transport: withRelay( // [!code focus]
http(), // default transport // [!code focus]
http('https://api.tempo.xyz/rpc/sponsor', { // relay transport // [!code focus]
fetchOptions: { headers: { 'tempo-api-key': 'tempo_sandbox:sk:...' } }, // [!code focus]
}), // [!code focus]
), // [!code focus]
})
```
```ts twoslash [Wagmi (Tempo Wallet)]
// @noErrors
import { tempoModerato } from 'viem/chains'
import { createConfig, http } from 'wagmi'
import { tempoWallet } from 'wagmi/connectors'
export const config = createConfig({
connectors: [tempoWallet({
feePayer: 'https://sponsor.moderato.tempo.xyz', // [!code focus]
})],
chains: [tempoModerato],
multiInjectedProviderDiscovery: false,
transports: {
[tempoModerato.id]: http(),
},
})
```
```ts twoslash [Wagmi (WebAuthn)]
// @noErrors
import { tempoModerato } from 'viem/chains'
import { withRelay } from 'viem/tempo'
import { createConfig, http } from 'wagmi'
import { webAuthn } from 'wagmi/tempo'
export const config = createConfig({
connectors: [webAuthn({ authUrl: '/auth' })],
chains: [tempoModerato],
multiInjectedProviderDiscovery: false,
transports: {
[tempoModerato.id]: withRelay( // [!code focus]
http(), // [!code focus]
http('https://sponsor.moderato.tempo.xyz'), // [!code focus]
), // [!code focus]
},
})
```
:::
The Wagmi tabs run in the browser, so they use the keyless [public testnet fee payer](https://tempo.com/developers/docs/api/fee-payer#public-testnet-fee-payer). Never put an API key in browser code. For keyed or mainnet sponsorship, call the Fee Payer API from your own backend.
`withRelay` sends every `eth_fillTransaction` request to the relay, including self-paid ones. `withFeePayer` is deprecated.
### Send a sponsored transaction
Set `feePayer: true` on each transaction you want sponsored.
:::code-group
```ts [Viem]
const receipt = await client.sendTransactionSync({
data: '0xdeadbeef',
feePayer: true, // [!code focus]
to: '0xcafebabecafebabecafebabecafebabecafebabe',
})
```
```tsx twoslash [React (Wagmi)]
import { Hooks } from 'wagmi/tempo'
import { getAddress, parseUnits } from 'viem'
const alphaUsd = '0x20c0000000000000000000000000000000000001'
// @noErrors
function SendSponsoredPayment() {
const sendPayment = Hooks.token.useTransferSync() // [!code hl]
return (
)
}
```
:::
For mainnet, remove `testnet: true`, use a production key (`tempo:sk:...`), and activate production billing. Sandbox keys can't sponsor mainnet transactions.
::::
## How the Fee Payer API works
The sender signs the transaction, and the fee payer separately signs the fee. The fee payer applies its policy, fills the fee fields, and reports whether it sponsored the request. Tempo supports this natively, so you don't need a paymaster contract, bundler, or EntryPoint contract.
A fee payer signs one specific transaction. Sponsorship doesn't grant authority over the sender's account. The [Tempo Transaction specification](https://tempo.com/developers/docs/protocol/transactions/spec-tempo-transaction#fee-payer-signature-details) lists the fields each signer commits to.
## Public testnet fee payer
For demos and testnet development without an API key, use `https://sponsor.moderato.tempo.xyz`. Use the hosted fee payer with a sandbox key for authenticated testing.
## Fee sponsorship limits
Decide who you sponsor, which contracts and methods you cover, per-user limits, and your total fee budget.
Sponsorship covers the network fee only. It doesn't fund the transfer amount, an FX spread, or a receiving provider's charges. Record the sponsored fee against each payment.
## Related
[Choose a fee token](https://tempo.com/developers/docs/guide/payments/pay-fees-in-any-stablecoin): Covers paying fees in any supported stablecoin.
[Tempo API authentication](https://tempo.com/developers/docs/api/authentication): Covers production and sandbox API keys.
[Fee specification](https://tempo.com/developers/docs/protocol/fees/spec-fee): Covers how fees work on Tempo.
> Source: [/docs/guide/payments/pay-fees-in-any-stablecoin](https://tempo.com/developers/docs/guide/payments/pay-fees-in-any-stablecoin.md)
> Section: [Tempo EVM](https://tempo.com/developers/docs/development.md). Build on Tempo EVM: wallets and keys, payments, transactions and fees, TIP-20 Tokens, contracts, exchange, network details, nodes, protocol specifications, and changelog.
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
# Choose a fee token
Choose which stablecoin pays a transaction’s fees, independently of the token being transferred. A fee token must be USD-denominated, use the TIP-20 standard, and have sufficient liquidity in the native Fee AMM. Tempo has no separate gas token.
See [transaction fees](https://tempo.com/developers/docs/protocol/fees) for eligibility and conversion rules, or [Sponsor fees](https://tempo.com/developers/docs/api/fee-payer) to have your application cover the fee.
## Fee-token payment demo
Select a supported fee token and send a payment with it in this demo.
**Interactive demo: Choose a fee token**
1. Connect
2. Add funds
3. Pay with fee token
Source: [tempoxyz/examples/tree/main/examples/payments](https://github.com/tempoxyz/examples/tree/main/examples/payments)
## Quick fee-token snippet
Pass `feeToken` when submitting a payment. Use the [Viem client](https://tempo.com/developers/docs/guide/payments/send-a-payment#send-from-your-backend) for backend signing or the [Wagmi configuration](https://tempo.com/developers/docs/guide/payments/send-a-payment#add-a-payment-action-in-the-browser) for a browser wallet. These examples use AlphaUSD and BetaUSD on Moderato; replace the example recipient with an account you control. Set `RPC_URL` or `TEMPO_RPC_URL` to `https://rpc.moderato.tempo.xyz` for the other language examples.
### Viem
```tsx twoslash
// @noErrors
import { parseUnits } from 'viem'
import { client } from './viem.config'
const alphaUsd = '0x20c0000000000000000000000000000000000001'
const betaUsd = '0x20c0000000000000000000000000000000000002'
const { receipt } = await client.token.transferSync({
amount: parseUnits('100', 6),
feeToken: betaUsd, // [!code ++]
to: '0x742d35cc6634c0532925a3b844bc9e7595f0bebb',
token: alphaUsd,
})
```
### Wagmi
```tsx twoslash
// @noErrors
import { Hooks } from 'wagmi/tempo'
import { parseUnits } from 'viem'
const alphaUsd = '0x20c0000000000000000000000000000000000001'
const betaUsd = '0x20c0000000000000000000000000000000000002'
function SendPayment() {
const sendPayment = Hooks.token.useTransferSync()
return (
)
}
```
### Rust
:::code-group
```rust [example.rs]
use alloy::{
primitives::{address, U256},
providers::Provider,
sol_types::SolCall,
};
use tempo_alloy::{
contracts::precompiles::ITIP20, primitives::transaction::Call,
rpc::TempoTransactionRequest,
};
mod provider;
#[tokio::main]
async fn main() -> Result<(), Box> {
let provider = provider::get_provider().await?;
let alpha_usd = address!("0x20c0000000000000000000000000000000000001");
let beta_usd = address!("0x20c0000000000000000000000000000000000002");
let calls = vec![Call {
to: alpha_usd.into(),
input: ITIP20::transferCall {
to: address!("0x742d35cc6634c0532925a3b844bc9e7595f0bebb"),
amount: U256::from(100_000_000),
}
.abi_encode()
.into(),
value: U256::ZERO,
}];
let pending = provider
.send_transaction(TempoTransactionRequest {
calls,
fee_token: Some(beta_usd), // [!code ++]
..Default::default()
})
.await?;
Ok(())
}
```
```rust [provider.rs]
use alloy::providers::ProviderBuilder;
use alloy::signers::local::PrivateKeySigner;
use tempo_alloy::TempoNetwork;
pub async fn get_provider() -> Result<
impl alloy::providers::Provider,
Box,
> {
let signer: PrivateKeySigner = std::env::var("PRIVATE_KEY")
.expect("PRIVATE_KEY not set")
.parse()?;
let provider = ProviderBuilder::new_with_network::()
.wallet(signer)
.connect(&std::env::var("RPC_URL").expect("RPC_URL not set"))
.await?;
Ok(provider)
}
```
:::
### Python
```python
from pytempo import TempoTransaction
from pytempo.contracts import TIP20, ALPHA_USD, BETA_USD
transfer = TIP20(ALPHA_USD).transfer(
to="0x742d35cc6634c0532925a3b844bc9e7595f0bebb",
amount=100_000_000,
)
draft = TempoTransaction.create(calls=(transfer,))
tx = TempoTransaction.create(
chain_id=w3.eth.chain_id,
gas_limit=w3.eth.estimate_gas(draft.to_estimate_gas_request(account.address)),
max_fee_per_gas=w3.eth.gas_price * 2,
max_priority_fee_per_gas=w3.eth.gas_price,
nonce=w3.eth.get_transaction_count(account.address),
fee_token=BETA_USD, # [!code ++]
calls=(transfer,),
)
```
### Go
```go
alphaUSD := common.HexToAddress("0x20c0000000000000000000000000000000000001")
betaUSD := common.HexToAddress("0x20c0000000000000000000000000000000000002")
tx := transaction.NewBuilder(big.NewInt(transaction.ChainIdModerato)).
SetNonce(nonce).
SetGas(100_000).
SetMaxFeePerGas(big.NewInt(25_000_000_000)).
SetMaxPriorityFeePerGas(big.NewInt(1_000_000_000)).
SetFeeToken(betaUSD). // [!code ++]
AddCall(alphaUSD, big.NewInt(0), buildTransferData(recipient, big.NewInt(100_000_000))).
Build()
```
### Cast
```bash
$ cast send \
0x20c0000000000000000000000000000000000001 \
"transfer(address,uint256)" \
0x742d35cc6634c0532925a3b844bc9e7595f0bebb \
100000000 \
--rpc-url $TEMPO_RPC_URL \
--private-key $PRIVATE_KEY \
--tempo.fee-token 0x20c0000000000000000000000000000000000002 # [!code ++]
```
### Solidity
:::info
The fee token for a given transaction cannot be set from Solidity — it is a transaction-level parameter handled by the signing SDK. However, you can configure a **default** fee token for an account using [`setUserToken`](https://tempo.com/developers/docs/guide/payments/pay-fees-in-any-stablecoin#set-a-default-user-fee-token), which will apply to all future transactions unless explicitly overridden at submission.
:::
## Fee-token implementation steps
### Wagmi
::::steps
### Set up Wagmi for fee tokens
Ensure that you have set up your project with Wagmi, a Tempo chain config, and a wallet connector:
* [Connection details](https://tempo.com/developers/docs/quickstart/connection-details)
* [TypeScript SDK](https://tempo.com/developers/docs/sdk/typescript)
* [Wallet integration](https://tempo.com/developers/docs/quickstart/wallet-developers)
### Fund the payment and fee tokens
Before you can pay fees in a token of your choice, you need to fund your account. In this guide you will be sending `AlphaUSD` (`0x20c000…0001`) and paying fees in `BetaUSD` (`0x20c000…0002`).
The built-in Tempo testnet faucet includes `AlphaUSD` and `BetaUSD` when funding.
**Interactive demo: Add Funds**
1. Add funds
:::code-group
```tsx twoslash [AddFunds.ts]
// @noErrors
import { Hooks } from 'wagmi/tempo'
import { useConnection } from 'wagmi'
function AddFunds() {
const { address } = useConnection()
const { mutate, isPending } = Hooks.faucet.useFundSync()
return (
)
}
```
```tsx twoslash [wagmi.config.ts] filename="wagmi.config.ts"
// @noErrors
import { tempoModerato } from 'viem/chains'
import { createConfig, http } from 'wagmi'
import { tempoWallet } from 'wagmi/connectors'
export const config = createConfig({
connectors: [tempoWallet()],
chains: [tempoModerato],
multiInjectedProviderDiscovery: false,
transports: {
[tempoModerato.id]: http(),
},
})
```
:::
### Add custom fee-token logic
Add a fee-token selector to your payment form. The sender needs a balance in both the payment token and fee token when they differ.
**Interactive demo: Choose a fee token**
1. Add funds
2. Pay with fee token
Source: [tempoxyz/examples/tree/main/examples/payments](https://github.com/tempoxyz/examples/tree/main/examples/payments)
:::code-group
```tsx twoslash [PayWithFeeToken.tsx]
import { Hooks } from 'wagmi/tempo'
import { parseUnits } from 'viem'
const alphaUsd = '0x20c0000000000000000000000000000000000001'
const betaUsd = '0x20c0000000000000000000000000000000000002'
const thetaUsd = '0x20c0000000000000000000000000000000000003'
const ousd = '0x20c0000000000000000000006a37da5c996874be'
// @noErrors
function PayWithFeeToken() {
const sendPayment = Hooks.token.useTransferSync()
const metadata = Hooks.token.useGetMetadata({
token: alphaUsd,
})
return (
)
}
```
```tsx twoslash [wagmi.config.ts] filename="wagmi.config.ts"
// @noErrors
import { tempoModerato } from 'viem/chains'
import { createConfig, http } from 'wagmi'
import { tempoWallet } from 'wagmi/connectors'
export const config = createConfig({
connectors: [tempoWallet()],
chains: [tempoModerato],
multiInjectedProviderDiscovery: false,
transports: {
[tempoModerato.id]: http(),
},
})
```
:::
### Display the fee-token receipt
Now that users can send payments with a specified fee token, you can link to the transaction receipt.
:::code-group
```tsx twoslash [PayWithFeeToken.tsx]
import { Hooks } from 'wagmi/tempo'
import { parseUnits } from 'viem'
const alphaUsd = '0x20c0000000000000000000000000000000000001'
const betaUsd = '0x20c0000000000000000000000000000000000002'
const thetaUsd = '0x20c0000000000000000000000000000000000003'
const ousd = '0x20c0000000000000000000006a37da5c996874be'
// @noErrors
function PayWithFeeToken() {
const sendPayment = Hooks.token.useTransferSync()
const metadata = Hooks.token.useGetMetadata({
token: alphaUsd,
})
return (
<>
{/* ... your payment form ... */}
{sendPayment.data && ( // [!code ++]
{/* [!code ++] */}
View receipt {/* [!code ++] */}
{/* [!code ++] */}
)} {/* [!code ++] */}
>
)
}
```
```tsx twoslash [wagmi.config.ts] filename="wagmi.config.ts"
// @noErrors
import { tempoModerato } from 'viem/chains'
import { createConfig, http } from 'wagmi'
import { tempoWallet } from 'wagmi/connectors'
export const config = createConfig({
connectors: [tempoWallet()],
chains: [tempoModerato],
multiInjectedProviderDiscovery: false,
transports: {
[tempoModerato.id]: http(),
},
})
```
:::
### Next fee-token steps
Now that you have made a payment using a desired fee token, you can:
* Follow a guide on how to [sponsor user fees](https://tempo.com/developers/docs/api/fee-payer) to enable gasless transactions
* Learn more about [transaction fees](https://tempo.com/developers/docs/protocol/fees)
::::
### Viem
::::steps
### Set up a Viem client for fee tokens
First, we will set up a Viem client configured with Tempo.
```ts twoslash [viem.config.ts]
import { tempoModerato } from 'viem/chains'
import { Account, createClient } from 'viem/tempo'
const privateKey = process.env.TEMPO_PRIVATE_KEY
if (!privateKey || !/^0x[0-9a-fA-F]{64}$/.test(privateKey)) {
throw new Error('Set TEMPO_PRIVATE_KEY to your funded test account private key')
}
export const client = createClient({
account: Account.fromSecp256k1(privateKey as `0x${string}`),
chain: tempoModerato,
feeToken: '0x20c0000000000000000000000000000000000001',
})
```
:::info
For simplicity of the guide, this example uses a Private Key (Secp256k1) account instead of Passkeys (WebAuthn).
:::
### Fund the payment and fee tokens
Before you can pay fees in a token of your choice, you need to fund your account. In this guide you will be sending `AlphaUSD` (`0x20c000…0001`) and paying fees in `BetaUSD` (`0x20c000…0002`).
The built-in Tempo testnet faucet includes `AlphaUSD` and `BetaUSD` when funding.
**Interactive demo: Add Funds**
1. Add funds
:::code-group
```tsx twoslash [example.ts]
// @noErrors
import { client } from './viem.config'
await client.faucet.fundSync({
account: client.account,
})
```
```tsx twoslash [viem.config.ts] filename="viem.config.ts"
// @noErrors
import { tempoModerato } from 'viem/chains'
import { Account, createClient } from 'viem/tempo'
const privateKey = process.env.TEMPO_PRIVATE_KEY
if (!privateKey || !/^0x[0-9a-fA-F]{64}$/.test(privateKey)) {
throw new Error('Set TEMPO_PRIVATE_KEY to your funded test account private key')
}
export const client = createClient({
account: Account.fromSecp256k1(privateKey as `0x${string}`),
chain: tempoModerato,
feeToken: '0x20c0000000000000000000000000000000000001',
})
```
:::
### Add custom fee-token logic
Now that you have `AlphaUSD` to send and `BetaUSD` to pay fees with, you can now add logic to send a payment with a specified fee token.
**Interactive demo: Choose a fee token**
1. Add funds
2. Pay with fee token
Source: [tempoxyz/examples/tree/main/examples/payments](https://github.com/tempoxyz/examples/tree/main/examples/payments)
:::code-group
```tsx twoslash [example.ts]
// @noErrors
import { parseUnits } from 'viem'
import { client } from './viem.config'
const alphaUsd = '0x20c0000000000000000000000000000000000001'
const betaUsd = '0x20c0000000000000000000000000000000000002'
const { receipt } = await client.token.transferSync({
amount: parseUnits('100', 6),
feeToken: betaUsd, // [!code hl]
to: '0x742d35cc6634c0532925a3b844bc9e7595f0bebb',
token: alphaUsd,
})
```
```tsx twoslash [viem.config.ts] filename="viem.config.ts"
// @noErrors
import { tempoModerato } from 'viem/chains'
import { Account, createClient } from 'viem/tempo'
const privateKey = process.env.TEMPO_PRIVATE_KEY
if (!privateKey || !/^0x[0-9a-fA-F]{64}$/.test(privateKey)) {
throw new Error('Set TEMPO_PRIVATE_KEY to your funded test account private key')
}
export const client = createClient({
account: Account.fromSecp256k1(privateKey as `0x${string}`),
chain: tempoModerato,
feeToken: '0x20c0000000000000000000000000000000000001',
})
```
:::
::::
## Set a default user fee token
You can also set a persistent default fee token for an account, so users don't need to specify `feeToken` on every transaction. Learn more about fee token preferences [here](https://tempo.com/developers/docs/protocol/fees/spec-fee#fee-token-preferences).
### Wagmi
```tsx twoslash
// @noErrors
// @errors: 2307
import { Hooks } from 'wagmi/tempo'
const { data: result, mutate } = Hooks.fee.useSetUserTokenSync()
// Call `mutate` in response to user action (e.g. button click, form submission)
mutate({
token: '0x20c0000000000000000000000000000000000001',
})
if (result) console.log('Transaction hash:', result.receipt.transactionHash)
// @log: Transaction hash: 0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef
```
### Viem
```ts twoslash
// @noErrors
// @errors: 2307
import { client } from './viem.config'
const { receipt } = await client.fee.setUserTokenSync({
token: '0x20c0000000000000000000000000000000000001',
})
console.log('Transaction hash:', receipt.transactionHash)
// @log: Transaction hash: 0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef
```
### Rust
:::code-group
```rust [example.rs]
use alloy::primitives::address;
use tempo_alloy::contracts::precompiles::IFeeManager;
mod provider;
#[tokio::main]
async fn main() -> Result<(), Box> {
let provider = provider::get_provider().await?;
let fee_manager = IFeeManager::new(
address!("0xFEEc000000000000000000000000000000000000"),
&provider,
);
let receipt = fee_manager
.setUserToken( // [!code hl]
address!("0x20c0000000000000000000000000000000000001"), // [!code hl]
) // [!code hl]
.send()
.await?
.get_receipt()
.await?;
println!("Transaction hash: {:?}", receipt.transaction_hash);
Ok(())
}
```
```rust [provider.rs]
use alloy::providers::ProviderBuilder;
use alloy::signers::local::PrivateKeySigner;
use tempo_alloy::TempoNetwork;
pub async fn get_provider() -> Result<
impl alloy::providers::Provider,
Box,
> {
let signer: PrivateKeySigner = std::env::var("PRIVATE_KEY")
.expect("PRIVATE_KEY not set")
.parse()?;
let provider = ProviderBuilder::new_with_network::()
.wallet(signer)
.connect(&std::env::var("RPC_URL").expect("RPC_URL not set"))
.await?;
Ok(provider)
}
```
:::
### Python
:::code-group
```python [example.py]
from pytempo import TempoTransaction
from pytempo.contracts import FeeManager, ALPHA_USD
from provider import w3, account
call = FeeManager.set_user_token(token=ALPHA_USD) # [!code hl]
draft = TempoTransaction.create(calls=(call,))
tx = TempoTransaction.create(
chain_id=w3.eth.chain_id,
gas_limit=w3.eth.estimate_gas(draft.to_estimate_gas_request(account.address)),
max_fee_per_gas=w3.eth.gas_price * 2,
max_priority_fee_per_gas=w3.eth.gas_price,
nonce=w3.eth.get_transaction_count(account.address),
calls=(call,),
)
signed_tx = tx.sign(account.key.hex())
tx_hash = w3.eth.send_raw_transaction(signed_tx.encode())
```
```python [provider.py]
from web3 import Web3
from eth_account import Account
w3 = Web3(Web3.HTTPProvider("https://rpc.moderato.tempo.xyz"))
account = Account.from_key("0x...")
```
:::
### Go
:::code-group
```go [main.go]
package main
import (
"context"
"log"
"math/big"
"github.com/ethereum/go-ethereum/common"
"github.com/tempoxyz/tempo-go/pkg/signer"
"github.com/tempoxyz/tempo-go/pkg/transaction"
)
func main() {
sgn, _ := signer.NewSigner("0x...")
c := newClient()
ctx := context.Background()
nonce, _ := c.GetTransactionCount(ctx, sgn.Address().Hex())
feeManager := common.HexToAddress("0xFEEc000000000000000000000000000000000000")
token := common.HexToAddress("0x20c0000000000000000000000000000000000001")
// setUserToken(address) selector: 0xe7897444
data := make([]byte, 36) // [!code hl]
data[0], data[1], data[2], data[3] = 0xe7, 0x89, 0x74, 0x44 // [!code hl]
copy(data[16:36], token.Bytes()) // [!code hl]
tx := transaction.NewBuilder(big.NewInt(transaction.ChainIdModerato)).
SetNonce(nonce).
SetGas(100_000).
SetMaxFeePerGas(big.NewInt(25_000_000_000)).
SetMaxPriorityFeePerGas(big.NewInt(1_000_000_000)).
AddCall(feeManager, big.NewInt(0), data).
Build()
_ = transaction.SignTransaction(tx, sgn)
serialized, _ := transaction.Serialize(tx, nil)
txHash, _ := c.SendRawTransaction(ctx, serialized)
log.Printf("Transaction hash: %s", txHash)
}
```
```go [provider.go]
package main
import (
"os"
"github.com/tempoxyz/tempo-go/pkg/client"
)
func newClient() *client.Client {
return client.New(os.Getenv("TEMPO_RPC_URL"))
}
```
:::
### Cast
```bash
$ cast send \
0xFEEc000000000000000000000000000000000000 \
"setUserToken(address)" \
0x20c0000000000000000000000000000000000001 \
--rpc-url $TEMPO_RPC_URL \
--private-key $PRIVATE_KEY # [!code hl]
```
### Solidity
```solidity
import {StdPrecompiles} from "tempo-std/StdPrecompiles.sol";
StdPrecompiles.TIP_FEE_MANAGER.setUserToken(0x20c0000000000000000000000000000000000001); // [!code hl]
```
## Fee-token learning resources
[Transaction Fees](https://tempo.com/developers/docs/protocol/fees): Learn more about transaction fees on Tempo
> Source: [/docs/guide/getting-funds](https://tempo.com/developers/docs/guide/getting-funds.md)
> Section: [Tempo EVM](https://tempo.com/developers/docs/development.md). Build on Tempo EVM: wallets and keys, payments, transactions and fees, TIP-20 Tokens, contracts, exchange, network details, nodes, protocol specifications, and changelog.
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
# Fund an account
Choose a funding path for the network and integration you are building. Tempo Wallet uses mainnet and real funds; the Moderato faucet supplies separate test tokens.
## Choose a funding path
### Get testnet funds
Use test stablecoins on Moderato to try payments and build your integration.
[Testnet faucet](https://tempo.com/developers/docs/quickstart/faucet)
[Send a test payment](https://tempo.com/developers/get-started/quickstart)
### Add money with Tempo Wallet
Use the fiat onramp in Tempo Wallet, or open its funding flow directly from your app.
[Try the onramp](https://tempo.com/developers/docs/guide/getting-funds#tempo-wallet)
[Add funding to your app](https://tempo.com/developers/docs/guide/getting-funds#open-funding-with-the-accounts-sdk)
### Transfer from another network
Use Routes to move stablecoins to Tempo or accept customer deposits from other networks.
[Transfer with Routes](https://tempo.com/developers/docs/routes)
[Customer deposit addresses](https://tempo.com/developers/docs/routes/deposits)
[Bridge integrations](https://tempo.com/developers/docs/guide/getting-funds#bridge)
### Get OUSD on Tempo
Explore minting through an integration partner or swapping stablecoins already on Tempo.
[OUSD funding options](https://tempo.com/developers/docs/guide/ousd#get-ousd)
[Swap stablecoins](https://tempo.com/developers/docs/guide/stablecoin-dex/executing-swaps)
## Add money with Tempo Wallet
[Tempo Wallet](https://wallet.tempo.xyz) takes deposits from other chains, such as Base, Ethereum, and Solana. Connect below, select **Add funds**, and choose a funding method in the wallet. The wallet shows the available methods, amount, and any fees before you confirm.
This demo opens the funding flow on Moderato testnet, where Tempo's funding page offers the faucet first. In your app on mainnet, the same page takes real deposits.
**Interactive demo: Add Funds**
1. Sign in with Tempo
2. Deposit to tempo wallet
### With the CLI
After [setting up Tempo Wallet in the CLI](https://tempo.com/developers/docs/cli/wallet), run:
```bash
tempo wallet fund
```
### With an agent
Paste this into your agent to set up Tempo Wallet and add funds:
:::code-group
```bash [Claude Code]
claude -p "Read https://tempo.com/skills/wallet/SKILL.md and fund my Tempo Wallet"
```
```bash [Amp]
amp --execute "Read https://tempo.com/skills/wallet/SKILL.md and fund my Tempo Wallet"
```
```bash [Codex CLI]
codex exec "Read https://tempo.com/skills/wallet/SKILL.md and fund my Tempo Wallet"
```
:::
## Open funding with the Accounts SDK
Use the [Accounts SDK](https://accounts.tempo.xyz) to open Tempo's funding page from an **Add funds** button. Tempo handles the funding flow; your application signs the user in and calls `accounts.funding.open`.
:::steps
### Install the Accounts SDK
```bash
pnpm add accounts@alpha viem
```
### Add a funding button
This React example signs the user in with Tempo and opens funding for their Tempo Account on mainnet:
```tsx [AddFundsButton.tsx]
import { Accounts } from 'accounts'
import { useState } from 'react'
const accounts = Accounts.create()
export function AddFundsButton() {
const [pending, setPending] = useState(false)
const [error, setError] = useState()
// Each click opens one Tempo page, since a second popup has no user gesture left.
async function addFunds() {
setPending(true)
setError(undefined)
try {
// The funding page needs a session. Without one, this click signs in, and the next adds funds.
if (!(await accounts.session.get())) {
await accounts.dialog.signIn()
return
}
const result = await accounts.funding.open()
if (result?.status === 'received') {
// Refresh balances. See "Confirm funds have arrived".
}
} catch (cause) {
setError(cause instanceof Error ? cause.message : 'Could not open funding.')
} finally {
setPending(false)
}
}
return (
{error &&
{error}
}
)
}
```
Call `funding.open` from the click handler, since the browser blocks a popup opened outside a user gesture. You can prefill `amount` as a human-readable string, such as `'50'`, and `token` as a supported token symbol, such as `'USDC.e'`. The user reviews and confirms the funding request on Tempo's funding page.
### Confirm funds have arrived
A resolved `funding.open` call doesn't mean the account is funded. Fiat funding can complete asynchronously, after the funding page closes. Refresh [balances and activity](https://tempo.com/developers/docs/guide/payments/accept-a-payment#read-balances), and [verify incoming transfers](https://tempo.com/developers/docs/guide/payments/accept-a-payment) before crediting funds in your application's records.
:::
## Get OUSD
See [OUSD on Tempo](https://tempo.com/developers/docs/guide/ousd) for minting, redemption, and swap options. Check the token contract address and network when adding an asset to your application.
## Add funding to your application
Use [Tempo Routes](https://tempo.com/developers/docs/routes) to quote a cross-network transfer or create a deposit address for customers who send funds independently. Track destination delivery before crediting the payment in your application.
## Bridge integrations
If you integrate a bridge directly, follow its quote, submission, and delivery flow:
* [LayerZero (Stargate)](https://tempo.com/developers/docs/guide/bridge-layerzero)
* [Bungee](https://tempo.com/developers/docs/guide/bridge-bungee)
* [Relay](https://tempo.com/developers/docs/guide/bridge-relay)
See [bridge providers](https://tempo.com/developers/docs/partners/bridges) for the directory. Check the output asset as well as the network: USDC sent through Stargate arrives on Tempo as USDC.e.
## Testnet funds
For development and testing, use the [Tempo Faucet](https://tempo.com/developers/docs/quickstart/faucet).
The faucet provides `OUSD`, `pathUSD`, `alphaUSD`, `betaUSD`, and `thetaUSD` test stablecoins.
> Source: [/docs/guide/payments/send-a-payment](https://tempo.com/developers/docs/guide/payments/send-a-payment.md)
> Section: [Tempo EVM](https://tempo.com/developers/docs/development.md). Build on Tempo EVM: wallets and keys, payments, transactions and fees, TIP-20 Tokens, contracts, exchange, network details, nodes, protocol specifications, and changelog.
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
# Send payments
Send stablecoin payments and payouts between Tempo accounts and verify delivery. Use a payment reference when you need to match a transfer to an invoice or order.
The examples use AlphaUSD on Moderato testnet. [Create and fund a test account](https://tempo.com/developers/get-started/quickstart), then choose a recipient you control.
For complete files and more languages, see [single transfers](https://tempo.com/developers/docs/guide/payments/send-a-payment/examples#send-a-payment), [payment references](https://tempo.com/developers/docs/guide/payments/send-a-payment/examples#add-a-payment-reference), or [batches](https://tempo.com/developers/docs/guide/payments/send-a-payment/examples#batch-payments).
## Send a payment
Use the [CLI, Viem, and Wagmi setup](https://tempo.com/developers/docs/guide/payments/send-a-payment/examples#choose-your-tools) with a funded test account. It defines the signer, `client`, `recipient`, and `alphaUsd`; the Python setup supplies `w3` and `transaction_options()`. All amounts use base units: `10_000_000` is ten AlphaUSD. Wagmi hooks belong inside a React component; call the named handlers from buttons and show their pending and error states.
:::code-group
```ts [Viem]
const { receipt } = await client.token.transferSync({
token: alphaUsd, to: recipient, amount: 10_000_000n,
})
console.log(receipt.transactionHash)
```
```bash [CLI]
cast erc20 transfer "$ALPHA_USD" "$TEMPO_RECIPIENT" 10000000 \
--tempo.fee-token "$ALPHA_USD" \
--rpc-url "$TEMPO_RPC_URL" --private-key "$TEMPO_PRIVATE_KEY"
```
```tsx [Wagmi]
import { Hooks } from 'wagmi/tempo'
const { mutate: transfer, data, isPending, error } = Hooks.token.useTransferSync()
const sendPayment = () => transfer({
token: alphaUsd, to: recipient, amount: 10_000_000n,
})
```
```python [Python]
tx = TempoTransaction.create(
**transaction_options(),
calls=(TIP20(alpha_usd).transfer(to=recipient, amount=10_000_000),),
)
signed_tx = tx.sign(private_key)
tx_hash = w3.eth.send_raw_transaction(signed_tx.encode())
```
```bash [cURL (RPC)]
curl --fail-with-body https://rpc.moderato.tempo.xyz \
-H "Content-Type: application/json" \
--data '{"jsonrpc":"2.0","id":1,"method":"eth_sendRawTransaction","params":["'"$SIGNED_TRANSACTION"'"]}'
```
:::
Viem and Wagmi sign and wait for the receipt. Python signs and submits; wait for its receipt below. cURL **only submits an already-signed transaction**: set `SIGNED_TRANSACTION` to the encoded hex bytes from your signer, as shown in [Python setup](https://tempo.com/developers/docs/guide/payments/send-a-payment/examples#python-client). The hosted API does not sign a payment for you.
For customer-approved payments, follow the [browser walkthrough](https://tempo.com/developers/docs/guide/payments/send-a-payment/browser). To try a live payment first, use the [quickstart demo](https://tempo.com/developers/get-started/quickstart#try-a-payment).
### Add a payment reference
Use a memo to carry an invoice or order identifier. Encode it as a 32-byte value and save the same identifier in your payment record.
:::code-group
```ts [Viem]
const { receipt } = await client.token.transferSync({
token: alphaUsd, to: recipient, amount: 10_000_000n,
memo: toHex('invoice-001', { size: 32 }),
})
```
```bash [CLI]
cast send "$ALPHA_USD" 'transferWithMemo(address,uint256,bytes32)' \
"$TEMPO_RECIPIENT" 10000000 "$(cast format-bytes32-string invoice-001)" \
--tempo.fee-token "$ALPHA_USD" \
--rpc-url "$TEMPO_RPC_URL" --private-key "$TEMPO_PRIVATE_KEY"
```
```tsx [Wagmi]
import { Hooks } from 'wagmi/tempo'
import { toHex } from 'viem'
const { mutate: transfer, data, isPending, error } = Hooks.token.useTransferSync()
const sendPayment = () => transfer({
token: alphaUsd, to: recipient, amount: 10_000_000n,
memo: toHex('invoice-001', { size: 32 }),
})
```
```python [Python]
memo = b"invoice-001".ljust(32, b"\0")
call = TIP20(alpha_usd).transfer_with_memo(
to=recipient, amount=10_000_000, memo=memo,
)
tx = TempoTransaction.create(**transaction_options(), calls=(call,))
signed_tx = tx.sign(private_key)
tx_hash = w3.eth.send_raw_transaction(signed_tx.encode())
```
:::
See [Payment references](https://tempo.com/developers/docs/guide/payments/transfer-memos) for encoding rules and reconciliation.
## Batch payments
Send several payments as calls in one transaction. If a call reverts, the whole batch reverts. For independent receipts, use [parallel transactions](https://tempo.com/developers/docs/guide/payments/send-parallel-transactions).
:::code-group
```ts [Viem]
const calls = [10_000_000n, 20_000_000n].map((amount) =>
Actions.token.transfer.call({ token: alphaUsd, to: recipient, amount }),
)
const hash = await client.sendTransaction({ calls })
const receipt = await client.waitForTransactionReceipt({ hash })
```
```bash [CLI]
cast batch-send \
--call "$ALPHA_USD::transfer(address,uint256):$TEMPO_RECIPIENT,10000000" \
--call "$ALPHA_USD::transfer(address,uint256):$TEMPO_RECIPIENT,20000000" \
--tempo.fee-token "$ALPHA_USD" \
--rpc-url "$TEMPO_RPC_URL" --private-key "$TEMPO_PRIVATE_KEY"
```
```tsx [Wagmi]
import { useSendTransactionSync } from 'wagmi'
import { Actions } from 'viem/tempo'
const { mutate: send, data: receipt, isPending, error } = useSendTransactionSync()
const sendBatch = () => send({ calls: [10_000_000n, 20_000_000n].map((amount) =>
Actions.token.transfer.call({ token: alphaUsd, to: recipient, amount }),
) })
```
```python [Python]
calls = tuple(TIP20(alpha_usd).transfer(to=recipient, amount=amount)
for amount in (10_000_000, 20_000_000))
tx = TempoTransaction.create(**transaction_options(), calls=calls)
signed_tx = tx.sign(private_key)
tx_hash = w3.eth.send_raw_transaction(signed_tx.encode())
```
:::
Use your own list of recipients and amounts. Confirm every expected transfer in the receipt before marking the batch delivered.
## Pay fees
The Viem and CLI examples select AlphaUSD for transaction fees. Wallet-connected Wagmi requests use the wallet's fee settings. Keep enough of the fee token in addition to the payment amount.
* [Choose a fee token](https://tempo.com/developers/docs/guide/payments/pay-fees-in-any-stablecoin) when the sender pays.
* [Sponsor fees](https://tempo.com/developers/docs/api/fee-payer) when your application pays for its customers.
* [Estimate costs](https://tempo.com/developers/docs/network/fees#estimate-costs) before funding a payment run.
Choosing a fee token does not convert the payment itself. Use [Routes](https://tempo.com/developers/docs/routes) for supported cross-network transfers and [Exchange](https://tempo.com/developers/docs/guide/stablecoin-dex) for onchain swaps.
## Confirm delivery
Use the transaction hash as `PAYMENT_TX_HASH` (CLI), `paymentHash` (Wagmi), or `tx_hash` (Python). Viem's synchronous helper already returned `receipt`; the Wagmi transfer exposes `data?.receipt`. Use the API tool below to inspect a transaction by its hash and network.
:::code-group
```ts [Viem]
if (receipt.status !== 'success') throw new Error('Transaction failed')
console.log(receipt.transactionHash)
```
```bash [CLI]
cast receipt "$PAYMENT_TX_HASH" --rpc-url "$TEMPO_RPC_URL"
```
```tsx [Wagmi]
import { useWaitForTransactionReceipt } from 'wagmi'
const { data: receipt, isPending, error } = useWaitForTransactionReceipt({
hash: paymentHash,
})
const succeeded = receipt?.status === 'success'
```
```python [Python]
receipt = w3.eth.wait_for_transaction_receipt(tx_hash)
if receipt["status"] != 1:
raise RuntimeError("Transaction failed")
print(receipt["transactionHash"].hex())
```
:::
`GET /v1/transactions/{transactionHash}/receipt`
Get a transaction receipt
[API reference](https://tempo.com/developers/docs/api/transactions#getreceipt) — request parameters, authentication, and response schema. The examples below use editable sample values.
**cURL**
```bash
curl 'https://api.tempo.xyz/v1/transactions/0x515801d7f9a5ac705e793e85904c9c69b3f1694b465cc8fb6ba3f0298dc82665/receipt?chainId=42431'
```
**TypeScript**
```ts
fetch('https://api.tempo.xyz/v1/transactions/0x515801d7f9a5ac705e793e85904c9c69b3f1694b465cc8fb6ba3f0298dc82665/receipt?chainId=42431')
```
Check the transaction status, then match the token contract, recipient, and amount in the receipt's `Transfer` events. Even when the transaction succeeds, a [receive policy](https://tempo.com/developers/docs/accounts/policies/receive-policies#blocked-receipts) can redirect funds to `ReceivePolicyGuard` instead of the recipient.
If submission times out, check the submitted transaction hash before rebuilding or sending another payment.
Use the [verification example](https://tempo.com/developers/docs/guide/payments/accept-a-payment/examples#verify-an-invoice) to connect confirmed transfers to application records. Save the network, transaction hash, and transfer log index so a replay cannot credit the same payment twice.
For a browser integration, show [pending and failed payment states](https://tempo.com/developers/docs/guide/payments/send-a-payment/browser#payment-states).
See [Transactions](https://tempo.com/developers/docs/protocol/transactions) for execution details.
> Source: [/docs/guide/payments/send-a-payment/browser](https://tempo.com/developers/docs/guide/payments/send-a-payment/browser.md)
> Section: [Tempo EVM](https://tempo.com/developers/docs/development.md). Build on Tempo EVM: wallets and keys, payments, transactions and fees, TIP-20 Tokens, contracts, exchange, network details, nodes, protocol specifications, and changelog.
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
# Browser payments
Add a payment form that asks customers to authorize stablecoin transfers in their wallet. This walkthrough uses React, Wagmi, and AlphaUSD on Moderato testnet.
::::steps
### Set up Wagmi for Tempo payments
Ensure that you have set up your project with Wagmi, a Tempo chain config, and a wallet connector:
* [Connection details](https://tempo.com/developers/docs/quickstart/connection-details)
* [TypeScript SDK](https://tempo.com/developers/docs/sdk/typescript)
* [Wallet integration](https://tempo.com/developers/docs/quickstart/wallet-developers)
### Add testnet stablecoin funds
This guide sends `AlphaUSD` (`0x20c000…0001`) on Moderato testnet. Use the faucet to fund your test account. For mainnet funding, see [Fund an account](https://tempo.com/developers/docs/guide/getting-funds).
**Interactive demo: Add Funds**
1. Add funds
:::code-group
```tsx twoslash [AddFunds.ts]
// @noErrors
import { Hooks } from 'wagmi/tempo'
import { useConnection } from 'wagmi'
function AddFunds() {
const { address } = useConnection()
const { mutate, isPending } = Hooks.faucet.useFundSync()
return (
)
}
```
```tsx twoslash [wagmi.config.ts] filename="wagmi.config.ts"
// @noErrors
import { tempoModerato } from 'viem/chains'
import { createConfig, http } from 'wagmi'
import { tempoWallet } from 'wagmi/connectors'
export const config = createConfig({
connectors: [tempoWallet()],
chains: [tempoModerato],
multiInjectedProviderDiscovery: false,
transports: {
[tempoModerato.id]: http(),
},
})
```
:::
### Add TIP-20 transfer logic
Send `AlphaUSD` to the recipient and include a memo when you need a payment reference. Validate the address and the memo’s 32-byte limit before requesting a signature; show validation and wallet errors beside the form.
**Interactive demo: Send Payment**
1. Add funds
2. Send payment
:::code-group
```tsx twoslash [SendPaymentWithMemo.tsx]
import React, { useState } from 'react'
import { Hooks } from 'wagmi/tempo'
import { getAddress, isAddress, parseUnits, toHex } from 'viem'
function SendPaymentWithMemo() {
const sendPayment = Hooks.token.useTransferSync()
const [validationError, setValidationError] = useState(null)
return (
)
}
```
```tsx twoslash [wagmi.config.ts] filename="wagmi.config.ts"
// @noErrors
import { tempoModerato } from 'viem/chains'
import { createConfig, http } from 'wagmi'
import { tempoWallet } from 'wagmi/connectors'
export const config = createConfig({
connectors: [tempoWallet()],
chains: [tempoModerato],
multiInjectedProviderDiscovery: false,
transports: {
[tempoModerato.id]: http(),
},
})
```
:::
### Display the payment receipt
Check the receipt’s transfer events for the expected token, amount, and recipient before recording delivery. See [Receive a payment](https://tempo.com/developers/docs/guide/payments/accept-a-payment#verify-stablecoin-payments) for verification code.
:::code-group
```tsx twoslash [SendPaymentWithMemo.tsx]
import { Hooks } from 'wagmi/tempo'
// @noErrors
function SendPaymentWithMemo() {
const sendPayment = Hooks.token.useTransferSync()
return (
<>
{/* ... your payment form ... */}
{sendPayment.data && ( // [!code ++]
{/* [!code ++] */}
View receipt {/* [!code ++] */}
{/* [!code ++] */}
)} {/* [!code ++] */}
>
)
}
```
```tsx twoslash [wagmi.config.ts] filename="wagmi.config.ts"
// @noErrors
import { tempoModerato } from 'viem/chains'
import { createConfig, http } from 'wagmi'
import { tempoWallet } from 'wagmi/connectors'
export const config = createConfig({
connectors: [tempoWallet()],
chains: [tempoModerato],
multiInjectedProviderDiscovery: false,
transports: {
[tempoModerato.id]: http(),
},
})
```
:::
### Connect payment records
* **[Receive a payment](https://tempo.com/developers/docs/guide/payments/accept-a-payment)** and reconcile it in your application
* Learn about [Tempo Transactions](https://tempo.com/developers/docs/protocol/transactions) for batched calls, sponsorship, and transaction validity windows
* Send a payment [with a specific fee token](https://tempo.com/developers/docs/guide/payments/pay-fees-in-any-stablecoin)
::::
## Payment states
### Pending payments
Users should see a loading state when the payment is being processed.
You can use the `isPending` property from the `useTransferSync` hook to show pending state to the user.
### Failed payments
If an error unexpectedly occurs, you can display an error message to the user by using the `error` property from the `useTransferSync` hook.
```tsx
import { Hooks } from 'wagmi/tempo'
function SendPayment() {
const sendPayment = Hooks.token.useTransferSync()
return (
<>
{/* ... your paymentform ... */}
{sendPayment.error &&
Error: {sendPayment.error.message}
}
>
)
}
```
Return to [Send payments](https://tempo.com/developers/docs/guide/payments/send-a-payment) for batching, fees, and delivery checks.
> Source: [/docs/guide/payments/send-parallel-transactions](https://tempo.com/developers/docs/guide/payments/send-parallel-transactions.md)
> Section: [Tempo EVM](https://tempo.com/developers/docs/development.md). Build on Tempo EVM: wallets and keys, payments, transactions and fees, TIP-20 Tokens, contracts, exchange, network details, nodes, protocol specifications, and changelog.
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
# Send payments in parallel
Submit independent payment transactions concurrently when each payment needs its own receipt. Use [batch payments](https://tempo.com/developers/docs/guide/payments/send-a-payment#batch-payment-transactions) when the calls must succeed or fail together in one transaction.
## Submit independent transactions
Connect a test account and send two independent transactions on Moderato testnet. The wallet demo uses separate nonce keys; the backend example below uses expiring nonces. The wallet demo shows each submitted hash and confirms the expected token transfer before marking it complete. The backend example waits for each transaction’s receipt.
**Interactive demo: Send Parallel Payments**
1. Connect
2. Add funds
3. Send parallel payments
Use the funded Moderato account from the [Viem client setup](https://tempo.com/developers/docs/guide/payments/send-a-payment/examples#viem-client). This Viem example selects [expiring nonces](https://tempo.com/developers/docs/guide/tempo-transaction#expiring-nonces) with `nonceKey: 'expiring'`, so the transactions do not compete for a sequential nonce.
:::code-group
```ts [parallel-payments.ts]
import { parseUnits } from 'viem'
import { client } from './viem.config'
const payments = [
{ to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', amount: '10' },
{ to: '0x3c44cdddb6a900fa2b585dd299e03d12fa4293bc', amount: '5' },
] as const
const results = await Promise.allSettled(
payments.map(({ to, amount }) =>
client.token.transferSync({
token: '0x20c0000000000000000000000000000000000001',
to,
amount: parseUnits(amount, 6),
nonceKey: 'expiring',
}),
),
)
for (const [index, result] of results.entries()) {
if (result.status === 'fulfilled') {
console.log(index, result.value.receipt.transactionHash)
} else {
console.error(index, result.reason)
}
}
```
```ts [viem.config.ts]
import { tempoModerato } from 'viem/chains'
import { Account, createClient } from 'viem/tempo'
const privateKey = process.env.TEMPO_PRIVATE_KEY
if (!privateKey || !/^0x[0-9a-fA-F]{64}$/.test(privateKey)) {
throw new Error('Set TEMPO_PRIVATE_KEY to your funded test account private key')
}
export const client = createClient({
account: Account.fromSecp256k1(privateKey as `0x${string}`),
chain: tempoModerato,
feeToken: '0x20c0000000000000000000000000000000000001',
})
```
:::
Replace the example recipients with test accounts you control. Each payment produces a separate result; one failure does not roll back the others. [Verify delivery](https://tempo.com/developers/docs/guide/payments/accept-a-payment#verify-stablecoin-payments) for each receipt before marking its payment complete.
Expiring nonces include a transaction validity window. If a submission times out, check its transaction hash before rebuilding or retrying the payment. See [expiring nonce behavior](https://tempo.com/developers/docs/guide/tempo-transaction#expiring-nonces) for expiry and replay rules.
## Parallel transaction learning resources
[Expiring nonces](https://tempo.com/developers/docs/guide/tempo-transaction#expiring-nonces): Choose nonce and validity-window settings for concurrent submissions.
[Transactions](https://tempo.com/developers/docs/protocol/transactions): Read the transaction format and execution rules.
> Source: [/docs/guide/payments/send-a-payment/examples](https://tempo.com/developers/docs/guide/payments/send-a-payment/examples.md)
> Section: [Tempo EVM](https://tempo.com/developers/docs/development.md). Build on Tempo EVM: wallets and keys, payments, transactions and fees, TIP-20 Tokens, contracts, exchange, network details, nodes, protocol specifications, and changelog.
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
# Payment examples
Use these examples to send AlphaUSD on Moderato testnet. Start with [Send payments](https://tempo.com/developers/docs/guide/payments/send-a-payment) for the integration flow, or [Browser payments](https://tempo.com/developers/docs/guide/payments/send-a-payment/browser) for a complete React walkthrough.
Fund a test account with the [faucet](https://tempo.com/developers/docs/quickstart/faucet) and replace the example recipients with accounts you control. Set `RPC_URL` or `TEMPO_RPC_URL` to `https://rpc.moderato.tempo.xyz` for command-line examples. Use the [SDK guides](https://tempo.com/developers/docs/sdk) to install and configure your language's tooling. Cast examples use `TEMPO_PRIVATE_KEY` from the [CLI setup](https://tempo.com/developers/docs/guide/payments/send-a-payment/examples#cli-client); all token amounts are in base units.
## Send a payment
Send a payment using the standard `transfer` function. The Solidity examples are owner-operated treasury contracts: pass the token address to the constructor and fund the contract before calling it.
### Viem
:::code-group
```ts twoslash [example.ts]
// @noErrors
import { parseUnits } from 'viem'
import { client } from './viem.config'
const { receipt } = await client.token.transferSync({
amount: parseUnits('100', 6), // 100 tokens (6 decimals) // [!code hl]
to: '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEbb', // [!code hl]
token: '0x20c0000000000000000000000000000000000001', // AlphaUSD // [!code hl]
})
```
```ts twoslash [viem.config.ts]
import { tempoModerato } from 'viem/chains'
import { Account, createClient } from 'viem/tempo'
const privateKey = process.env.TEMPO_PRIVATE_KEY
if (!privateKey || !/^0x[0-9a-fA-F]{64}$/.test(privateKey)) {
throw new Error('Set TEMPO_PRIVATE_KEY to your funded test account private key')
}
export const client = createClient({
account: Account.fromSecp256k1(privateKey as `0x${string}`),
chain: tempoModerato,
feeToken: '0x20c0000000000000000000000000000000000001',
})
```
:::
### Wagmi
```tsx twoslash
// @noErrors
import { Hooks } from 'wagmi/tempo'
import { parseUnits } from 'viem'
function SendPayment() {
const { mutate, isPending } = Hooks.token.useTransferSync() // [!code hl]
return (
)
}
```
### Rust
:::code-group
```rust [example.rs]
use alloy::{
primitives::{address, U256},
providers::ProviderBuilder,
};
use tempo_alloy::{TempoNetwork, contracts::precompiles::ITIP20};
mod provider;
#[tokio::main]
async fn main() -> Result<(), Box> {
let provider = provider::get_provider().await?;
let token = ITIP20::new( // [!code hl]
address!("0x20c0000000000000000000000000000000000001"), // AlphaUSD // [!code hl]
&provider, // [!code hl]
); // [!code hl]
let receipt = token // [!code hl]
.transfer( // [!code hl]
address!("0x742d35Cc6634C0532925a3b844Bc9e7595f0bEbb"), // [!code hl]
U256::from(100_000_000), // 100 tokens (6 decimals) // [!code hl]
) // [!code hl]
.send() // [!code hl]
.await? // [!code hl]
.get_receipt() // [!code hl]
.await?; // [!code hl]
println!("Transfer successful: {:?}", receipt.transaction_hash);
Ok(())
}
```
```rust [provider.rs]
use alloy::providers::ProviderBuilder;
use alloy::signers::local::PrivateKeySigner;
use tempo_alloy::TempoNetwork;
pub async fn get_provider() -> Result<
impl alloy::providers::Provider,
Box,
> {
let signer: PrivateKeySigner = std::env::var("PRIVATE_KEY")
.expect("PRIVATE_KEY not set")
.parse()?;
let provider = ProviderBuilder::new_with_network::()
.wallet(signer)
.connect(&std::env::var("RPC_URL").expect("RPC_URL not set"))
.await?;
Ok(provider)
}
```
:::
### Python
:::code-group
```python [example.py]
from eth_abi import encode
from eth_account import Account
from pytempo import Call, TempoTransaction
from provider import w3, account
TRANSFER_SELECTOR = bytes.fromhex("a9059cbb")
ALPHA_USD = "0x20c0000000000000000000000000000000000001"
recipient = Account.create().address # replace with your recipient's address
data = TRANSFER_SELECTOR + encode( # [!code hl]
["address", "uint256"], # [!code hl]
[recipient, 100_000_000], # [!code hl]
) # [!code hl]
call = Call.create(to=ALPHA_USD, data="0x" + data.hex()) # [!code hl]
draft = TempoTransaction.create(calls=(call,))
tx = TempoTransaction.create(
chain_id=w3.eth.chain_id,
gas_limit=w3.eth.estimate_gas(draft.to_estimate_gas_request(account.address)),
max_fee_per_gas=w3.eth.gas_price * 2,
max_priority_fee_per_gas=w3.eth.gas_price,
nonce=w3.eth.get_transaction_count(account.address),
calls=(call,),
)
signed_tx = tx.sign(account.key.hex())
tx_hash = w3.eth.send_raw_transaction(signed_tx.encode())
```
```python [provider.py]
from web3 import Web3
from eth_account import Account
w3 = Web3(Web3.HTTPProvider("https://rpc.moderato.tempo.xyz"))
account = Account.from_key("0x...")
```
:::
### Go
:::code-group
```go [main.go]
package main
import (
"context"
"log"
"math/big"
"github.com/ethereum/go-ethereum/common"
"github.com/tempoxyz/tempo-go/pkg/signer"
"github.com/tempoxyz/tempo-go/pkg/transaction"
)
func buildTransferData(to common.Address, amount *big.Int) []byte {
data := make([]byte, 68) // 4 (selector) + 32 (address) + 32 (uint256)
data[0], data[1], data[2], data[3] = 0xa9, 0x05, 0x9c, 0xbb
copy(data[16:36], to.Bytes())
amount.FillBytes(data[36:68])
return data
}
func main() {
sgn, _ := signer.NewSigner("0x...")
c := newClient()
ctx := context.Background()
nonce, _ := c.GetTransactionCount(ctx, sgn.Address().Hex())
recipient := common.HexToAddress("0x742d35Cc6634C0532925a3b844Bc9e7595f0bEbb")
alphaUSD := common.HexToAddress("0x20c0000000000000000000000000000000000001")
tx := transaction.NewBuilder(big.NewInt(42431)).
SetNonce(nonce).
SetGas(100_000).
SetMaxFeePerGas(big.NewInt(25_000_000_000)).
SetMaxPriorityFeePerGas(big.NewInt(1_000_000_000)).
AddCall( // [!code hl]
alphaUSD, // [!code hl]
big.NewInt(0), // [!code hl]
buildTransferData(recipient, big.NewInt(100_000_000)), // [!code hl]
). // [!code hl]
Build()
_ = transaction.SignTransaction(tx, sgn)
serialized, _ := transaction.Serialize(tx, nil)
txHash, _ := c.SendRawTransaction(ctx, serialized)
log.Printf("Transaction hash: %s", txHash)
}
```
```go [provider.go]
package main
import (
"os"
"github.com/tempoxyz/tempo-go/pkg/client"
)
func newClient() *client.Client {
return client.New(os.Getenv("TEMPO_RPC_URL"))
}
```
:::
### Cast
```bash
cast erc20 transfer \
0x20c0000000000000000000000000000000000001 \
0x742d35Cc6634C0532925a3b844Bc9e7595f0bEbb \
100000000 \
--tempo.fee-token 0x20c0000000000000000000000000000000000001 \
--rpc-url "$TEMPO_RPC_URL" \
--private-key "$TEMPO_PRIVATE_KEY" # [!code hl]
```
### Solidity
```solidity
import {ITIP20} from "tempo-std/interfaces/ITIP20.sol";
contract PaymentSender {
ITIP20 public immutable token;
address public immutable owner;
constructor(ITIP20 token_) {
token = token_;
owner = msg.sender;
}
function sendPayment(address recipient, uint256 amount) external {
require(msg.sender == owner, "Only owner");
token.transfer(recipient, amount); // [!code hl]
}
}
```
## Add a payment reference
Include a memo for payment reconciliation and tracking. Use a short invoice or order ID. Follow [Payment references](https://tempo.com/developers/docs/guide/payments/transfer-memos#encode-a-payment-reference) for the shared UTF-8 encoding and length checks.
### Viem
:::code-group
```ts twoslash [example.ts]
// @noErrors
import { parseUnits, toHex } from 'viem'
import { client } from './viem.config'
const invoiceId = toHex('INV-12345', { size: 32 }) // [!code hl]
const { receipt } = await client.token.transferSync({
amount: parseUnits('100', 6),
to: '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEbb',
token: '0x20c0000000000000000000000000000000000001',
memo: invoiceId, // [!code hl]
})
```
```ts twoslash [viem.config.ts]
import { tempoModerato } from 'viem/chains'
import { Account, createClient } from 'viem/tempo'
const privateKey = process.env.TEMPO_PRIVATE_KEY
if (!privateKey || !/^0x[0-9a-fA-F]{64}$/.test(privateKey)) {
throw new Error('Set TEMPO_PRIVATE_KEY to your funded test account private key')
}
export const client = createClient({
account: Account.fromSecp256k1(privateKey as `0x${string}`),
chain: tempoModerato,
feeToken: '0x20c0000000000000000000000000000000000001',
})
```
:::
### Wagmi
```tsx twoslash
// @noErrors
import { Hooks } from 'wagmi/tempo'
import { parseUnits, toHex } from 'viem'
function SendPaymentWithMemo() {
const { mutate, isPending } = Hooks.token.useTransferSync()
return (
)
}
```
### Rust
:::code-group
```rust [example.rs]
use alloy::{
primitives::{address, B256, U256},
providers::ProviderBuilder,
};
use tempo_alloy::{TempoNetwork, contracts::precompiles::ITIP20};
mod provider;
#[tokio::main]
async fn main() -> Result<(), Box> {
let provider = provider::get_provider().await?;
let token = ITIP20::new(
address!("0x20c0000000000000000000000000000000000001"),
&provider,
);
let receipt = token
.transferWithMemo( // [!code hl]
address!("0x742d35Cc6634C0532925a3b844Bc9e7595f0bEbb"),
U256::from(100_000_000),
B256::right_padding_from("INV-12345".as_bytes()), // [!code hl]
)
.send()
.await?
.get_receipt()
.await?;
println!("Transfer successful: {:?}", receipt.transaction_hash);
Ok(())
}
```
```rust [provider.rs]
use alloy::providers::ProviderBuilder;
use alloy::signers::local::PrivateKeySigner;
use tempo_alloy::TempoNetwork;
pub async fn get_provider() -> Result<
impl alloy::providers::Provider,
Box,
> {
let signer: PrivateKeySigner = std::env::var("PRIVATE_KEY")
.expect("PRIVATE_KEY not set")
.parse()?;
let provider = ProviderBuilder::new_with_network::()
.wallet(signer)
.connect(&std::env::var("RPC_URL").expect("RPC_URL not set"))
.await?;
Ok(provider)
}
```
:::
### Python
:::code-group
```python [example.py]
from eth_abi import encode
from eth_account import Account
from pytempo import Call, TempoTransaction
from provider import w3, account
TRANSFER_WITH_MEMO_SELECTOR = bytes.fromhex("95777d59")
ALPHA_USD = "0x20c0000000000000000000000000000000000001"
recipient = Account.create().address # replace with your recipient's address
memo = b"INV-12345" + b"\x00" * 23 # right-pad to 32 bytes # [!code hl]
data = TRANSFER_WITH_MEMO_SELECTOR + encode( # [!code hl]
["address", "uint256", "bytes32"], # [!code hl]
[recipient, 100_000_000, memo], # [!code hl]
) # [!code hl]
call = Call.create(to=ALPHA_USD, data="0x" + data.hex())
draft = TempoTransaction.create(calls=(call,))
tx = TempoTransaction.create(
chain_id=w3.eth.chain_id,
gas_limit=w3.eth.estimate_gas(draft.to_estimate_gas_request(account.address)),
max_fee_per_gas=w3.eth.gas_price * 2,
max_priority_fee_per_gas=w3.eth.gas_price,
nonce=w3.eth.get_transaction_count(account.address),
calls=(call,),
)
signed_tx = tx.sign(account.key.hex())
tx_hash = w3.eth.send_raw_transaction(signed_tx.encode())
```
```python [provider.py]
from web3 import Web3
from eth_account import Account
w3 = Web3(Web3.HTTPProvider("https://rpc.moderato.tempo.xyz"))
account = Account.from_key("0x...")
```
:::
### Go
:::code-group
```go [main.go]
package main
import (
"context"
"log"
"math/big"
"github.com/ethereum/go-ethereum/common"
"github.com/tempoxyz/tempo-go/pkg/signer"
"github.com/tempoxyz/tempo-go/pkg/transaction"
)
func buildTransferWithMemoData(to common.Address, amount *big.Int, memo [32]byte) []byte {
data := make([]byte, 100) // 4 + 32 + 32 + 32
data[0], data[1], data[2], data[3] = 0x76, 0xa8, 0xee, 0x59
copy(data[16:36], to.Bytes())
amount.FillBytes(data[36:68])
copy(data[68:100], memo[:])
return data
}
func main() {
sgn, _ := signer.NewSigner("0x...")
c := newClient()
ctx := context.Background()
nonce, _ := c.GetTransactionCount(ctx, sgn.Address().Hex())
recipient := common.HexToAddress("0x742d35Cc6634C0532925a3b844Bc9e7595f0bEbb")
alphaUSD := common.HexToAddress("0x20c0000000000000000000000000000000000001")
var memo [32]byte // [!code hl]
copy(memo[:], []byte("INV-12345")) // [!code hl]
tx := transaction.NewBuilder(big.NewInt(42431)).
SetNonce(nonce).
SetGas(100_000).
SetMaxFeePerGas(big.NewInt(25_000_000_000)).
SetMaxPriorityFeePerGas(big.NewInt(1_000_000_000)).
AddCall( // [!code hl]
alphaUSD, // [!code hl]
big.NewInt(0), // [!code hl]
buildTransferWithMemoData(recipient, big.NewInt(100_000_000), memo), // [!code hl]
). // [!code hl]
Build()
_ = transaction.SignTransaction(tx, sgn)
serialized, _ := transaction.Serialize(tx, nil)
txHash, _ := c.SendRawTransaction(ctx, serialized)
log.Printf("Transaction hash: %s", txHash)
}
```
```go [provider.go]
package main
import (
"os"
"github.com/tempoxyz/tempo-go/pkg/client"
)
func newClient() *client.Client {
return client.New(os.Getenv("TEMPO_RPC_URL"))
}
```
:::
### Cast
```bash
cast send \
0x20c0000000000000000000000000000000000001 \
"transferWithMemo(address,uint256,bytes32)" \
0x742d35Cc6634C0532925a3b844Bc9e7595f0bEbb \
100000000 \
"$(cast format-bytes32-string "INV-12345")" \
--tempo.fee-token 0x20c0000000000000000000000000000000000001 \
--rpc-url "$TEMPO_RPC_URL" \
--private-key "$TEMPO_PRIVATE_KEY" # [!code hl]
```
### Solidity
```solidity
import {ITIP20} from "tempo-std/interfaces/ITIP20.sol";
contract PaymentSender {
ITIP20 public immutable token;
address public immutable owner;
constructor(ITIP20 token_) {
token = token_;
owner = msg.sender;
}
function sendPaymentWithMemo(
address recipient,
uint256 amount,
bytes32 invoiceId
) external {
require(msg.sender == owner, "Only owner");
token.transferWithMemo(recipient, amount, invoiceId); // [!code hl]
}
}
```
## Batch payments
Send several payments as calls in one transaction. If a call reverts, the whole batch reverts. For separate transaction receipts, [send payments in parallel](https://tempo.com/developers/docs/guide/payments/send-parallel-transactions).
### Viem
:::code-group
```ts twoslash [example.ts]
// @noErrors
import { parseUnits } from 'viem'
import { Actions } from 'viem/tempo'
import { client } from './viem.config'
const token = '0x20c0000000000000000000000000000000000001' as const
const payments = [
{ to: '0x742d35cc6634c0532925a3b844bc9e7595f0bebb', amount: parseUnits('100', 6) },
{ to: '0x70997970c51812dc3a010c7d01b50e0d17dc79c8', amount: parseUnits('50', 6) },
] as const
const calls = payments.map(({ to, amount }) =>
Actions.token.transfer.call({ token, to, amount }), // [!code hl]
)
await client.sendTransaction({ calls }) // [!code hl]
```
```ts twoslash [viem.config.ts]
import { tempoModerato } from 'viem/chains'
import { Account, createClient } from 'viem/tempo'
const privateKey = process.env.TEMPO_PRIVATE_KEY
if (!privateKey || !/^0x[0-9a-fA-F]{64}$/.test(privateKey)) {
throw new Error('Set TEMPO_PRIVATE_KEY to your funded test account private key')
}
export const client = createClient({
account: Account.fromSecp256k1(privateKey as `0x${string}`),
chain: tempoModerato,
feeToken: '0x20c0000000000000000000000000000000000001',
})
```
:::
### Wagmi
```tsx twoslash
// @noErrors
import { useSendTransactionSync } from 'wagmi'
import { parseUnits } from 'viem'
import { Actions } from 'viem/tempo'
function BatchPayment() {
const { mutate: sendTransactionSync, isPending } = useSendTransactionSync()
const token = '0x20c0000000000000000000000000000000000001'
return (
)
}
```
### Rust
:::code-group
```rust [example.rs]
use alloy::{
primitives::{address, Address, U256},
providers::{Provider, ProviderBuilder},
sol_types::SolCall,
};
use tempo_alloy::{
TempoNetwork, contracts::precompiles::ITIP20, primitives::transaction::Call,
rpc::TempoTransactionRequest,
};
mod provider;
#[tokio::main]
async fn main() -> Result<(), Box> {
let provider = provider::get_provider().await?;
let recipient1 = address!("0x742d35Cc6634C0532925a3b844Bc9e7595f0bEbb");
let recipient2 = address!("0x70997970C51812dc3A010C7d01b50e0d17dc79C8");
let token_address: Address = address!("0x20c0000000000000000000000000000000000001");
let calls = vec![ // [!code hl]
Call { // [!code hl]
to: token_address.into(), // [!code hl]
input: ITIP20::transferCall { // [!code hl]
to: recipient1, // [!code hl]
amount: U256::from(100_000_000), // [!code hl]
} // [!code hl]
.abi_encode() // [!code hl]
.into(), // [!code hl]
value: U256::ZERO, // [!code hl]
}, // [!code hl]
Call { // [!code hl]
to: token_address.into(), // [!code hl]
input: ITIP20::transferCall { // [!code hl]
to: recipient2, // [!code hl]
amount: U256::from(50_000_000), // [!code hl]
} // [!code hl]
.abi_encode() // [!code hl]
.into(), // [!code hl]
value: U256::ZERO, // [!code hl]
}, // [!code hl]
]; // [!code hl]
let pending = provider
.send_transaction(TempoTransactionRequest {
calls,
..Default::default()
})
.await?;
let tx_hash = pending.tx_hash();
println!("Batch transaction sent: {tx_hash:?}");
Ok(())
}
```
```rust [provider.rs]
use alloy::providers::ProviderBuilder;
use alloy::signers::local::PrivateKeySigner;
use tempo_alloy::TempoNetwork;
pub async fn get_provider() -> Result<
impl alloy::providers::Provider,
Box,
> {
let signer: PrivateKeySigner = std::env::var("PRIVATE_KEY")
.expect("PRIVATE_KEY not set")
.parse()?;
let provider = ProviderBuilder::new_with_network::()
.wallet(signer)
.connect(&std::env::var("RPC_URL").expect("RPC_URL not set"))
.await?;
Ok(provider)
}
```
:::
### Python
:::code-group
```python [example.py]
from eth_abi import encode
from eth_account import Account
from pytempo import Call, TempoTransaction
from provider import w3, account
TRANSFER_SELECTOR = bytes.fromhex("a9059cbb")
ALPHA_USD = "0x20c0000000000000000000000000000000000001"
recipient1 = Account.create().address # replace with your recipients' addresses
recipient2 = Account.create().address
def build_transfer(to: str, amount: int) -> str:
data = TRANSFER_SELECTOR + encode(
["address", "uint256"], [to, amount]
)
return "0x" + data.hex()
calls = ( # [!code hl]
Call.create(to=ALPHA_USD, data=build_transfer(recipient1, 100_000_000)), # [!code hl]
Call.create(to=ALPHA_USD, data=build_transfer(recipient2, 50_000_000)), # [!code hl]
) # [!code hl]
# Estimate every call in the batch, not only the first.
gas_limit = w3.eth.estimate_gas({
"from": account.address,
"calls": [{"to": ALPHA_USD, "data": "0x" + c.data.hex(), "value": "0x0"} for c in calls],
})
tx = TempoTransaction.create(
chain_id=w3.eth.chain_id,
gas_limit=gas_limit,
max_fee_per_gas=w3.eth.gas_price * 2,
max_priority_fee_per_gas=w3.eth.gas_price,
nonce=w3.eth.get_transaction_count(account.address),
calls=calls,
)
signed_tx = tx.sign(account.key.hex())
tx_hash = w3.eth.send_raw_transaction(signed_tx.encode())
```
```python [provider.py]
from web3 import Web3
from eth_account import Account
w3 = Web3(Web3.HTTPProvider("https://rpc.moderato.tempo.xyz"))
account = Account.from_key("0x...")
```
:::
### Go
:::code-group
```go [main.go]
package main
import (
"context"
"log"
"math/big"
"github.com/ethereum/go-ethereum/common"
"github.com/tempoxyz/tempo-go/pkg/signer"
"github.com/tempoxyz/tempo-go/pkg/transaction"
)
func buildTransferData(to common.Address, amount *big.Int) []byte {
data := make([]byte, 68)
data[0], data[1], data[2], data[3] = 0xa9, 0x05, 0x9c, 0xbb
copy(data[16:36], to.Bytes())
amount.FillBytes(data[36:68])
return data
}
func main() {
sgn, _ := signer.NewSigner("0x...")
c := newClient()
ctx := context.Background()
nonce, _ := c.GetTransactionCount(ctx, sgn.Address().Hex())
recipient1 := common.HexToAddress("0x742d35Cc6634C0532925a3b844Bc9e7595f0bEbb")
recipient2 := common.HexToAddress("0x70997970C51812dc3A010C7d01b50e0d17dc79C8")
alphaUSD := common.HexToAddress("0x20c0000000000000000000000000000000000001")
tx := transaction.NewBuilder(big.NewInt(42431)).
SetNonce(nonce).
SetGas(200_000).
SetMaxFeePerGas(big.NewInt(25_000_000_000)).
SetMaxPriorityFeePerGas(big.NewInt(1_000_000_000)).
AddCall(alphaUSD, big.NewInt(0), buildTransferData(recipient1, big.NewInt(100_000_000))). // [!code hl]
AddCall(alphaUSD, big.NewInt(0), buildTransferData(recipient2, big.NewInt(50_000_000))). // [!code hl]
Build()
_ = transaction.SignTransaction(tx, sgn)
serialized, _ := transaction.Serialize(tx, nil)
txHash, _ := c.SendRawTransaction(ctx, serialized)
log.Printf("Batch transaction sent: %s", txHash)
}
```
```go [provider.go]
package main
import (
"os"
"github.com/tempoxyz/tempo-go/pkg/client"
)
func newClient() *client.Client {
return client.New(os.Getenv("TEMPO_RPC_URL"))
}
```
:::
### Cast
```bash
cast batch-send \
--tempo.fee-token 0x20c0000000000000000000000000000000000001 \
--rpc-url "$TEMPO_RPC_URL" \
--private-key "$TEMPO_PRIVATE_KEY" \
--call "0x20c0000000000000000000000000000000000001::transfer(address,uint256):0x742d35Cc6634C0532925a3b844Bc9e7595f0bEbb,100000000" \
--call "0x20c0000000000000000000000000000000000001::transfer(address,uint256):0x70997970C51812dc3A010C7d01b50e0d17dc79C8,50000000" # [!code hl]
```
### Solidity
```solidity
import {ITIP20} from "tempo-std/interfaces/ITIP20.sol";
contract BatchPaymentSender {
ITIP20 public immutable token;
address public immutable owner;
constructor(ITIP20 token_) {
token = token_;
owner = msg.sender;
}
struct Payment {
address recipient;
uint256 amount;
}
function batchPay(Payment[] calldata payments) external {
require(msg.sender == owner, "Only owner");
for (uint256 i = 0; i < payments.length; i++) {
token.transfer(payments[i].recipient, payments[i].amount); // [!code hl]
}
}
}
```
Pass every encoded call together so Tempo executes all transfers in one all-or-nothing transaction.
Check the receipt and transfer events before recording delivery. See [Confirm delivery](https://tempo.com/developers/docs/guide/payments/send-a-payment#confirm-delivery).
## Payment client setup
Configure a client for creating accounts, reading balances, and sending payments. These setups supply the shared configuration used in the payment guides. API examples use Moderato with `chainId=42431`.
### Choose your tools
The examples on this page and in the payment guides use AlphaUSD on Moderato. Choose one signing environment for each workflow: a CLI/private-key signer, a Viem client, or a wallet connected through Wagmi. Read-only examples need no private key.
* [CLI](https://tempo.com/developers/docs/guide/payments/send-a-payment/examples#cli-client): install the current Foundry release with Tempo support.
* [Viem](https://tempo.com/developers/docs/guide/payments/send-a-payment/examples#viem-client): use a local script or backend signer.
* [Wagmi](https://tempo.com/developers/docs/guide/payments/send-a-payment/examples#wagmi-client): connect Tempo Wallet in React.
* [Python](https://tempo.com/developers/docs/guide/payments/send-a-payment/examples#python-client): use the typed Python SDK.
### CLI client
Follow [Foundry installation](https://tempo.com/developers/docs/sdk/foundry#get-started-with-foundry). These examples require a current release with Tempo support, including `cast batch-send` and `cast keychain`.
```bash
export TEMPO_RPC_URL=https://rpc.moderato.tempo.xyz
export ALPHA_USD=0x20c0000000000000000000000000000000000001
export TEMPO_ACCOUNT_ADDRESS=your_test_account_address
export TEMPO_RECIPIENT=your_test_recipient_address
export TEMPO_PRIVATE_KEY=your_test_account_private_key
```
Replace the last three values with your own test inputs. `cast wallet new` creates a local key and address. Keep the private key in your signing environment. A read-only balance query only needs the RPC URL, token, and address. Set `PAYMENT_TX_HASH` to a returned transaction hash when inspecting its receipt.
`cast erc20 transfer` and token amounts in `cast send` or `cast batch-send` use base units: `1000000` is one AlphaUSD. `cast erc20 balance` also returns base units. `cast logs --subscribe` uses the Moderato WebSocket endpoint; stop it with Ctrl+C.
### Wagmi client
Install `wagmi`, `viem`, and `@tanstack/react-query`. Save the network and Tempo Wallet connector configuration:
```ts [wagmi.config.ts]
import { tempoModerato } from 'viem/chains'
import { createConfig, http } from 'wagmi'
import { tempoWallet } from 'wagmi/connectors'
export const config = createConfig({
connectors: [tempoWallet()],
chains: [tempoModerato],
multiInjectedProviderDiscovery: false,
transports: {
[tempoModerato.id]: http(),
},
})
declare module 'wagmi' {
interface Register { config: typeof config }
}
```
The type registration lets Wagmi accept Tempo transaction fields such as `calls`. Wrap your application in the providers once:
```tsx [App.tsx]
import { QueryClient, QueryClientProvider } from '@tanstack/react-query'
import { WagmiProvider } from 'wagmi'
import { config } from './wagmi.config'
import { Payments } from './Payments'
const queryClient = new QueryClient()
export function App() {
return (
)
}
```
`Payments` is your React component. Keep imports at module scope and put the short hook examples in its body. Call write handlers such as `sendPayment`, `getTestFunds`, `grantAccess`, and `revokeAccess` only from user actions. Disable buttons while pending or disconnected and display errors. The [complete browser form](https://tempo.com/developers/docs/guide/payments/send-a-payment/browser) shows validation, connection, and receipt states.
Set `alphaUsd` to `0x20c0000000000000000000000000000000000001` and `recipient` to your intended address. Read examples take `account` as an address. The configured connector uses Moderato; keep the connected account on that network.
#### Access-key restrictions
For [granting access](https://tempo.com/developers/docs/accounts/keys#grant-access), use the new P-256 `accessKey` from the [access-key example](https://tempo.com/developers/docs/accounts/access-keys#authorize-a-limited-key). The connected wallet must control the account that key acts for. The official Account Keychain ABI represents the same one-hour, 10 AlphaUSD, recipient-scoped permission as follows:
```ts
const keyRestrictions = {
expiry: BigInt(Math.floor(Date.now() / 1000) + 3600),
enforceLimits: true,
limits: [{ token: alphaUsd, amount: 10_000_000n, period: 0n }],
allowAnyCalls: false,
allowedCalls: [{ target: alphaUsd, selectorRules: [{
selector: '0xa9059cbb', recipients: [recipient],
}] }],
} as const
```
The raw ABI names the token allowance `amount`; Viem’s helper names it `limit`. In the [Wagmi authorization call](https://tempo.com/developers/docs/accounts/keys#grant-access), `1` identifies the P-256 signature type in `authorizeKey`. Use the actual type of your generated key; secp256k1 is `0`. A connected wallet submits this root-authorized contract call; it does not expose its private key to the application.
### API requests
Get a [Tempo API key](https://tempo.com/developers/docs/api/authentication). Set `TEMPO_API_KEY` and `TEMPO_ACCOUNT_ADDRESS` in your environment. `PAYMENT_TX_HASH` is needed only when reading a specific payment. Keep API keys on your backend.
:::code-group
```ts [TypeScript (fetch)]
const apiHeaders = { 'tempo-api-key': process.env.TEMPO_API_KEY! }
const accountAddress = process.env.TEMPO_ACCOUNT_ADDRESS!
const transactionHash = process.env.PAYMENT_TX_HASH!
if (!apiHeaders['tempo-api-key'] || !accountAddress)
throw new Error('Set TEMPO_API_KEY and TEMPO_ACCOUNT_ADDRESS')
```
```python [Python]
import os
import requests
api_headers = {"tempo-api-key": os.environ["TEMPO_API_KEY"]}
account_address = os.environ["TEMPO_ACCOUNT_ADDRESS"]
transaction_hash = os.environ.get("PAYMENT_TX_HASH")
```
```bash [cURL (API)]
export TEMPO_API_KEY=your_api_key
export TEMPO_ACCOUNT_ADDRESS=your_account_address
export PAYMENT_TX_HASH=your_transaction_hash
```
:::
Install `requests` with `python -m pip install requests`. Run TypeScript examples in an ESM file such as `example.mts` with `pnpm exec tsx example.mts` after installing `viem` and `tsx`. Replace the shell values with your real inputs. Public reads can support anonymous access; an API key identifies your project's requests and usage.
### Viem client
Install `viem` and `tsx`. Set `TEMPO_PRIVATE_KEY` to your test account key and `TEMPO_RECIPIENT` to an address you control. Fund the signer with the [faucet](https://tempo.com/developers/docs/quickstart/faucet). Save this as `viem.config.ts`:
```ts [viem.config.ts]
import { tempoModerato } from 'viem/chains'
import { Account, createClient } from 'viem/tempo'
const privateKey = process.env.TEMPO_PRIVATE_KEY
if (!privateKey || !/^0x[0-9a-fA-F]{64}$/.test(privateKey)) {
throw new Error('Set TEMPO_PRIVATE_KEY to your funded test account private key')
}
export const client = createClient({
account: Account.fromSecp256k1(privateKey as `0x${string}`),
chain: tempoModerato,
feeToken: '0x20c0000000000000000000000000000000000001',
})
```
Use these imports and inputs before the short payment examples:
```ts [payment.mts]
import { getAddress, toHex } from 'viem'
import { Actions } from 'viem/tempo'
import { client } from './viem.config'
const alphaUsd = '0x20c0000000000000000000000000000000000001'
const recipientInput = process.env.TEMPO_RECIPIENT
if (!recipientInput) throw new Error('Set TEMPO_RECIPIENT')
const recipient = getAddress(recipientInput)
```
Amounts use six decimal places: `1_000_000n` is one AlphaUSD. The client signs with the test account and pays fees in AlphaUSD. A browser uses a wallet client instead of a backend private key.
### Python client
Install the typed SDK with `python -m pip install pytempo==0.7.0 requests`. Set `TEMPO_PRIVATE_KEY`, `TEMPO_RECIPIENT`, and `TEMPO_GAS_LIMIT` before running a payment. The gas limit is your cap for the calls you submit; estimate for your actual transaction instead of assuming every payment has the same cost.
Save this as `payment_setup.py`. It exposes `w3`, `account`, `private_key`, `recipient`, `alpha_usd`, and `transaction_options()` for the examples. The function refreshes the nonce and fee fields each time you build a transaction.
```python [payment_setup.py]
import os
from web3 import Web3
from pytempo import TempoTransaction
from pytempo.contracts import TIP20
w3 = Web3(Web3.HTTPProvider("https://rpc.moderato.tempo.xyz"))
private_key = os.environ["TEMPO_PRIVATE_KEY"]
account = w3.eth.account.from_key(private_key)
recipient = Web3.to_checksum_address(os.environ["TEMPO_RECIPIENT"])
alpha_usd = "0x20c0000000000000000000000000000000000001"
def transaction_options():
chain_id = w3.eth.chain_id
if chain_id != 42431:
raise ValueError("Expected Moderato testnet")
gas_price = w3.eth.gas_price
return {
"chain_id": chain_id,
"nonce": w3.eth.get_transaction_count(account.address),
"gas_limit": int(os.environ["TEMPO_GAS_LIMIT"]),
"max_fee_per_gas": gas_price * 2,
"max_priority_fee_per_gas": gas_price,
"fee_token": alpha_usd,
}
```
Import the setup before a Python payment example:
```python
from payment_setup import (
w3, account, private_key, recipient, alpha_usd, transaction_options,
)
from pytempo import TempoTransaction
from pytempo.contracts import TIP20
```
`TIP20.transfer` returns a typed call. `TempoTransaction.create` adds transaction fields; `.sign` signs it; `w3.eth.send_raw_transaction` submits the encoded result. To submit the same signed bytes through cURL instead, print `"0x" + signed_tx.encode().hex()` and set `SIGNED_TRANSACTION` to that value. Do not submit both paths unless you intend to rebroadcast the same transaction.
### First payment script
For a complete TypeScript quickstart, save the following as `first-payment.mts` and run `pnpm exec tsx first-payment.mts`. It creates fresh test accounts, requests test funds, transfers one AlphaUSD, and verifies delivery. It needs no API key.
```ts [first-payment.mts]
import { parseEventLogs, parseUnits } from 'viem'
import { generatePrivateKey } from 'viem/accounts'
import { tempoModerato } from 'viem/chains'
import { Abis, Account, createClient } from 'viem/tempo'
const account = Account.fromSecp256k1(generatePrivateKey())
const recipient = Account.fromSecp256k1(generatePrivateKey())
const token = '0x20c0000000000000000000000000000000000001'
const client = createClient({
account,
chain: tempoModerato,
feeToken: token,
})
console.log('Sender:', account.address)
console.log('Recipient:', recipient.address)
await client.faucet.fundSync({ account })
const balance = await client.token.getBalance({ token })
console.log('AlphaUSD balance:', balance.formatted)
const amount = parseUnits('1', 6)
const { receipt } = await client.token.transferSync({
token,
to: recipient.address,
amount,
})
if (receipt.status !== 'success') throw new Error('Transaction failed')
const transfers = parseEventLogs({
abi: Abis.tip20,
eventName: 'Transfer',
logs: receipt.logs.filter((log) => log.address.toLowerCase() === token),
strict: true,
})
const delivered = transfers.some(
(transfer) =>
transfer.args.from.toLowerCase() === account.address.toLowerCase() &&
transfer.args.to.toLowerCase() === recipient.address.toLowerCase() &&
transfer.args.amount === amount,
)
if (!delivered) throw new Error('Expected payment was not delivered')
console.log(`Receipt: https://explore.testnet.tempo.xyz/tx/${receipt.transactionHash}`)
```
### Browser wallet setup
Install `accounts@alpha` and `viem`. Save this as `connection.ts`; call `connectAccount` from a user action such as a Connect button. `walletClient` signs with the access key the user approves at sign-in.
```ts [connection.ts]
import { Accounts } from 'accounts'
import { viem } from 'accounts/plugins'
import { tempoModerato } from 'viem/chains'
import { createClient } from 'viem/tempo'
export const accounts = Accounts.create({
// Each sign-in requests an access key that sends up to 100 AlphaUSD for a day.
accessKey: () => ({
expiry: '1d',
limits: [{ limit: '100', token: 'alphaUSD' }],
}),
chain: 'testnet',
plugins: [viem()],
})
export const walletClient = accounts.viem
export const publicClient = createClient({
chain: tempoModerato,
})
export async function connectAccount() {
const session = await accounts.dialog.signIn()
const address = session.accessKey?.account
if (!address) throw new Error('No account was selected')
return address
}
```
For a complete React payment form with loading and error states, follow [Browser payments](https://tempo.com/developers/docs/guide/payments/send-a-payment/browser).
### Passkey creation
Call this function from a user action on localhost or an HTTPS origin. Persist the credential ID and public key in the customer's record so the same passkey can reconnect later.
```ts [create-passkey.ts]
import { Account, WebAuthnP256 } from 'viem/tempo'
export async function createPasskeyAccount() {
const credential = await WebAuthnP256.createCredential({
label: 'My Tempo account',
userId: crypto.getRandomValues(new Uint8Array(32)),
})
const account = Account.fromWebAuthnP256(credential)
return {
account,
credential: {
id: credential.id,
publicKey: credential.publicKey,
},
}
}
```
### Onchain balances and history
Read balances and index account activity directly from the chain. Set `TEMPO_ACCOUNT_ADDRESS` and `TEMPO_FROM_BLOCK` before running `balance.mts`.
```ts [balance.mts]
import { getAddress } from 'viem'
import { tempoModerato } from 'viem/chains'
import { Abis, createClient } from 'viem/tempo'
const accountAddress = process.env.TEMPO_ACCOUNT_ADDRESS
if (!accountAddress) throw new Error('Set TEMPO_ACCOUNT_ADDRESS')
const account = getAddress(accountAddress)
const token = '0x20c0000000000000000000000000000000000001'
const client = createClient({ chain: tempoModerato })
const [balance, { symbol }] = await Promise.all([
client.token.getBalance({ account, token }),
client.token.getMetadata({ token }),
])
console.log(`${balance.formatted} ${symbol}`)
const fromBlock = process.env.TEMPO_FROM_BLOCK
if (!fromBlock) throw new Error('Set TEMPO_FROM_BLOCK')
const payments = await client.getContractEvents({
address: token,
abi: Abis.tip20,
eventName: 'Transfer',
args: { to: account },
fromBlock: BigInt(fromBlock),
toBlock: 'latest',
})
console.log(payments.map((payment) => ({
from: payment.args.from,
amount: payment.args.amount,
transactionHash: payment.transactionHash,
logIndex: payment.logIndex,
})))
const unwatch = client.token.watchTransfer({
token,
args: { to: account },
onTransfer: async (transfer, log) => {
const balance = await client.token.getBalance({ account, token })
console.log({
balance: balance.formatted,
received: transfer.amount,
transactionHash: log.transactionHash,
logIndex: log.logIndex,
})
},
})
// Call unwatch() when the application no longer needs the subscription.
```
Call `unwatch()` when the subscription is no longer needed. For indexed reads from any language, use the [interactive API tools](https://tempo.com/developers/docs/guide/payments/accept-a-payment#read-balances).
> Source: [/docs/guide/payments/accept-a-payment](https://tempo.com/developers/docs/guide/payments/accept-a-payment.md)
> Section: [Tempo EVM](https://tempo.com/developers/docs/development.md). Build on Tempo EVM: wallets and keys, payments, transactions and fees, TIP-20 Tokens, contracts, exchange, network details, nodes, protocol specifications, and changelog.
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
# Receive payments
Receive stablecoins at a Tempo account, confirm the token and amount delivered, and match the transfer to your payment records. Use [payment references](https://tempo.com/developers/docs/guide/payments/transfer-memos) for invoices or [customer deposit addresses](https://tempo.com/developers/docs/guide/payments/virtual-addresses) to identify who paid.
## Get a deposit address
Share an account address you control with the sender. For customer-specific addresses that credit a shared account, use [customer deposit addresses](https://tempo.com/developers/docs/guide/payments/virtual-addresses); your application maintains the customer ledger. For deposits from other networks, use [Routes](https://tempo.com/developers/docs/routes/deposits).
Show the network and token alongside the receiving address, then read incoming transfer events to confirm delivery. To accept only specific tokens or senders, [configure an address-level receive policy](https://tempo.com/developers/docs/accounts/policies/receive-policies) before sharing the address.
This demo funds a test account and displays its token balances. The examples below use AlphaUSD on Moderato testnet. Configure your client or `RPC_URL` / `TEMPO_RPC_URL` for `https://rpc.moderato.tempo.xyz`; use an account you control as the recipient.
**Interactive demo: Receive a Payment**
1. Connect
2. Add funds
Source: [tempoxyz/examples/tree/main/examples/payments](https://github.com/tempoxyz/examples/tree/main/examples/payments)
## Detect payments
Use the account balance to display available funds. To verify a payment, match the network, token contract, recipient, and amount in its confirmed transfer events to your payment record.
The event examples below read activity for a token contract. Filter by recipient and use the transaction hash and log index to process each payment once. For virtual addresses, follow the [deposit attribution flow](https://tempo.com/developers/docs/guide/payments/virtual-addresses#what-to-verify-in-virtual-address-deposits).
For payments held by a receive policy, see [Handle blocked receipts](https://tempo.com/developers/docs/accounts/policies/receive-policies#blocked-receipts).
For balance snapshots and display formatting, see [Read balances](https://tempo.com/developers/docs/guide/payments/accept-a-payment#read-balances). Credit customers from transfer events, not balance changes.
Enter the receiving account as both `address` and `recipient`; the example uses the same sample address for both. Set `chainId` to `42431` and `type` to `transfer` to read incoming payments on Moderato:
`GET /v1/addresses/{address}/activities`
List address activities
[API reference](https://tempo.com/developers/docs/api/activities#getaddressactivities) — request parameters, authentication, and response schema. The examples below use editable sample values.
**cURL**
```bash
curl 'https://api.tempo.xyz/v1/addresses/0xbe058e1c4df8a4366a387bf595b284246a93039e/activities?chainId=42431&recipient=0xbe058e1c4df8a4366a387bf595b284246a93039e&type=transfer'
```
**TypeScript**
```ts
fetch('https://api.tempo.xyz/v1/addresses/0xbe058e1c4df8a4366a387bf595b284246a93039e/activities?chainId=42431&recipient=0xbe058e1c4df8a4366a387bf595b284246a93039e&type=transfer')
```
For direct transfer subscriptions, use the [CLI, Viem, or Wagmi setup](https://tempo.com/developers/docs/guide/payments/send-a-payment/examples#choose-your-tools). Set `account` to the recipient and `token` to AlphaUSD. Wagmi hooks run inside a React component and clean up on unmount:
:::code-group
```ts [Viem]
const unwatch = client.token.watchTransfer({
token, args: { to: account },
onTransfer: (transfer, log) => console.log(transfer, log.transactionHash),
})
// Call unwatch() when the view closes.
```
```bash [CLI]
cast logs 'Transfer(address indexed from,address indexed to,uint256 value)' \
'' "$TEMPO_ACCOUNT_ADDRESS" --address "$ALPHA_USD" \
--subscribe --rpc-url wss://rpc.moderato.tempo.xyz
```
```tsx [Wagmi]
import { Hooks } from 'wagmi/tempo'
Hooks.token.useWatchTransfer({
token, args: { to: account },
onTransfer: (transfer, log) => console.log(transfer, log.transactionHash),
})
```
:::
Use [webhooks](https://tempo.com/developers/docs/api/webhooks) for backend callbacks. Read historical activity after reconnecting and follow pagination to recover missed events. The [complete event examples](https://tempo.com/developers/docs/guide/payments/accept-a-payment/examples#listen-for-tip-20-transfer-events) cover direct RPC log queries.
## Read balances
Read indexed token balances with the Tempo API. Enter the account address, choose Moderato (`chainId=42431`), and click **Try**. It needs no wallet connection or signing key.
`GET /v1/addresses/{address}/balances`
List address balances
[API reference](https://tempo.com/developers/docs/api/balances#getaddressbalances) — request parameters, authentication, and response schema. The examples below use editable sample values.
**cURL**
```bash
curl 'https://api.tempo.xyz/v1/addresses/0xbe058e1c4df8a4366a387bf595b284246a93039e/balances?chainId=42431'
```
**TypeScript**
```ts
fetch('https://api.tempo.xyz/v1/addresses/0xbe058e1c4df8a4366a387bf595b284246a93039e/balances?chainId=42431')
```
For a direct read, use the [client setup](https://tempo.com/developers/docs/guide/payments/send-a-payment/examples#choose-your-tools):
:::code-group
```ts [Viem]
const token = '0x20c0000000000000000000000000000000000001'
const balance = await client.token.getBalance({ account, token })
console.log(balance.formatted)
```
```bash [CLI]
cast erc20 balance "$ALPHA_USD" "$TEMPO_ACCOUNT_ADDRESS" --rpc-url "$TEMPO_RPC_URL"
```
```tsx [Wagmi]
import { Hooks } from 'wagmi/tempo'
const token = '0x20c0000000000000000000000000000000000001'
const { data: balance, isPending, error } = Hooks.token.useGetBalance({ account, token })
```
```python [Python]
from web3 import Web3
from pytempo.contracts import TIP20
w3 = Web3(Web3.HTTPProvider("https://rpc.moderato.tempo.xyz"))
token = Web3.to_checksum_address("0x20c0000000000000000000000000000000000001")
balance = TIP20(token).balance_of(w3, account=account_address)
print(balance)
```
:::
`balance.amount` contains integer base units; `balance.formatted` is the decimal string for display. Python and Cast return integer base units. Identify each token by its network and contract address.
For indexed history, use [account activity](https://tempo.com/developers/docs/api/activities) and [transfers](https://tempo.com/developers/docs/api/transfers); one transaction can produce several transfers. Follow the [API pagination](https://tempo.com/developers/docs/api/pagination) fields for older activity, or query chain logs with the [onchain example](https://tempo.com/developers/docs/guide/payments/send-a-payment/examples#onchain-balances-and-history).
Use TIP-20 balances for spendable stablecoins. Tempo's `eth_getBalance` response is a [compatibility value](https://tempo.com/developers/docs/quickstart/evm-compatibility#handling-eth-native-token-balance-checks), not a spendable stablecoin balance. Show [Earn positions](https://tempo.com/developers/docs/earn) and [Zone balances](https://tempo.com/developers/docs/zones) separately.
## Match payments to customers
Use the memo to find an invoice, or a [customer deposit address](https://tempo.com/developers/docs/guide/payments/virtual-addresses) to identify who paid. Enter the candidate transaction hash and its network below to inspect the token movements.
`GET /v1/transactions/{transactionHash}/activities`
List transaction activities
[API reference](https://tempo.com/developers/docs/api/activities#gettransactionactivities) — request parameters, authentication, and response schema. The examples below use editable sample values.
**cURL**
```bash
curl 'https://api.tempo.xyz/v1/transactions/0x4845ae2098724ab26a5d89370dce5124d044be6a5acc164afc348662de67d474/activities?chainId=42431'
```
**TypeScript**
```ts
fetch('https://api.tempo.xyz/v1/transactions/0x4845ae2098724ab26a5d89370dce5124d044be6a5acc164afc348662de67d474/activities?chainId=42431')
```
:::steps
### Find the invoice
Match the transfer's memo using the [same reference encoding](https://tempo.com/developers/docs/guide/payments/transfer-memos#encode-a-payment-reference) your application requested.
### Verify delivery
Check the network, token, recipient, and amount against the invoice. Confirm the successful transaction and the delivered `Transfer` event. For a blocked receipt, funds go to the receive-policy guard rather than the intended recipient.
### Record the payment once
Store the network, transaction hash, and transfer log index as a unique event key. Save that event and mark the invoice paid in one database transaction. Never fulfill an invoice from an API response or a matching memo.
:::
Use the [complete TypeScript verifier](https://tempo.com/developers/docs/guide/payments/accept-a-payment/examples#verify-an-invoice) for receipt checks, memo matching, and a stable event key.
For contract-based collections, read [Receive payments in a contract](https://tempo.com/developers/docs/guide/payments/accept-a-payment/examples#receive-payments-in-a-contract). If you need to hold a different stablecoin, [swap the received funds](https://tempo.com/developers/docs/guide/stablecoin-dex/executing-swaps) after verifying delivery.
> Source: [/docs/guide/payments/virtual-addresses](https://tempo.com/developers/docs/guide/payments/virtual-addresses.md)
> Section: [Tempo EVM](https://tempo.com/developers/docs/development.md). Build on Tempo EVM: wallets and keys, payments, transactions and fees, TIP-20 Tokens, contracts, exchange, network details, nodes, protocol specifications, and changelog.
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
# Customer deposit addresses
Give each customer a distinct deposit address while receiving TIP-20 payments in one registered account. These virtual addresses preserve customer attribution in transfer events; they do not hold separate customer balances.
Virtual addresses receive payments on Tempo. To accept deposits from another network, use [Routes deposit addresses](https://tempo.com/developers/docs/routes/deposits).
The demo may use pre-release infrastructure in preview environments.
## How virtual address deposits work
```mermaid
sequenceDiagram
participant Sender
participant TIP20 as TIP-20
participant Registry as Virtual registry
participant Master as Registered wallet
Sender->>TIP20: transfer(virtualAddress, amount)
TIP20->>Registry: resolve(masterId)
Registry-->>TIP20: master wallet
TIP20->>Master: credit balance
Note over TIP20: emits Transfer(sender → virtual, amount)
Note over TIP20: emits Transfer(virtual → master, amount)
```
The important behavior is:
* the sender pays the **virtual address**
* TIP-20 resolves that address to the registered **master wallet**
* the **master wallet** receives the balance
* the virtual address still appears in events, so you can attribute the deposit correctly
## Virtual address live demo
The fast demo uses a docs-managed master wallet. Choose **Real registration** to complete the full flow with your own passkey:
1. sign in with a passkey and get a Tempo address
2. register a master id for that address
3. send `OUSD` from a second address to a virtual address derived from that master id
4. confirm that the balance lands in the registered wallet
The Moderato demos use OUSD. Localnet and devnet demos use pathUSD.
### Fast demo
Use a docs-managed master with a pre-mined valid salt so you can skip the wait and jump straight to the forwarding flow.
**Interactive demo: Virtual addresses**
1. Virtual addresses fast demo
### Real registration
Use `VirtualMaster.mineSaltAsync` to register a master id for the passkey account you create in the demo.
:::info
Mining a virtual-address salt can take 30+ seconds depending on your browser, hardware, and available worker parallelism.
:::
**Interactive demo: Virtual addresses**
1. Virtual addresses live demo
## What to verify in virtual address deposits
When the demo succeeds, you should see all of the following:
* the selected wallet is shown as the registered master wallet
* the virtual address is distinct from the master wallet
* the sender transfers the selected test token to the virtual address
* the master wallet balance increases
* the virtual address TIP-20 balance remains `0`
* the receipt shows the expected two-hop `Transfer` events
## Derive deposit addresses offchain
Once a master is registered, operators derive virtual addresses offchain from the `masterId` and their own customer tag.
:::code-group
```ts [virtualAddress.ts]
import { VirtualAddress } from 'viem/tempo'
const masterId = process.env.TEMPO_MASTER_ID
if (!masterId || !/^0x[0-9a-fA-F]{8}$/.test(masterId)) {
throw new Error('Set TEMPO_MASTER_ID to your registered 4-byte master ID')
}
const virtualAddress = VirtualAddress.from({
masterId: masterId as `0x${string}`,
userTag: '0x000000000001',
})
```
:::
In practice, the `userTag` is the operator's internal routing value for a customer, account, or payment reference.
## Operational notes
A few things matter in production:
* virtual forwarding applies only to **TIP-20** transfer and mint paths
* `balanceOf(virtualAddress)` stays `0`; use events and your own `userTag` mapping for attribution
* policy checks apply to the **resolved master wallet**, not the literal virtual address
* avoid using virtual addresses in reward protocols (lending pools, DEX rewards, etc) unless explicitly supported, because virtual addresses hold no balance, so protocols that read `balanceOf` see zero
## Learn more about TIP-20 virtual addresses
[Virtual addresses overview](https://tempo.com/developers/docs/protocol/tip20/virtual-addresses): Start with the conceptual model for routing, attribution, and treasury operations.
[Virtual address specification](https://tempo.com/developers/docs/protocol/tips/tip-1022): Read the full protocol definition, including derivation rules, transfer paths, and invariants.
[T3 network upgrade](https://tempo.com/developers/docs/protocol/upgrades/t3): See when virtual addresses activate and what else ships with T3.
> Source: [/docs/guide/payments/transfer-memos](https://tempo.com/developers/docs/guide/payments/transfer-memos.md)
> Section: [Tempo EVM](https://tempo.com/developers/docs/development.md). Build on Tempo EVM: wallets and keys, payments, transactions and fees, TIP-20 Tokens, contracts, exchange, network details, nodes, protocol specifications, and changelog.
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
# Payment references
Attach a 32-byte transfer memo to a [TIP-20 payment](https://tempo.com/developers/get-started/stablecoins) to identify an invoice, order, or customer record. Store the reference with your payment record, then match it to confirmed transfer events.
## Encode a payment reference
Use a short, opaque ID such as `INV-12345`. Memos are public transaction data; keep customer details in your application.
Use the same encoding when sending a reference and searching for it. This helper encodes a UTF-8 string and pads it on the right with zero bytes to fit the `bytes32` field:
```ts [payment-reference.ts]
import { toHex } from 'viem'
export function encodePaymentReference(reference: string) {
if (new TextEncoder().encode(reference).length > 32) {
throw new Error('Payment references must fit in 32 UTF-8 bytes')
}
return toHex(reference, { size: 32 })
}
```
The limit is **32 bytes**, not 32 characters. `toHex` throws if the input exceeds the requested size; it does not truncate it. For a longer reference, keep the full value in your database and put a short lookup ID in the memo.
## Send a payment with a reference
Connect a test account and send a payment with a reference on Moderato testnet.
**Interactive demo: Transfer with Memo**
1. Connect
2. Add funds
3. Send payment with memo
Source: [tempoxyz/examples/tree/main/examples/payments](https://github.com/tempoxyz/examples/tree/main/examples/payments)
Use the funded Moderato test account from [Send a payment](https://tempo.com/developers/docs/guide/payments/send-a-payment#send-from-your-backend). Set `TEMPO_RECIPIENT` to an account you control and save the helper above as `payment-reference.ts`.
:::code-group
```ts [send-payment.ts]
import { getAddress, parseUnits } from 'viem'
import { encodePaymentReference } from './payment-reference'
import { client } from './viem.config'
const recipient = process.env.TEMPO_RECIPIENT
if (!recipient) throw new Error('Set TEMPO_RECIPIENT')
const { receipt } = await client.token.transferSync({
token: '0x20c0000000000000000000000000000000000001',
to: getAddress(recipient),
amount: parseUnits('10', 6),
memo: encodePaymentReference('INV-12345'),
})
console.log(receipt.transactionHash)
```
```ts [viem.config.ts]
import { tempoModerato } from 'viem/chains'
import { Account, createClient } from 'viem/tempo'
const privateKey = process.env.TEMPO_PRIVATE_KEY
if (!privateKey || !/^0x[0-9a-fA-F]{64}$/.test(privateKey)) {
throw new Error('Set TEMPO_PRIVATE_KEY to your funded test account private key')
}
export const client = createClient({
account: Account.fromSecp256k1(privateKey as `0x${string}`),
chain: tempoModerato,
feeToken: '0x20c0000000000000000000000000000000000001',
})
```
:::
Passing `memo` makes the SDK call `transferWithMemo`. For a browser integration, pass the same value to `Hooks.token.useTransferSync` in your [payment action](https://tempo.com/developers/docs/guide/payments/send-a-payment#add-a-payment-action-in-the-browser).
## Find payments by reference
The `TransferWithMemo` event indexes `memo`, so you can query the token contract for a specific reference. Set `TEMPO_RECIPIENT` to your receiving account and `TEMPO_FROM_BLOCK` to the first block in the range you want to inspect.
```ts [find-payment.ts]
import { getAddress } from 'viem'
import { tempoModerato } from 'viem/chains'
import { Abis, createClient } from 'viem/tempo'
import { encodePaymentReference } from './payment-reference'
const recipient = process.env.TEMPO_RECIPIENT
const fromBlock = process.env.TEMPO_FROM_BLOCK
if (!recipient || !fromBlock) {
throw new Error('Set TEMPO_RECIPIENT and TEMPO_FROM_BLOCK')
}
const client = createClient({ chain: tempoModerato })
const logs = await client.getContractEvents({
address: '0x20c0000000000000000000000000000000000001',
abi: Abis.tip20,
eventName: 'TransferWithMemo',
args: {
to: getAddress(recipient),
memo: encodePaymentReference('INV-12345'),
},
fromBlock: BigInt(fromBlock),
toBlock: 'latest',
})
console.log(logs)
```
A memo match identifies a candidate payment. [Verify the token, recipient, amount, and receipt](https://tempo.com/developers/docs/guide/payments/accept-a-payment#reconcile-payments-with-memos) before crediting it. Store the transaction hash and log index so replaying events cannot credit the same transfer twice.
Keep the reference, expected payment, verified transfer, and any exception in your application ledger. Define how you handle missing references, partial payments, duplicate references, and unsupported tokens.
## Choose a reference for your workflow
For customer deposits, assign a short customer ID and ask the sender to include it. If the sender cannot supply a memo, use [customer deposit addresses](https://tempo.com/developers/docs/guide/payments/virtual-addresses) instead.
### Payroll batch payments
Encode a distinct payment reference for each call in a [batch payment](https://tempo.com/developers/docs/guide/payments/send-a-payment#batch-payment-transactions). Store that reference with the corresponding payroll record so you can reconcile each transfer, even though the batch shares one transaction hash.
### Link refunds to the original payment
Use an original payment ID or a separate refund ID as the memo. Keep the refund destination in the payment record and verify it before submitting the refund. An Ethereum-style address written as text takes 42 bytes and cannot fit in this 32-byte field.
## Transfer memo learning resources
[Send a payment](https://tempo.com/developers/docs/guide/payments/send-a-payment): Transfer stablecoins from a backend or browser application.
[Receive a payment](https://tempo.com/developers/docs/guide/payments/accept-a-payment): Verify incoming transfers and reconcile payment records.
[TIP-20 Specification](https://tempo.com/developers/docs/protocol/tip20/spec): Read the contract methods and event definitions.
> Source: [/docs/guide/payments/accept-a-payment/examples](https://tempo.com/developers/docs/guide/payments/accept-a-payment/examples.md)
> Section: [Tempo EVM](https://tempo.com/developers/docs/development.md). Build on Tempo EVM: wallets and keys, payments, transactions and fees, TIP-20 Tokens, contracts, exchange, network details, nodes, protocol specifications, and changelog.
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
# Payment verification examples
Read incoming transfers and verify delivery before crediting a customer. These full examples use AlphaUSD on Moderato testnet. Use [Receive payments](https://tempo.com/developers/docs/guide/payments/accept-a-payment) for the integration flow and short API examples.
Set `RPC_URL` or `TEMPO_RPC_URL` to `https://rpc.moderato.tempo.xyz`. Use the [SDK setup](https://tempo.com/developers/docs/sdk) for your language. The Rust watcher also requires `cargo add futures`.
## Listen for TIP-20 transfer events
Set `TEMPO_RECIPIENT` to your receiving account. Viem and Cast watch incoming transfers to that address; Go queries its transfers in the latest 100 blocks. The Rust and Python watchers show all transfers for the token. Cast subscribes over WebSocket; stop it with Ctrl+C.
### Viem
:::code-group
```ts [example.ts]
import { getAddress } from 'viem'
import { client } from './viem.config'
const recipient = process.env.TEMPO_RECIPIENT
if (!recipient) throw new Error('Set TEMPO_RECIPIENT')
const unwatch = client.token.watchTransfer({
token: '0x20c0000000000000000000000000000000000001',
args: { to: getAddress(recipient) },
onTransfer: (transfer, log) => {
console.log('Incoming transfer:', {
from: transfer.from,
amount: transfer.amount,
transactionHash: log.transactionHash,
logIndex: log.logIndex,
})
},
})
```
```ts [viem.config.ts]
import { tempoModerato } from 'viem/chains'
import { createClient } from 'viem/tempo'
export const client = createClient({ chain: tempoModerato })
```
:::
### Rust
:::code-group
```rust [example.rs]
use alloy::{primitives::address, providers::ProviderBuilder};
use futures::StreamExt;
use tempo_alloy::{TempoNetwork, contracts::precompiles::ITIP20};
#[tokio::main]
async fn main() -> Result<(), Box> {
let provider = ProviderBuilder::new_with_network::()
.connect(&std::env::var("RPC_URL").expect("No RPC URL set"))
.await?;
// Watch for incoming transfers // [!code focus]
let mut transfers = ITIP20::new( // [!code focus]
address!("0x20c0000000000000000000000000000000000001"), // [!code focus]
&provider, // [!code focus]
) // [!code focus]
.Transfer_filter() // [!code focus]
.watch() // [!code focus]
.await? // [!code focus]
.into_stream(); // [!code focus]
while let Some(Ok((payment, _))) = transfers.next().await { // [!code focus]
println!("Received payment: {payment:?}") // [!code focus]
} // [!code focus]
Ok(())
}
```
```rust [provider.rs]
use alloy::providers::ProviderBuilder;
use tempo_alloy::TempoNetwork;
pub async fn get_provider() -> Result<
impl alloy::providers::Provider,
Box,
> {
let provider = ProviderBuilder::new_with_network::()
.connect(&std::env::var("RPC_URL").expect("RPC_URL not set"))
.await?;
Ok(provider)
}
```
:::
### Python
:::code-group
```python [example.py]
import json
from web3 import Web3
from provider import w3
token_address = "0x20c0000000000000000000000000000000000001" # AlphaUSD
transfer_event_abi = { # [!code focus]
"anonymous": False, # [!code focus]
"name": "Transfer", # [!code focus]
"type": "event", # [!code focus]
"inputs": [ # [!code focus]
{"indexed": True, "name": "from", "type": "address"}, # [!code focus]
{"indexed": True, "name": "to", "type": "address"}, # [!code focus]
{"indexed": False, "name": "value", "type": "uint256"}, # [!code focus]
], # [!code focus]
} # [!code focus]
contract = w3.eth.contract( # [!code focus]
address=Web3.to_checksum_address(token_address), # [!code focus]
abi=[transfer_event_abi], # [!code focus]
) # [!code focus]
# Get historical Transfer events # [!code focus]
events = contract.events.Transfer().get_logs(from_block="latest") # [!code focus]
for event in events: # [!code focus]
print(f"Transfer: {event.args['from']} -> {event.args['to']}: {event.args['value']}") # [!code focus]
```
```python [provider.py]
from web3 import Web3
w3 = Web3(Web3.HTTPProvider("https://rpc.moderato.tempo.xyz"))
assert w3.eth.chain_id == 42431, "Expected Moderato testnet"
```
:::
### Go
:::code-group
```go [main.go]
package main
import (
"context"
"fmt"
"log"
"os"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/crypto"
)
func main() {
c := newClient()
ctx := context.Background()
token := "0x20c0000000000000000000000000000000000001"
recipient := os.Getenv("TEMPO_RECIPIENT")
if !common.IsHexAddress(recipient) { log.Fatal("Set TEMPO_RECIPIENT") }
latest, err := c.GetBlockNumber(ctx)
if err != nil { log.Fatal(err) }
var fromBlock uint64
if latest > 99 { fromBlock = latest - 99 }
recipientTopic := common.BytesToHash(common.HexToAddress(recipient).Bytes())
// Transfer(address,address,uint256) event topic // [!code focus]
transferTopic := crypto.Keccak256Hash([]byte("Transfer(address,address,uint256)")) // [!code focus]
resp, err := c.SendRequest(ctx, "eth_getLogs", map[string]interface{}{ // [!code focus]
"fromBlock": fmt.Sprintf("0x%x", fromBlock), // [!code focus]
"toBlock": fmt.Sprintf("0x%x", latest), // [!code focus]
"address": token, // [!code focus]
"topics": []interface{}{transferTopic.Hex(), nil, recipientTopic.Hex()}, // [!code focus]
}) // [!code focus]
if err != nil {
log.Fatal(err)
}
if err := resp.CheckError(); err != nil { log.Fatal(err) }
logs, _ := resp.Result.([]interface{}) // [!code focus]
for _, entry := range logs { // [!code focus]
l := entry.(map[string]interface{}) // [!code focus]
topics := l["topics"].([]interface{}) // [!code focus]
fmt.Printf("Transfer: %s -> %s (data: %s)\n", topics[1], topics[2], l["data"]) // [!code focus]
} // [!code focus]
}
```
```go [provider.go]
package main
import (
"os"
"github.com/tempoxyz/tempo-go/pkg/client"
)
func newClient() *client.Client {
return client.New(os.Getenv("TEMPO_RPC_URL"))
}
```
:::
### Cast
```bash
cast logs 'Transfer(address indexed from,address indexed to,uint256 amount)' \
'' "$TEMPO_RECIPIENT" \
--address 0x20c0000000000000000000000000000000000001 \
--subscribe --rpc-url wss://rpc.moderato.tempo.xyz
```
## Verify an invoice
Use a [memo](https://tempo.com/developers/docs/guide/payments/transfer-memos) to find an invoice, or a [customer deposit address](https://tempo.com/developers/docs/guide/payments/virtual-addresses) to identify a customer. The example below verifies a memo payment before marking the invoice paid.
:::steps
### Find the invoice
Read the memo from `TransferWithMemo` and look up the corresponding invoice. Use the [same memo encoding](https://tempo.com/developers/docs/guide/payments/transfer-memos#encode-a-payment-reference) when sending and matching payments.
### Verify delivery
Check the network, token, recipient, and amount against the invoice using the confirmed `Transfer` event. For [blocked receipts](https://tempo.com/developers/docs/accounts/policies/receive-policies#blocked-receipts), the recipient is the receive-policy guard.
### Record the payment once
Store the network, transaction hash, and transfer log index as a unique event key. Save it and mark the invoice paid in the same database transaction. Replayed events or another payment with the same memo must not fulfill a paid invoice again.
:::
This example verifies one payment of 10 AlphaUSD to a regular account on Moderato testnet. Replace the expected values with your invoice details and set `PAYMENT_TX_HASH` to the payment transaction hash. It prints an event key for your database to record.
```ts [verify-payment.ts]
import {
parseEventLogs,
parseUnits,
toHex,
} from 'viem'
import { tempoModerato } from 'viem/chains'
import { Abis, createClient } from 'viem/tempo'
const client = createClient({ chain: tempoModerato })
const expected = {
token: '0x20c0000000000000000000000000000000000001',
recipient: '0x742d35cc6634c0532925a3b844bc9e7595f0bebb',
amount: parseUnits('10', 6),
memo: toHex('invoice-001', { size: 32 }),
}
const hash = process.env.PAYMENT_TX_HASH
if (!hash || !/^0x[0-9a-fA-F]{64}$/.test(hash)) {
throw new Error('Set PAYMENT_TX_HASH to the payment transaction hash')
}
if (await client.getChainId() !== tempoModerato.id) {
throw new Error('Expected Moderato testnet')
}
const receipt = await client.waitForTransactionReceipt({
hash: hash as `0x${string}`,
})
if (receipt.status !== 'success') throw new Error('Payment transaction failed')
const tokenLogs = receipt.logs.filter(
(log) => log.address.toLowerCase() === expected.token,
)
const payments = parseEventLogs({
abi: Abis.tip20,
eventName: 'TransferWithMemo',
logs: tokenLogs,
strict: true,
}).filter((log) =>
log.args.to.toLowerCase() === expected.recipient &&
log.args.amount === expected.amount &&
log.args.memo === expected.memo,
)
if (payments.length !== 1) {
throw new Error('Expected one transfer matching the invoice')
}
const payment = payments[0]
const deliveries = parseEventLogs({
abi: Abis.tip20,
eventName: 'Transfer',
logs: tokenLogs,
strict: true,
}).filter((log) =>
log.args.from.toLowerCase() === payment.args.from.toLowerCase() &&
log.args.to.toLowerCase() === expected.recipient &&
log.args.amount === expected.amount,
)
if (deliveries.length !== 1) {
throw new Error('Expected one delivery to the invoice recipient')
}
const eventKey = `${tempoModerato.id}:${receipt.transactionHash}:${deliveries[0].logIndex}`
console.log('Verified payment:', { eventKey, memo: expected.memo })
```
### Receive payments in a contract
When a contract collects payment with `transferFrom`, require delivery before fulfilling the invoice:
* Read the expected token, payer, and amount from the invoice record, and reject an invoice that is already paid.
* Check that the payer authorized the payment and approved the required token allowance.
* Read the contract’s token balance before and after `transferFrom`. Require the expected increase before updating the invoice or delivering the purchased item.
* Revert if the expected funds did not arrive.
See the [TIP-20 contract interface](https://tempo.com/developers/docs/protocol/tip20/spec#tip20) and [receive-policy behavior](https://tempo.com/developers/docs/accounts/policies/receive-policies#how-tempo-enforces-receive-policies) before implementing settlement.
### Record a payment once
* Verify the token contract, recipient, and amount in confirmed transfer events before marking an order paid.
* Match a memo or customer deposit address to the expected payment record.
* Store the transaction hash and log index to avoid processing the same event twice.
* Handle partial payments, refunds, blocked receipts, and failed transactions explicitly.
### Convert a received stablecoin
If your application accepts one stablecoin but holds another, [swap the received funds](https://tempo.com/developers/docs/guide/stablecoin-dex/executing-swaps). Set the minimum acceptable output from a current quote. Choosing a different fee token only changes how you pay transaction fees.
* **[Send a payment](https://tempo.com/developers/docs/guide/payments/send-a-payment)** to learn how to send payments
* Learn more about [Exchange](https://tempo.com/developers/docs/guide/stablecoin-dex) for cross-stablecoin payments
> Source: [/docs/protocol/tip20/virtual-addresses](https://tempo.com/developers/docs/protocol/tip20/virtual-addresses.md)
> Section: [Tempo EVM](https://tempo.com/developers/docs/development.md). Build on Tempo EVM: wallets and keys, payments, transactions and fees, TIP-20 Tokens, contracts, exchange, network details, nodes, protocol specifications, and changelog.
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
# Virtual addresses for TIP-20 deposits
Virtual addresses let you give each customer their own TIP-20 deposit address without giving each customer their own onchain wallet balance. A deposit sent to that address is forwarded by the protocol to a registered master wallet.
For exchanges, ramps, custodians, and payment processors, this changes the operational model. You still get one address per customer for attribution and reconciliation, but you no longer need sweep jobs to consolidate funds.
## Why this feature exists
Without virtual addresses, per-customer deposit addresses are operationally expensive. Each deposit address becomes a real onchain balance holder. Funds land there first, and then the operator has to sweep those funds into a central wallet.
With virtual addresses, the customer-facing address is still unique, but it behaves like a routing alias. The protocol resolves it to the registered master wallet during the TIP-20 transfer itself.
This means:
* you keep one deposit address per customer
* the master wallet receives the balance directly
* no sweep transaction is needed
* no separate TIP-20 balance is created for each deposit address
Forwarding happens inside the same TIP-20 precompile call that processes the transfer — there is no second transaction or additional token movement. Forwarding adds a registry lookup and forwarding-event costs. Estimate the full transfer rather than assuming only one extra storage read. The resolved master's receive policy still applies: if it blocks delivery, funds go to the ReceivePolicyGuard instead of the master. Check for blocked receipts before crediting a customer.
## The mental model
A virtual address is not a second wallet. It is a deposit alias for one canonical wallet.
The important idea is simple: the virtual address is for routing and attribution, while the master wallet is where the TIP-20 balance actually lives.
## Address format
A virtual address is still a normal 20-byte EVM address. The [specification](https://github.com/tempoxyz/tempo/blob/main/tips/tip-1022.md) gives those 20 bytes a specific layout:
```text
0x | masterId (4 bytes) | VIRTUAL_MAGIC (10 bytes) | userTag (6 bytes)
```
Example:
```text
0x2612766c fdfdfdfdfdfdfdfdfdfd 000000000001
```
Where:
| Part | Size | Purpose |
| --- | --- | --- |
| `masterId` | 4 bytes | identifies which registered master wallet should receive the funds |
| `VIRTUAL_MAGIC` | 10 bytes | marks the address as virtual so TIP-20 can recognize it |
| `userTag` | 6 bytes | operator-chosen routing or attribution value |
TIP-20 recognizes a virtual address by the fixed 10-byte middle marker. It then uses the leading `masterId` to resolve the registered wallet and leaves the trailing `userTag` available for operator-side attribution.
## What happens when someone sends funds
When a sender transfers a covered TIP-20 token to a virtual address, the TIP-20 precompile detects the virtual format, looks up the registered master, and credits that master wallet.
```mermaid
sequenceDiagram
participant Sender
participant TIP20 as TIP-20
participant Registry as Virtual registry
participant Master as Registered wallet
Sender->>TIP20: transfer(virtualAddress, amount)
TIP20->>Registry: resolve(masterId)
Registry-->>TIP20: master wallet
TIP20->>Master: credit balance
Note over TIP20: emits Transfer(sender → virtual, amount)
Note over TIP20: emits Transfer(virtual → master, amount)
```
Two things matter here:
1. The balance is credited only to the master wallet.
2. The transaction still exposes the virtual address in events, so backends and indexers can attribute the deposit correctly.
That is why `balanceOf(virtualAddress)` remains `0`. The virtual address is visible in the transfer path, but it does not end up holding the token balance.
## What this changes for operators
Virtual addresses are mainly an operations feature.
For an exchange or payment processor, the normal flow becomes:
1. register one master wallet
2. derive deposit addresses offchain for each customer
3. watch TIP-20 events and map the `userTag` back to the customer record on the backend
4. credit the customer internally once the deposit is observed
This gives you the accounting benefits of per-customer addresses without managing thousands or millions of real onchain balances.
## What this changes for wallets, explorers, and indexers
A virtual address is a forwarding alias, not a balance-holding account. Treat it as such in any UI or tooling: do not show it as holding a balance. Wallets, block explorers, and operational tooling that truncate addresses should display enough of the address to distinguish both the `masterId` and the `userTag`; ideally show the full address.
For indexers, the event sequences vary by operation. The basic transfer pattern is shown above. Memo and mint paths produce additional events in the same forwarding pattern:
**transferWithMemo / transferFromWithMemo:**
```
Transfer(sender, virtualAddress, amount)
TransferWithMemo(sender, virtualAddress, amount, memo)
Transfer(virtualAddress, masterWallet, amount)
```
**mint:**
```
Transfer(0x0, virtualAddress, amount)
Mint(virtualAddress, amount)
Transfer(virtualAddress, masterWallet, amount)
```
**mintWithMemo:**
```
Transfer(0x0, virtualAddress, amount)
TransferWithMemo(0x0, virtualAddress, amount, memo)
Mint(virtualAddress, amount)
Transfer(virtualAddress, masterWallet, amount)
```
In all cases, treat the full sequence as one logical deposit to the master wallet. If you surface each `Transfer` log independently, forwarded deposits will appear twice and the effective recipient will be wrong.
For deposit attribution, extract the `userTag` (trailing 6 bytes) directly from the virtual address to map the deposit to the right customer record without additional onchain queries.
If the sender and registered master wallet are the same address, two `Transfer` events still emit but the net balance change is zero. Account for this when counting deposits or computing balances.
## What this does not do
Virtual address forwarding is deliberately narrow in scope.
### It only changes TIP-20 deposit paths
Virtual forwarding applies only to the TIP-20 transfer and mint paths defined by the [specification](https://github.com/tempoxyz/tempo/blob/main/tips/tip-1022.md). It is not a general EVM alias system.
### It does not change ERC-20 contracts deployed on Tempo
If a non-TIP-20 token contract receives a transfer to a virtual address, that contract treats it as a normal literal address. Virtual address forwarding does not apply there.
### It does not make every protocol virtual-address aware
Some protocols record ownership against the literal address they are given. If they mint LP shares, receipts, or similar positions to a virtual address, those positions can become stranded unless that protocol explicitly supports resolution.
### It does not bypass TIP-403 policy checks
Policy checks run against the resolved master wallet. If the master is not allowed to receive a token, deposits to that master's virtual addresses fail too.
## Adoption at a glance
Adopting virtual addresses is straightforward conceptually:
* one-time setup: register a master wallet and mine the required salt
* ongoing operations: derive deposit addresses offchain
* reconciliation: decode the `userTag` from events and credit the right customer internally
If you want the exact transfer semantics, event shape, and validation rules, read the [virtual address specification](https://github.com/tempoxyz/tempo/blob/main/tips/tip-1022.md) alongside the [TIP-20 specification](https://tempo.com/developers/docs/protocol/tip20/spec).
## Learn more about TIP-20 virtual addresses
[TIP-20 specification](https://tempo.com/developers/docs/protocol/tip20/spec): See how T3 updates recipient resolution and event semantics for TIP-20 transfers and mints.
[Virtual address specification](https://github.com/tempoxyz/tempo/blob/main/tips/tip-1022.md): Read the full TIP with address derivation, forwarding semantics, and invariants.
[T3 network upgrade](https://tempo.com/developers/docs/protocol/upgrades/t3): See when virtual addresses activate and what else ships in T3.
> Source: [/docs/protocol/tip403/receive-policies](https://tempo.com/developers/docs/protocol/tip403/receive-policies.md)
> Section: [Tempo EVM](https://tempo.com/developers/docs/development.md). Build on Tempo EVM: wallets and keys, payments, transactions and fees, TIP-20 Tokens, contracts, exchange, network details, nodes, protocol specifications, and changelog.
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
# TIP-403 receive policies
Receive policies let a receiver control which [TIP-20](https://tempo.com/developers/docs/protocol/tip20/overview) tokens it accepts and which senders may send those tokens to it. [TIP-1028](https://tips.sh/1028) specifies them.
When a receive policy blocks an inbound TIP-20 transfer or mint, the call still succeeds. Delivery is redirected to `ReceivePolicyGuard`, and the guard records a receipt for that blocked transfer or mint. The token's [TIP-403](https://tempo.com/developers/docs/protocol/tip403/spec) policy checks still run first and still revert on failure.
## Protocol changes
Receive policies add three protocol surfaces:
* TIP-403 stores per-address receive policies and exposes `setReceivePolicy(...)` and `validateReceivePolicy(...)`.
* `ReceivePolicyGuard` records receipts for blocked transfers and mints at `0xB10C000000000000000000000000000000000000`.
* TIP-20 transfer and mint flows check the receiver's policy before crediting the receiver.
## Transfer flow
```mermaid
sequenceDiagram
participant Sender
participant TIP20 as TIP-20
participant TIP403 as TIP-403
participant Guard as ReceivePolicyGuard
participant Recovery as Recovery authority
Sender->>TIP20: transfer(receiver, amount)
TIP20->>TIP403: check token TIP-403 policy
TIP403-->>TIP20: allowed
TIP20->>TIP403: validateReceivePolicy(token, sender, receiver)
TIP403-->>TIP20: blocked
TIP20->>Guard: storeBlocked(...)
TIP20-->>Sender: success
Recovery->>Guard: claim(to, receipt)
Guard->>TIP20: release amount from guard
```
The receive-policy check applies to:
* `transfer`
* `transferFrom`
* `transferWithMemo`
* `transferFromWithMemo`
* `systemTransferFrom`
* `mint`
* `mintWithMemo`
The check does not apply to `approve`, `permit`, or `burn`. It also does not affect fee deposits or refunds through `transfer_fee_pre_tx` or `transfer_fee_post_tx`, TIP-20 rewards, or internal balances.
For transfer-like operations, the sender checked by the policy is the `from` address. For `mint` and `mintWithMemo`, the sender checked by the policy is `msg.sender`.
For `transferFrom` and `transferFromWithMemo`, the checked sender is the token owner (`from`), not the spender, and a blocked transfer still spends the spender's allowance.
A blocked transfer or mint still emits the token's usual `Transfer` event (and `Mint` for a mint), with `ReceivePolicyGuard` as the recipient instead of the receiver.
## Receive-policy configuration
Receive policies are stored per address in the TIP-403 registry. Conceptually, each configured address has:
```text
ReceivePolicy(account) = (
senderPolicyId,
tokenFilterId,
recoveryAuthority
)
```
`senderPolicyId` and `tokenFilterId` must reference built-in policy `0`, built-in policy `1`, or a simple TIP-403 `WHITELIST` or `BLACKLIST` policy. `COMPOUND` policies are not valid for receive policies.
The recovery authority controls who can claim future blocked receipts:
| Recovery authority | Claimer |
|---|---|
| `address(0)` | the transfer or mint originator |
| receiver address | the receiver |
| another nonzero address | that address |
Nonzero recovery authorities must not be `ReceivePolicyGuard`, [virtual addresses](https://tempo.com/developers/docs/protocol/tip20/virtual-addresses), or system precompile addresses that cannot initiate calls. A virtual address must not call `setReceivePolicy(...)`; configure the resolved master address instead.
If no receive policy is set, all transfers and mints are allowed by the receive-policy layer.
## Evaluation order
`validateReceivePolicy(token, sender, receiver)` checks configured policies in a fixed order:
1. Check `token` against the receiver's token filter. If rejected, return `TOKEN_FILTER`.
2. Check `sender` against the receiver's sender policy. If rejected, return `RECEIVE_POLICY`.
3. If both checks pass, return `NONE`.
If both checks would reject, `TOKEN_FILTER` is returned because the token filter is the first canonical check. Blocked events must not use `NONE`.
## ReceivePolicyGuard
`ReceivePolicyGuard` tracks blocked inbound TIP-20 transfers and mints. The aggregate blocked balance for each TIP-20 token is held at `0xB10C000000000000000000000000000000000000`.
Each blocked transfer or mint creates one receipt. The v1 receipt includes:
* version
* token
* recovery authority
* originator
* recipient
* blocked timestamp
* blocked nonce
* blocked reason
* inbound kind
* memo
The receipt key is `keccak256(abi.encode(receipt))`, and the guard stores the full amount for that receipt key. Receipts are not enumerable onchain, so claimers must supply the receipt they want to consume, typically by indexing `TransferBlocked` events.
## Claims
A claim consumes one full receipt and releases the stored amount to one destination. Partial claims are not supported.
Only the authorized claimer may call `claim(...)`:
* if `recoveryAuthority == address(0)`, only the receipt originator may claim
* otherwise, only the nonzero recovery authority may claim
Changing a receiver's recovery authority affects future receipts only. Existing receipts remain governed by the recovery authority captured in their receipt.
### Resume claims
A claim resumes the original inbound when `recoveryAuthority != address(0)` and `to == receiver`.
A resume claim does not recheck the receiver's receive policy. It still requires the receiver to be currently authorized under the token's TIP-403 policy as the destination of the release.
For blocked transfers to a virtual address, the receiver is the resolved master, so the receipt belongs to the master and a resume releases directly to it. The receipt keeps the original virtual `to` address for attribution.
### Reroute claims
All other claims are reroutes, including every originator-authorized claim.
A reroute must:
* reject `to == ReceivePolicyGuard`
* resolve `to` if it is a virtual address, or revert if resolution fails
* require the policy subject to be authorized as a sender under the token's TIP-403 policy
* require the resolved destination to be authorized as a recipient under the token's TIP-403 policy
* require the resolved destination's receive policy to accept the policy subject as sender
For originator recovery, the policy subject is the originator. For nonzero recovery authority, the policy subject is the receiver.
## Burns
`burnBlockedReceipt(...)` consumes one full receipt and burns the stored amount from `ReceivePolicyGuard`.
The caller must hold `BURN_BLOCKED_ROLE` for the token. A receipt is burnable only when its policy subject is currently unauthorized as a sender under the token's TIP-403 policy.
## Events
Receive policy updates emit:
```solidity
event ReceivePolicyUpdated(
address indexed account,
uint64 senderPolicyId,
uint64 tokenFilterId,
address recoveryAuthority
);
```
Blocked, claimed, and burned receipts emit:
```solidity
event TransferBlocked(
address indexed token,
address indexed receiver,
uint64 indexed blockedNonce,
uint256 amount,
uint8 receiptVersion,
bytes receipt
);
event ReceiptClaimed(
address indexed token,
address indexed receiver,
uint64 indexed blockedNonce,
uint64 blockedAt,
uint8 receiptVersion,
address originator,
address recipient,
address recoveryAuthority,
address caller,
address to,
uint256 amount
);
event ReceiptBurned(
address indexed token,
address indexed receiver,
uint64 indexed blockedNonce,
uint64 blockedAt,
uint8 receiptVersion,
address originator,
address recipient,
address recoveryAuthority,
address caller,
uint256 amount
);
```
`TransferBlocked.receipt` is the ABI-encoded receipt witness and must be directly usable as the `receipt` argument to `balanceOf`, `claim`, and `burnBlockedReceipt`.
## Related receive policy docs
[Receive policies specification](https://tips.sh/1028): Approved specification for address-level receive policies.
[Receive policies](https://tempo.com/developers/docs/accounts/policies/receive-policies): Set a receive policy on an account and claim the payments it holds.
[TIP-20 Tokens](https://tempo.com/developers/docs/protocol/tip20/overview): Token standard whose transfers and mints run receive-policy checks.
> Source: [/docs/network/transactions](https://tempo.com/developers/docs/network/transactions.md)
> Section: [Tempo EVM](https://tempo.com/developers/docs/development.md). Build on Tempo EVM: wallets and keys, payments, transactions and fees, TIP-20 Tokens, contracts, exchange, network details, nodes, protocol specifications, and changelog.
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
# Transactions
Build a transaction from contract calls, sign it with your account, and submit it to Tempo. These examples transfer one AlphaUSD on Moderato testnet.
Start with [Network example setup](https://tempo.com/developers/docs/network/examples) for CLI variables, the Viem client, a connected Wagmi wallet, and the Python helper. Each tab continues in the same script.
::::steps
### Send a transaction
Use the token helper to build, sign, and submit a transfer. The amount is in base units: `1_000_000` is one AlphaUSD. Viem and the CLI sign locally; Wagmi asks the connected wallet to sign.
:::code-group
```ts [Viem]
import { alphaUsd, client, recipient } from './network.config'
const hash = await client.token.transfer({
token: alphaUsd,
to: recipient,
amount: 1_000_000n,
})
```
```bash [CLI]
TX_HASH=$(cast erc20 transfer "$TOKEN" "$TEMPO_RECIPIENT" 1000000 \
--rpc-url "$RPC_URL" --tempo.fee-token "$TOKEN" --interactive --async)
```
```ts [Wagmi]
const hash = await Actions.token.transfer(config, {
token: alphaUsd,
to: recipient,
amount: 1_000_000n,
})
```
```python [Python]
from network_config import ALPHA_USD, TIP20, account, make_transaction, recipient, w3
call = TIP20(ALPHA_USD).transfer(to=recipient, amount=1_000_000)
tx = make_transaction((call,))
signed = tx.sign(account.key.hex())
tx_hash = w3.eth.send_raw_transaction(signed.encode())
```
:::
For separate signing and broadcasting, follow the [complete transaction example](https://tempo.com/developers/docs/network/examples#typescript-setup). Submit its serialized bytes with [`eth_sendRawTransaction`](https://tempo.com/developers/docs/protocol/rpc#eth_sendrawtransaction). To submit several calls atomically, use [batch transactions](https://tempo.com/developers/docs/guide/tempo-transaction#batch-calls); for separate outcomes, use [independent nonces](https://tempo.com/developers/docs/guide/payments/send-parallel-transactions).
### Check the receipt
Wait for inclusion and check execution status. The RPC method returns `null` until a receipt is available; poll again while it is `null`. A receipt status of `0x1` means success.
:::code-group
```ts [Viem]
const receipt = await client.waitForTransactionReceipt({ hash })
if (receipt.status !== 'success') throw new Error('Transaction reverted')
console.log(receipt.transactionHash)
```
```bash [CLI]
cast receipt "$TX_HASH" --rpc-url "$RPC_URL"
```
```ts [Wagmi]
const receipt = await waitForTransactionReceipt(config, { hash })
if (receipt.status !== 'success') throw new Error('Transaction reverted')
console.log(receipt.transactionHash)
```
```python [Python]
receipt = w3.eth.wait_for_transaction_receipt(tx_hash)
if receipt["status"] != 1:
raise RuntimeError("Transaction reverted")
print(tx_hash.hex())
```
```bash [API (RPC)]
curl "$RPC_URL" -H 'Content-Type: application/json' \
--data "{\"jsonrpc\":\"2.0\",\"id\":1,\"method\":\"eth_getTransactionReceipt\",\"params\":[\"$TX_HASH\"]}"
```
:::
Before recording a payment as delivered, [verify transfer events](https://tempo.com/developers/docs/guide/payments/accept-a-payment#verify-stablecoin-payments) against the expected token, amount, and recipient. Receive policies can redirect a transfer even when the transaction succeeds.
::::
## Add transaction controls
| Your application needs to | Use |
| --- | --- |
| Choose who pays and which token pays | [Fees](https://tempo.com/developers/docs/network/fees) |
| Delegate signing with limits | [Keys and permissions](https://tempo.com/developers/docs/accounts/keys) |
| Bound when a transaction can execute | [Validity windows](https://tempo.com/developers/docs/guide/tempo-transaction#validity-windows) |
| Submit separate transactions concurrently | [Concurrent transactions](https://tempo.com/developers/docs/guide/tempo-transaction#concurrent-transactions) |
| Inspect encoding and signature rules | [Transaction specification](https://tempo.com/developers/docs/protocol/transactions/spec-tempo-transaction) |
Use the [complete runnable example](https://tempo.com/developers/docs/network/examples#typescript-setup), [wallet payment demo](https://tempo.com/developers/docs/guide/payments/send-a-payment#send-payment-demo), or [other language recipes](https://tempo.com/developers/docs/guide/tempo-transaction) for a full integration.
> Source: [/docs/guide/tempo-transaction](https://tempo.com/developers/docs/guide/tempo-transaction.md)
> Section: [Tempo EVM](https://tempo.com/developers/docs/development.md). Build on Tempo EVM: wallets and keys, payments, transactions and fees, TIP-20 Tokens, contracts, exchange, network details, nodes, protocol specifications, and changelog.
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
# Use Tempo Transactions
Use Tempo Transactions to submit payments and contract calls with the signing method, fee payer, and permissions your application needs. The examples below show each capability through Tempo SDKs.
For a complete payment flow, start with [Send a payment](https://tempo.com/developers/docs/guide/payments/send-a-payment). For transaction encoding and validation rules, see the [transaction specification](https://tempo.com/developers/docs/protocol/transactions/spec-tempo-transaction).
## Choose an SDK
| Language or tool | Integration guide |
| --- | --- |
| TypeScript | [Viem and Wagmi](https://tempo.com/developers/docs/sdk/typescript) |
| Rust | [tempo-alloy](https://tempo.com/developers/docs/sdk/rust) |
| Go | [tempo-go](https://tempo.com/developers/docs/sdk/go) |
| Python | [pytempo](https://tempo.com/developers/docs/sdk/python) |
| Solidity | [Foundry](https://tempo.com/developers/docs/sdk/foundry) |
## Choose a transaction capability
| Your application needs to | Use |
| --- | --- |
| Select the stablecoin used for fees | [Fee tokens](https://tempo.com/developers/docs/guide/tempo-transaction#configurable-fee-tokens) |
| Pay a customer's transaction fees | [Fee sponsorship](https://tempo.com/developers/docs/guide/tempo-transaction#fee-sponsorship) |
| Execute several calls atomically | [Batch calls](https://tempo.com/developers/docs/guide/tempo-transaction#batch-calls) |
| Delegate signing with defined permissions | [Access keys](https://tempo.com/developers/docs/guide/tempo-transaction#access-keys) |
| Submit separate transactions concurrently | [Concurrent transactions](https://tempo.com/developers/docs/guide/tempo-transaction#concurrent-transactions) |
| Avoid managing sequential nonces | [Expiring nonces](https://tempo.com/developers/docs/guide/tempo-transaction#expiring-nonces) |
| Maintain separate ordered transaction streams | [2D nonces](https://tempo.com/developers/docs/guide/tempo-transaction#2d-nonces) |
| Bound when a transaction may be included | [Validity windows](https://tempo.com/developers/docs/guide/tempo-transaction#validity-windows) |
The Viem and Wagmi examples below use Moderato testnet. Fund the test account before submitting transactions.
### Configurable Fee Tokens
A fee token is a USD-denominated [TIP-20 token](https://tempo.com/developers/docs/protocol/tip20/overview) supported for fee payment. When conversion is needed, the Fee AMM must have sufficient liquidity for the validator's preferred token. See the [fee-token rules](https://tempo.com/developers/docs/protocol/fees/spec-fee#fee-token-preferences).
When a TIP-20 token is passed as the `fee_token` parameter in a transaction,
Tempo's [Fee AMM](https://tempo.com/developers/docs/protocol/fees/spec-fee-amm) automatically facilitates conversion between the
user's preferred fee token and the validator's preferred token.
### Viem
:::code-group
```tsx twoslash [example.ts]
// @noErrors
import { client } from './viem.config'
const alphaUsd = '0x20c0000000000000000000000000000000000001'
const receipt = await client.sendTransactionSync({
data: '0xdeadbeef',
feeToken: alphaUsd, // [!code hl]
to: '0xcafebabecafebabecafebabecafebabecafebabe',
})
```
```tsx twoslash [viem.config.ts]
import { tempoModerato } from 'viem/chains'
import { Account, createClient } from 'viem/tempo'
const privateKey = process.env.TEMPO_PRIVATE_KEY
if (!privateKey || !/^0x[0-9a-fA-F]{64}$/.test(privateKey)) {
throw new Error('Set TEMPO_PRIVATE_KEY to your funded test account private key')
}
export const client = createClient({
account: Account.fromSecp256k1(privateKey as `0x${string}`),
chain: tempoModerato,
feeToken: '0x20c0000000000000000000000000000000000001',
})
```
:::
### Wagmi
:::code-group
```tsx twoslash [example.ts]
// @noErrors
import { useSendTransactionSync } from 'wagmi'
const { sendTransactionSync } = useSendTransactionSync()
const alphaUsd = '0x20c0000000000000000000000000000000000001'
sendTransactionSync({
data: '0xdeadbeef',
feeToken: alphaUsd, // [!code hl]
to: '0xcafebabecafebabecafebabecafebabecafebabe',
})
```
```tsx twoslash [wagmi.config.ts]
// @noErrors
import { tempoModerato } from 'viem/chains'
import { createConfig, http } from 'wagmi'
import { tempoWallet } from 'wagmi/connectors'
export const config = createConfig({
connectors: [tempoWallet()],
chains: [tempoModerato],
multiInjectedProviderDiscovery: false,
transports: {
[tempoModerato.id]: http(),
},
})
```
:::
### Rust
:::code-group
```rust [example.rs]
use alloy::primitives::{address, bytes};
use alloy::providers::Provider;
use tempo_alloy::rpc::TempoTransactionRequest;
mod provider;
#[tokio::main]
async fn main() -> Result<(), Box> {
let provider = provider::get_provider().await?;
let alpha_usd = address!("0x20c0000000000000000000000000000000000001");
let pending = provider
.send_transaction(
TempoTransactionRequest::default()
.with_fee_token(alpha_usd) // [!code hl]
.with_to(address!("0xcafebabecafebabecafebabecafebabecafebabe"))
.with_input(bytes!("deadbeef")),
)
.await?;
Ok(())
}
```
```rust [provider.rs]
use alloy::providers::ProviderBuilder;
use alloy::signers::local::PrivateKeySigner;
use tempo_alloy::TempoNetwork;
pub async fn get_provider() -> Result<
impl alloy::providers::Provider,
Box,
> {
let signer: PrivateKeySigner = std::env::var("PRIVATE_KEY")
.expect("PRIVATE_KEY not set")
.parse()?;
let provider = ProviderBuilder::new_with_network::()
.wallet(signer)
.connect(&std::env::var("RPC_URL").expect("RPC_URL not set"))
.await?;
Ok(provider)
}
```
:::
### Python
:::code-group
```python [example.py]
from pytempo import Call, TempoTransaction
from provider import w3, account
alpha_usd = "0x20c0000000000000000000000000000000000001"
tx = TempoTransaction.create(
chain_id=w3.eth.chain_id,
gas_limit=300_000,
max_fee_per_gas=w3.eth.gas_price * 2,
max_priority_fee_per_gas=w3.eth.gas_price,
nonce=w3.eth.get_transaction_count(account.address),
fee_token=alpha_usd, # [!code hl]
calls=(
Call.create(
to="0xcafebabecafebabecafebabecafebabecafebabe",
data="0xdeadbeef",
),
),
)
signed_tx = tx.sign(account.key.hex())
tx_hash = w3.eth.send_raw_transaction(signed_tx.encode())
```
```python [provider.py]
from web3 import Web3
from eth_account import Account
w3 = Web3(Web3.HTTPProvider("https://rpc.tempo.xyz"))
account = Account.from_key("0x...")
```
:::
### Go
:::code-group
```go [main.go]
package main
import (
"context"
"log"
"math/big"
"github.com/ethereum/go-ethereum/common"
"github.com/tempoxyz/tempo-go/pkg/signer"
"github.com/tempoxyz/tempo-go/pkg/transaction"
)
func main() {
sgn, _ := signer.NewSigner("0x...")
c := newClient()
ctx := context.Background()
nonce, _ := c.GetTransactionCount(ctx, sgn.Address().Hex())
tx := transaction.NewBuilder(big.NewInt(transaction.ChainIdMainnet)).
SetNonce(nonce).
SetGas(300_000).
SetMaxFeePerGas(big.NewInt(25_000_000_000)).
SetMaxPriorityFeePerGas(big.NewInt(1_000_000_000)).
SetFeeToken(transaction.AlphaUSDAddress). // [!code hl]
AddCall(
common.HexToAddress("0xcafebabecafebabecafebabecafebabecafebabe"),
big.NewInt(0),
common.Hex2Bytes("deadbeef"),
).
Build()
_ = transaction.SignTransaction(tx, sgn)
serialized, _ := transaction.Serialize(tx, nil)
txHash, _ := c.SendRawTransaction(ctx, serialized)
log.Printf("Transaction hash: %s", txHash)
}
```
```go [provider.go]
package main
import (
"os"
"github.com/tempoxyz/tempo-go/pkg/client"
)
func newClient() *client.Client {
return client.New(os.Getenv("TEMPO_RPC_URL"))
}
```
:::
### Cast
```bash
$ cast send 0xcafebabecafebabecafebabecafebabecafebabe \
--data 0xdeadbeef \
--rpc-url $TEMPO_RPC_URL \
--private-key $PRIVATE_KEY \
--tempo.fee-token 0x20c0000000000000000000000000000000000001 # [!code hl]
```
### RLP
```tsx
rlp([
chain_id,
max_priority_fee_per_gas,
max_fee_per_gas,
gas,
calls,
access_list,
nonce_key,
nonce,
valid_before,
valid_after,
fee_token, // [!code focus]
fee_payer_signature,
aa_authorization_list,
key_authorization,
signature,
])
```
:::info
See a full guide on [paying fees in any stablecoin](https://tempo.com/developers/docs/guide/payments/pay-fees-in-any-stablecoin).
:::
### Fee Sponsorship
Fee sponsorship enables a third party (the fee payer) to pay transaction fees on behalf of the transaction sender.
The process uses dual signature domains: the sender signs their transaction, and then the fee payer signs
over the transaction with a special "fee payer envelope" to commit to paying fees for that specific sender.
### Viem
:::code-group
```tsx twoslash [example.ts]
// @noErrors
import { client } from './viem.config'
import { Account } from 'viem/tempo'
const feePayer = Account.fromSecp256k1('0x...')
const receipt = await client.sendTransactionSync({
data: '0xdeadbeef',
feePayer, // [!code hl]
to: '0xcafebabecafebabecafebabecafebabecafebabe',
})
```
```tsx twoslash [viem.config.ts]
import { tempoModerato } from 'viem/chains'
import { Account, createClient } from 'viem/tempo'
const privateKey = process.env.TEMPO_PRIVATE_KEY
if (!privateKey || !/^0x[0-9a-fA-F]{64}$/.test(privateKey)) {
throw new Error('Set TEMPO_PRIVATE_KEY to your funded test account private key')
}
export const client = createClient({
account: Account.fromSecp256k1(privateKey as `0x${string}`),
chain: tempoModerato,
feeToken: '0x20c0000000000000000000000000000000000001',
})
```
:::
### Wagmi
:::code-group
```tsx twoslash [example.ts]
// @noErrors
import { useSendTransactionSync } from 'wagmi'
import { Account } from 'viem/tempo'
export const feePayer = Account.fromSecp256k1('0x...')
const { sendTransactionSync } = useSendTransactionSync()
sendTransactionSync({
data: '0xdeadbeef',
feePayer, // [!code hl]
to: '0xcafebabecafebabecafebabecafebabecafebabe',
})
```
```tsx twoslash [wagmi.config.ts]
// @noErrors
import { tempoModerato } from 'viem/chains'
import { createConfig, http } from 'wagmi'
import { tempoWallet } from 'wagmi/connectors'
export const config = createConfig({
connectors: [tempoWallet()],
chains: [tempoModerato],
multiInjectedProviderDiscovery: false,
transports: {
[tempoModerato.id]: http(),
},
})
```
:::
### Rust
:::code-group
```rust [example.rs]
use alloy::primitives::{U256, address, bytes};
use alloy::providers::Provider;
use alloy::signers::{SignerSync, local::PrivateKeySigner};
use tempo_alloy::primitives::transaction::tempo_transaction::Call;
use tempo_alloy::rpc::TempoTransactionRequest;
mod provider;
#[tokio::main]
async fn main() -> Result<(), Box> {
let provider = provider::get_provider().await?;
let tx = TempoTransactionRequest {
calls: vec![Call {
to: address!("0xcafebabecafebabecafebabecafebabecafebabe").into(),
value: U256::ZERO,
input: bytes!("deadbeef"),
}],
..Default::default()
};
// Step 1: Build the transaction
let mut tempo_tx = provider.fill(tx).await?.build_aa()?;
let sender_addr = provider.default_signer_address();
let fee_payer_hash = tempo_tx.fee_payer_signature_hash(sender_addr);
// Step 2: Fee payer counter-signs the transaction // [!code hl]
let fee_payer: PrivateKeySigner = "0x...".parse()?; // [!code hl]
tempo_tx.fee_payer_signature = Some(fee_payer.sign_hash_sync(&fee_payer_hash)?); // [!code hl]
// Step 3: Broadcast
let pending = provider.send_transaction(tempo_tx).await?;
Ok(())
}
```
```rust [provider.rs]
use alloy::providers::ProviderBuilder;
use alloy::signers::local::PrivateKeySigner;
use tempo_alloy::TempoNetwork;
pub async fn get_provider() -> Result<
impl alloy::providers::Provider,
Box,
> {
let signer: PrivateKeySigner = std::env::var("PRIVATE_KEY")
.expect("PRIVATE_KEY not set")
.parse()?;
let provider = ProviderBuilder::new_with_network::()
.wallet(signer)
.connect(&std::env::var("RPC_URL").expect("RPC_URL not set"))
.await?;
Ok(provider)
}
```
:::
### Python
:::code-group
```python [example.py]
from pytempo import Call, TempoTransaction
from provider import w3, account
fee_payer_key = "0x..."
# Sender signs with awaiting_fee_payer flag
tx = TempoTransaction.create(
chain_id=w3.eth.chain_id,
gas_limit=300_000,
max_fee_per_gas=w3.eth.gas_price * 2,
max_priority_fee_per_gas=w3.eth.gas_price,
nonce=w3.eth.get_transaction_count(account.address),
awaiting_fee_payer=True, # [!code hl]
calls=(
Call.create(
to="0xcafebabecafebabecafebabecafebabecafebabe",
data="0xdeadbeef",
),
),
)
sender_signed = tx.sign(account.key.hex())
# Fee payer co-signs the transaction // [!code hl]
fully_signed = sender_signed.sign(fee_payer_key, for_fee_payer=True) # [!code hl]
tx_hash = w3.eth.send_raw_transaction(fully_signed.encode())
```
```python [provider.py]
from web3 import Web3
from eth_account import Account
w3 = Web3(Web3.HTTPProvider("https://rpc.tempo.xyz"))
account = Account.from_key("0x...")
```
:::
### Go
:::code-group
```go [main.go]
package main
import (
"context"
"log"
"math/big"
"github.com/ethereum/go-ethereum/common"
"github.com/tempoxyz/tempo-go/pkg/signer"
"github.com/tempoxyz/tempo-go/pkg/transaction"
)
func main() {
senderSgn, _ := signer.NewSigner("0x...")
sponsorSgn, _ := signer.NewSigner("0x...")
c := newClient()
ctx := context.Background()
nonce, _ := c.GetTransactionCount(ctx, senderSgn.Address().Hex())
// Sender builds and signs a sponsored transaction
tx := transaction.NewBuilder(big.NewInt(transaction.ChainIdMainnet)).
SetNonce(nonce).
SetGas(300_000).
SetMaxFeePerGas(big.NewInt(25_000_000_000)).
SetMaxPriorityFeePerGas(big.NewInt(1_000_000_000)).
SetSponsored(true). // [!code hl]
AddCall(
common.HexToAddress("0xcafebabecafebabecafebabecafebabecafebabe"),
big.NewInt(0),
common.Hex2Bytes("deadbeef"),
).
Build()
_ = transaction.SignTransaction(tx, senderSgn)
// Fee payer co-signs the transaction // [!code hl]
tx.FeeToken = transaction.AlphaUSDAddress // [!code hl]
tx.AwaitingFeePayer = false // [!code hl]
_ = transaction.AddFeePayerSignature(tx, sponsorSgn) // [!code hl]
serialized, _ := transaction.Serialize(tx, nil)
txHash, _ := c.SendRawTransaction(ctx, serialized)
log.Printf("Transaction hash: %s", txHash)
}
```
```go [provider.go]
package main
import (
"os"
"github.com/tempoxyz/tempo-go/pkg/client"
)
func newClient() *client.Client {
return client.New(os.Getenv("TEMPO_RPC_URL"))
}
```
:::
### Cast
```bash
# 1. Get the fee payer signature hash
$ FEE_PAYER_HASH=$(cast mktx 0xcafebabecafebabecafebabecafebabecafebabe \
--data 0xdeadbeef \
--rpc-url $TEMPO_RPC_URL \
--private-key $SENDER_KEY \
--tempo.print-sponsor-hash) # [!code hl]
# 2. Sponsor signs the hash
$ SPONSOR_SIG=$(cast wallet sign \
--private-key $SPONSOR_KEY \
"$FEE_PAYER_HASH" \
--no-hash) # [!code hl]
# 3. Send with sponsor signature
$ cast send 0xcafebabecafebabecafebabecafebabecafebabe \
--data 0xdeadbeef \
--rpc-url $TEMPO_RPC_URL \
--private-key $SENDER_KEY \
--tempo.sponsor-signature "$SPONSOR_SIG" # [!code hl]
```
### RLP
```tsx
// 1. User signs over `user_envelope` // [!code focus]
user_envelope = 0x77 ∥ rlp([
chain_id,
max_priority_fee_per_gas,
max_fee_per_gas,
gas,
calls,
access_list,
nonce_key,
nonce,
valid_before,
valid_after,
fee_token,
0x00, // indicate intention for a fee payer // [!code focus]
aa_authorization_list,
key_authorization
])
// 2. Fee payer signs over `fee_payer_envelope` // [!code focus]
fee_payer_envelope = 0x76 ∥ rlp([
chain_id,
max_priority_fee_per_gas,
max_fee_per_gas,
gas,
calls,
access_list,
nonce_key,
nonce,
valid_before,
valid_after,
fee_token,
sender_address, // scope to sender // [!code focus]
aa_authorization_list,
key_authorization
])
// 3. Construct + send off `final_envelope` to the network // [!code focus]
final_envelope = 0x77 ∥ rlp([
chain_id,
max_priority_fee_per_gas,
max_fee_per_gas,
gas,
calls,
access_list,
nonce_key,
nonce,
valid_before,
valid_after,
fee_token,
fee_payer_signature, // signature over `fee_payer_envelope` // [!code focus]
aa_authorization_list,
key_authorization,
signature, // signature over `user_envelope` // [!code focus]
])
```
:::tip
You can also use a remote [fee payer relay](https://tempo.com/developers/docs/api/fee-payer) instead of a local account.
:::
:::tip
For demos and testnet development, use the public fee payer endpoint at `https://sponsor.moderato.tempo.xyz` without an API key. For authenticated sandbox and production sponsorship, use the [Fee Payer API](https://tempo.com/developers/docs/api/fee-payer).
:::
:::info
See a full guide on [sponsoring fees](https://tempo.com/developers/docs/api/fee-payer).
:::
### Batch Calls
Batch calls enable multiple operations to be executed atomically within a single transaction.
Instead of sending separate transactions for each operation, you can bundle multiple calls together using the `calls`
parameter.
### Viem
:::code-group
```tsx twoslash [example.ts]
// @noErrors
import { client } from './viem.config'
const receipt = await client.sendTransactionSync({
calls: [ // [!code hl]
{ // [!code hl]
to: '0xcafebabecafebabecafebabecafebabecafebabe', // [!code hl]
data: '0xdeadbeef0000000000000000000000000000000001', // [!code hl]
}, // [!code hl]
{ // [!code hl]
to: '0xdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef', // [!code hl]
data: '0xcafebabe0000000000000000000000000000000001', // [!code hl]
}, // [!code hl]
{ // [!code hl]
to: '0xcafebabecafebabecafebabecafebabecafebabe', // [!code hl]
data: '0xdeadbeef0000000000000000000000000000000001', // [!code hl]
}, // [!code hl]
] // [!code hl]
})
```
```tsx twoslash [viem.config.ts]
import { tempoModerato } from 'viem/chains'
import { Account, createClient } from 'viem/tempo'
const privateKey = process.env.TEMPO_PRIVATE_KEY
if (!privateKey || !/^0x[0-9a-fA-F]{64}$/.test(privateKey)) {
throw new Error('Set TEMPO_PRIVATE_KEY to your funded test account private key')
}
export const client = createClient({
account: Account.fromSecp256k1(privateKey as `0x${string}`),
chain: tempoModerato,
feeToken: '0x20c0000000000000000000000000000000000001',
})
```
:::
### Wagmi
:::code-group
```tsx twoslash [example.ts]
// @noErrors
import { useSendTransactionSync } from 'wagmi'
const { sendTransactionSync } = useSendTransactionSync()
sendTransactionSync({
calls: [ // [!code hl]
{ // [!code hl]
to: '0xcafebabecafebabecafebabecafebabecafebabe', // [!code hl]
data: '0xdeadbeef0000000000000000000000000000000001', // [!code hl]
}, // [!code hl]
{ // [!code hl]
to: '0xdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef', // [!code hl]
data: '0xcafebabe0000000000000000000000000000000001', // [!code hl]
}, // [!code hl]
{ // [!code hl]
to: '0xcafebabecafebabecafebabecafebabecafebabe', // [!code hl]
data: '0xdeadbeef0000000000000000000000000000000001', // [!code hl]
}, // [!code hl]
] // [!code hl]
})
```
```tsx twoslash [wagmi.config.ts]
// @noErrors
import { tempoModerato } from 'viem/chains'
import { createConfig, http } from 'wagmi'
import { tempoWallet } from 'wagmi/connectors'
export const config = createConfig({
connectors: [tempoWallet()],
chains: [tempoModerato],
multiInjectedProviderDiscovery: false,
transports: {
[tempoModerato.id]: http(),
},
})
```
:::
### Rust
:::code-group
```rust [example.rs]
use alloy::primitives::{U256, address, bytes};
use alloy::providers::Provider;
use tempo_alloy::primitives::transaction::Call;
use tempo_alloy::rpc::TempoTransactionRequest;
mod provider;
#[tokio::main]
async fn main() -> Result<(), Box> {
let provider = provider::get_provider().await?;
let pending = provider
.send_transaction(TempoTransactionRequest {
calls: vec![ // [!code hl]
Call { // [!code hl]
to: address!("0xcafebabecafebabecafebabecafebabecafebabe").into(), // [!code hl]
value: U256::ZERO, // [!code hl]
input: bytes!("deadbeef0000000000000000000000000000000001"), // [!code hl]
}, // [!code hl]
Call { // [!code hl]
to: address!("0xdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef").into(), // [!code hl]
value: U256::ZERO, // [!code hl]
input: bytes!("cafebabe0000000000000000000000000000000001"), // [!code hl]
}, // [!code hl]
Call { // [!code hl]
to: address!("0xcafebabecafebabecafebabecafebabecafebabe").into(), // [!code hl]
value: U256::ZERO, // [!code hl]
input: bytes!("deadbeef0000000000000000000000000000000001"), // [!code hl]
}, // [!code hl]
], // [!code hl]
..Default::default()
})
.await?;
Ok(())
}
```
```rust [provider.rs]
use alloy::providers::ProviderBuilder;
use alloy::signers::local::PrivateKeySigner;
use tempo_alloy::TempoNetwork;
pub async fn get_provider() -> Result<
impl alloy::providers::Provider,
Box,
> {
let signer: PrivateKeySigner = std::env::var("PRIVATE_KEY")
.expect("PRIVATE_KEY not set")
.parse()?;
let provider = ProviderBuilder::new_with_network::()
.wallet(signer)
.connect(&std::env::var("RPC_URL").expect("RPC_URL not set"))
.await?;
Ok(provider)
}
```
:::
### Python
:::code-group
```python [example.py]
from pytempo import Call, TempoTransaction
from provider import w3, account
tx = TempoTransaction.create(
chain_id=w3.eth.chain_id,
gas_limit=600_000,
max_fee_per_gas=w3.eth.gas_price * 2,
max_priority_fee_per_gas=w3.eth.gas_price,
nonce=w3.eth.get_transaction_count(account.address),
calls=( # [!code hl]
Call.create( # [!code hl]
to="0xcafebabecafebabecafebabecafebabecafebabe", # [!code hl]
data="0xdeadbeef0000000000000000000000000000000001", # [!code hl]
), # [!code hl]
Call.create( # [!code hl]
to="0xdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef", # [!code hl]
data="0xcafebabe0000000000000000000000000000000001", # [!code hl]
), # [!code hl]
Call.create( # [!code hl]
to="0xcafebabecafebabecafebabecafebabecafebabe", # [!code hl]
data="0xdeadbeef0000000000000000000000000000000001", # [!code hl]
), # [!code hl]
), # [!code hl]
)
signed_tx = tx.sign(account.key.hex())
tx_hash = w3.eth.send_raw_transaction(signed_tx.encode())
```
```python [provider.py]
from web3 import Web3
from eth_account import Account
w3 = Web3(Web3.HTTPProvider("https://rpc.tempo.xyz"))
account = Account.from_key("0x...")
```
:::
### Go
:::code-group
```go [main.go]
package main
import (
"context"
"log"
"math/big"
"github.com/ethereum/go-ethereum/common"
"github.com/tempoxyz/tempo-go/pkg/signer"
"github.com/tempoxyz/tempo-go/pkg/transaction"
)
func main() {
sgn, _ := signer.NewSigner("0x...")
c := newClient()
ctx := context.Background()
nonce, _ := c.GetTransactionCount(ctx, sgn.Address().Hex())
tx := transaction.NewBuilder(big.NewInt(transaction.ChainIdMainnet)).
SetNonce(nonce).
SetGas(600_000).
SetMaxFeePerGas(big.NewInt(25_000_000_000)).
SetMaxPriorityFeePerGas(big.NewInt(1_000_000_000)).
AddCall( // [!code hl]
common.HexToAddress("0xcafebabecafebabecafebabecafebabecafebabe"), // [!code hl]
big.NewInt(0), // [!code hl]
common.Hex2Bytes("deadbeef0000000000000000000000000000000001"), // [!code hl]
). // [!code hl]
AddCall( // [!code hl]
common.HexToAddress("0xdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef"), // [!code hl]
big.NewInt(0), // [!code hl]
common.Hex2Bytes("cafebabe0000000000000000000000000000000001"), // [!code hl]
). // [!code hl]
AddCall( // [!code hl]
common.HexToAddress("0xcafebabecafebabecafebabecafebabecafebabe"), // [!code hl]
big.NewInt(0), // [!code hl]
common.Hex2Bytes("deadbeef0000000000000000000000000000000001"), // [!code hl]
). // [!code hl]
Build()
_ = transaction.SignTransaction(tx, sgn)
serialized, _ := transaction.Serialize(tx, nil)
txHash, _ := c.SendRawTransaction(ctx, serialized)
log.Printf("Transaction hash: %s", txHash)
}
```
```go [provider.go]
package main
import (
"os"
"github.com/tempoxyz/tempo-go/pkg/client"
)
func newClient() *client.Client {
return client.New(os.Getenv("TEMPO_RPC_URL"))
}
```
:::
### Cast
```bash
$ cast batch-send \
--rpc-url $TEMPO_RPC_URL \
--private-key $PRIVATE_KEY \
--call "0xcafebabecafebabecafebabecafebabecafebabe::increment()" \
--call "0xdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef::setNumber(uint256):500" \
--call "0xcafebabecafebabecafebabecafebabecafebabe::increment()"
```
### RLP
```tsx
rlp([
chain_id,
max_priority_fee_per_gas,
max_fee_per_gas,
gas,
calls, // [!code focus]
access_list,
nonce_key,
nonce,
valid_before,
valid_after,
fee_token,
fee_payer_signature,
aa_authorization_list,
key_authorization,
signature,
])
```
### Access Keys
Access keys enable you to delegate signing authority from a primary account to a secondary key,
such as device-bound non-extractable [WebCrypto key](https://developer.mozilla.org/en-US/docs/Web/API/CryptoKeyPair). The primary account signs a key authorization that grants the access key permission
to sign transactions on its behalf.
This authorization is then attached to the next transaction (that can be signed by either the primary or the access key), then all
transactions thereafter can be signed by the access key.
### Viem
:::code-group
```tsx twoslash [example.ts]
// @noErrors
import { parseUnits } from 'viem'
import { Account, P256 } from 'viem/tempo'
import { client } from './viem.config'
const account = Account.fromSecp256k1('0x...')
const alphaUsd = '0x20c0000000000000000000000000000000000001'
const treasury = '0xcafebabecafebabecafebabecafebabecafebabe'
const accessKey = Account.fromP256(P256.randomPrivateKey(), {
access: account,
})
const keyAuthorization = await account.signKeyAuthorization(accessKey, {
chainId: BigInt(client.chain.id),
expiry: Math.floor(Date.now() / 1000) + 3600,
limits: [
{
token: alphaUsd,
limit: parseUnits('1000', 6),
period: 60 * 60 * 24 * 30,
},
],
scopes: [
{
address: alphaUsd,
selector: 'transfer(address,uint256)',
recipients: [treasury],
},
],
})
// `keyAuthorization` provisions the access key and uses it in this same transaction.
const receipt = await client.sendTransactionSync({
account: accessKey, // [!code hl]
data: '0xa9059cbb000000000000000000000000cafebabecafebabecafebabecafebabecafebabe00000000000000000000000000000000000000000000000000000000000f4240',
keyAuthorization, // [!code hl]
to: alphaUsd,
})
```
```tsx twoslash [viem.config.ts]
import { tempoModerato } from 'viem/chains'
import { Account, createClient } from 'viem/tempo'
const privateKey = process.env.TEMPO_PRIVATE_KEY
if (!privateKey || !/^0x[0-9a-fA-F]{64}$/.test(privateKey)) {
throw new Error('Set TEMPO_PRIVATE_KEY to your funded test account private key')
}
export const client = createClient({
account: Account.fromSecp256k1(privateKey as `0x${string}`),
chain: tempoModerato,
feeToken: '0x20c0000000000000000000000000000000000001',
})
```
:::
### Wagmi
```tsx twoslash [example.tsx]
// @noErrors
import { parseUnits } from 'viem'
import { Account, Expiry, P256, Period, tempoActions } from 'viem/tempo'
import { useConnectorClient } from 'wagmi'
export function useAuthorizeAccessKey() {
const { data: connectorClient } = useConnectorClient()
async function authorize() {
if (!connectorClient) return
const client = connectorClient.extend(tempoActions())
const alphaUsd = '0x20c0000000000000000000000000000000000001'
const accessKey = Account.fromP256(P256.randomPrivateKey(), {
access: connectorClient.account,
})
const { receipt } = await client.accessKey.authorizeSync({
accessKey, // [!code hl]
expiry: Expiry.hours(1),
limits: [
{
token: alphaUsd,
limit: parseUnits('1000', 6),
period: Period.months(1),
},
],
scopes: [
{
address: alphaUsd,
selector: 'transfer(address,uint256)',
},
],
})
return receipt.transactionHash
}
return { authorize }
}
```
### Rust
:::code-group
```rust [example.rs]
use std::str::FromStr;
use alloy::primitives::{U256, address, bytes};
use alloy::providers::Provider;
use alloy::signers::{SignerSync, local::PrivateKeySigner};
use tempo_alloy::primitives::transaction::key_authorization::{
CallScope, KeyAuthorization, SelectorRule, TokenLimit,
};
use tempo_alloy::primitives::transaction::tt_signature::{
KeychainSignature, PrimitiveSignature, SignatureType, TempoSignature,
};
use tempo_alloy::rpc::TempoTransactionRequest;
mod provider;
#[tokio::main]
async fn main() -> Result<(), Box> {
let provider = provider::get_provider().await?;
let root: PrivateKeySigner = std::env::var("PRIVATE_KEY")?.parse()?;
let access_key = PrivateKeySigner::random();
let alpha_usd = address!("0x20c0000000000000000000000000000000000001");
let treasury = address!("0xcafebabecafebabecafebabecafebabecafebabe");
let authorization = KeyAuthorization::unrestricted( // [!code hl]
4217, // [!code hl]
SignatureType::Secp256k1, // [!code hl]
access_key.address(), // [!code hl]
) // [!code hl]
.with_expiry(1_893_456_000) // [!code hl]
.with_limits(vec![TokenLimit { // [!code hl]
token: alpha_usd, // [!code hl]
limit: U256::from(1_000_000u64), // [!code hl]
period: 86_400, // [!code hl]
}]) // [!code hl]
.with_allowed_calls(vec![CallScope { // [!code hl]
target: alpha_usd, // [!code hl]
selector_rules: vec![SelectorRule { // [!code hl]
selector: [0xa9, 0x05, 0x9c, 0xbb], // transfer(address,uint256) // [!code hl]
recipients: vec![treasury], // [!code hl]
}], // [!code hl]
}]); // [!code hl]
let sig = root.sign_hash_sync(&authorization.signature_hash())?; // [!code hl]
let key_authorization = // [!code hl]
authorization.into_signed(PrimitiveSignature::Secp256k1(sig)); // [!code hl]
provider
.send_transaction(
TempoTransactionRequest {
key_authorization: Some(key_authorization), // [!code hl]
..Default::default()
}
.with_to(alpha_usd)
.with_input(bytes!("a9059cbb000000000000000000000000cafebabecafebabecafebabecafebabecafebabe00000000000000000000000000000000000000000000000000000000000f4240")),
)
.await?
.get_receipt()
.await?;
let tx = TempoTransactionRequest::default()
.with_to(alpha_usd)
.with_input(bytes!("a9059cbb000000000000000000000000cafebabecafebabecafebabecafebabecafebabe00000000000000000000000000000000000000000000000000000000000f4240"));
let filled = provider.fill(tx).await?;
let tempo_tx = filled.build_aa()?;
// Keychain signatures are domain-separated by the root account address.
let inner_hash = // [!code hl]
KeychainSignature::signing_hash(tempo_tx.signature_hash(), root.address()); // [!code hl]
let inner_sig = access_key.sign_hash_sync(&inner_hash)?; // [!code hl]
let signature = TempoSignature::Keychain(KeychainSignature::new( // [!code hl]
root.address(), // [!code hl]
PrimitiveSignature::Secp256k1(inner_sig), // [!code hl]
)); // [!code hl]
let envelope = tempo_tx.into_signed(signature); // [!code hl]
let pending = provider // [!code hl]
.send_raw_transaction(envelope.encoded_2718().as_ref()) // [!code hl]
.await?; // [!code hl]
Ok(())
}
```
```rust [provider.rs]
use alloy::providers::ProviderBuilder;
use alloy::signers::local::PrivateKeySigner;
use tempo_alloy::TempoNetwork;
pub async fn get_provider() -> Result<
impl alloy::providers::Provider,
Box,
> {
let signer: PrivateKeySigner = std::env::var("PRIVATE_KEY")
.expect("PRIVATE_KEY not set")
.parse()?;
let provider = ProviderBuilder::new_with_network::()
.wallet(signer)
.connect(&std::env::var("RPC_URL").expect("RPC_URL not set"))
.await?;
Ok(provider)
}
```
:::
### Python
:::code-group
```python [example.py]
import time
from eth_account import Account as EthAccount
from pytempo import (
Call, CallScope, KeyRestrictions, SignatureType, TempoTransaction,
TokenLimit,
)
from pytempo.contracts import AccountKeychain
from provider import w3, account
access_key = EthAccount.create()
alpha_usd = "0x20c0000000000000000000000000000000000001"
treasury = "0xcafebabecafebabecafebabecafebabecafebabe"
auth_nonce = w3.eth.get_transaction_count(account.address)
authorize_call = AccountKeychain.authorize_key( # [!code hl]
key_id=access_key.address, # [!code hl]
signature_type=SignatureType.SECP256K1, # [!code hl]
restrictions=KeyRestrictions( # [!code hl]
expiry=int(time.time()) + 3600, # [!code hl]
limits=[TokenLimit(token=alpha_usd, limit=1_000_000, period=86_400)], # [!code hl]
allowed_calls=[CallScope.transfer(target=alpha_usd, recipients=[treasury])], # [!code hl]
), # [!code hl]
) # [!code hl]
# Root key authorizes first, then the access key signs later transactions.
auth_tx = TempoTransaction.create(
chain_id=w3.eth.chain_id,
gas_limit=300_000,
max_fee_per_gas=w3.eth.gas_price * 2,
max_priority_fee_per_gas=w3.eth.gas_price,
nonce=auth_nonce,
calls=(authorize_call,),
)
signed_auth_tx = auth_tx.sign(account.key.hex())
w3.eth.send_raw_transaction(signed_auth_tx.encode())
tx = TempoTransaction.create(
chain_id=w3.eth.chain_id,
gas_limit=300_000,
max_fee_per_gas=w3.eth.gas_price * 2,
max_priority_fee_per_gas=w3.eth.gas_price,
nonce=auth_nonce + 1,
calls=(
Call.create(
to=alpha_usd,
data="0xa9059cbb000000000000000000000000cafebabecafebabecafebabecafebabecafebabe00000000000000000000000000000000000000000000000000000000000f4240",
),
),
)
signed_tx = tx.sign_access_key( # [!code hl]
access_key_private_key=access_key.key.hex(), # [!code hl]
root_account=account.address, # [!code hl]
) # [!code hl]
tx_hash = w3.eth.send_raw_transaction(signed_tx.encode())
```
```python [provider.py]
from web3 import Web3
from eth_account import Account
w3 = Web3(Web3.HTTPProvider("https://rpc.tempo.xyz"))
account = Account.from_key("0x...")
```
:::
### Go
:::code-group
```go [main.go]
package main
import (
"context"
"log"
"math/big"
"time"
"github.com/ethereum/go-ethereum/common"
"github.com/tempoxyz/tempo-go/pkg/keychain"
"github.com/tempoxyz/tempo-go/pkg/signer"
"github.com/tempoxyz/tempo-go/pkg/transaction"
)
func main() {
rootSgn, _ := signer.NewSigner("0x...")
accessKey, _ := signer.NewSigner("0x...")
c := newClient()
ctx := context.Background()
chainID := big.NewInt(transaction.ChainIdMainnet)
gasPrice := big.NewInt(25_000_000_000)
alphaUSD := common.HexToAddress("0x20c0000000000000000000000000000000000001")
treasury := common.HexToAddress("0xcafebabecafebabecafebabecafebabecafebabe")
// Authorize the access key with T3 restrictions. // [!code hl]
restrictions := keychain.NewKeyRestrictions(uint64(time.Now().Add(1 * time.Hour).Unix())). // [!code hl]
WithLimits([]keychain.TokenLimit{{ // [!code hl]
Token: alphaUSD, // [!code hl]
Amount: big.NewInt(1_000_000), // [!code hl]
Period: 86_400, // [!code hl]
}}). // [!code hl]
WithAllowedCalls([]keychain.CallScope{ // [!code hl]
keychain.NewCallScopeBuilder(alphaUSD).Transfer([]common.Address{treasury}).Build(), // [!code hl]
}) // [!code hl]
authorizeCall, _ := keychain.AuthorizeKey( // [!code hl]
accessKey.Address(), // [!code hl]
keychain.SignatureTypeSecp256k1, // [!code hl]
restrictions, // [!code hl]
) // [!code hl]
// Go shows the explicit two-step flow: root key authorizes first, then the access key signs later transactions.
nonce, _ := c.GetTransactionCount(ctx, rootSgn.Address().Hex())
authTx := transaction.NewBuilder(chainID).
SetNonce(nonce).
SetGas(300_000).
SetMaxFeePerGas(gasPrice).
SetMaxPriorityFeePerGas(gasPrice).
AddCall(authorizeCall.To, big.NewInt(0), authorizeCall.Data).
Build()
_ = transaction.SignTransaction(authTx, rootSgn)
serializedAuth, _ := transaction.Serialize(authTx, nil)
authHash, _ := c.SendRawTransaction(ctx, serializedAuth)
log.Printf("Authorized access key: %s", authHash)
// Sign a transaction with the access key. // [!code hl]
tx := transaction.NewBuilder(chainID). // [!code hl]
SetNonce(nonce + 1). // [!code hl]
SetGas(300_000). // [!code hl]
SetMaxFeePerGas(gasPrice). // [!code hl]
SetMaxPriorityFeePerGas(gasPrice). // [!code hl]
AddCall( // [!code hl]
alphaUSD, // [!code hl]
big.NewInt(0), // [!code hl]
common.Hex2Bytes("a9059cbb000000000000000000000000cafebabecafebabecafebabecafebabecafebabe00000000000000000000000000000000000000000000000000000000000f4240"), // [!code hl]
). // [!code hl]
Build() // [!code hl]
_ = keychain.SignWithAccessKey(tx, accessKey, rootSgn.Address()) // [!code hl]
serialized, _ := transaction.Serialize(tx, nil)
txHash, _ := c.SendRawTransaction(ctx, serialized)
log.Printf("Transaction hash: %s", txHash)
}
```
```go [provider.go]
package main
import (
"os"
"github.com/tempoxyz/tempo-go/pkg/client"
)
func newClient() *client.Client {
return client.New(os.Getenv("TEMPO_RPC_URL"))
}
```
:::
### Cast
```bash
# 1. Authorize the access key with a recurring limit and transfer scope
$ cast keychain authorize $ACCESS_KEY_ADDR secp256k1 $(($(date +%s) + 3600)) \
--limit 0x20c0000000000000000000000000000000000001:1000000:86400 \
--scope 0x20c0000000000000000000000000000000000001:transfer@0xcafebabecafebabecafebabecafebabecafebabe \
--rpc-url $TEMPO_RPC_URL \
--private-key $ROOT_PRIVATE_KEY # [!code hl]
# 2. Send using the access key
$ cast send 0x20c0000000000000000000000000000000000001 \
--data 0xa9059cbb000000000000000000000000cafebabecafebabecafebabecafebabecafebabe00000000000000000000000000000000000000000000000000000000000f4240 \
--rpc-url $TEMPO_RPC_URL \
--tempo.root-account $ROOT_ADDRESS \
--tempo.access-key $ACCESS_KEY_PRIVATE_KEY # [!code hl]
```
### RLP
```tsx
rlp([
chain_id,
max_priority_fee_per_gas,
max_fee_per_gas,
gas,
calls,
access_list,
nonce_key,
nonce,
valid_before,
valid_after,
fee_token,
fee_payer_signature,
aa_authorization_list,
key_authorization, // rlp([chain_id, key_type, key_id, expiry?, limits?, allowed_calls?, signature]) // [!code focus]
signature,
])
```
:::info
Learn more about [Access Keys](https://tempo.com/developers/docs/protocol/transactions/spec-tempo-transaction#access-keys).
:::
### Concurrent Transactions
Concurrent transactions enable higher throughput by allowing multiple transactions from the same account to be sent
in parallel without waiting for sequential nonce confirmation.
By utilizing nonce keys, you can submit multiple transactions simultaneously that don't conflict with each other,
enabling parallel execution and significantly improved transaction throughput for high-activity accounts.
Concurrent transactions can be achieved with nonce keys via:
* [Expiring Nonces](https://tempo.com/developers/docs/guide/tempo-transaction#expiring-nonces)
* [2D Nonces](https://tempo.com/developers/docs/guide/tempo-transaction#2d-nonces)
In **Viem** and **Wagmi**, expiring nonces are handled automatically.
### Viem
:::code-group
```tsx twoslash [example.ts]
// @noErrors
import { client } from './viem.config'
const [receipt1, receipt2, receipt3] = await Promise.all([
client.sendTransactionSync({
data: '0xdeadbeef0000000000000000000000000000000001',
to: '0xcafebabecafebabecafebabecafebabecafebabe',
}),
client.sendTransactionSync({
data: '0xcafebabe0000000000000000000000000000000001',
to: '0xdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef',
}),
client.sendTransactionSync({
data: '0xdeadbeef0000000000000000000000000000000001',
to: '0xcafebabecafebabecafebabecafebabecafebabe',
}),
])
```
```tsx twoslash [viem.config.ts]
import { tempoModerato } from 'viem/chains'
import { Account, createClient } from 'viem/tempo'
const privateKey = process.env.TEMPO_PRIVATE_KEY
if (!privateKey || !/^0x[0-9a-fA-F]{64}$/.test(privateKey)) {
throw new Error('Set TEMPO_PRIVATE_KEY to your funded test account private key')
}
export const client = createClient({
account: Account.fromSecp256k1(privateKey as `0x${string}`),
chain: tempoModerato,
feeToken: '0x20c0000000000000000000000000000000000001',
})
```
:::
### Wagmi
:::code-group
```tsx twoslash [example.ts]
// @noErrors
import { useSendTransaction } from 'wagmi'
const { sendTransaction } = useSendTransaction()
sendTransaction({
data: '0xdeadbeef0000000000000000000000000000000001',
to: '0xcafebabecafebabecafebabecafebabecafebabe',
})
sendTransaction({
data: '0xdeadbeef0000000000000000000000000000000001',
to: '0xcafebabecafebabecafebabecafebabecafebabe',
})
sendTransaction({
data: '0xdeadbeef0000000000000000000000000000000001',
to: '0xcafebabecafebabecafebabecafebabecafebabe',
})
```
```tsx twoslash [wagmi.config.ts]
// @noErrors
import { tempoModerato } from 'viem/chains'
import { createConfig, http } from 'wagmi'
import { tempoWallet } from 'wagmi/connectors'
export const config = createConfig({
connectors: [tempoWallet()],
chains: [tempoModerato],
multiInjectedProviderDiscovery: false,
transports: {
[tempoModerato.id]: http(),
},
})
```
:::
### Rust
:::code-group
```rust [example.rs]
use alloy::primitives::{U256, address, bytes};
use alloy::providers::Provider;
use tempo_alloy::rpc::TempoTransactionRequest;
mod provider;
#[tokio::main]
async fn main() -> Result<(), Box> {
let provider = provider::get_provider().await?;
// Send three transactions concurrently using different nonce keys
let (r1, r2, r3) = tokio::try_join!(
provider.send_transaction(
TempoTransactionRequest::default()
.with_nonce_key(U256::from(1)) // [!code hl]
.with_to(address!("0xcafebabecafebabecafebabecafebabecafebabe"))
.with_input(bytes!("deadbeef0000000000000000000000000000000001")),
),
provider.send_transaction(
TempoTransactionRequest::default()
.with_nonce_key(U256::from(2)) // [!code hl]
.with_to(address!("0xdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef"))
.with_input(bytes!("cafebabe0000000000000000000000000000000001")),
),
provider.send_transaction(
TempoTransactionRequest::default()
.with_nonce_key(U256::from(3)) // [!code hl]
.with_to(address!("0xcafebabecafebabecafebabecafebabecafebabe"))
.with_input(bytes!("deadbeef0000000000000000000000000000000001")),
),
)?;
Ok(())
}
```
```rust [provider.rs]
use alloy::providers::ProviderBuilder;
use alloy::signers::local::PrivateKeySigner;
use tempo_alloy::TempoNetwork;
pub async fn get_provider() -> Result<
impl alloy::providers::Provider,
Box,
> {
let signer: PrivateKeySigner = std::env::var("PRIVATE_KEY")
.expect("PRIVATE_KEY not set")
.parse()?;
let provider = ProviderBuilder::new_with_network::()
.wallet(signer)
.connect(&std::env::var("RPC_URL").expect("RPC_URL not set"))
.await?;
Ok(provider)
}
```
:::
### Python
:::code-group
```python [example.py]
from pytempo import Call, TempoTransaction
from provider import w3, account
# Send three transactions concurrently using different nonce keys
for nonce_key, to, data in [
(1, "0xcafebabecafebabecafebabecafebabecafebabe", "0xdeadbeef0000000000000000000000000000000001"),
(2, "0xdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef", "0xcafebabe0000000000000000000000000000000001"),
(3, "0xcafebabecafebabecafebabecafebabecafebabe", "0xdeadbeef0000000000000000000000000000000001"),
]:
tx = TempoTransaction.create(
chain_id=w3.eth.chain_id,
gas_limit=300_000,
max_fee_per_gas=w3.eth.gas_price * 2,
max_priority_fee_per_gas=w3.eth.gas_price,
nonce=0,
nonce_key=nonce_key, # [!code hl]
calls=(Call.create(to=to, data=data),),
)
signed_tx = tx.sign(account.key.hex())
w3.eth.send_raw_transaction(signed_tx.encode())
```
```python [provider.py]
from web3 import Web3
from eth_account import Account
w3 = Web3(Web3.HTTPProvider("https://rpc.tempo.xyz"))
account = Account.from_key("0x...")
```
:::
### Go
:::code-group
```go [main.go]
package main
import (
"context"
"log"
"math/big"
"sync"
"github.com/ethereum/go-ethereum/common"
"github.com/tempoxyz/tempo-go/pkg/signer"
"github.com/tempoxyz/tempo-go/pkg/transaction"
)
func main() {
sgn, _ := signer.NewSigner("0x...")
c := newClient()
ctx := context.Background()
// Send three transactions concurrently using different nonce keys
type txParams struct {
nonceKey int64
to string
data string
}
params := []txParams{
{1, "0xcafebabecafebabecafebabecafebabecafebabe", "deadbeef0000000000000000000000000000000001"},
{2, "0xdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef", "cafebabe0000000000000000000000000000000001"},
{3, "0xcafebabecafebabecafebabecafebabecafebabe", "deadbeef0000000000000000000000000000000001"},
}
var wg sync.WaitGroup
for _, p := range params {
wg.Add(1)
go func(p txParams) {
defer wg.Done()
tx := transaction.NewBuilder(big.NewInt(transaction.ChainIdMainnet)).
SetNonce(0).
SetNonceKey(big.NewInt(p.nonceKey)). // [!code hl]
SetGas(300_000).
SetMaxFeePerGas(big.NewInt(25_000_000_000)).
SetMaxPriorityFeePerGas(big.NewInt(1_000_000_000)).
AddCall(
common.HexToAddress(p.to),
big.NewInt(0),
common.Hex2Bytes(p.data),
).
Build()
_ = transaction.SignTransaction(tx, sgn)
serialized, _ := transaction.Serialize(tx, nil)
txHash, _ := c.SendRawTransaction(ctx, serialized)
log.Printf("Nonce key %d tx: %s", p.nonceKey, txHash)
}(p)
}
wg.Wait()
}
```
```go [provider.go]
package main
import (
"os"
"github.com/tempoxyz/tempo-go/pkg/client"
)
func newClient() *client.Client {
return client.New(os.Getenv("TEMPO_RPC_URL"))
}
```
:::
### Cast
```bash
# Send three transactions concurrently using different nonce keys
$ cast send 0xcafebabecafebabecafebabecafebabecafebabe \
--data 0xdeadbeef0000000000000000000000000000000001 \
--rpc-url $TEMPO_RPC_URL \
--private-key $PRIVATE_KEY \
--async --nonce 0 --tempo.nonce-key 1 # [!code hl]
$ cast send 0xdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef \
--data 0xcafebabe0000000000000000000000000000000001 \
--rpc-url $TEMPO_RPC_URL \
--private-key $PRIVATE_KEY \
--async --nonce 0 --tempo.nonce-key 2 # [!code hl]
$ cast send 0xcafebabecafebabecafebabecafebabecafebabe \
--data 0xdeadbeef0000000000000000000000000000000001 \
--rpc-url $TEMPO_RPC_URL \
--private-key $PRIVATE_KEY \
--async --nonce 0 --tempo.nonce-key 3 # [!code hl]
```
### RLP
```tsx
rlp([
chain_id,
max_priority_fee_per_gas,
max_fee_per_gas,
gas,
calls,
access_list,
nonce_key, // [!code focus]
nonce,
valid_before, // [!code focus]
valid_after,
fee_token,
fee_payer_signature,
aa_authorization_list,
key_authorization,
signature,
])
```
### Expiring Nonces
The [expiring nonces specification](https://github.com/tempoxyz/tempo/blob/main/tips/tip-1009.md) defines transactions that automatically expire if they are not executed within a specified time window.
**Benefits:**
* No nonce tracking required
* Automatic replay protection via circular buffer
* No permanent state bloat from unused nonce keys
Set `nonceKey` to `maxUint256` and `validBefore` to a Unix timestamp in seconds satisfying `now < validBefore <= now + 300`, where `now` is the current block timestamp. The maximum window is five minutes; SDK defaults may use shorter windows. See [TIP-1093](https://tips.sh/1093).
### Viem
:::code-group
```tsx twoslash [example.ts]
// @noErrors
import { maxUint256 } from 'viem'
import { client } from './viem.config'
const receipt = await client.sendTransactionSync({
data: '0xdeadbeef0000000000000000000000000000000001',
nonceKey: maxUint256, // [!code focus]
to: '0xcafebabecafebabecafebabecafebabecafebabe',
validBefore: Math.floor(Date.now() / 1000) + 20, // [!code focus]
})
```
```tsx twoslash [viem.config.ts] filename="viem.config.ts"
import { tempoModerato } from 'viem/chains'
import { Account, createClient } from 'viem/tempo'
const privateKey = process.env.TEMPO_PRIVATE_KEY
if (!privateKey || !/^0x[0-9a-fA-F]{64}$/.test(privateKey)) {
throw new Error('Set TEMPO_PRIVATE_KEY to your funded test account private key')
}
export const client = createClient({
account: Account.fromSecp256k1(privateKey as `0x${string}`),
chain: tempoModerato,
feeToken: '0x20c0000000000000000000000000000000000001',
})
```
:::
### Wagmi
:::code-group
```tsx twoslash [example.ts]
// @noErrors
import { maxUint256 } from 'viem'
import { useSendTransaction } from 'wagmi'
const { sendTransaction } = useSendTransaction()
sendTransaction({
data: '0xdeadbeef0000000000000000000000000000000001',
nonceKey: maxUint256, // [!code focus]
to: '0xcafebabecafebabecafebabecafebabecafebabe',
validBefore: Math.floor(Date.now() / 1000) + 20, // [!code focus]
})
```
```tsx twoslash [wagmi.config.ts]
// @noErrors
import { tempoModerato } from 'viem/chains'
import { createConfig, http } from 'wagmi'
import { tempoWallet } from 'wagmi/connectors'
export const config = createConfig({
connectors: [tempoWallet()],
chains: [tempoModerato],
multiInjectedProviderDiscovery: false,
transports: {
[tempoModerato.id]: http(),
},
})
```
:::
### Rust
:::code-group
```rust [example.rs]
use std::time::{SystemTime, UNIX_EPOCH};
use alloy::primitives::{U256, address, bytes};
use alloy::providers::Provider;
use tempo_alloy::rpc::TempoTransactionRequest;
mod provider;
#[tokio::main]
async fn main() -> Result<(), Box> {
let provider = provider::get_provider().await?;
let valid_before = SystemTime::now().duration_since(UNIX_EPOCH)?.as_secs() + 30;
let pending = provider
.send_transaction(
TempoTransactionRequest::default()
.with_nonce_key(U256::MAX) // [!code focus]
.with_valid_before(valid_before) // [!code focus]
.with_to(address!("0xcafebabecafebabecafebabecafebabecafebabe"))
.with_input(bytes!("deadbeef0000000000000000000000000000000001")),
)
.await?;
Ok(())
}
```
```rust [provider.rs]
use alloy::providers::ProviderBuilder;
use alloy::signers::local::PrivateKeySigner;
use tempo_alloy::TempoNetwork;
pub async fn get_provider() -> Result<
impl alloy::providers::Provider,
Box,
> {
let signer: PrivateKeySigner = std::env::var("PRIVATE_KEY")
.expect("PRIVATE_KEY not set")
.parse()?;
let provider = ProviderBuilder::new_with_network::()
.wallet(signer)
.connect(&std::env::var("RPC_URL").expect("RPC_URL not set"))
.await?;
Ok(provider)
}
```
:::
### Python
:::code-group
```python [example.py]
import time
from pytempo import Call, TempoTransaction
from provider import w3, account
# maxUint256: signals an expiring nonce
MAX_UINT256 = 2**256 - 1
valid_before = int(time.time()) + 20
tx = TempoTransaction.create(
chain_id=w3.eth.chain_id,
gas_limit=300_000,
max_fee_per_gas=w3.eth.gas_price * 2,
max_priority_fee_per_gas=w3.eth.gas_price,
nonce_key=MAX_UINT256, # [!code focus]
valid_before=valid_before, # [!code focus]
calls=(
Call.create(
to="0xcafebabecafebabecafebabecafebabecafebabe",
data="0xdeadbeef0000000000000000000000000000000001",
),
),
)
signed_tx = tx.sign(account.key.hex())
tx_hash = w3.eth.send_raw_transaction(signed_tx.encode())
```
```python [provider.py]
from web3 import Web3
from eth_account import Account
w3 = Web3(Web3.HTTPProvider("https://rpc.tempo.xyz"))
account = Account.from_key("0x...")
```
:::
### Go
:::code-group
```go [main.go]
package main
import (
"context"
"log"
"math/big"
"time"
"github.com/ethereum/go-ethereum/common"
"github.com/tempoxyz/tempo-go/pkg/signer"
"github.com/tempoxyz/tempo-go/pkg/transaction"
)
func main() {
sgn, _ := signer.NewSigner("0x...")
c := newClient()
ctx := context.Background()
// maxUint256: signals an expiring nonce
maxUint256, _ := new(big.Int).SetString("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", 16)
validBefore := uint64(time.Now().Unix()) + 20
tx := transaction.NewBuilder(big.NewInt(transaction.ChainIdMainnet)).
SetGas(300_000).
SetMaxFeePerGas(big.NewInt(25_000_000_000)).
SetMaxPriorityFeePerGas(big.NewInt(1_000_000_000)).
SetNonceKey(maxUint256). // [!code focus]
SetValidBefore(validBefore). // [!code focus]
AddCall(
common.HexToAddress("0xcafebabecafebabecafebabecafebabecafebabe"),
big.NewInt(0),
common.Hex2Bytes("deadbeef0000000000000000000000000000000001"),
).
Build()
_ = transaction.SignTransaction(tx, sgn)
serialized, _ := transaction.Serialize(tx, nil)
txHash, _ := c.SendRawTransaction(ctx, serialized)
log.Printf("Transaction hash: %s", txHash)
}
```
```go [provider.go]
package main
import (
"os"
"github.com/tempoxyz/tempo-go/pkg/client"
)
func newClient() *client.Client {
return client.New(os.Getenv("TEMPO_RPC_URL"))
}
```
:::
### Cast
```bash
$ VALID_BEFORE=$(($(date +%s) + 20))
$ cast send 0xcafebabecafebabecafebabecafebabecafebabe \
--data 0xdeadbeef0000000000000000000000000000000001 \
--rpc-url $TEMPO_RPC_URL \
--private-key $PRIVATE_KEY \
--tempo.expiring-nonce --tempo.valid-before $VALID_BEFORE # [!code hl]
```
### RLP
```tsx
rlp([
chain_id,
max_priority_fee_per_gas,
max_fee_per_gas,
gas,
calls,
access_list,
nonce_key, // set to `maxUint256` // [!code focus]
nonce,
valid_before, // e.g. `now + 20`; maximum `now + 300` // [!code focus]
valid_after,
fee_token,
fee_payer_signature,
aa_authorization_list,
key_authorization,
signature,
])
```
#### Distinguishing identical transactions
Expiring nonce transactions don't use a sequential nonce, so two transactions from the same sender with the same calls, fee parameters, and `validBefore` have the same hash. The second one is rejected as a replay.
After [T12](https://tempo.com/developers/docs/protocol/upgrades/t12), the `nonce` field of an expiring nonce transaction can be any `uint64` value. The protocol doesn't track or order it; it only makes the transaction hash unique. To submit otherwise identical transactions in parallel, set a distinct or random `nonce` on each one. Before T12, `nonce` must be `0`. See [TIP-1106](https://github.com/tempoxyz/tempo/blob/main/tips/tip-1106.md).
### 2D Nonces
For cases requiring ordered sequences within a key, Tempo's **2D nonce system** enables parallel transaction execution:
* **Protocol nonce (key 0)**: The default sequential nonce. Transactions must be processed in order.
* **User nonces (keys 1+)**: Independent nonce sequences that allow concurrent transaction submission.
### Viem
:::code-group
```tsx twoslash [example.ts]
// @noErrors
import { client } from './viem.config'
const [receipt1, receipt2, receipt3] = await Promise.all([
client.sendTransactionSync({
data: '0xdeadbeef0000000000000000000000000000000001',
nonceKey: 1n, // [!code focus]
to: '0xcafebabecafebabecafebabecafebabecafebabe',
}),
client.sendTransactionSync({
data: '0xcafebabe0000000000000000000000000000000001',
nonceKey: 2n, // [!code focus]
to: '0xdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef',
}),
client.sendTransactionSync({
data: '0xdeadbeef0000000000000000000000000000000001',
nonceKey: 3n, // [!code focus]
to: '0xcafebabecafebabecafebabecafebabecafebabe',
}),
])
```
```tsx twoslash [viem.config.ts]
import { tempoModerato } from 'viem/chains'
import { Account, createClient } from 'viem/tempo'
const privateKey = process.env.TEMPO_PRIVATE_KEY
if (!privateKey || !/^0x[0-9a-fA-F]{64}$/.test(privateKey)) {
throw new Error('Set TEMPO_PRIVATE_KEY to your funded test account private key')
}
export const client = createClient({
account: Account.fromSecp256k1(privateKey as `0x${string}`),
chain: tempoModerato,
feeToken: '0x20c0000000000000000000000000000000000001',
})
```
:::
### Wagmi
:::code-group
```tsx twoslash [example.ts]
// @noErrors
import { useSendTransaction } from 'wagmi'
const { sendTransaction } = useSendTransaction()
sendTransaction({
data: '0xdeadbeef0000000000000000000000000000000001',
nonceKey: 1n, // [!code focus]
to: '0xcafebabecafebabecafebabecafebabecafebabe',
})
sendTransaction({
data: '0xdeadbeef0000000000000000000000000000000001',
nonceKey: 2n, // [!code focus]
to: '0xcafebabecafebabecafebabecafebabecafebabe',
})
sendTransaction({
data: '0xdeadbeef0000000000000000000000000000000001',
nonceKey: 3n, // [!code focus]
to: '0xcafebabecafebabecafebabecafebabecafebabe',
})
```
```tsx twoslash [wagmi.config.ts]
// @noErrors
import { tempoModerato } from 'viem/chains'
import { createConfig, http } from 'wagmi'
import { tempoWallet } from 'wagmi/connectors'
export const config = createConfig({
connectors: [tempoWallet()],
chains: [tempoModerato],
multiInjectedProviderDiscovery: false,
transports: {
[tempoModerato.id]: http(),
},
})
```
:::
### Rust
:::code-group
```rust [example.rs]
use alloy::primitives::{U256, address, bytes};
use alloy::providers::Provider;
use tempo_alloy::rpc::TempoTransactionRequest;
mod provider;
#[tokio::main]
async fn main() -> Result<(), Box> {
let provider = provider::get_provider().await?;
let (r1, r2, r3) = tokio::try_join!(
provider.send_transaction(
TempoTransactionRequest::default()
.with_nonce_key(U256::from(1)) // [!code focus]
.with_to(address!("0xcafebabecafebabecafebabecafebabecafebabe"))
.with_input(bytes!("deadbeef0000000000000000000000000000000001")),
),
provider.send_transaction(
TempoTransactionRequest::default()
.with_nonce_key(U256::from(2)) // [!code focus]
.with_to(address!("0xdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef"))
.with_input(bytes!("cafebabe0000000000000000000000000000000001")),
),
provider.send_transaction(
TempoTransactionRequest::default()
.with_nonce_key(U256::from(3)) // [!code focus]
.with_to(address!("0xcafebabecafebabecafebabecafebabecafebabe"))
.with_input(bytes!("deadbeef0000000000000000000000000000000001")),
),
)?;
Ok(())
}
```
```rust [provider.rs]
use alloy::providers::ProviderBuilder;
use alloy::signers::local::PrivateKeySigner;
use tempo_alloy::TempoNetwork;
pub async fn get_provider() -> Result<
impl alloy::providers::Provider,
Box,
> {
let signer: PrivateKeySigner = std::env::var("PRIVATE_KEY")
.expect("PRIVATE_KEY not set")
.parse()?;
let provider = ProviderBuilder::new_with_network::()
.wallet(signer)
.connect(&std::env::var("RPC_URL").expect("RPC_URL not set"))
.await?;
Ok(provider)
}
```
:::
### Python
:::code-group
```python [example.py]
from pytempo import Call, TempoTransaction
from provider import w3, account
for nonce_key, to, data in [
(1, "0xcafebabecafebabecafebabecafebabecafebabe", "0xdeadbeef0000000000000000000000000000000001"),
(2, "0xdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef", "0xcafebabe0000000000000000000000000000000001"),
(3, "0xcafebabecafebabecafebabecafebabecafebabe", "0xdeadbeef0000000000000000000000000000000001"),
]:
tx = TempoTransaction.create(
chain_id=w3.eth.chain_id,
gas_limit=300_000,
max_fee_per_gas=w3.eth.gas_price * 2,
max_priority_fee_per_gas=w3.eth.gas_price,
nonce=0,
nonce_key=nonce_key, # [!code focus]
calls=(Call.create(to=to, data=data),),
)
signed_tx = tx.sign(account.key.hex())
w3.eth.send_raw_transaction(signed_tx.encode())
```
```python [provider.py]
from web3 import Web3
from eth_account import Account
w3 = Web3(Web3.HTTPProvider("https://rpc.tempo.xyz"))
account = Account.from_key("0x...")
```
:::
### Go
:::code-group
```go [main.go]
package main
import (
"context"
"log"
"math/big"
"sync"
"github.com/ethereum/go-ethereum/common"
"github.com/tempoxyz/tempo-go/pkg/signer"
"github.com/tempoxyz/tempo-go/pkg/transaction"
)
func main() {
sgn, _ := signer.NewSigner("0x...")
c := newClient()
ctx := context.Background()
type txParams struct {
nonceKey int64
to string
data string
}
params := []txParams{
{1, "0xcafebabecafebabecafebabecafebabecafebabe", "deadbeef0000000000000000000000000000000001"},
{2, "0xdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef", "cafebabe0000000000000000000000000000000001"},
{3, "0xcafebabecafebabecafebabecafebabecafebabe", "deadbeef0000000000000000000000000000000001"},
}
var wg sync.WaitGroup
for _, p := range params {
wg.Add(1)
go func(p txParams) {
defer wg.Done()
tx := transaction.NewBuilder(big.NewInt(transaction.ChainIdMainnet)).
SetNonce(0).
SetNonceKey(big.NewInt(p.nonceKey)). // [!code focus]
SetGas(300_000).
SetMaxFeePerGas(big.NewInt(25_000_000_000)).
SetMaxPriorityFeePerGas(big.NewInt(1_000_000_000)).
AddCall(
common.HexToAddress(p.to),
big.NewInt(0),
common.Hex2Bytes(p.data),
).
Build()
_ = transaction.SignTransaction(tx, sgn)
serialized, _ := transaction.Serialize(tx, nil)
txHash, _ := c.SendRawTransaction(ctx, serialized)
log.Printf("Nonce key %d tx: %s", p.nonceKey, txHash)
}(p)
}
wg.Wait()
}
```
```go [provider.go]
package main
import (
"os"
"github.com/tempoxyz/tempo-go/pkg/client"
)
func newClient() *client.Client {
return client.New(os.Getenv("TEMPO_RPC_URL"))
}
```
:::
### Cast
```bash
$ cast send 0xcafebabecafebabecafebabecafebabecafebabe \
--data 0xdeadbeef0000000000000000000000000000000001 \
--rpc-url $TEMPO_RPC_URL \
--private-key $PRIVATE_KEY \
--nonce 0 --tempo.nonce-key 1 # [!code hl]
$ cast send 0xdeadbeefdeadbeefdeadbeefdeadbeefdeadbeef \
--data 0xcafebabe0000000000000000000000000000000001 \
--rpc-url $TEMPO_RPC_URL \
--private-key $PRIVATE_KEY \
--nonce 0 --tempo.nonce-key 2 # [!code hl]
$ cast send 0xcafebabecafebabecafebabecafebabecafebabe \
--data 0xdeadbeef0000000000000000000000000000000001 \
--rpc-url $TEMPO_RPC_URL \
--private-key $PRIVATE_KEY \
--nonce 0 --tempo.nonce-key 3 # [!code hl]
```
### RLP
```tsx
rlp([
chain_id,
max_priority_fee_per_gas,
max_fee_per_gas,
gas,
calls,
access_list,
nonce_key, // [!code focus]
nonce,
valid_before,
valid_after,
fee_token,
fee_payer_signature,
aa_authorization_list,
key_authorization,
signature,
])
```
:::warning
**Reuse nonce keys instead of generating random ones.** Creating a new nonce key incurs a state creation cost that increases with the number of active keys (see [State creation costs](https://github.com/tempoxyz/tempo/blob/main/tips/tip-1000.md)). For most applications, using a small set of sequential nonce keys (e.g., `1n`, `2n`, `3n`) is sufficient and much more cost-effective than generating random nonce keys for each transaction.
:::
### Validity windows
Set `validAfter` and `validBefore` to bound when a signed transaction may be included in a block. Your application must still submit it; a validity window does not schedule a job or guarantee inclusion.
### Viem
:::code-group
```tsx twoslash [example.ts]
// @noErrors
import { client } from './viem.config'
const signature = await client.signTransaction({
data: '0xdeadbeef0000000000000000000000000000000001',
to: '0xcafebabecafebabecafebabecafebabecafebabe',
validAfter: Math.floor(Date.now() / 1000), // [!code hl]
validBefore: Math.floor(Date.now() / 1000) + 3600, // [!code hl]
})
```
```tsx twoslash [viem.config.ts]
import { tempoModerato } from 'viem/chains'
import { Account, createClient } from 'viem/tempo'
const privateKey = process.env.TEMPO_PRIVATE_KEY
if (!privateKey || !/^0x[0-9a-fA-F]{64}$/.test(privateKey)) {
throw new Error('Set TEMPO_PRIVATE_KEY to your funded test account private key')
}
export const client = createClient({
account: Account.fromSecp256k1(privateKey as `0x${string}`),
chain: tempoModerato,
feeToken: '0x20c0000000000000000000000000000000000001',
})
```
:::
### Wagmi
:::code-group
```tsx twoslash [example.ts]
// @noErrors
import { signTransaction } from 'wagmi/actions'
import { config } from './wagmi.config'
const signature = await signTransaction(config, {
data: '0xdeadbeef0000000000000000000000000000000001',
to: '0xcafebabecafebabecafebabecafebabecafebabe',
validAfter: Math.floor(Date.now() / 1000), // [!code hl]
validBefore: Math.floor(Date.now() / 1000) + 3600, // [!code hl]
})
```
```tsx twoslash [wagmi.config.ts]
// @noErrors
import { tempoModerato } from 'viem/chains'
import { createConfig, http } from 'wagmi'
import { tempoWallet } from 'wagmi/connectors'
export const config = createConfig({
connectors: [tempoWallet()],
chains: [tempoModerato],
multiInjectedProviderDiscovery: false,
transports: {
[tempoModerato.id]: http(),
},
})
```
:::
### Rust
:::code-group
```rust [example.rs]
use std::time::{SystemTime, UNIX_EPOCH};
use alloy::primitives::{address, bytes};
use alloy::providers::Provider;
use tempo_alloy::rpc::TempoTransactionRequest;
mod provider;
#[tokio::main]
async fn main() -> Result<(), Box> {
let provider = provider::get_provider().await?;
// valid from now until one hour from now
let valid_after = SystemTime::now().duration_since(UNIX_EPOCH)?.as_secs();
let valid_before = valid_after + 3600;
let pending = provider
.send_transaction(
TempoTransactionRequest::default()
.with_valid_after(valid_after) // [!code hl]
.with_valid_before(valid_before) // [!code hl]
.with_to(address!("0xcafebabecafebabecafebabecafebabecafebabe"))
.with_input(bytes!("deadbeef0000000000000000000000000000000001")),
)
.await?;
Ok(())
}
```
```rust [provider.rs]
use alloy::providers::ProviderBuilder;
use alloy::signers::local::PrivateKeySigner;
use tempo_alloy::TempoNetwork;
pub async fn get_provider() -> Result<
impl alloy::providers::Provider,
Box,
> {
let signer: PrivateKeySigner = std::env::var("PRIVATE_KEY")
.expect("PRIVATE_KEY not set")
.parse()?;
let provider = ProviderBuilder::new_with_network::()
.wallet(signer)
.connect(&std::env::var("RPC_URL").expect("RPC_URL not set"))
.await?;
Ok(provider)
}
```
:::
### Python
:::code-group
```python [example.py]
import time
from pytempo import Call, TempoTransaction
from provider import w3, account
# valid from now until one hour from now
valid_after = int(time.time())
valid_before = valid_after + 3600
tx = TempoTransaction.create(
chain_id=w3.eth.chain_id,
gas_limit=300_000,
max_fee_per_gas=w3.eth.gas_price * 2,
max_priority_fee_per_gas=w3.eth.gas_price,
nonce=w3.eth.get_transaction_count(account.address),
valid_after=valid_after, # [!code hl]
valid_before=valid_before, # [!code hl]
calls=(
Call.create(
to="0xcafebabecafebabecafebabecafebabecafebabe",
data="0xdeadbeef0000000000000000000000000000000001",
),
),
)
# Sign now, submit to the network for later execution
signed_tx = tx.sign(account.key.hex())
tx_hash = w3.eth.send_raw_transaction(signed_tx.encode())
```
```python [provider.py]
from web3 import Web3
from eth_account import Account
w3 = Web3(Web3.HTTPProvider("https://rpc.tempo.xyz"))
account = Account.from_key("0x...")
```
:::
### Go
:::code-group
```go [main.go]
package main
import (
"context"
"log"
"math/big"
"time"
"github.com/ethereum/go-ethereum/common"
"github.com/tempoxyz/tempo-go/pkg/signer"
"github.com/tempoxyz/tempo-go/pkg/transaction"
)
func main() {
sgn, _ := signer.NewSigner("0x...")
c := newClient()
ctx := context.Background()
nonce, _ := c.GetTransactionCount(ctx, sgn.Address().Hex())
// valid from now until one hour from now
validAfter := uint64(time.Now().Unix())
validBefore := validAfter + 3600
tx := transaction.NewBuilder(big.NewInt(transaction.ChainIdMainnet)).
SetNonce(nonce).
SetGas(300_000).
SetMaxFeePerGas(big.NewInt(25_000_000_000)).
SetMaxPriorityFeePerGas(big.NewInt(1_000_000_000)).
SetValidAfter(validAfter). // [!code hl]
SetValidBefore(validBefore). // [!code hl]
AddCall(
common.HexToAddress("0xcafebabecafebabecafebabecafebabecafebabe"),
big.NewInt(0),
common.Hex2Bytes("deadbeef0000000000000000000000000000000001"),
).
Build()
// Sign now, submit to the network for later execution
_ = transaction.SignTransaction(tx, sgn)
serialized, _ := transaction.Serialize(tx, nil)
txHash, _ := c.SendRawTransaction(ctx, serialized)
log.Printf("Transaction hash: %s", txHash)
}
```
```go [provider.go]
package main
import (
"os"
"github.com/tempoxyz/tempo-go/pkg/client"
)
func newClient() *client.Client {
return client.New(os.Getenv("TEMPO_RPC_URL"))
}
```
:::
### Cast
```bash
$ VALID_AFTER=$(date +%s)
$ VALID_BEFORE=$((VALID_AFTER + 3600))
$ cast mktx 0xcafebabecafebabecafebabecafebabecafebabe \
--data 0xdeadbeef0000000000000000000000000000000001 \
--rpc-url $TEMPO_RPC_URL \
--private-key $PRIVATE_KEY \
--tempo.valid-after $VALID_AFTER \
--tempo.valid-before $VALID_BEFORE # [!code hl]
```
### RLP
```tsx
rlp([
chain_id,
max_priority_fee_per_gas,
max_fee_per_gas,
gas,
calls,
access_list,
nonce_key,
nonce,
valid_before, // [!code focus]
valid_after, // [!code focus]
fee_token,
fee_payer_signature,
aa_authorization_list,
key_authorization,
signature,
])
```
> Source: [/docs/network/examples](https://tempo.com/developers/docs/network/examples.md)
> Section: [Tempo EVM](https://tempo.com/developers/docs/development.md). Build on Tempo EVM: wallets and keys, payments, transactions and fees, TIP-20 Tokens, contracts, exchange, network details, nodes, protocol specifications, and changelog.
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
# Network examples
Set up the clients used by the Network guides: [Send a transaction](https://tempo.com/developers/docs/network/transactions), [Pay fees](https://tempo.com/developers/docs/network/fees), [TIP-20 tokens](https://tempo.com/developers/docs/network/tokens), and [Deploy a contract](https://tempo.com/developers/docs/network/contracts).
The examples run on Moderato, Tempo's testnet ([chain ID `42431`, RPC `https://rpc.moderato.tempo.xyz`](https://tempo.com/developers/docs/accounts/wallets/add-tempo-to-your-wallet)). They pay network fees in AlphaUSD, a test stablecoin at `0x20c0000000000000000000000000000000000001`. BetaUSD, at `0x20c0000000000000000000000000000000000002`, is a second test stablecoin for swap examples. Both are [TIP-20 tokens](https://tempo.com/developers/docs/protocol/tip20/overview), Tempo's stablecoin token standard, with 6 decimals: 1,000,000 base units is one AlphaUSD.
Each setup reads the same three environment variables. Keep private keys on your server.
* **`TEMPO_PRIVATE_KEY`.** The sender's private key, used by the Viem and Python clients.
* **`TEMPO_SENDER_ADDRESS`.** The sender's address, used by the CLI and HTTP examples.
* **`TEMPO_RECIPIENT`.** Another test address you control, which receives the example transfers in every client.
Fund the sender with the [faucet](https://tempo.com/developers/docs/quickstart/faucet).
## Viem setup
Use an ESM project (`"type": "module"` in `package.json`). Install `viem` and a TypeScript runner with `pnpm add viem` and `pnpm add -D tsx`. Save this file as `network.config.ts` beside the example you run. It requires `TEMPO_PRIVATE_KEY` and `TEMPO_RECIPIENT`, and exports `alphaUsd`, `betaUsd`, `recipient`, and a Moderato `client` that signs with your key and pays fees in AlphaUSD:
```ts [network.config.ts]
import { getAddress } from 'viem'
import { Account, createClient } from 'viem/tempo'
const privateKey = process.env.TEMPO_PRIVATE_KEY
const recipientAddress = process.env.TEMPO_RECIPIENT
if (!privateKey || !/^0x[0-9a-fA-F]{64}$/.test(privateKey))
throw new Error('Set TEMPO_PRIVATE_KEY to your funded test account private key')
if (!recipientAddress) throw new Error('Set TEMPO_RECIPIENT to an address you control')
export const alphaUsd = '0x20c0000000000000000000000000000000000001'
export const betaUsd = '0x20c0000000000000000000000000000000000002'
export const recipient = getAddress(recipientAddress)
export const client = createClient({
account: Account.fromSecp256k1(privateKey as `0x${string}`),
testnet: true,
feeToken: alphaUsd,
})
```
This complete transaction example builds one call, fills transaction fields, signs, submits, and checks the receipt. Run it with `pnpm exec tsx transaction.ts`.
```ts [transaction.ts]
import { alphaUsd, client, recipient } from './network.config'
const call = client.token.transfer.call({
token: alphaUsd,
to: recipient,
amount: 1_000_000n,
})
const request = await client.prepareTransactionRequest({ calls: [call] })
const serializedTransaction = await client.signTransaction(request)
const hash = await client.sendRawTransaction({ serializedTransaction })
const receipt = await client.waitForTransactionReceipt({ hash })
if (receipt.status !== 'success') throw new Error('Transaction reverted')
console.log(receipt.transactionHash)
```
Each guide's snippets import `client`, `alphaUsd`, `betaUsd`, and `recipient` from `./network.config` as needed. Fee snippets also import `formatUnits` from `viem`. Exchange snippets, which swap on the [Stablecoin DEX](https://tempo.com/developers/docs/guide/stablecoin-dex), import `Addresses` from `viem/tempo`.
### Sponsored transactions
A sponsor, or fee payer, pays a transaction's network fee for the sender. Moderato runs a public test sponsor at `https://sponsor.moderato.tempo.xyz`. Import `createClient`, `http`, and `withRelay` from `viem/tempo`, then create a `sponsored` client. Its `withRelay` transport sends transactions marked `feePayer: true` to the sponsor:
```ts
const sponsored = createClient({
account: client.account,
testnet: true,
feeToken: alphaUsd,
transport: withRelay(http(), http('https://sponsor.moderato.tempo.xyz')),
})
```
The [fee examples](https://tempo.com/developers/docs/network/fees#sponsor-fees) use this `sponsored` client. The sponsor pays only the fee, so the sender still needs the AlphaUSD it transfers.
## Wagmi setup
Use Wagmi actions inside a browser application where the user connects Tempo Wallet, which signs for their account. Install `wagmi`, `viem`, and `@tanstack/react-query`. Save this configuration as `network.wagmi.config.ts`. It exports `alphaUsd`, `betaUsd`, and a `config` that selects Moderato with AlphaUSD fees. Its Tempo Wallet connector sends actions that pass `feePayer: true` to the test sponsor:
```ts [network.wagmi.config.ts]
import { tempoModerato } from 'viem/chains'
import { createConfig, http } from 'wagmi'
import { tempoWallet } from 'wagmi/connectors'
export const alphaUsd = '0x20c0000000000000000000000000000000000001'
export const betaUsd = '0x20c0000000000000000000000000000000000002'
const chain = tempoModerato.extend({ feeToken: alphaUsd })
export const config = createConfig({
chains: [chain],
connectors: [tempoWallet({ feePayer: 'https://sponsor.moderato.tempo.xyz' })],
transports: { [chain.id]: http() },
})
```
Follow [Connect a wallet](https://tempo.com/developers/docs/accounts/wallets#connect-tempo-wallet) for the providers and connect button. Pass this `config` to your `WagmiProvider`. The snippets expect two values from your app: `accountAddress`, the connected account's address from `useConnection`, and `recipient`, from your validated form. Run write actions in an event handler after the user reviews them.
The Wagmi snippets use these imports as needed:
```ts
import { formatUnits } from 'viem'
import { Actions as ViemActions, Addresses } from 'viem/tempo'
import { estimateGas, getGasPrice } from 'wagmi/actions'
import { waitForTransactionReceipt } from 'wagmi/actions'
import { Actions } from 'wagmi/tempo'
import { alphaUsd, betaUsd, config } from './network.wagmi.config'
```
`Actions` sends through the connected wallet. `ViemActions.token.transfer.call` only encodes a transfer call, which fee estimation passes to `estimateGas`. The [wallet payment demo](https://tempo.com/developers/docs/guide/payments/send-a-payment#send-payment-demo) shows React hooks for pending state and confirmation.
### Machine payment clients
Machine payments let a client pay for an API inside the HTTP request, using the [Machine Payments Protocol](https://tempo.com/developers/docs/agents) (MPP). Install `mppx` with `viem`. The Wagmi tab also needs `wagmi` and `accounts@alpha`, whose `tempoId` connector signs in with Tempo. The client creates an `Mppx` instance with the `tempo` payment method, both from `mppx/client`, and calls `mppx.fetch(paidUrl)`.
The machine payment example has Viem and Wagmi tabs. The Viem tab pays from a Viem `account`, created on your server with `privateKeyToAccount(process.env.PRIVATE_KEY)` as in the [MPP client guide](https://tempo.com/developers/docs/guide/machine-payments/client#define-the-mpp-payer-account). The Wagmi tab pays from a connected wallet on Tempo Mainnet, not Moderato. It imports `getConnectorClient` from `wagmi/actions` and uses this mainnet configuration, separate from `network.wagmi.config.ts`:
```ts
import { tempoId } from 'accounts/wagmi'
import { tempo as tempoMainnet } from 'viem/chains'
import { createConfig, http } from 'wagmi'
import { getConnectorClient } from 'wagmi/actions'
export const mppConfig = createConfig({
chains: [tempoMainnet],
connectors: [
// Each sign-in requests an access key that spends up to 10 OUSD for a day.
// List the token each service charges in: the access key can't spend any other.
tempoId({ accessKey: { expiry: '1d', limits: [{ limit: '10', token: 'ousd' }] } }),
],
transports: { [tempoMainnet.id]: http() },
})
```
Use `mppConfig` for that app's `WagmiProvider` and connect flow. Mainnet service payments require mainnet funds. For a testnet service, select Moderato instead, and keep the wallet and service on the same network. `paidUrl` is the URL of the paid service you call in the [machine payment example](https://tempo.com/developers/docs/agents#pay-for-an-api).
## CLI setup
Install the latest [Foundry](https://tempo.com/developers/docs/sdk/foundry#get-started-with-foundry) with Tempo support. The snippets use `cast` for contract calls and transactions. `--interactive` prompts for the test account's signing key. The Exchange quote command also uses `jq` to read the JSON result.
Export the shared values. `TOKEN` is AlphaUSD and `BETA_TOKEN` is BetaUSD. `FACTORY` is the TIP-20 factory that creates tokens, and `DEX` is the Stablecoin DEX:
```bash
export RPC_URL=https://rpc.moderato.tempo.xyz
export SENDER="$TEMPO_SENDER_ADDRESS"
export TOKEN=0x20c0000000000000000000000000000000000001
export BETA_TOKEN=0x20c0000000000000000000000000000000000002
export FACTORY=0x20fc000000000000000000000000000000000000
export DEX=0xdec0000000000000000000000000000000000000
```
The [token creation example](https://tempo.com/developers/docs/network/tokens) stores its new token's address as `DEMO_TOKEN`. The [Foundry Tempo guide](https://www.getfoundry.sh/guides/tempo) documents current CLI options, including fee tokens and remote sponsorship.
## Python setup
Install `pytempo` with `pip install pytempo`. Save these blocks, in order, as `network_config.py` beside your script. The examples use pytempo 0.7.0 with web3.py 7 or 8.
The first block connects web3.py to Moderato. It creates `account` from `TEMPO_PRIVATE_KEY` and `recipient` from `TEMPO_RECIPIENT`, and imports `ALPHA_USD`, `BETA_USD`, and `TIP20` from pytempo:
```python [network_config.py]
import os
from web3 import Web3
from pytempo import Call, TempoTransaction
from pytempo.contracts import ALPHA_USD, BETA_USD, TIP20
w3 = Web3(Web3.HTTPProvider("https://rpc.moderato.tempo.xyz"))
account = w3.eth.account.from_key(os.environ["TEMPO_PRIVATE_KEY"])
recipient = Web3.to_checksum_address(os.environ["TEMPO_RECIPIENT"])
```
The second block defines two helpers. `make_transaction(calls, fee_token=ALPHA_USD)` returns an unsigned [Tempo Transaction](https://tempo.com/developers/docs/guide/tempo-transaction), Tempo's transaction type that runs a batch of calls,, with chain ID, nonce, fee token, and gas limit filled. It estimates the complete batch, adds a 20% gas buffer, and sets a maximum gas price at twice the current suggestion. Review those choices for your application. `submit(tx)` signs, broadcasts, waits for the receipt, and raises if the transaction reverted.
```python [network_config.py]
def make_transaction(calls, fee_token=ALPHA_USD):
rpc_calls = [{
"to": Web3.to_checksum_address(bytes(call.to)),
"data": "0x" + call.data.hex(),
"value": hex(call.value),
} for call in calls]
gas_request = {
"type": "0x76", "from": account.address,
"feeToken": fee_token, "calls": rpc_calls,
}
gas = int(w3.manager.request_blocking("eth_estimateGas", [gas_request]), 16)
return TempoTransaction.create(
chain_id=w3.eth.chain_id,
gas_limit=(gas * 12 + 9) // 10,
max_fee_per_gas=w3.eth.gas_price * 2,
max_priority_fee_per_gas=0,
nonce=w3.eth.get_transaction_count(account.address),
fee_token=fee_token,
calls=tuple(calls),
)
def submit(tx):
signed = tx.sign(account.key.hex())
tx_hash = w3.eth.send_raw_transaction(signed.encode())
receipt = w3.eth.wait_for_transaction_receipt(tx_hash)
if receipt["status"] != 1:
raise RuntimeError("Transaction reverted")
return receipt
```
For token creation and Exchange examples, add the contract bindings in the third block. It defines `factory`, the TIP-20 factory with its six-argument [`createToken` overload](https://tempo.com/developers/docs/protocol/tip20/spec#tip20factory), and `dex`, the Stablecoin DEX with the ABI supplied by pytempo.
```python [network_config.py]
from pytempo.contracts import (
STABLECOIN_DEX_ABI, STABLECOIN_DEX_ADDRESS, TIP20_FACTORY_ADDRESS,
)
factory_abi = [
{
"type": "function", "name": "createToken", "stateMutability": "nonpayable",
"inputs": [{"name": name, "type": kind} for name, kind in [
("name", "string"), ("symbol", "string"), ("currency", "string"),
("quoteToken", "address"), ("admin", "address"), ("salt", "bytes32"),
]],
"outputs": [{"name": "token", "type": "address"}],
},
{
"type": "function", "name": "getTokenAddress", "stateMutability": "pure",
"inputs": [{"name": "sender", "type": "address"}, {"name": "salt", "type": "bytes32"}],
"outputs": [{"name": "token", "type": "address"}],
},
]
factory = w3.eth.contract(address=TIP20_FACTORY_ADDRESS, abi=factory_abi)
dex = w3.eth.contract(address=STABLECOIN_DEX_ADDRESS, abi=STABLECOIN_DEX_ABI)
```
Use each guide's Python imports, or import the shared names you need from `network_config`. The [Python SDK](https://tempo.com/developers/docs/sdk/python) covers custom transactions, fee sponsorship, and access keys.
## HTTP requests
JSON-RPC reads use the Moderato RPC endpoint, `https://rpc.moderato.tempo.xyz`, without an API key.
Gas estimation (`eth_estimateGas`) needs the sender address and calldata. Run this block. It reads `TEMPO_SENDER_ADDRESS` and `TEMPO_RECIPIENT` and uses [Cast](https://tempo.com/developers/docs/sdk/foundry) to encode a one-AlphaUSD transfer as `CALL_DATA`:
```bash
export RPC_URL=https://rpc.moderato.tempo.xyz
export SENDER="$TEMPO_SENDER_ADDRESS"
export TOKEN=0x20c0000000000000000000000000000000000001
export CALL_DATA=$(cast calldata 'transfer(address,uint256)' "$TEMPO_RECIPIENT" 1000000)
```
JSON-RPC broadcasts transactions that are already signed, so the signing key stays in your application or wallet. For transaction submission, set `SIGNED_TX` to a hex-encoded signed transaction, such as the `signed.encode()` value in the Python `submit` helper. For receipt lookup, set `TX_HASH` to the returned transaction hash.
The [JSON-RPC reference](https://tempo.com/developers/docs/protocol/rpc) documents method behavior. The [hosted API](https://tempo.com/developers/docs/api) is a separate interface for indexed data and services.
> Source: [/docs/protocol/transactions](https://tempo.com/developers/docs/protocol/transactions.md)
> Section: [Tempo EVM](https://tempo.com/developers/docs/development.md). Build on Tempo EVM: wallets and keys, payments, transactions and fees, TIP-20 Tokens, contracts, exchange, network details, nodes, protocol specifications, and changelog.
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
# Tempo Transactions: protocol overview
Tempo Transactions use an [EIP-2718](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-2718.md) transaction envelope with native support for fee sponsorship, atomic calls, and delegated signing. Use this transaction type when building payments on Tempo.
For runnable SDK examples, see [Use Tempo Transactions](https://tempo.com/developers/docs/guide/tempo-transaction). For field definitions and encoding, see the [transaction specification](https://tempo.com/developers/docs/protocol/transactions/spec-tempo-transaction).
## Transaction capabilities
### Fee tokens
Pay fees with a supported USD-denominated TIP-20 token. When the fee payer's token differs from the validator's preferred token, the Fee AMM converts the fee. This does not convert the amount sent to a payment recipient. See [fee-token selection](https://tempo.com/developers/docs/protocol/fees/spec-fee#fee-token-preferences).
### Fee sponsorship
A separate fee payer can cover a transaction's fees while the sender authorizes its calls. See [Sponsor fees](https://tempo.com/developers/docs/api/fee-payer).
### Batch calls
One transaction can contain several calls that execute atomically: either all calls succeed or their changes are reverted. This differs from submitting independent transactions concurrently. See [Batch payments](https://tempo.com/developers/docs/guide/payments/send-a-payment#batch-payment-transactions).
### Access keys
Authorize another key to sign for the same account. Limited access keys have spending and call restrictions; admin keys delegate key management. See [Access keys](https://tempo.com/developers/docs/accounts/access-keys) for integration and [Account Keychain](https://tempo.com/developers/docs/protocol/transactions/AccountKeychain) for precompile behavior.
### Concurrent transactions
Submit independent transactions without waiting for a single sequential nonce stream. Each transaction has its own receipt and can succeed or fail independently. See [Send payments in parallel](https://tempo.com/developers/docs/guide/payments/send-parallel-transactions).
### Expiring nonces
Use expiring nonces for transactions with a bounded validity window and no application-managed sequential nonce. See the [SDK examples](https://tempo.com/developers/docs/guide/tempo-transaction#expiring-nonces) and [TIP-1093](https://github.com/tempoxyz/tempo/blob/main/tips/tip-1093.md).
### 2D nonces
Use separate nonce keys when your application needs independent, ordered transaction streams. See the [SDK examples](https://tempo.com/developers/docs/guide/tempo-transaction#2d-nonces), including how to distinguish otherwise identical transactions.
### Validity windows
Set `validAfter` and `validBefore` to bound when a transaction may be included. Your application still submits the transaction; these fields do not schedule a job or guarantee inclusion. See the [SDK examples](https://tempo.com/developers/docs/guide/tempo-transaction#validity-windows).
## Integrate Tempo Transactions
* [Send a payment](https://tempo.com/developers/docs/guide/payments/send-a-payment) for a stablecoin transfer.
* [Create an account](https://tempo.com/developers/docs/accounts/create) for signing methods and key setup.
* [Use Tempo Transactions](https://tempo.com/developers/docs/guide/tempo-transaction) for SDK examples of each capability.
* [Transaction specification](https://tempo.com/developers/docs/protocol/transactions/spec-tempo-transaction) for signatures, encoding, validation, and gas costs.
> Source: [/docs/protocol/transactions/spec-tempo-transaction](https://tempo.com/developers/docs/protocol/transactions/spec-tempo-transaction.md)
> Section: [Tempo EVM](https://tempo.com/developers/docs/development.md). Build on Tempo EVM: wallets and keys, payments, transactions and fees, TIP-20 Tokens, contracts, exchange, network details, nodes, protocol specifications, and changelog.
> [Documentation index](https://tempo.com/developers/llms.txt) · [Docs skill](https://tempo.com/developers/SKILL.md)
> Tempo MCP: Use `search`, `find_pages`, `read_page`, and `code` at `https://mcp.tempo.xyz` for Tempo and related documentation.
> If an indexed page is missing or reflects an older site, read this site’s [documentation index](https://tempo.com/developers/llms.txt) and Markdown pages directly.
[**Specification**](https://tempo.com/developers/docs/protocol)
# Tempo Transactions Specification
:::warning[T14 removes admin access keys]
From [T14](https://tempo.com/developers/docs/protocol/upgrades/t14), Tempo rejects new admin access keys. Existing ones can no longer manage keys but keep spending without limits, so revoke any you don't need.
:::
## Abstract
This spec introduces native protocol support for the following features, using Tempo Transactions:
* WebAuthn/P256 signature validation - enables passkey signing
* Parallelizable nonces - allows higher tx throughput for each account
* Gas sponsorship - allows apps to pay for their users' transactions
* Call Batching - allows users to multicall efficiently and atomically
* Validity windows - specify the earliest and latest times a transaction may be included
* Access Keys - allow a sender's key to provision scoped access keys with spending limits or admin access keys for key management
## Motivation
Current accounts are limited to secp256k1 signatures and sequential nonces, creating UX and scalability challenges.\
Users cannot leverage modern authentication methods like passkeys, applications face throughput limitations due to sequential nonces.
## Specification
### Transaction Type
A new EIP-2718 transaction type is introduced with type byte `0x76`:
```rust
pub struct TempoTransaction {
// Standard EIP-1559 fields
chain_id: ChainId, // EIP-155 replay protection
max_priority_fee_per_gas: u128,
max_fee_per_gas: u128,
gas_limit: u64,
calls: Vec, // Batch of calls to execute atomically
access_list: AccessList, // EIP-2930 access list
// nonce-related fields
nonce_key: U256, // 0 = protocol nonce; uint256.max = expiring nonce; other keys = sequences
nonce: u64, // Current nonce value for the nonce key
// Optional features
fee_token: Option, // Optional fee token preference
fee_payer_signature: Option, // Sponsored transactions (secp256k1 only)
valid_before: Option, // Transaction expiration timestamp (seconds)
valid_after: Option, // Transaction can only be included after this timestamp (seconds)
key_authorization: Option, // Access key authorization (optional)
aa_authorization_list: Vec