> ## Documentation Index
> Fetch the complete documentation index at: https://developers.squads.so/llms.txt
> Use this file to discover all available pages before exploring further.

# Gas Abstraction for Solana

> Enable seamless transactions by sponsoring gas fees for standard Solana wallets

## Overview

The Gas Abstraction service allows you to sponsor transaction fees for users with standard Solana wallets (keypair-based wallets, also known as Externally Owned Accounts). By removing the requirement for users to hold SOL tokens for gas fees, you can create a seamless payment experience where users only need to hold the tokens they want to transact with.

> [!WARNING]
>
> This service is **exclusively for standard Solana wallets** (keypair-based
> accounts). For Squads smart accounts with built-in gas abstraction, see
> [Grid's Smart Accounts](https://developers.squads.so/grid/v1/accounts/introduction.md).

## How It Works

The gas abstraction flow is straightforward:

**1. Create Transaction**

Build your Solana transaction as usual, but do not sign it. The transaction can include any standard Solana instructions like transfers, token operations, or program interactions.

**2. Submit for Sponsorship**

Send the unsigned, serialized transaction to the gas abstraction endpoint. The
Grid paymaster will calculate the required fees and add its signature to
sponsor the costs.

**3. Sign and Execute**

Receive the paymaster-signed transaction, add the user's signature, and submit to the Solana blockchain. The fees are automatically handled by the paymaster.

## Key Benefits

> **Seamless User Experience**
>
> Users don't need to acquire or manage SOL for transaction fees. They can transact with just the tokens they care about.

> **Flexible Fee Management**
>
> You control when and how to sponsor fees. Use custom identifiers to track
> costs by user, feature, or session.

> **Transparent Billing**
>
> Query detailed fee records with pagination and filtering. Track costs across
> different time periods and categories.

> **Production Ready**
>
> Built on enterprise-grade infrastructure with sandbox and production environments for testing and deployment.

## Use Cases

### Embedded Wallets

Enable seamless user experiences in embedded wallet solutions. Privy, a leading wallet infrastructure provider, uses Grid's gas abstraction to power gasless transactions for their Solana wallets.

> **[Privy Enables Gasless Transactions on Solana](https://squads.xyz/blog/privy-enables-gasless-transactions-on-solana-powered-by-grid)**
>
> Learn how Privy integrated Grid's gas abstraction to eliminate SOL
> requirements for their users, creating a seamless onboarding and transaction
> experience.

### Consumer Payment Apps

Enable users to make USDC payments without needing SOL for fees. Perfect for remittance apps, digital wallets, or payment platforms where users shouldn't need to understand blockchain mechanics.

### Gaming and NFT Platforms

Let players focus on gameplay and collecting, not managing gas tokens. Sponsor fees for in-game transactions, NFT mints, or marketplace operations.

### DeFi Applications

Remove friction from DeFi interactions. Users can swap tokens, provide liquidity, or stake assets without maintaining a SOL balance for fees.

### Developer Tools

Build better developer experiences by abstracting away gas management in your SDKs and APIs. Focus on your core functionality while Grid handles the fee infrastructure.

## Fee Structure

### What You Pay For

Gas abstraction fees consist of two components:

* **Compute Fees**: Based on the computational complexity of your transaction
* **Priority Fees**: Based on the optimal priority of the transaction to optimize for fast confirmation
* **Rent Fees**: For creating new accounts or maintaining rent-exempt balances

Fees are calculated in real-time based on current network conditions and quoted in your preferred currency (defaults to USDC).

### Billing

* **Sandbox Environment**: All devnet transactions are processed but not billed, perfect for testing
* **Production Environment**: Mainnet transactions are recorded and billed according to your Grid API agreement
* **Transparent Tracking**: Every transaction generates a detailed fee record that you can query at any time

## Custom Identifiers

Track and organize your gas abstraction usage with custom identifiers:

```javascript theme={null}
// Group transactions by user
const response = await fetch(
  "https://grid.squads.xyz/api/v0/grid/transactions/eoa/gas-abstraction?customIdentifier=user-123",
  {
    method: "POST",
    headers: {
      Authorization: "Bearer YOUR_API_KEY",
      "X-Grid-Environment": "production",
      "Content-Type": "application/json",
    },
    body: JSON.stringify({ transaction: serializedTx }),
  }
);

// Query fees for a specific user
const feesResponse = await fetch(
  "https://grid.squads.xyz/api/v0/grid/transactions/eoa/gas-abstraction?customIdentifier=user-123",
  {
    headers: {
      Authorization: "Bearer YOUR_API_KEY",
      "X-Grid-Environment": "production",
    },
  }
);
const { data } = await feesResponse.json();
```

Custom identifiers enable you to:

* Generate usage reports per user or feature
* Implement cost allocation and chargebacks
* Monitor spending patterns and optimize costs
* Debug issues by grouping related transactions

## Environments

**Sandbox (Devnet)**

Use the sandbox environment for development and testing:

* Set `X-Grid-Environment: sandbox` header
* Transactions execute on Solana devnet
* No fees are charged for testing
* Same API behavior as production

Perfect for integration testing, development, and QA.

**Production (Mainnet)**

Use production for live applications:

* Set `X-Grid-Environment: production` header
* Transactions execute on Solana mainnet
* Fees are recorded and billed
* Full monitoring and support

For production deployments serving real users.

### Transaction Verification

Always validate transactions before sponsoring fees:

1. **Verify the transaction matches user intent** (amounts, recipients, instructions)
2. **Check transaction limits** to prevent abuse
3. **Implement rate limiting** per user or session
4. **Monitor for anomalies** in fee spending

## Get Started

> **[Get onboarded to Grid's Gas Abstraction API](https://squads-grid.typeform.com/gas-abstraction)**
>
> Get onboarded to Grid's Gas Abstraction API by filling out the form below.

## API Endpoints

* [Abstract Transaction Fees](https://developers.squads.so/grid/v0/eoa/gas-abstraction/post.md): Sponsor gas fees for unsigned transactions. Returns a signed transaction ready for blockchain submission.
* [Query Fee Records](https://developers.squads.so/grid/v0/eoa/gas-abstraction/get.md): Retrieve historical fee records with pagination and filtering. Track costs and generate usage reports.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.