Documentation Index
Fetch the complete documentation index at: https://docs.stablenet.network/llms.txt
Use this file to discover all available pages before exploring further.
Build a two-signature flow where a fee payer account covers gas costs on behalf of a transaction sender.
What you’ll learn
By the end of this tutorial, you’ll be able to:- Build and sign a fee-delegated transaction (type
0x16) with ethers.js - Add the fee payer’s signature to a partially signed transaction
- Broadcast the completed transaction and verify gas was charged to the fee payer
How fee delegation works
StableNet’s fee delegation separates transaction signing from gas payment using transaction type0x16.
| Role | Signs | Pays |
|---|---|---|
Sender (From) | Transaction intent (v, r, s) | Transfer value only |
Fee Payer (FeePayer) | Gas consent (fv, fr, fs) | gasLimit × gasPrice |
Fee delegation requires the Applepie fork to be active. Transactions of type
0x16 submitted before the fork activate are rejected immediately.Prerequisites
- Node.js ≥ 18 and
npm install ethers(v6) - Two funded testnet accounts: one sender wallet, one fee payer wallet
- Get testnet WKRC for both accounts at the Faucet
Build and sign the transaction
The sender builds the transaction, setsfeePayer to the fee payer’s address, and signs it.
Add the fee payer’s signature
The fee payer receives the partially signed transaction, reviews the contents, and adds their signature.Broadcast the completed transaction
Verify gas was charged to the fee payer
Check the fee payer’s balance before and after to confirm gas was deducted from their account, not the sender’s.feePayer field in the transaction details confirms which account paid gas.
Key invariants
tx.originis always the sender. Existing contracts that checkmsg.senderortx.originwork without modification.- The fee payer’s balance cannot be used for value transfer — only gas is at risk.
- Unused gas is refunded to the fee payer automatically.
- The fee payer’s address is not exposed inside EVM execution — smart contracts cannot detect that fee delegation was used.
Next steps
Fee Delegation Use Case
Build a gasless dApp flow with fee delegation.
RPC API Reference
personal_signRawFeeDelegateTransaction and related methods.
Deploy with Foundry
Deploy the contract your fee payer will interact with.
Listen to Events
Subscribe to events emitted by fee-delegated transactions.

