Skip to main content
POST
Abstract gas fees for EOA transactions
The Gas Abstraction endpoint enables fee sponsorship for standard Solana wallet transactions through the Grid paymaster system. This service removes the requirement for users to hold SOL tokens for transaction fees, creating a seamless user experience.
This endpoint is exclusively for standard Solana wallets (keypair-based accounts). For Squads smart accounts with built-in gas abstraction, see Grid v1 Cost Efficiency.

How It Works

The gas abstraction process follows these steps:
  1. Transaction Submission: Send your unsigned, base64-encoded transaction to the endpoint
  2. Fee Calculation: The paymaster computes the required fees in your specified currency (defaults to USDC)
  3. Paymaster Signing: The paymaster adds its signature to sponsor the fees
  4. User Signing: Add the user’s signature to the paymaster-signed transaction
  5. Blockchain Submission: Submit the fully signed transaction to Solana

Implementation Guide

1

Prepare Your Unsigned Transaction

Create your versioned transaction without signing it:
2

Submit to Gas Abstraction API

Send your unsigned transaction to the endpoint:
3

Sign and Submit to Blockchain

Deserialize the paymaster-signed transaction, add the user’s signature, and submit:

Fee Structure

Fee Calculation

The total fee consists of:
  • Compute Units: Based on transaction complexity and computational requirements
  • Rent Fees: For account creation or rent-exempt balance requirements
  • Currency Conversion: Fees quoted in your specified currency (default: USDC)

Billing Details

  • Sandbox Environment: Devnet transactions are processed but not billed
  • Production Environment: Mainnet transactions are recorded and billed according to your Grid API agreement
  • Fee Components: Transaction, priority, and rent fees are included in billing

Custom Identifiers

Use the optional customIdentifier query parameter to group and track related transactions:
Custom identifiers enable you to:
  • Group transactions by user, session, or feature
  • Query fee history by identifier
  • Track usage patterns and costs per category

Transaction Validation

Transactions must:
  • Be valid Solana transactions that can be simulated successfully
  • Use versioned transaction format
  • Be properly serialized to base64
  • Not be pre-signed

Error Handling

Common error scenarios:

Invalid Transaction Format

Solution: Verify your transaction is properly serialized and base64-encoded.

Invalid Environment Header

Solution: Ensure X-Grid-Environment header is set to either sandbox or production.

Service Unavailable

Solution: Implement retry logic with exponential backoff.

Security Best Practices

  1. API Key Protection: Never expose your Grid API key in client-side code or public repositories
  2. Environment Separation: Use sandbox for testing, production only for live transactions
  3. Transaction Verification: Always validate the returned signed transaction matches your intent
  4. Fee Monitoring: Implement alerts for unexpected fee spikes
  5. Rate Limiting: Implement appropriate rate limiting to avoid overwhelming the API

Authorizations

Authorization
string
header
required

API Key for authentication

Headers

X-Grid-Environment
string
required

The environment you're using. Can be sandbox or production.

Query Parameters

customIdentifier
string

Optional custom identifier for tracking purposes

Body

application/json
transaction
string
required

Base64-encoded transaction to process for fee abstraction

Response

Transaction successfully processed with abstracted fees

transaction
string
required

Base64-encoded signed transaction ready for submission to the blockchain

fee
object
required

Detailed fee breakdown for the transaction