Skip to main content
Fee delegation is a StableNet-native transaction type (0x16) that separates who signs the transaction from who pays the gas — a feature with no equivalent in standard EVM chains.

What Is Fee Delegation?

In a standard EVM transaction, the sender pays the gas. StableNet adds a second role: the fee payer. The fee payer is a separate account that covers gas costs while the sender only provides the value being transferred.
RoleResponsibility
Sender (From)Signs transaction intent, provides transferred value, holds a valid nonce
Fee Payer (FeePayer)Signs gas consent, pays gasLimit × gasPrice, receives unused gas refund
Both accounts must sign the transaction. Neither signature is optional.
Fee delegation requires the Applepie fork to be active on the network. Transactions of type 0x16 submitted before the fork are rejected immediately.

How It Works

1

Sender signs the transaction

Build an EIP-1559-style transaction and set type to 0x16. Add the feePayer address to the payload. Sign with the sender’s private key to produce v, r, s.
{
  "type": "0x16",
  "chainId": "0x2052",
  "nonce": "0x1",
  "to": "0xd46e8dd67c5d32be8058bb8eb970870f07244567",
  "gas": "0x76c0",
  "maxFeePerGas": "0x9184e72a000",
  "maxPriorityFeePerGas": "0x5f5e100",
  "value": "0xde0b6b3a7640000",
  "input": "0x",
  "accessList": [],
  "feePayer": "0x407d73d8a49eeb85d32cf465507dd71d507100c1"
}
2

Fee payer signs the transaction

The fee payer receives the partially-signed transaction, verifies the contents, then signs it to produce fv, fr, fs.
3

Broadcast the completed transaction

Submit the fully-signed transaction (both signature sets) via eth_sendRawTransaction. The node validates both signatures before accepting it into the mempool.
The node processes the transaction as follows:
  • Balance check: fee payer must hold ≥ gasLimit × gasPrice; sender must hold ≥ value
  • Execution: tx.origin is always the sender — smart contracts cannot observe that fee delegation was used
  • Refund: unused gas is refunded to the fee payer, not the sender

ethers.js Example

The example below shows the full two-signature flow using ethers.js v6.
// requires: npm install ethers (v6)
import { ethers } from "ethers";

const provider = new ethers.JsonRpcProvider("https://api.test.stablenet.network");
const senderWallet = new ethers.Wallet(SENDER_PRIVATE_KEY, provider);
const feePayerWallet = new ethers.Wallet(FEE_PAYER_PRIVATE_KEY, provider);

// 1. Build the unsigned transaction (type 0x16)
const unsignedTx = {
  type: 0x16,
  chainId: 0x205B,
  nonce: await provider.getTransactionCount(senderWallet.address),
  to: "0xd46e8dd67c5d32be8058bb8eb970870f07244567",
  value: ethers.parseEther("1.0"),
  gas: 30400n,
  maxFeePerGas: ethers.parseUnits("10000", "gwei"),
  maxPriorityFeePerGas: ethers.parseUnits("100", "gwei"),
  feePayer: feePayerWallet.address,
  input: "0x",
  accessList: [],
};

// 2. Sender signs
const senderSig = await senderWallet.signTransaction(unsignedTx);

// 3. Decode, add fee payer signature, re-encode
const decoded = ethers.Transaction.from(senderSig);
const feePayerSig = await feePayerWallet.signTransaction(decoded);

// 4. Broadcast
const txResponse = await provider.broadcastTransaction(feePayerSig);
const receipt = await txResponse.wait();
console.log("Confirmed in block", receipt.blockNumber);
The fee payer should validate the transaction contents before signing — specifically to, value, data, and gas — to avoid being charged for unintended operations.

Use Cases

  • Gasless onboarding — new users interact with your dApp before they hold any WKRC
  • Subsidized transactions — your backend account sponsors gas for specific user actions (e.g. first mint, daily claim)
  • Batch relayer — a single fee payer wallet processes transactions on behalf of many users

Developer Benefits

  • No wallet UX changes for users — the sender signs a normal transaction; gas mechanics are invisible to them
  • tx.origin is always the sender — existing contracts that check msg.sender or tx.origin work without modification
  • Balance isolation — the fee payer’s funds cannot be used for value transfer; only gas is at risk
  • Unused gas is refunded — the fee payer receives the refund automatically, reducing overpayment cost

System Overview

Where fee delegation fits in StableNet’s architecture.

Gas and Fees

Base fee policy, tip limits, and fee calculation.