---
title: create_swap and the payment instruction, field by field
description: For an agent paying from its own wallet: the create_swap inputs and the payment instruction field by field: base units, decimals, contract, chainId, wallet URI.
url: https://sablebolt.io/blog/create-swap-for-an-agent-with-its-own-wallet
---

# create_swap for an agent with its own wallet: the payment instruction, field by field

Sablebolt Team 3 November 2026 9 min read

Contents

1. Who this is for
2. The inputs
3. What comes back
4. The payment instruction, field by field
5. Three worked instructions
6. Before sending: what the agent checks
7. Following the swap
8. When a swap cannot be completed
9. FAQ

Most swaps on sablebolt.io are made by a person: the form, two addresses, a deposit from the person's own wallet. This post is about the other case, a program that holds the keys of the wallet the deposit comes from and needs the facts a wallet needs, in the units a wallet uses. For it there is one tool, `create_swap` on the MCP endpoint ( `POST /v1/swaps` in the REST API), and it answers with a payment instruction. Here it is field by field, with three worked examples, the checks before broadcasting and how to follow the swap. The overview is [how Sablebolt talks to machines](https://sablebolt.io/blog/how-sablebolt-talks-to-machines) ; connecting a client is [the connection guide](https://sablebolt.io/blog/connect-sablebolt-to-claude-cursor-and-chatgpt) ; the reference page is [/developers](https://sablebolt.io/developers) .

## Who this is for

