Gasless Execution & Citadel Facilitator
Users deposit USDC once and run agents forever. The Citadel Facilitator sponsors all on-chain gas across Base, 0G, and Solana — automatically, in real time.
Overview
Traditional blockchain agents require users to maintain native gas balances on every chain. This creates a compounding UX problem: a user running agents on Base + 0G + Solana must separately acquire and manage ETH, A0GI, and SOL — before a single useful action can occur.
Opacus solves this at the infrastructure level with the Citadel Facilitator: a set of platform-owned gas wallets that monitor every execution and top up any wallet that would otherwise fail due to insufficient native gas.
How it works
- User deposits USDC into their Kinetic Ledger balance (on-chain, Base USDC).
- User creates an agent or triggers any on-chain operation (bridge, swap, storage, compute).
- Before submitting the transaction, Agent Kernel calls
GasStationService.ensureGas(chain, walletAddress). - The gas station checks the execution wallet's native balance against a threshold (default:
0.00005 ETHequivalent). - If the balance is below the threshold, the facilitator sends a top-up (default:
0.0007 ETH/0.0007 A0GI/10,000 lamports) to the execution wallet. - The original transaction proceeds without delay.
- A 1% platform fee is deducted off-chain from the user's Kinetic Ledger via
ledger.debit(). No on-chain fee transaction is needed.
Supported chains
| Chain | Gas Token | Facilitator env var | Top-up amount (default) |
|---|---|---|---|
| Base | ETH | OPACUS_FACILITATOR_BASE_KEY | 0.0007 ETH |
| 0G Network | A0GI | OPACUS_FACILITATOR_OG_KEY | 0.0007 A0GI |
| Solana | SOL | OPACUS_FACILITATOR_SOL_KEY | 10,000 lamports (~$0.0015) |
Platform fee structure
All fees are deducted off-chain from the user's Kinetic Ledger balance. There is no on-chain fee transaction, and therefore no gas cost for the fee itself.
| Operation | Fee | Method |
|---|---|---|
| Agent creation | 0.05 USDC flat | Kinetic Ledger debit |
| Per prompt / task | 0.01 USDC flat | Kinetic Ledger debit |
| Bridge / swap / transfer | 1% of operation amount | Kinetic Ledger debit |
| Gas top-up (native token) | Free to user | Facilitator wallet covers it |
The 1% rate is configurable via OPACUS_PLATFORM_FEE_BPS (100 = 1%). Fees are credited to the treasury address (OPACUS_FEE_RECIPIENT).
Architecture
The facilitator is implemented in agent-kernel/src/gasless/gas-station.service.ts as GasStationService. It is instantiated at server startup and injected into all execution paths.
// Execution flow (simplified)
async executeOperation(chain, walletAddress, operationFn) {
// 1. Ensure native gas is present
await gasStation.ensureGas(chain, walletAddress);
// 2. Execute the on-chain operation
const result = await operationFn();
// 3. Deduct platform fee from Kinetic Ledger (off-chain)
await chargePlatformFee(userRecord, operationAmount, 'bridge');
return result;
}
GasStationService API
| Method | Description |
|---|---|
ensureBaseGas(address) | Tops up ETH on Base if below threshold. Returns SponsorResult. |
ensure0gGas(address) | Tops up A0GI on 0G Network if below threshold. |
ensureSolGas(address) | Tops up SOL lamports on Solana if below threshold. |
ensureGas(chain, address) | High-level dispatch — routes to the correct chain method. |
getFacilitatorAddresses() | Returns { base, og, solana } wallet addresses. |
getFacilitatorBalances() | Returns current native balance for each facilitator wallet. |
calculatePlatformFee(amountUsdc) | Returns { feeUsdc } at the configured BPS rate. |
REST endpoint — GET /api/gasless/status
Returns the current state of the gasless system, including facilitator wallet addresses and balances.
curl -H "x-opacus-user-email: you@example.com" \
http://localhost:3006/api/gasless/status
Response:
{
"ok": true,
"gaslessEnabled": true,
"platformFeeBps": 100,
"platformFeePercent": 1,
"facilitatorAddresses": {
"base": "0x5e610033a5AA7DF74f469917A1746d929Daa784b",
"og": "0x39fADDd6189042BEa44FD290D0a8d488146e2aCF",
"solana": "G1eDkth1i5oR4ZNSGWevz95WmU9zHed8A43ZtY4WDYyR"
},
"facilitatorBalances": {
"base_eth": "0.00025 ETH (0x5e610033…)",
"og_native": "1.0 0G (0x39fADDd6…)",
"solana_sol": "0.006402 SOL (G1eDkth1…)"
},
"note": "Fund each facilitator wallet with native gas token. Users only need USDC in their Kinetic Ledger."
}
Environment variables
| Variable | Required | Default | Description |
|---|---|---|---|
OPACUS_FACILITATOR_BASE_KEY | Yes (for Base) | — | EVM private key (hex) for the Base gas wallet. Fund with ETH on Base mainnet. |
OPACUS_FACILITATOR_OG_KEY | Yes (for 0G) | — | EVM private key (hex) for the 0G gas wallet. Fund with A0GI on 0G mainnet. |
OPACUS_FACILITATOR_SOL_KEY | Yes (for Solana) | — | Base58 Solana keypair. Fund with SOL on Solana mainnet. |
OPACUS_GASLESS_ENABLED | No | true | Set to false to disable gas sponsorship entirely. |
OPACUS_PLATFORM_FEE_BPS | No | 100 | Platform fee in basis points. 100 = 1%, 50 = 0.5%. |
OPACUS_GAS_TOPUP_ETH_BASE | No | 0.0007 | Amount of ETH to send per top-up on Base. |
OPACUS_GAS_TOPUP_NATIVE_OG | No | 0.0007 | Amount of A0GI to send per top-up on 0G. |
SOLANA_RPC_URL | No | https://api.mainnet-beta.solana.com | Solana RPC endpoint. |
Funding the facilitator wallets
After setting the private keys and restarting with pm2 restart opacus-kernel --update-env, retrieve the generated wallet addresses:
curl -H "x-opacus-user-email: admin@opacus.local" \
http://localhost:3006/api/gasless/status | python3 -m json.tool
Fund each address with the recommended amount before going live:
| Chain | Recommended starting balance | Covers approx. |
|---|---|---|
| Base | 0.01 ETH (~$26) | ~14 top-ups at 0.0007 ETH each |
| 0G Network | 1 A0GI | ~1,400 top-ups (A0GI is very cheap) |
| Solana | 0.05 SOL (~$7) | ~5,000 top-ups at 10k lamports each |
Security considerations
- Facilitator private keys should be stored only in
.env.local(excluded from git). Never commit them. - These wallets hold only small gas amounts and have no access to user funds.
- The top-up amount per transaction is small by design (~$1.80 ETH equivalent per Base top-up) to limit exposure if a key is compromised.
- Rotate keys immediately if compromised: generate new wallets, update env vars, restart with
--update-env.
Full fee flow diagram
User action (e.g. bridge 100 USDC Base → 0G)
│
▼
GasStationService.ensureGas("base", executionWallet)
├── check ETH balance on Base RPC
├── balance < 0.00005 ETH? YES → send 0.0007 ETH from facilitator
└── balance OK → skip (no cost)
│
▼
Submit bridge transaction (execution wallet now has gas)
│
▼
chargePlatformFee(user, 100 USDC, "bridge")
├── fee = 100 × 1% = 1.00 USDC
├── ledger.debit(1.00 USDC, { source: "manual-adjustment", note: "platform-fee:bridge" })
└── record in db.payments for audit trail
│
▼
Return: { txHash: "0x…", platformFee: { method: "kinetic-ledger", charged: true, amountUsdc: "1.00" } }