Skip to content
PortunaPortunaPortunaDocsTestnet

Recipes

The batch overhead is shared by its addresses: a repeat USDT sweep on Sepolia takes about 44,600 gas alone in its batch and 18,100 in a batch of 50. Send sweep requests in bursts, for example every few minutes for everything that arrived, rather than one by one with pauses. Sweeps of one hot wallet that are queued when a batch is prepared go together, up to the chain’s batch size.

You do not need to track which addresses are delegated. Sign an authorization when you create a deposit address and send it with every sweep of that address: the service uses it only when the address needs it. Re-sign only if the address sends a transaction of its own, which changes its nonce.

  • Leave amount out to sweep the whole balance; set it to sweep part of it.
  • Turn on keep_one_unit for permanent deposit addresses: your users’ next deposits become much cheaper, and with your fee above zero it does not raise what you pay. See Keeping one unit on the address.
  • Mind the decimals: amounts are integers in the token’s smallest units, and the same token can have different decimals on different chains.
  • Fund it with a plain transfer of the chain’s native coin. It is one address on every chain, but each chain has its own balance.
  • Watch available in GET /v1/balance: the balance minus the fees due, which are kept in reserve.
  • Keep a few days of gas, and set a low balance alert at a day or two.
  • If it runs dry, sweeps wait and retry; after five attempts they fail. Top up and send them again with new external_ids.

The savings come from repeat sweeps of permanent deposit addresses, which your users top up again and again. For one-time addresses, such as a new address per invoice, a first sweep costs about as much gas as the classic way: you still get no top-ups and no dust, but no gas saving. See First and repeat sweeps.

  • Do not delegate addresses only to sweep ETH or BNB: the first sweep costs more than a plain transfer.
  • Sweep the native coin from addresses that are delegated anyway, in batches of 10 or more.
  • If users send ETH or BNB to an address from exchanges with a fixed gas limit, do not delegate it: see Deposits from exchanges.

Each hot wallet has its own delegate, and an address runs one delegate at a time. To move an address to another hot wallet, sign an authorization for that hot wallet’s delegate and send it with the next sweep to the new hot wallet. That sweep costs about as much as a first one; no revocation is needed.

  • Each sweep: the webhook, or GET /v1/sweeps/{id}, has swept_amount, tx_hash, gas_cost and fee, enough to recompute the fee.
  • All sweeps: GET /v1/sweeps lists them newest first, filtered by status, chain_id, account or hot_wallet; GET /v1/revocations does the same for revocations.
  • The gas wallet: GET /v1/ledger lists every movement with its sign: gas, fees, withdrawals of fees and top-ups.
  • By day: GET /v1/usage?days=30 gives sweeps by outcome, revocations, gas and fees per UTC day and chain.

These lists are not in the SDKs yet: call them over HTTP. They are pages of up to 200 rows: pass next_cursor as cursor for the next one. See the API overview.