Stop managing gas wallets across 500 agents on 5 chains. Deposit once — every agent relays freely until the tank runs dry.
Running 100 agents across 5 chains = 500 funded wallets to maintain
Pure viem. Sign EIP-7702 authorizations server-side.
import { createWalletClient, http } from "viem";
import { privateKeyToAccount } from "viem/accounts";
import { avalanche } from "viem/chains";
const account = privateKeyToAccount(process.env.AGENT_PRIVATE_KEY);
const client = createWalletClient({
account, chain: avalanche,
transport: http(process.env.AVAX_RPC),
});// No MetaMask needed — viem signs directly
const auth = await client.experimental_signAuthorization({
contractAddress: "0x96a8C74d95A35D0c14Ec60364c78ba6De99E9A4c",
nonce: await client.getTransactionCount({ address: account.address }),
});
// → { chainId, address, nonce, yParity, r, s }const res = await fetch("https://q402.quackai.ai/api/relay", {
method: "POST",
body: JSON.stringify({
apiKey: process.env.Q402_API_KEY, // shared across all agents
chain: "avax", token: "USDC",
from: account.address, to: recipient,
amount: "5000000", // 5 USDC
deadline: Math.floor(Date.now() / 1000) + 3600,
nonce: String(randomNonce),
witnessSig: sig,
authorization: auth,
}),
});
const { txHash, gasCostNative } = await res.json();
// gasCostNative charged from your Gas Tank — agents pay $0+ Gas Tank deposits (consumed at actual on-chain cost, no markup)
Custom pricing for pipelines with 1,000+ agents