Fees
Transfers, unshields, earn, and swaps carry a private fee paid in the token being moved. The fee is charged on top of the amount: the notes the sender spends coveramount + fee, and exactly amount reaches the recipient or the
gateway call. Users pay no gas for these operations. The operator’s relay
submits each epoch on-chain and pays its gas.
The operator sets these fees for each app and chain, and can override them for
individual wallets. Read them for the signed-in user at runtime instead of
hard-coding them. The on-chain rules behind them are in the protocol’s
fee model.
Fees by operation
Shields and transfers also have minimums.
getRegisteredTokens() reports a
per-token minShieldAmount, and the fee rates carry minTransferAmountUSD.
Transfer and unshield fees
Transfers and unshields each have their own fee mode: flat, or a rate in basis points (bps), where 1 bps is 0.01%. A flat fee is set in USD. The server converts it to the token at the current price, so the token amount moves with the price. A flat transfer fee applies to every transfer, including a transfer to yourself. A bps fee isfloor(base * bps / 10000). For an unshield, the base is the
withdrawn amount. For a transfer, the base is the value sent to other
accounts. Change and self-transfers add nothing to it.
Because the fee comes on top, unshielding a whole shielded balance fails with
INSUFFICIENT_BALANCE. Withdraw at most the balance minus the fee, as the
withdrawals guide shows.
A transfer must send at least minTransferAmountUSD worth of value to other
accounts. Self-transfers are exempt.
The server totals each epoch’s fees by token and pays them into one private
note per token, owned by the operator’s fee account.
App-paid fees
An app can run on theapp_pays fee model. Its users then pay no transfer,
unshield, or gateway fee, and there is no minimum transfer amount. The operator
meters the app’s usage instead. The feeModel field on the fee rates says
which model applies.
Gateway fees for earn and swaps
Earn deposits and redemptions and swaps are gateway unshields. They pay a gateway fee in place of the unshield fee. It is charged on top of the net amount that enters the vault or router call, so the input notes coveramount + fee. A call that
fails and refunds the input as a private note still pays the fee.
The operator configures the gateway fee per app, chain, and gateway, and can
override it for one call selector or one wallet. It is either flat (set in
USD) or a rate. A gateway rate can be finer than one basis point, so the
rates carry gatewayFeeRate over gatewayFeeRateDenominator (10000, or
100000 for tenths of a basis point). When no gateway fee is configured for the
app, fee reads and submissions fail with GATEWAY_FEE_NOT_CONFIGURED.
EarnResult.fee and SwapResult.fee report the fee charged.
Portal deposits
A portal deposit pays a sweep fee. The pool owner sets one rate for every token,portalSweepFeeBps, capped at 10%. Each sweep records the rate at that
moment, and the portal’s owner is credited
gross - floor(gross * feeBps / 10000). The fee is paid to the address that
ran the sweep.
A sweep must move at least the token’s portalMinSweep; a smaller balance
waits at the portal address. When ETH is sent, 0.001 ETH stays at the portal
address as a reserve and is not swept. See
Portal Deposits for the full flow.
On-chain withdrawal fee
The pool contract’swithdrawFeeBps applies only to the two exits that skip
the operator: forced withdrawals and public gift exits. The pool owner sets it
with setFees, capped at 1,000 bps (10%), and it is paid to the treasury
address. Epoch transfers and unshields don’t use it.
A forced withdrawal records the rate when it is requested and deducts the fee
from the payout when it is executed. A public gift exit applies the current
rate, and its proof binds a minimum net payout. An exit that would pay less
than that minimum reverts.
Claimable transfers
Claims and refunds of a claimable transfer pay no fee, so the recipient receives the full gift amount.Showing fees before a send
sdk.vault.getFees(tokenAddress) returns the rates for the signed-in user and
one token, and needs a signed-in session. Price an amount with calculateFee
and display the rate with formatFeeRate:
{ externalVolume } as the fourth argument. For earn or a swap, read
sdk.vault.getGatewayFees(tokenAddress, gatewayAddress, gatewaySelector?) and
price it with calculateGatewayFee. The
fee math reference lists every
helper.
The SDK reads the rates again and recomputes the fee when it builds the
transaction, so fetch rates close to the confirmation step. A flat fee follows
the token price between the two reads.
In React, useFees({ tokenAddress })
fetches the rates and returns calculateFee(amount, type) and
formatFeeRate(type). Its calculateFee returns null until the rates load,
so an unknown fee never shows as zero. Pass gatewayAddress to price
'gateway' instead.
From the CLI:
getFees(tokenAddress) and
getGatewayFees(...) with the same FeeRates shape.