Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.decibel.trade/llms.txt

Use this file to discover all available pages before exploring further.

Do You Need Gas Station?

Every Decibel transaction requires gas. There are two ways to handle this:
ApproachWhen to useSetup
Self-funded (default)Your wallet already holds APT (e.g., Petra wallet users)No extra setup — just have APT in your account
Gas Station (sponsored)You want to remove the APT requirement for your users — useful for cross-chain wallets or smoother onboardingCreate a Gas Station on Geomi (see below)
If your users already have APT-funded wallets, you can skip this page entirely. Gas Station is most valuable when you’re building an app where users come from other chains or shouldn’t need to think about gas at all.

What Is Gas Station?

Geomi Gas Station sponsors gas fees on behalf of your users. Your project covers the cost so users can trade without acquiring APT first. Geomi gives you free credits to start, and you can pay with USD after those run out. The Decibel SDK has built-in Gas Station support. You provide a gasStationApiKey in your config and the SDK handles sponsored transaction submission automatically.

Setup

1. Create a Gas Station on Geomi

  1. Go to geomi.dev and sign in (or create an account)
  2. Select your project (or create one)
  3. Navigate to the Gas Station resource
  4. Create a new Gas Station by importing our template:
    • Download one of our templates linked below for the network you’re targeting (Mainnet or Testnet)
    • In Geomi, click the “Import Template” button and select the template you downloaded
    • Click “Next” and review the rules configured by the template
    • When you are ready to continue, click “Create gas station”
  5. Copy the Gas Station API Key from your dashboard

Decibel Testnet Gas Station Template

Download the Testnet Gas Station Template (JSON)

Decibel Mainnet Gas Station Template

Download the Mainnet Gas Station Template (JSON)
For detailed Gas Station configuration options (allowlists, rate limits, CAPTCHA), see the Geomi documentation.

2. Integrate with the Decibel SDK

Pass your Gas Station API key when constructing DecibelWriteDex:
import { DecibelWriteDex, TESTNET_CONFIG } from "@decibeltrade/sdk";
import { Ed25519Account, Ed25519PrivateKey } from "@aptos-labs/ts-sdk";

const account = new Ed25519Account({
  privateKey: new Ed25519PrivateKey(process.env.PRIVATE_KEY!),
});

const config = {
  ...TESTNET_CONFIG,
  gasStationApiKey: process.env.GAS_STATION_API_KEY!,
};

const write = new DecibelWriteDex(config, account, {
  nodeApiKey: process.env.APTOS_NODE_API_KEY,
});

// All transactions are now gas-sponsored automatically
await write.placeOrder({
  marketName: "BTC-USD",
  price: 45000,
  size: 0.001,
  isBuy: true,
  timeInForce: 0,
  isReduceOnly: false,
});
The SDK uses the @aptos-labs/gas-station-client package under the hood. When gasStationApiKey is set, every transaction is automatically built with withFeePayer: true and submitted through the Gas Station for fee sponsorship.

3. Environment Variables

Add these to your .env:
GAS_STATION_API_KEY=your_geomi_gas_station_api_key
APTOS_NODE_API_KEY=your_geomi_node_api_key    # optional, for higher rate limits
PRIVATE_KEY=0x...your_wallet_private_key

How It Works

  1. SDK builds the transaction with withFeePayer: true, setting the fee payer to a placeholder address
  2. User signs the transaction with their private key (sender-only signature)
  3. SDK submits the transaction to the Gas Station API via GasStationClient
  4. Gas Station signs as fee payer and submits the fully-signed transaction on-chain
  5. Gas fees are charged to the Gas Station’s funding account, not the user

Network Configuration

Each pre-built SDK config already includes the correct gasStationUrl for its network. You only need to add your gasStationApiKey:
NetworkgasStationUrl (pre-configured)
Mainnethttps://api.mainnet.aptoslabs.com/gs/v1
Testnethttps://api.testnet.aptoslabs.com/gs/v1
import { MAINNET_CONFIG, TESTNET_CONFIG } from "@decibeltrade/sdk";

// Just spread the config and add your API key
const config = {
  ...MAINNET_CONFIG,
  gasStationApiKey: process.env.GAS_STATION_API_KEY!,
};

Opting Out

If a user wants to pay their own gas (e.g., they already hold APT), simply omit gasStationApiKey from the config:
import { TESTNET_CONFIG } from "@decibeltrade/sdk";

// No gasStationApiKey — user pays their own gas
const write = new DecibelWriteDex(TESTNET_CONFIG, account);
Without gasStationApiKey, the SDK submits transactions directly without Gas Station sponsorship.

Troubleshooting

Transaction Rejected by Gas Station

  • Verify your Gas Station API key is valid and not expired
  • Check that the on-chain function being called is in your Gas Station’s allowlist
  • Confirm your Gas Station has sufficient funding on the target network

Rate Limit Errors

  • Check your per-wallet and global rate limits on the Geomi dashboard
  • The same rate limiting rules that apply to Decibel endpoints also apply to Gas Station requests

Next Steps