Skip to main content
This first Sauce SDK walkthrough uses the sauce command to prepare a USDC payment on Base. You will write a program, compile it, simulate both success and failure, and build an unsigned transaction. None of that needs a wallet or a key. Creating a wallet and sending the transaction are the optional final steps. If you want the concepts first, read the introduction to Sauce. For other tasks, browse the Sauce SDK quickstarts. The program runs on a Pot, an account that holds its funds. A cook is the transaction that runs the program. A Pot belongs to an owner, an address that is the only account that can send its cooks. Simulating and building a cook only need the owner’s address. You pass it with --owner. Compilation, simulation and transaction building do not sign or send transactions. To follow the same workflow through a coding agent, see AI agents.

Prerequisites

  • Node.js 24 or newer, a terminal, and the sauce command from Installation.
  • The release’s engine deployed on Base. Simulating, building and sending a cook need it, and sauce pot --chain base --owner <address> reports whether it is deployed.
  • For the optional send step: a wallet, 1 USDC on Base, and enough ETH on Base for gas and the Kitchen fee.
  • To send without real funds, run each step with --chain base-sepolia instead of --chain base. Base Sepolia is a supported testnet: its USDC is Circle’s testnet USDC and gas is testnet ETH. The program and commands are otherwise the same. See Testnets.
1

Write the program

pot is your Pot, available without declaring it, and pot.USDC is its USDC balance (Names).Save this as pay.sauce.ts:
pay.sauce.ts
  • main’s parameters are the program’s inputs. You pass them with --args, in order.
  • amount is in raw token units: USDC has 6 decimals, so 1000000 is 1 USDC.
  • USDC needs no import and no address: it resolves to USDC’s address on the chain you compile for.
  • require reverts the whole cook when its condition is false.
  • USDC.transfer pays from the Pot, with the checks of OpenZeppelin’s SafeERC20.
The commands below use two stand-in addresses. Replace them with your own whenever you like; any address works for simulation:
2

Compile it

The output is the program’s bytecode, one line of hex:
A mistake in the file prints an error with its line and column instead. The same file compiles for Solana with --chain solana.
3

Simulate it

This command does not sign or send anything:
  • It reads Base’s current state, through a built-in public endpoint unless you pass --rpc-url or --config.
  • It runs the cook as if the owner sent it, and derives the owner’s Pot from that address.
  • --assume-balance USDC:5 gives the Pot 5 USDC for this simulation only. It changes nothing on chain, and it is not a deposit: the real Pot still holds what it holds. Unlike --args, it takes whole tokens, so USDC:5 is 5 USDC, the same as 5000000 in raw units.
The transfers happen in order:
  • [1] The owner sends the fee to the Pot as the cook’s value.
  • [2] The Pot pays the Kitchen’s execution fee.
  • [3] The Pot pays 1 USDC to the recipient.
Because this Pot is not deployed yet, the simulation deploys it first, as sauce run would. Gas, fees and the block number depend on chain state when you run it, so your numbers will differ.Now give the Pot less than the amount:
The command exits with status 1. The require reverted the cook, so nothing would move. Add --expect-revert "not enough USDC" to make a revert like this the passing outcome (exit 0), for example in a script.
4

Build an unsigned transaction

sauce tx prints unsigned transactions as JSON. It takes the same --owner as the simulation, so the plan uses the same Pot:
If the Pot is not deployed yet, the command prints a plan of two transactions to send in order:
  1. the Kitchen’s deployPot, which any account may send;
  2. the cook, which only the owner may send.
Abridged example output (addresses and values vary):
The value of the cook is the Kitchen’s execution fee in wei, read from the chain. sendCalls holds both transactions as one batch, for a wallet that sends batches.Notes on stderr explain the prerequisites for sending. Because the Pot holds no USDC, a note says the cook would revert with not enough USDC. That is expected here: the plan is for a Pot you fund. Add --fund USDC:1 to put a transfer of 1 USDC from the owner into the Pot, after its deployment and before the cook. That transfer reverts unless the owner holds the USDC.You can stop here if you only want to build a transaction. To send it later, build it with --owner set to an address you control: only that account can send the cook.
5

Optional: create a wallet to send

Only sending needs a key. The owner you used above was a stand-in, so a Pot you fund and cook on must be the one your own wallet owns. Create a wallet:
The command asks for a password twice (at least 8 characters). It then writes an encrypted keystore to ~/.sauce/wallets/me.json and prints the address:
Your wallet will have its own address. Already have a key? Use sauce wallet import me <file> instead (sauce wallet). This is a hot wallet: keep small balances in it. A policy file can cap what it sends (Wallets, passwords and spending policy).Later commands select it with --wallet me, which names the owner in place of --owner. Simulate again from your wallet’s address to see the plan for your Pot, with no password and nothing sent:
The Pot address in the report is now your wallet’s Pot. sauce tx signs nothing and takes no --wallet: pass --owner $(sauce wallet address me) to rebuild the unsigned plan for it.
6

Optional: send with sauce run

This step spends real funds. Fund your wallet’s address (sauce wallet address me) with enough ETH on Base for gas and the Kitchen fee. Then read the current fee, and whether the engine and Kitchen are deployed and your Pot is:
The report states the Kitchen’s execution fee in wei and ETH. Read it from this command when you send, not from these docs. It changes, and on a testnet it can be 0 (sauce pot --chain base-sepolia --wallet me).Deploy your Pot, which sends the deployment and waits for the Pot’s code:
Send 1 USDC on Base to the "pot" address it prints. Deploy before you send funds: until the Pot is deployed, its address is a prediction that a Kitchen upgrade can move (Funding a Pot). Then:
sauce run then does the following:
  1. Asks for the wallet’s password.
  2. Checks the Pot. A Pot with no code yet is deployed first, after you approve it, in a transaction of its own.
  3. Simulates the cook, signs it, sends it and waits for the receipt.
  4. Prints the hash, the status and the gas used. If the cook reverts, it prints the decoded reason and exits with status 1.
--assume-balance is for sauce simulate only. sauce run uses the Pot’s real balance, so it reverts with not enough USDC until the Pot holds the USDC. For scripts or CI, configure a password source and explicit approvals as described in sauce run. The command stops when it needs an interactive answer that it cannot obtain.

What you built

  • The program compiled to bytecode for V12, the Sauce engine. The engine runs that bytecode; you do not deploy a separate contract for the program.
  • The cook is a transaction to the owner’s Pot. If you send it successfully, the Pot runs the program, pays the recipient and pays the Kitchen its fee.
  • If the require fails, the whole cook reverts and only the gas is spent. The program catches no failure, so any failed call would revert it the same way.
  • Tokens left in the Pot stay there until a later cook moves them.

Troubleshooting

  • The engine is not deployed: compilation still works, but simulation and execution require the matching release on Base. See deployment troubleshooting.
  • The program reports not enough USDC: an assumed balance applies only to simulation. Deploy and fund the Pot before sending, or use funding in the cook, which deploys the Pot first.
  • RPC calls fail: configure an endpoint with --rpc-url or --config. See endpoint troubleshooting.

Next steps