10 Contract
Gas and costs
Measured gas for every function, what that costs at the gas price we measured on Robinhood Chain, and who pays what.
#Measured gas
These numbers come from forge test --gas-report on the real test suite (min to max across the runs of each function), and from a run on a local anvil chain with the compiled contract. They are measurements of this code, not estimates.
| Function | Gas (forge, range) | Gas (anvil run) |
|---|---|---|
createLinkEth | about 104k at the top of the range | 101,934 |
createLinkToken | about 164k to 170k | 165,107 |
claim (ETH) | about 85k to 117k | 93,131 |
claim (token) | within the same range | 92,394 |
undo | about 53k to 67k | 42,398 |
expireRefund | about 56k to 68k | 44,899 |
sweepFees | about 69k | 60,306 |
setParams | about 28k | not run |
Runtime code size is 6,101 bytes.
The forge ranges are wider because the suite includes cold and warm storage, fuzzed inputs and different token types. The anvil figures are single runs on a fresh chain with a warm test token, so treat them as typical rather than as limits. A first createLinkEth costs more than the numbers suggest if the sender is a brand-new account, and a token with expensive transfer logic costs more than the mock token used here.
#What that costs in money
Gas is only one component of a transaction's fee, and the price moves. On 2026-10-09 we measured a gas price of about 0.0202 gwei on Robinhood Chain. At that price:
| Action | Gas | Cost at 0.0202 gwei |
|---|---|---|
| Create an ETH link | ~104k | ~0.0000021 ETH |
| Claim | ~117k | ~0.0000024 ETH |
| Undo | ~67k | ~0.0000014 ETH |
| Refund after expiry | ~68k | ~0.0000014 ETH |
The arithmetic is gas × gasPrice: for example 67,000 × 0.0202 gwei = 0.0000013534 ETH. At that measured price an undo costs a tiny fraction of a cent.
#Who pays what
| Cost | Paid by |
|---|---|
Gas of createLinkEth / createLinkToken (and the token approve) | the sender |
Gas of claim | whoever submits it: the recipient, or a relayer |
Gas of undo | the sender |
Gas of expireRefund | whoever calls it: a keeper, the sender, anyone |
Gas of sweepFees | whoever calls it |
| The fee (0.3% by default) | taken from the amount on a claim only, so the recipient receives the net |
| Undo or expiry | no protocol fee: the sender gets 100% back, and only paid the gas |
Unlike some chains, there is no rent or account deposit to recover: an escrow record is a storage entry that is cleared when the link ends.
#Why a claim by a brand-new wallet works
The recipient's wallet signs a message and never sends a transaction, so it needs no ETH. The relayer pays the gas of claim. At the gas price above, that is a few millionths of an ETH, which is why a free relayer is plausible. See Relayer.
#Sends too small to be worth it
The fee rounds down. At 0.3%, any amount below 334 base units carries a zero fee. On the other side of the ledger, gas is a fixed cost, so very small sends are dominated by it. Nothing in the contract blocks a tiny send, but the app should warn when gas would be a large share of the amount.
#Reproduce the numbers
cd contracts && forge test --gas-report --match-contract OopsendTest
node scripts/docs-e2e.mjs # anvil run: prints gas for each call
The second command starts its own anvil, deploys the compiled contract, and prints the figures in the right-hand column above.