---
id: UC0102
title: "Withdrawal fee cost model"
url: https://carbium.sh/library/usecase/withdrawal-fee-cost-model
collection: Use cases
category: Exchanges, custodians and on-ramps
revision: 1
updated: 2026-11-23
author: Carbium
code: MIT (LICENSE in the zip); text: all rights reserved, Carbium Corporation
---

# Withdrawal fee cost model

Work out what a withdrawal costs your exchange in lamports: base fee, priority fee and recipient account rent, read live for three transfer shapes, with the margin left against the flat fee you charge the customer.

## What one withdrawal costs you

A withdrawal fee you show a customer is a price set against what the chain charges you. The chain side has three parts, and one of them depends on who the recipient is. A fourth line, your infrastructure, is small per withdrawal but belongs in the model.

| Part | How it is set | Size |
|---|---|---|
| Base fee | A fixed charge per signature in the transaction | 5,000 lamports for a one-signer withdrawal |
| Priority fee | Compute unit limit you request times the price per unit you bid, in micro-lamports | Zero with no bid, and it grows with the price you bid |
| Recipient rent | A one-time deposit to open the recipient's token account when it does not exist yet | 1,488,440 lamports for a 165-byte token account, read live |
| Infrastructure | The calls that send the transaction and check that it landed | Plan price spread over the month's withdrawals |

The base fee never changes with load. The priority fee does, and it is the only part you can tune. The rent line is the largest by a wide margin and applies only to the first withdrawal of a mint to a given wallet.

## One script that prices three shapes

The script reads the recent prioritization fees and the rent minimum for a token account in parallel, then prints the cost of a SOL transfer, a token transfer to an existing account and a token transfer to a wallet that has no account for the mint yet. Each row shows the total at the median and at the 75th percentile of recent prices.

`main.ts` (run: `CARBIUM_KEY=$CARBIUM_KEY node main.ts [<flat fee charged, in lamports>]`)

```ts
// UC0102 · Withdrawal fee cost model
// https://carbium.sh/library/usecase/withdrawal-fee-cost-model
// Copyright (c) Carbium Corporation. MIT License (LICENSE). Keep this notice.
// SPDX-License-Identifier: MIT

// Read-only: prices one withdrawal in lamports from live priority fees and the rent minimum, for three transfer shapes.
import { createDefaultRpcTransport, createSolanaRpcFromTransport } from "@solana/kit";

const key = process.env.CARBIUM_KEY;
if (!key) { console.error("Set CARBIUM_KEY to your Carbium API key."); process.exit(1); }
const rpc = createSolanaRpcFromTransport(createDefaultRpcTransport({
  url: process.env.CARBIUM_RPC_URL ?? "https://services.carbium.sh", headers: { "x-api-key": key } }));

const charged = BigInt(process.argv[2] ?? "0"); // optional: the flat fee you charge a customer, in lamports
const BASE = 5000n; // lamports per signature
const TOKEN_ACCOUNT_BYTES = 165n;
// Compute unit limits you would request per shape; simulate your own transaction to tune them
const shapes: [string, bigint, boolean][] = [
  ["SOL transfer", 1_000n, false],
  ["token transfer, account exists", 10_000n, false],
  ["token transfer, new account", 40_000n, true],
];
const msg = (e: unknown) => (e instanceof Error ? e.message : String(e));
const pct = (xs: bigint[], p: number) => xs[Math.min(xs.length - 1, Math.floor(xs.length * p))] ?? 0n;
// priority fee = limit x price (micro-lamports per unit), rounded up to a whole lamport
const prio = (units: bigint, price: bigint) => (units * price + 999_999n) / 1_000_000n;

const [fees, rent] = await Promise.allSettled([
  rpc.getRecentPrioritizationFees().send(),
  rpc.getMinimumBalanceForRentExemption(TOKEN_ACCOUNT_BYTES).send(),
]);

let prices: bigint[] = [];
if (fees.status === "fulfilled") {
  prices = fees.value.map((f) => BigInt(f.prioritizationFee)).sort((a, b) => (a < b ? -1 : a > b ? 1 : 0));
} else console.log(`getRecentPrioritizationFees failed: ${msg(fees.reason)}`);
let rentLamports: bigint | undefined;
if (rent.status === "fulfilled") rentLamports = BigInt(rent.value);
else console.log(`getMinimumBalanceForRentExemption failed: ${msg(rent.reason)}`);

const p50 = pct(prices, 0.5);
const p75 = pct(prices, 0.75);
console.log(`slots=${prices.length} paid=${prices.filter((p) => p > 0n).length} price p50=${p50} p75=${p75} micro-lamports/unit rent(165 bytes)=${rentLamports ?? "-"}`);

for (const [name, units, needsRent] of shapes) {
  if (needsRent && rentLamports === undefined) { console.log(`${name.padEnd(32)} skipped: no rent read`); continue; }
  const extra = needsRent ? (rentLamports ?? 0n) : 0n;
  const total = (price: bigint) => BASE + prio(units, price) + extra;
  const margin = charged > 0n ? ` margin@p75=${charged - total(p75)}` : "";
  console.log(`${name.padEnd(32)} base=${BASE} priority@p75=${prio(units, p75)} rent=${extra} total@p50=${total(p50)} total@p75=${total(p75)}${margin}`);
}
```