An agent with its own wallet: software that controls a private key and will pay the deposit itself. One example is an agent paying a [payment link](https://sablebolt.io/pay) from a treasury wallet it holds.

Everyone else uses the page: an assistant prepares the route, the amount and the address checks, then hands over with `get_swap_page_link` , and the person creates the swap in the form and sends from their own wallet. The tool's description says it: "Use it only when you control the wallet at fromAddress and will send the deposit yourself; for a person use get_swap_page_link." The tool is marked not read-only and not idempotent; calling it twice creates two swaps.

## The inputs

| Field | Required | What it is |
|---|---|---|
| from | yes | the slug of the asset you send, e.g. `usdt-trc20` ; the slug names the network |
| to | yes | the slug of the asset to receive, e.g. `btc` |
| amount | yes | the amount of `from` you will send, a decimal string within `get_limits` |
| fromAddress | yes | the address the deposit will come from, on the `from` network: a wallet you control |
| toAddress | yes | the receiving address on the `to` network |
| extraId | only where `to` has one | the receiving side's memo or tag: XRP uses a Destination Tag, USDT on TON a Payment ID |
| fromExtraId | only where `from` has one | the sending side's extra id, if your wallet attaches one |

Why the sender address is required: it is the one address the service knows on the sending side. A fixed-rate swap also takes refundAddress. Missing or wrong for the asset, the answer is a tool error with the code `invalid_sender_address` (a 400 over REST).

≈ 21–44 min 2 confirmations on Bitcoin

[Swap BTC to USDT TRC-20](https://sablebolt.io/swap/btc/usdt-trc20)

## What comes back

The swap: `id` , `depositAddress` , `depositExtraId` , `payoutAddress` , `amountFrom` , `expectedTo` (the estimate before the payout network fee), `networkFee` , `receiveAmount` (expectedTo − networkFee), `createdAt` , `statusUrl` and `payment` ; REST answers 201 with the same object under `data` . The rate floats: the final amount is set when the deposit confirms. `payment` exists while the swap waits for its deposit (stage 1) and is `null` afterwards.

## The payment instruction, field by field

| Field | Type | What it holds |
|---|---|---|
| asset, ticker, name | string | the asset to send: usdt-trc20, USDT, Tether |
| network | string or null | the token's network label, e.g. "TRON (TRC-20)"; null for a chain's own coin |
| chain | string | the chain code: bitcoin, tron, ethereum, binance_smart_chain, solana, ton, monero |
| chainId | integer or null | the EVM chain id; null off the EVM chains |
| tokenContract | string or null | the token contract or mint as listed by the liquidity provider; null for a chain's own coin or when not listed |
| decimals | integer or null | the decimals as listed; null when not listed (a chain's own EVM coin falls back to 18), or when the listing disagrees with the protocol constant |
| address | string | the one-time deposit address |
| extraId, extraIdName | string or null | the memo the deposit must carry, and its name on that chain |
| amount | decimal string | the exact amount to send |
| amountBaseUnits | string or null | the same amount in base units (satoshi, wei, sun), rounded up at the last unit; null when the decimals are unknown |
| uri, uriStandard | string or null | a wallet URI where a public standard exists, and the standard's name |
| note | string | the one rule, in words |

**Base units and the round-up rule.** `amountBaseUnits` is `amount` shifted by `decimals` : 0.0125 BTC with 8 decimals is 1250000 satoshi. When `amount` has more decimal places than the asset, the integer is rounded up at the last unit, never down: 12.3456789 USDT with 6 decimals becomes 12345679, not 12345678, so the deposit is never short.

**chainId.** The EVM chains are told apart by their chain id.

| chainId | Chain |
|---|---|
| 1 | Ethereum |
| 56 | BNB Smart Chain |
| 137 | Polygon |
| 8453 | Base |
| 42161 | Arbitrum |
| 10 | Optimism |
| 43114 | Avalanche C-Chain |
| 999 | HyperEVM |

**The wallet URI.** Where a public standard exists the instruction carries a link; where none exists, `uri` is null and the agent builds the transaction from the fields.

| Standard | Applies to | Shape |
|---|---|---|
| BIP-21 | BTC, LTC, DOGE | `bitcoin:<address>?amount=<decimal>` (litecoin:, dogecoin:) |
| Monero URI | XMR | `monero:<address>?tx_amount=<decimal>` |
| ERC-681, native value | ETH, BNB, POL and the other EVM coins | `ethereum:<address>@<chainId>?value=<base units>` |
| ERC-681, token transfer | ERC-20, BEP-20 and other EVM tokens | `ethereum:<contract>@<chainId>/transfer?address=<deposit address>&uint256=<base units>` |
| Solana Pay | SOL and SPL tokens | `solana:<address>?amount=<decimal>` , plus `&spl-token=<mint>` for a token |
| TON transfer | GRAM | `ton://transfer/<address>?amount=<base units>&text=<memo>` |
| none | TRON, XRP, Zcash and others | build from address, extraId and amount |

## Three worked instructions

The deposit addresses are shortened, since each is generated for one swap; the two contracts are Tether's, checked against Tether's list of supported protocols on 5 October 2026 ( [USDT page](https://sablebolt.io/coin/tether) ). Minimums were read with `get_limits` on 3 November 2026 at 13:29 UTC.

### A Bitcoin deposit: 0.0125 BTC for BTC → USDT TRC-20

The route is [BTC → USDT TRC-20](https://sablebolt.io/swap/btc/usdt-trc20) ; its minimum was 0.00038784 BTC.

| Field | Value |
|---|---|
| asset, ticker, name | btc, BTC, Bitcoin |
| network, chain, chainId | null, bitcoin, null |
| tokenContract, decimals | null, 8 |
| address | bc1q… (one-time, shortened here) |
| extraId, extraIdName | null, null |
| amount | 0.0125 |
| amountBaseUnits | 1250000 |
| uri, uriStandard | `bitcoin:bc1q…?amount=0.0125` , BIP-21 |
| note | Send exactly 0.0125 BTC on Bitcoin in one transaction from the sending address you gave. The swap starts after 2 confirmations. Anything else sent to this address is not credited automatically. |

### A USDT deposit on TRON: 250 USDT for USDT TRC-20 → BTC

The route is [USDT TRC-20 → BTC](https://sablebolt.io/swap/usdt-trc20/btc) ; its minimum was 30.04259 USDT. TRON has no URI standard, so the agent builds the TRC-20 transfer itself.

| Field | Value |
|---|---|
| asset, ticker, name | usdt-trc20, USDT, Tether |
| network, chain, chainId | TRON (TRC-20), tron, null |
| tokenContract | TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t, as listed |
| decimals | 6 |
| address | T… (34 characters, one-time) |
| extraId, extraIdName | null, null |
| amount | 250 |
| amountBaseUnits | 250000000 |
| uri, uriStandard | null, null |
| note | Send exactly 250 USDT on TRON in one transaction from the sending address you gave. The swap starts after 1 confirmation. Anything else sent to this address is not credited automatically. |

The TRC-20 transfer costs energy or TRX from the sending wallet ( [TRON energy and bandwidth](https://sablebolt.io/blog/tron-energy-and-bandwidth) ).

### An ERC-20 deposit: 250 USDT on Ethereum for USDT ERC-20 → BTC

The route is [USDT ERC-20 → BTC](https://sablebolt.io/swap/usdt-erc20/btc) ; its minimum was 30.042667 USDT.

| Field | Value |
|---|---|
| asset, ticker, name | usdt-erc20, USDT, Tether |
| network, chain, chainId | Ethereum (ERC-20), ethereum, 1 |
| tokenContract | 0xdAC17F958D2ee523a2206206994597C13D831ec7, as listed |
| decimals | 6 |
| address | 0x… (42 characters, one-time) |
| extraId, extraIdName | null, null |
| amount | 250 |
| amountBaseUnits | 250000000 |
| uri, uriStandard | `ethereum:0xdAC17F958D2ee523a2206206994597C13D831ec7@1/transfer?address=0x…&uint256=250000000` , ERC-681 |
| note | Send exactly 250 USDT on Ethereum in one transaction from the sending address you gave. The swap starts after 15 confirmations. Anything else sent to this address is not credited automatically. |

The URI's target is the contract, not the deposit address: call `transfer` on this contract, on chain 1, with this recipient and this integer. The same deposit on BNB Smart Chain would carry chainId 56 and the Binance-Peg contract, which has 18 decimals rather than 6.

## Before sending: what the agent checks

1. **The chain.** `chain` and `chainId` equal the network your wallet will broadcast on. A 0x deposit address with chainId 56 is paid on BNB Smart Chain; paying it on Ethereum is the mistake [Sent USDT to the wrong network](https://sablebolt.io/blog/sent-usdt-to-the-wrong-network) is about.
2. **The contract.** `tokenContract` equals the issuer's published contract: Tether's list for USDT on TRON, Ethereum and TON, BscScan for the Binance-Peg token on BNB Smart Chain, Circle's list for USDC. If it differs, do not send.
3. **The decimals, cross-checked.** Compute the base units yourself from `amount` and the issuer's decimals and compare with `amountBaseUnits` . If `decimals` is null, so are `amountBaseUnits` and `uri` : the listing stated no precision, or one that disagrees with the protocol constant, and the instruction carries nothing rather than a wrong number; use the issuer's figure.
4. **The memo.** If `extraId` is not null, the transaction carries it; on TON the URI puts it in `text=` .
5. **The amount, once.** Exactly `amount` , in one transaction, with the network fee paid on top from the fee coin (TRX or energy, ETH, BNB, GRAM), never out of the amount. Two half payments are "anything else" in the note's words.
6. **The sender.** Broadcast from `fromAddress` , and keep `id` and `statusUrl` : they are the only handle on the swap.

## Following the swap

`get_swap_status` (or `GET /v1/swaps/{id}` ) answers with `status` and `stage` :

| Stage | Status | What has happened |
|---|---|---|
| 1 | waiting | nothing seen yet; `payment` is still present |
| 2 | confirming | `txIn` is set; the network's confirmations are being counted |
| 3 | exchanging | the deposit is confirmed; the rate is set |
| 4 | sending | `txOut` is set |
| 5 | finished | `amountTo` is the actual payout |
| last reached | failed, refunded, expired, hold, unknown | not progress; the stage stays where it was |

Polling is one way; the other is a signed notification, REST only, since the MCP server has no tool for it. `POST /v1/swaps/{id}/notify` with `{ "url": "https://agent.example.com/hooks/sablebolt", "secret": "<16 to 128 printable characters>" }` answers 202 with a one-time `token` ; from then on every change of `status` or `stage` is a POST to that URL:

| Part | Value |
|---|---|
| Header X-Sablebolt-Event | swap.status |
| Header X-Sablebolt-Timestamp | Unix seconds of this attempt |
| Header X-Sablebolt-Signature | sha256= and the hex HMAC-SHA256, keyed with your secret, of the timestamp, a dot and the exact body bytes |
| Body | id, status, stage, amountTo, txIn, txOut, updatedAt |
| Example body, from openapi.json | `{"id":"a1b2c3d4e5f60718","status":"sending","stage":4,"amountTo":"0.00891","txIn":"7c1e…","txOut":"0x3f…","updatedAt":"2026-11-01T12:34:56.000Z"}` |
| Verifying | recompute over the raw bytes before parsing, compare in constant time, reject a timestamp more than 300 seconds off |
| Answering | any 2xx within 5 seconds; a 5xx, 429 or 408, a timeout or a connection error is retried after 1, 2 and 4 seconds; any other answer counts as one failed attempt without a retry |
| Ending | the final status (its event is still sent), 48 hours, 10 failed attempts in a row, a DELETE with `Authorization: Bearer <token>` , or a restart |

The service polls each subscribed swap once a minute, so two changes within one minute arrive as one event; deduplicate on `status` and `stage` . Subscriptions live in memory only.

## When a swap cannot be completed

The FAQ answer on every pair page applies to a swap created by an agent as well:

**What if the swap cannot be completed?** Write to support with the swap ID from the status page. The deposit is returned to the address you sent from, less the network fee, after support confirms the address. With Fixed rate on, the form shows a refund address, prefilled with the address you send from, and the deposit returns there.

The support page is [/support](https://sablebolt.io/support) .

## FAQ

Can a person use create_swap through an assistant?

The tool is for the wallet that pays. A person's swap is created on the page from get_swap_page_link, with both addresses on screen, and the deposit goes from the person's own wallet; an assistant calling create_swap for a person would have to hold that person's keys.

Is the rate locked when create_swap answers?

No: the rate is set when the deposit confirms; [Floating rate](https://sablebolt.io/blog/floating-rate-estimate-vs-payout) shows what can move in between.

What if decimals and amountBaseUnits are null?

Compute the integer from amount and the issuer's documented decimals, check it twice, and send exactly amount.

How many swaps can an agent create?

10 per minute per IP address, counted across create_swap and POST /v1/swaps together; the budget is deliberately small.

Is there a test mode?

GET /v1/health reports mode, "mock" or "live"; on 3 November 2026 it reported live. There is no separate sandbox; start with a small amount above the minimum.

## Sources

1. [BIP 21: Bitcoin URI Scheme](https://github.com/bitcoin/bips/blob/master/bip-0021.mediawiki) · read 2026-11-09
2. [ERC-681: URL Format for Transaction Requests](https://eips.ethereum.org/EIPS/eip-681) · read 2026-11-09
3. [Monero: URI scheme (docs/URI_SCHEME.md)](https://github.com/monero-project/monero/blob/master/docs/URI_SCHEME.md) · read 2026-11-09
4. [TON documentation: Deep links (ton://transfer)](https://docs.ton.org/ecosystem/wallet-apps/deep-links) · read 2026-11-09
5. [Tether: Supported Protocols and Integration Guidelines](https://tether.to/en/supported-protocols/) · read 2026-10-05
6. [Circle: USDC contract addresses](https://developers.circle.com/stablecoins/usdc-contract-addresses) · read 2026-11-09

## Related posts

- [AI & agents llms.txt, OpenAPI and agent skills: how Sablebolt talks to machines Every page has a markdown twin, the API has an OpenAPI file and agents have a skills index. Here is exactly what is there, with example requests, and the one step that is always yours. 23 October 2026 13 min](https://sablebolt.io/blog/how-sablebolt-talks-to-machines)
- [AI & agents Connect Sablebolt to Claude, Cursor and ChatGPT: a quote, an address check and a status over MCP One URL and no credentials: the exact setting for each of five clients, three tool calls with the answers they gave on 3 November 2026, the rate limits, and what each error means. 3 November 2026 9 min](https://sablebolt.io/blog/connect-sablebolt-to-claude-cursor-and-chatgpt)
- [How swaps work Reading a swap status page: every state from waiting to finished Waiting, Confirming, Swapping, Sending, Done — what each stage means, which hash to look up where, and when a wait is normal. 19 October 2026 9 min](https://sablebolt.io/blog/reading-a-swap-status-page)
