Tenzro Testnet is live. Get testnet TNZO

Paymaster & Gas Sponsorship

Tenzro's ERC-4337 v0.8 account abstraction includes a full Paymaster implementation that allows application developers to sponsor gas fees for their users. Users interact with the network without holding TNZO — the application's master wallet covers all transaction fees. This enables Web2-like onboarding where users never see gas costs.

How It Works

  1. User submits UserOperation (no gas payment)
  2. AppClient wraps it with paymaster data
  3. Paymaster validates the operation and stakes
  4. EntryPoint executes the operation
  5. Paymaster pays gas from master wallet deposit
  6. User never touches TNZO

Paymaster Configuration

import { TenzroClient, Paymaster } from "@tenzro/sdk";

const client = new TenzroClient("https://rpc.tenzro.network");

// Deploy a paymaster funded by your master wallet
const paymaster = await client.paymaster.deploy({
  masterWallet: "0xYourMasterWallet...",
  initialDeposit: "100000000000000000000", // 100 TNZO
  maxGasPerUser: "1000000000000000000",    // 1 TNZO max per user op
  allowedOperations: ["transfer", "inference", "identity"],
});

console.log("Paymaster address:", paymaster.address);

// Top up paymaster deposit
await client.paymaster.deposit(paymaster.address, "50000000000000000000");

// Check paymaster balance
const balance = await client.paymaster.getDeposit(paymaster.address);
console.log("Deposit:", balance, "TNZO");

Sponsored Transactions

With a paymaster deployed, user transactions are automatically sponsored. The user signs the operation but pays zero gas:

import { TenzroClient } from "@tenzro/sdk";

const client = new TenzroClient("https://rpc.tenzro.network");

// User sends a sponsored transaction
const tx = await client.sponsored.sendTransaction({
  paymaster: "0xPaymasterAddress...",
  userOp: {
    sender: "0xUserSmartAccount...",
    to: "0xRecipient...",
    value: "0",
    callData: "0x...", // Contract call
  },
});

// The user paid 0 TNZO in gas
// The paymaster paid the actual gas cost from its deposit

// Sponsor an inference request (user pays nothing)
const result = await client.sponsored.inference({
  paymaster: "0xPaymasterAddress...",
  model: "gemma3-270m",
  messages: [{ role: "user", content: "Hello" }],
});

AppClient Pattern

The AppClient is the recommended pattern for building applications on Tenzro. It combines a master wallet (for gas sponsorship) with user management and smart accounts:

import { AppClient } from "@tenzro/sdk";

// Initialize your application client
const app = new AppClient({
  rpcUrl: "https://rpc.tenzro.network",
  masterWallet: process.env.MASTER_WALLET_KEY,
  paymaster: "0xYourPaymaster...",
  appName: "MyAIApp",
});

// Register a new user (auto-provisions identity + smart account)
const user = await app.registerUser({
  externalId: "user-123",   // Your app's user ID
  displayName: "Alice",
});

// user.address  — Smart account address
// user.did      — TDIP DID (did:tenzro:human:...)
// user.wallet   — MPC wallet (2-of-3, auto-provisioned)

// Execute operations on behalf of the user (gas-free)
await app.executeFor(user.address, {
  operation: "inference",
  model: "gemma3-270m",
  messages: [{ role: "user", content: "Summarize this document" }],
});

Master Wallet Funding

# Fund the master wallet from the testnet faucet
curl -X POST https://api.tenzro.network/api/faucet \
  -H "Content-Type: application/json" \
  -d '{"address": "0xMasterWallet..."}'

# Fund a user wallet from the master wallet
curl -X POST https://rpc.tenzro.network \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "method": "eth_sendRawTransaction",
    "params": ["0xsigned_tx_from_master_to_user..."],
    "id": 1
  }'

ERC-4337 Details

ComponentDescription
EntryPointSingleton contract that validates and executes UserOperations
UserOperationv0.8 format with split gas fields (verificationGasLimit, callGasLimit, paymasterVerificationGasLimit, paymasterPostOpGasLimit)
SmartAccountModular account with SessionKey, SpendingLimit, SocialRecovery, and Batching modules
AccountFactoryDeterministic CREATE2 deployment of smart accounts
PaymasterGas sponsorship with per-operation validation and deposit management
Gas Penalty40,000 gas penalty for failed validations (per ERC-4337 spec)
Max Bundle Size100 UserOperations per bundle