The one argument is optional: the flat fee you charge a customer, in lamports. With it, each row adds the margin left at the 75th percentile, which is negative when the fee does not cover the cost. Each read sits in its own settled promise, so a failed rent read skips the new-account row and a failed fee read prices the priority part at zero, and the message names the call. The compute unit limits in the table of shapes are placeholders you replace with the figure from simulating your own transaction.

## Priority fee is limit times price

The priority fee is charged on the compute unit limit you request, and the units the transaction actually burns do not enter the sum. A withdrawal that asks for 200,000 units to move tokens that need 10,000 pays for 200,000. Simulate the transaction, add a margin, and set the limit to that figure. [Priority fee per compute unit](https://carbium.sh/library/howsolana/priority-fee-per-compute-unit) walks through reading the price from the same call.

`getRecentPrioritizationFees` answers with one price per recent slot. Called with no addresses, as the script calls it, each price is the smallest bid that landed in that slot, so many slots read zero and the median and 75th percentile are a floor. A withdrawal that must land in a busy slot needs a bid above that floor. Passing your hot wallet's address in the call limits each slot's figure to transactions that wrote to that account, which is closer to what your own sends compete with. Size the flat customer fee on the bid your sender actually sets, and refresh it before each batch.

Rounding goes up. The script divides by one million with a ceiling so that a bid of 1 micro-lamport per unit on 10,000 units is charged as 1 lamport and not as zero, which matches what the runtime does.

## Recipient rent is the large line

Sending a token to a wallet that has no token account for that mint means creating one in the same transaction, and the creator funds its rent. The rent minimum for a 165-byte token account reads 1,488,440 lamports on mainnet now, nearly 300 times the base fee, so one new recipient moves the cost of a withdrawal more than any fee market does. The deposit sits in the recipient's account and returns to whoever closes it, which is the recipient and not you.

That makes the first-time recipient a policy decision. Some exchanges absorb the rent, some charge it as a separate line, and some require the customer to open the account first. The model gives you the figure for each choice, and [Recipient account rent budget](https://carbium.sh/library/usecase/recipient-account-rent-budget) covers budgeting it across a payout run.

Knowing which case applies needs an account lookup before you quote a fee. Derive each recipient's associated token account for the mint and read them with `getMultipleAccounts`; an account that comes back null needs the creation instruction. On Carbium the call costs 10 cells per pubkey, 1,000 cells for 100, and below Pro the 1024-cell burst caps a call at 100 pubkeys, so the pre-quote check for a queue is one call per 100 withdrawals. Pro takes up to 300 pubkeys in one call.

Token-2022 mints change two things. Accounts with extensions are larger than 165 bytes, so ask `getMinimumBalanceForRentExemption` for the real size, and a mint with a transfer fee withholds part of the amount you send. That withheld amount is a token cost to the customer and not a lamport cost to you, so keep it out of the lamport model and show it beside it.

## Sending and confirming

Each withdrawal costs the sending call and at least one status check. A [send without preflight costs 20 cells and one with preflight costs 70](https://carbium.sh/docs/rpc), and credits meter the RPC work against your plan: Free gives 500K credits once at sign-up, and the paid plans add 10M, 50M or 200M a month on Dev, Business and Pro. Unspent credits stay.

For a queue, [one JSON-RPC request can hold up to 100 calls](https://carbium.sh/docs/rpc), and every key on your account draws on one shared budget. Spread the monthly plan price over the month's withdrawals to get the infrastructure line, and add it to the lamport figure after converting at the SOL price your treasury uses. Confirming a batch of sent withdrawals is covered in [Withdrawal confirmation tracker](https://carbium.sh/library/usecase/withdrawal-confirmation-tracker).

Skip preflight when your own checks already ran, and keep it when the saved 50 cells matter less than catching an obvious failure before a fee is spent.

## Where it ends

- The model prices a one-signer transfer. A withdrawal that adds a memo, a lookup table or a second signer changes the compute limit and the base fee, so enter those numbers in the shapes list.
- The compute unit limits in the script are starting points. Only simulating your own transaction gives the figure to bid on.
- The script reads recent prices and does not predict the next slot. A spike after the read costs more than the figure printed.
- Conversion to dollars is left out, since the SOL price at the time of each batch is yours to choose.
- Token-2022 transfer fees and rent for accounts with extensions need the size and fee settings of the specific mint, and the script prices neither.

## When it goes wrong

| What goes wrong | What to do |
|---|---|
| The priority part prints as zero for every shape. | Either the fee read failed and the message above the table says so, or every sampled slot landed a transaction with no bid, which is common when the call names no addresses. Rerun, and bid a floor price of your own for withdrawals that must land quickly. |
| The new-account row is skipped. | The rent read failed and the message above the table names the error. An HTTP 429 means the call was over its rate and came back with a retry-after hint; wait and rerun. Do not fall back to a remembered rent figure, since the minimum is read live. |
| The script exits with a SyntaxError on the argument. | The fee argument must be a whole number of lamports, such as 1000000, with no decimal point and no unit. |
| Real withdrawals cost more than the model says. | The requested compute unit limit is above the simulated need, or a withdrawal carried extra instructions. Compare the limit your sender sets with the table of shapes and correct either. |

## Questions

### Is the Solana withdrawal fee the same for every token?

The base fee is the same, 5,000 lamports for one signature. What differs is rent when the recipient needs a new token account, and the amount withheld by a Token-2022 mint that carries a transfer fee.

### Who pays the rent for the recipient's token account?

The payer named in the create instruction funds it, and that is usually the exchange's hot wallet. The deposit then belongs to the recipient's account, so you do not get it back.

### Should the customer fee track the live priority fee?

A flat fee sized to the 75th percentile and refreshed per batch keeps quotes stable. Per-withdrawal pricing from live data gives an exact figure and a fee that changes between two clicks.

### Do I need a paid plan to run this model?

The script makes two reads per run, so a Free key runs it. The plan matters for the sends and checks of real withdrawals, where [plan credits and rates](https://carbium.sh/docs/limits) apply per account.

## Related

- [Priority fee per compute unit](https://carbium.sh/library/howsolana/priority-fee-per-compute-unit) (How to use Solana, HS0015)
- [Recipient account rent budget](https://carbium.sh/library/usecase/recipient-account-rent-budget) (Use cases, UC0099)
- [carbium.sh/docs/rpc](https://carbium.sh/docs/rpc)
- [carbium.sh/docs/limits](https://carbium.sh/docs/limits)
- [carbium.sh/docs/errors](https://carbium.sh/docs/errors)
- [carbium.sh/docs/auth](https://carbium.sh/docs/auth)
