From 83f3665bfa442fe023c90b74c99ca9e7a8fd076e Mon Sep 17 00:00:00 2001 From: Derek Cofausper <256792747+decofe@users.noreply.github.com> Date: Fri, 10 Apr 2026 09:32:17 +0000 Subject: [PATCH 01/11] docs: add Foundry MPP integration guide Co-authored-by: 0xrusowsky <90208954+0xrusowsky@users.noreply.github.com> Amp-Thread-ID: https://ampcode.com/threads/T-019d76b5-e92a-7588-87bc-4969a2f98a2d --- src/pages/guide/machine-payments/foundry.mdx | 242 +++++++++++++++++++ src/pages/guide/machine-payments/index.mdx | 7 + vocs.config.ts | 4 + 3 files changed, 253 insertions(+) create mode 100644 src/pages/guide/machine-payments/foundry.mdx diff --git a/src/pages/guide/machine-payments/foundry.mdx b/src/pages/guide/machine-payments/foundry.mdx new file mode 100644 index 00000000..39cc3336 --- /dev/null +++ b/src/pages/guide/machine-payments/foundry.mdx @@ -0,0 +1,242 @@ +--- +title: Foundry Integration +description: Use Foundry tools (cast, forge, anvil, chisel) with MPP-gated RPC endpoints on Tempo — automatic 402 handling with zero config. +--- + +import { Card, Cards } from 'vocs' + +# Foundry integration + +[Tempo Foundry](https://github.com/tempoxyz/tempo-foundry) extends Foundry with native MPP support. When an RPC endpoint returns `402 Payment Required`, Foundry automatically handles the payment challenge — no wrapper scripts, no middleware, no code changes. + +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 it works + +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](/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. **Key discovery** — Foundry reads your signing key from `$TEMPO_HOME/wallet/keys.toml` (default `~/.tempo/wallet/keys.toml`) or the `TEMPO_PRIVATE_KEY` env var. +4. **Channel open** — If no payment channel exists, Foundry opens one on-chain with a deposit (default: `100,000` base units). This is a one-time on-chain lockup — unused balance remains in the channel. +5. **Voucher payment** — Foundry signs an off-chain voucher against the open channel and retries the request with an `Authorization: Payment` header. +6. **Channel reuse** — Subsequent requests reuse the same channel. Channel state is persisted to `$TEMPO_HOME/foundry/channels.json` (default `~/.tempo/foundry/channels.json`) across process invocations. + +:::tip +Channel reuse means the first call to an MPP endpoint has roughly one confirmation of overhead (~500ms on Tempo), but all subsequent calls add near-zero latency. +::: + +## Setup + +::::steps + +### Install the Tempo CLI + +```bash +curl -fsSL https://tempo.xyz/install | bash +``` + +### Install Tempo Foundry + +Tempo's fork is installed through the standard `foundryup` using the `-n tempo` flag: + +```bash +foundryup -n tempo +``` + +All standard Foundry commands work as before — MPP activates only when an endpoint returns `402`. + +### Configure your wallet + +```bash +tempo wallet login +``` + +This creates `~/.tempo/wallet/keys.toml` with your signing key. Foundry discovers this key automatically on the first `402` response. + +Alternatively, set the `TEMPO_PRIVATE_KEY` environment variable: + +```bash +export TEMPO_PRIVATE_KEY=0xabc…123 +``` + +### 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 +``` + +:::: + +## Examples + +### 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 0x20c0000000000000000000000000000000000000 \ + "balanceOf(address)(uint256)" 0xYourAddress \ + --rpc-url https://rpc.mpp.tempo.xyz +``` + +### 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 +``` + +### forge test with forks + +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 +``` + +### 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 +``` + +### chisel + +Interactive REPL against a paid endpoint: + +```bash +chisel --fork-url https://rpc.mpp.tempo.xyz +``` + +``` +➜ block.number +Type: uint256 +├ Hex: 0x... +└ Decimal: 1234567 +``` + +## Configuration + +### Deposit amount + +Set the fallback deposit amount used when the server does not suggest one: + +```bash +export MPP_DEPOSIT=500000 +cast block-number --rpc-url https://rpc.mpp.tempo.xyz +``` + +The deposit determines how many RPC calls you can make before the channel needs a top-up. When a channel is exhausted, Foundry automatically tops it up. + +### Key discovery + +Foundry discovers MPP signing keys in this order: + +1. **`TEMPO_PRIVATE_KEY`** env var — highest priority, no keychain metadata +2. **`$TEMPO_HOME/wallet/keys.toml`** — created by `tempo wallet login`, includes keychain signing mode and authorized signer metadata + +Within `keys.toml`, the key selection priority is: +- Passkey entries first +- Entries with an inline private key second +- First entry as fallback + +Foundry needs a usable inline private key — entries without one are skipped. + +When the server offers multiple chains or currencies, Foundry picks the first key that matches both the chain ID and currency from the challenge. + +### Channel persistence + +Open channels are saved to `$TEMPO_HOME/foundry/channels.json` (default `~/.tempo/foundry/channels.json`). This allows channel reuse across process invocations — you won't re-open a channel every time you run `cast` or `forge`. + +Channels are automatically evicted when fully spent or closed. If the server restarts and returns `410 Gone`, Foundry clears stale local state and opens a fresh channel on the next request. + +## Testnet + +Use the Moderato testnet MPP endpoint for development: + +```bash +# Testnet +cast block-number --rpc-url https://rpc.mpp.moderato.tempo.xyz + +# Mainnet +cast block-number --rpc-url https://rpc.mpp.tempo.xyz +``` + +Fund your testnet wallet with `tempo wallet fund` before making requests. + +## Troubleshooting + +| Error | Cause | Fix | +|---|---|---| +| `tempo: command not found` | Tempo CLI not installed | Run `curl -fsSL https://tempo.xyz/install \| bash` | +| `no supported MPP challenge` | Missing wallet key or wrong chain/currency | Run `tempo wallet login` or check `keys.toml` | +| `410 Gone` | Stale local channel state | Re-run the command — Foundry clears stale state and opens a fresh channel | + +## Next steps + + + + + + diff --git a/src/pages/guide/machine-payments/index.mdx b/src/pages/guide/machine-payments/index.mdx index b6984474..0400d782 100644 --- a/src/pages/guide/machine-payments/index.mdx +++ b/src/pages/guide/machine-payments/index.mdx @@ -100,6 +100,12 @@ Two [intents](https://mpp.dev/protocol#payment-intents) are available on Tempo: description="Session-based billing with off-chain vouchers" to="/guide/machine-payments/pay-as-you-go" /> + ## SDKs and tools @@ -110,6 +116,7 @@ Two [intents](https://mpp.dev/protocol#payment-intents) are available on Tempo: | TypeScript | [`mppx`](https://github.com/wevm/mppx) | `npm install mppx viem` | | Python | [`pympp`](https://github.com/tempoxyz/pympp) | `pip install pympp` | | Rust | [`mpp-rs`](https://github.com/tempoxyz/mpp-rs) | `cargo add mpp` | +| Foundry | [`tempo-foundry`](https://github.com/tempoxyz/tempo-foundry) | `foundryup -n tempo` | See the [full SDK documentation](https://mpp.dev/sdk) for API reference and advanced usage. diff --git a/vocs.config.ts b/vocs.config.ts index 72e0861a..7347cf0a 100644 --- a/vocs.config.ts +++ b/vocs.config.ts @@ -242,6 +242,10 @@ export default defineConfig({ text: 'Accept streamed payments', link: '/guide/machine-payments/streamed-payments', }, + { + text: 'Foundry integration', + link: '/guide/machine-payments/foundry', + }, { text: 'Use Cases', collapsed: true, From 63947193bd0e2b3dc11593ffa93a7b1e82d591b9 Mon Sep 17 00:00:00 2001 From: Derek Cofausper <256792747+decofe@users.noreply.github.com> Date: Fri, 10 Apr 2026 09:36:44 +0000 Subject: [PATCH 02/11] docs: link Foundry SDK page to MPP integration guide Co-Authored-By: 0xrusowsky <90208954+0xrusowsky@users.noreply.github.com> Amp-Thread-ID: https://ampcode.com/threads/T-019d76b5-e92a-7588-87bc-4969a2f98a2d --- src/pages/sdk/foundry/index.mdx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/pages/sdk/foundry/index.mdx b/src/pages/sdk/foundry/index.mdx index 18c284e3..013b9c29 100644 --- a/src/pages/sdk/foundry/index.mdx +++ b/src/pages/sdk/foundry/index.mdx @@ -315,4 +315,8 @@ The following flags are available for `cast` and `forge script` for Tempo-specif Ledger and Trezor wallets are not yet compatible with any `--tempo.*` option. +## MPP integration + +Tempo Foundry includes built-in support for [MPP (Machine Payments Protocol)](/guide/machine-payments) — all Foundry tools automatically handle `402 Payment Required` responses from MPP-gated RPC endpoints. See the [Foundry MPP integration guide](/guide/machine-payments/foundry) for setup, examples, and configuration. + From 53874d970c5fb7f46c5a7ddedb3727bfdac16554 Mon Sep 17 00:00:00 2001 From: Derek Cofausper <256792747+decofe@users.noreply.github.com> Date: Fri, 10 Apr 2026 09:52:49 +0000 Subject: [PATCH 03/11] docs: move Foundry MPP page to sdk/foundry/mpp Co-authored-by: 0xrusowsky <90208954+0xrusowsky@users.noreply.github.com> Amp-Thread-ID: https://ampcode.com/threads/T-019d76b5-e92a-7588-87bc-4969a2f98a2d --- src/pages/guide/machine-payments/index.mdx | 2 +- src/pages/sdk/foundry/index.mdx | 2 +- .../foundry.mdx => sdk/foundry/mpp.mdx} | 0 vocs.config.ts | 21 ++++++++++++++----- 4 files changed, 18 insertions(+), 7 deletions(-) rename src/pages/{guide/machine-payments/foundry.mdx => sdk/foundry/mpp.mdx} (100%) diff --git a/src/pages/guide/machine-payments/index.mdx b/src/pages/guide/machine-payments/index.mdx index 0400d782..f034fadf 100644 --- a/src/pages/guide/machine-payments/index.mdx +++ b/src/pages/guide/machine-payments/index.mdx @@ -104,7 +104,7 @@ Two [intents](https://mpp.dev/protocol#payment-intents) are available on Tempo: icon="lucide:hammer" title="Foundry integration" description="Use cast, forge, anvil, and chisel with MPP-gated endpoints" - to="/guide/machine-payments/foundry" + to="/sdk/foundry/mpp" /> diff --git a/src/pages/sdk/foundry/index.mdx b/src/pages/sdk/foundry/index.mdx index 013b9c29..5bb5bff0 100644 --- a/src/pages/sdk/foundry/index.mdx +++ b/src/pages/sdk/foundry/index.mdx @@ -317,6 +317,6 @@ Ledger and Trezor wallets are not yet compatible with any `--tempo.*` option. ## MPP integration -Tempo Foundry includes built-in support for [MPP (Machine Payments Protocol)](/guide/machine-payments) — all Foundry tools automatically handle `402 Payment Required` responses from MPP-gated RPC endpoints. See the [Foundry MPP integration guide](/guide/machine-payments/foundry) for setup, examples, and configuration. +Tempo Foundry includes built-in support for [MPP (Machine Payments Protocol)](/guide/machine-payments) — all Foundry tools automatically handle `402 Payment Required` responses from MPP-gated RPC endpoints. See the [Foundry MPP integration guide](/sdk/foundry/mpp) for setup, examples, and configuration. diff --git a/src/pages/guide/machine-payments/foundry.mdx b/src/pages/sdk/foundry/mpp.mdx similarity index 100% rename from src/pages/guide/machine-payments/foundry.mdx rename to src/pages/sdk/foundry/mpp.mdx diff --git a/vocs.config.ts b/vocs.config.ts index 7347cf0a..a66cd3cc 100644 --- a/vocs.config.ts +++ b/vocs.config.ts @@ -242,10 +242,6 @@ export default defineConfig({ text: 'Accept streamed payments', link: '/guide/machine-payments/streamed-payments', }, - { - text: 'Foundry integration', - link: '/guide/machine-payments/foundry', - }, { text: 'Use Cases', collapsed: true, @@ -686,7 +682,17 @@ export default defineConfig({ }, { text: 'Foundry', - link: '/sdk/foundry', + collapsed: true, + items: [ + { + text: 'Overview', + link: '/sdk/foundry', + }, + { + text: 'MPP integration', + link: '/sdk/foundry/mpp', + }, + ], }, { text: 'Python', @@ -1108,6 +1114,11 @@ export default defineConfig({ { text: 'Wallet', link: 'https://wallet.tempo.xyz' }, ], redirects: [ + { + source: '/guide/machine-payments/foundry', + destination: '/sdk/foundry/mpp', + status: 301, + }, { source: '/documentation/protocol/:path*', destination: '/protocol/:path*', From 82b9941706f61ea3f40e1b170074d2c1429aebaa Mon Sep 17 00:00:00 2001 From: Derek Cofausper <256792747+decofe@users.noreply.github.com> Date: Fri, 10 Apr 2026 09:54:54 +0000 Subject: [PATCH 04/11] docs: revert unrelated changes to index and config files Co-authored-by: 0xrusowsky <90208954+0xrusowsky@users.noreply.github.com> Amp-Thread-ID: https://ampcode.com/threads/T-019d76b5-e92a-7588-87bc-4969a2f98a2d --- src/pages/guide/machine-payments/index.mdx | 7 ------- src/pages/sdk/foundry/index.mdx | 4 ---- vocs.config.ts | 17 +---------------- 3 files changed, 1 insertion(+), 27 deletions(-) diff --git a/src/pages/guide/machine-payments/index.mdx b/src/pages/guide/machine-payments/index.mdx index f034fadf..b6984474 100644 --- a/src/pages/guide/machine-payments/index.mdx +++ b/src/pages/guide/machine-payments/index.mdx @@ -100,12 +100,6 @@ Two [intents](https://mpp.dev/protocol#payment-intents) are available on Tempo: description="Session-based billing with off-chain vouchers" to="/guide/machine-payments/pay-as-you-go" /> - ## SDKs and tools @@ -116,7 +110,6 @@ Two [intents](https://mpp.dev/protocol#payment-intents) are available on Tempo: | TypeScript | [`mppx`](https://github.com/wevm/mppx) | `npm install mppx viem` | | Python | [`pympp`](https://github.com/tempoxyz/pympp) | `pip install pympp` | | Rust | [`mpp-rs`](https://github.com/tempoxyz/mpp-rs) | `cargo add mpp` | -| Foundry | [`tempo-foundry`](https://github.com/tempoxyz/tempo-foundry) | `foundryup -n tempo` | See the [full SDK documentation](https://mpp.dev/sdk) for API reference and advanced usage. diff --git a/src/pages/sdk/foundry/index.mdx b/src/pages/sdk/foundry/index.mdx index 5bb5bff0..18c284e3 100644 --- a/src/pages/sdk/foundry/index.mdx +++ b/src/pages/sdk/foundry/index.mdx @@ -315,8 +315,4 @@ The following flags are available for `cast` and `forge script` for Tempo-specif Ledger and Trezor wallets are not yet compatible with any `--tempo.*` option. -## MPP integration - -Tempo Foundry includes built-in support for [MPP (Machine Payments Protocol)](/guide/machine-payments) — all Foundry tools automatically handle `402 Payment Required` responses from MPP-gated RPC endpoints. See the [Foundry MPP integration guide](/sdk/foundry/mpp) for setup, examples, and configuration. - diff --git a/vocs.config.ts b/vocs.config.ts index a66cd3cc..72e0861a 100644 --- a/vocs.config.ts +++ b/vocs.config.ts @@ -682,17 +682,7 @@ export default defineConfig({ }, { text: 'Foundry', - collapsed: true, - items: [ - { - text: 'Overview', - link: '/sdk/foundry', - }, - { - text: 'MPP integration', - link: '/sdk/foundry/mpp', - }, - ], + link: '/sdk/foundry', }, { text: 'Python', @@ -1114,11 +1104,6 @@ export default defineConfig({ { text: 'Wallet', link: 'https://wallet.tempo.xyz' }, ], redirects: [ - { - source: '/guide/machine-payments/foundry', - destination: '/sdk/foundry/mpp', - status: 301, - }, { source: '/documentation/protocol/:path*', destination: '/protocol/:path*', From c7deab091550b6ffce4eb0388379c9fe04e10567 Mon Sep 17 00:00:00 2001 From: Derek Cofausper <256792747+decofe@users.noreply.github.com> Date: Fri, 10 Apr 2026 14:22:34 +0000 Subject: [PATCH 05/11] =?UTF-8?q?docs:=20address=20review=20=E2=80=94=20me?= =?UTF-8?q?ntion=20multi-challenge=20selection=20and=20auto=20top-up?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: 0xrusowsky <90208954+0xrusowsky@users.noreply.github.com> Amp-Thread-ID: https://ampcode.com/threads/T-019d76b5-e92a-7588-87bc-4969a2f98a2d --- src/pages/sdk/foundry/mpp.mdx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/pages/sdk/foundry/mpp.mdx b/src/pages/sdk/foundry/mpp.mdx index 39cc3336..93061157 100644 --- a/src/pages/sdk/foundry/mpp.mdx +++ b/src/pages/sdk/foundry/mpp.mdx @@ -22,9 +22,9 @@ When you point any Foundry tool at an MPP-gated RPC URL, the built-in transport 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. **Key discovery** — Foundry reads your signing key from `$TEMPO_HOME/wallet/keys.toml` (default `~/.tempo/wallet/keys.toml`) or the `TEMPO_PRIVATE_KEY` env var. +3. **Key discovery** — Foundry reads your signing key from `$TEMPO_HOME/wallet/keys.toml` (default `~/.tempo/wallet/keys.toml`) or the `TEMPO_PRIVATE_KEY` env var. If the server offers multiple payment challenges (e.g. different chains or currencies), Foundry automatically picks the one matching your key's chain ID and spending allowance. 4. **Channel open** — If no payment channel exists, Foundry opens one on-chain with a deposit (default: `100,000` base units). This is a one-time on-chain lockup — unused balance remains in the channel. -5. **Voucher payment** — Foundry signs an off-chain voucher against the open channel and retries the request with an `Authorization: Payment` header. +5. **Voucher payment** — Foundry signs an off-chain voucher against the open channel and retries the request with an `Authorization: Payment` header. When a channel's deposit is exhausted, Foundry automatically tops it up on-chain so requests continue without interruption. 6. **Channel reuse** — Subsequent requests reuse the same channel. Channel state is persisted to `$TEMPO_HOME/foundry/channels.json` (default `~/.tempo/foundry/channels.json`) across process invocations. :::tip From 15656a515871d32971fad5490f38c69f52a08dcb Mon Sep 17 00:00:00 2001 From: Jennifer Date: Tue, 14 Apr 2026 15:32:28 +0100 Subject: [PATCH 06/11] Apply suggestions from code review Co-authored-by: Jennifer --- src/pages/sdk/foundry/mpp.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/sdk/foundry/mpp.mdx b/src/pages/sdk/foundry/mpp.mdx index 93061157..994abc42 100644 --- a/src/pages/sdk/foundry/mpp.mdx +++ b/src/pages/sdk/foundry/mpp.mdx @@ -5,7 +5,7 @@ description: Use Foundry tools (cast, forge, anvil, chisel) with MPP-gated RPC e import { Card, Cards } from 'vocs' -# Foundry integration +# Use MPP with Foundry [Tempo Foundry](https://github.com/tempoxyz/tempo-foundry) extends Foundry with native MPP support. When an RPC endpoint returns `402 Payment Required`, Foundry automatically handles the payment challenge — no wrapper scripts, no middleware, no code changes. From 562a3e4f055adf40cbd5af9aabdd9475b6275f83 Mon Sep 17 00:00:00 2001 From: jenpaff Date: Tue, 14 Apr 2026 15:54:47 +0100 Subject: [PATCH 07/11] docs: add Foundry MPP page to sidebar Co-Authored-By: Jennifer <5339211+jenpaff@users.noreply.github.com> --- vocs.config.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/vocs.config.ts b/vocs.config.ts index 72e0861a..246c18de 100644 --- a/vocs.config.ts +++ b/vocs.config.ts @@ -682,7 +682,17 @@ export default defineConfig({ }, { text: 'Foundry', - link: '/sdk/foundry', + collapsed: true, + items: [ + { + text: 'Overview', + link: '/sdk/foundry', + }, + { + text: 'Use MPP with Foundry', + link: '/sdk/foundry/mpp', + }, + ], }, { text: 'Python', From 87b3730a7cb8569e84754f485cd497b26546b574 Mon Sep 17 00:00:00 2001 From: 0xrusowsky <90208954+0xrusowsky@users.noreply.github.com> Date: Tue, 14 Apr 2026 17:01:48 +0200 Subject: [PATCH 08/11] Update src/pages/sdk/foundry/mpp.mdx Co-authored-by: Derek Cofausper <256792747+decofe@users.noreply.github.com> --- src/pages/sdk/foundry/mpp.mdx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/pages/sdk/foundry/mpp.mdx b/src/pages/sdk/foundry/mpp.mdx index 994abc42..791ae6fc 100644 --- a/src/pages/sdk/foundry/mpp.mdx +++ b/src/pages/sdk/foundry/mpp.mdx @@ -24,7 +24,8 @@ When you point any Foundry tool at an MPP-gated RPC URL, the built-in transport 2. **402 challenge** — The server responds with `402 Payment Required` and a `WWW-Authenticate: Payment` header describing the price. 3. **Key discovery** — Foundry reads your signing key from `$TEMPO_HOME/wallet/keys.toml` (default `~/.tempo/wallet/keys.toml`) or the `TEMPO_PRIVATE_KEY` env var. If the server offers multiple payment challenges (e.g. different chains or currencies), Foundry automatically picks the one matching your key's chain ID and spending allowance. 4. **Channel open** — If no payment channel exists, Foundry opens one on-chain with a deposit (default: `100,000` base units). This is a one-time on-chain lockup — unused balance remains in the channel. -5. **Voucher payment** — Foundry signs an off-chain voucher against the open channel and retries the request with an `Authorization: Payment` header. When a channel's deposit is exhausted, Foundry automatically tops it up on-chain so requests continue without interruption. +5. **Voucher payment** — Foundry signs an off-chain voucher against the open channel and retries the request with an `Authorization: Payment` header. +6. **Auto top-up** — When a channel's deposit is exhausted, Foundry sends a top-up transaction. The server accepts it with `204 No Content`, then Foundry signs a fresh voucher and retries automatically. 6. **Channel reuse** — Subsequent requests reuse the same channel. Channel state is persisted to `$TEMPO_HOME/foundry/channels.json` (default `~/.tempo/foundry/channels.json`) across process invocations. :::tip From 84cf49621d5651e29a41951a72c3f795e53f9c25 Mon Sep 17 00:00:00 2001 From: 0xrusowsky <90208954+0xrusowsky@users.noreply.github.com> Date: Tue, 14 Apr 2026 17:02:02 +0200 Subject: [PATCH 09/11] Update src/pages/sdk/foundry/mpp.mdx Co-authored-by: Derek Cofausper <256792747+decofe@users.noreply.github.com> --- src/pages/sdk/foundry/mpp.mdx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/pages/sdk/foundry/mpp.mdx b/src/pages/sdk/foundry/mpp.mdx index 791ae6fc..fc94478d 100644 --- a/src/pages/sdk/foundry/mpp.mdx +++ b/src/pages/sdk/foundry/mpp.mdx @@ -33,7 +33,11 @@ Channel reuse means the first call to an MPP endpoint has roughly one confirmati ::: ## 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 From eece1d4d1d230c5918c97999d4b5b2618f4ff4de Mon Sep 17 00:00:00 2001 From: 0xrusowsky <90208954+0xrusowsky@users.noreply.github.com> Date: Tue, 14 Apr 2026 17:02:17 +0200 Subject: [PATCH 10/11] Update src/pages/sdk/foundry/mpp.mdx Co-authored-by: Derek Cofausper <256792747+decofe@users.noreply.github.com> --- src/pages/sdk/foundry/mpp.mdx | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/pages/sdk/foundry/mpp.mdx b/src/pages/sdk/foundry/mpp.mdx index fc94478d..10fe2f66 100644 --- a/src/pages/sdk/foundry/mpp.mdx +++ b/src/pages/sdk/foundry/mpp.mdx @@ -240,7 +240,10 @@ Fund your testnet wallet with `tempo wallet fund` before making requests. /> From 21b5cbe4ce1763a767076b276841a82c8f80acec Mon Sep 17 00:00:00 2001 From: 0xrusowsky <90208954+0xrusowsky@users.noreply.github.com> Date: Tue, 14 Apr 2026 17:02:24 +0200 Subject: [PATCH 11/11] Update src/pages/sdk/foundry/mpp.mdx Co-authored-by: Derek Cofausper <256792747+decofe@users.noreply.github.com> --- src/pages/sdk/foundry/mpp.mdx | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/pages/sdk/foundry/mpp.mdx b/src/pages/sdk/foundry/mpp.mdx index 10fe2f66..a9d073fb 100644 --- a/src/pages/sdk/foundry/mpp.mdx +++ b/src/pages/sdk/foundry/mpp.mdx @@ -206,7 +206,15 @@ Channels are automatically evicted when fully spent or closed. If the server res Use the Moderato testnet MPP endpoint for development: ```bash -# Testnet +### Channel persistence + +Open channels are saved to `$TEMPO_HOME/foundry/channels.json` (default `~/.tempo/foundry/channels.json`). This allows channel reuse across process invocations — you won't re-open a channel every time you run `cast` or `forge`. + +Channels are automatically evicted when fully spent or closed. If the server restarts and returns `410 Gone`, Foundry clears stale local state and opens a fresh channel on the next request. + +### Gas sponsorship + +Some MPP endpoints sponsor gas fees on behalf of the caller. When the server's challenge includes a `feePayer` flag, Foundry delegates gas payment to the server — no TEMPO balance needed for gas. cast block-number --rpc-url https://rpc.mpp.moderato.tempo.xyz # Mainnet