# Check Balance Source: https://docs.altude.so/SDKs/solana/android-kotlin/check-balance Check a user balance by passing in the public key of the account you want to check. The response object includes your total balance as well as detailing all of the Mints and Tokens held by that Public Key. ```kotlin theme={null} val option = GetBalanceOption( account = signer.publicKey.toBase58(), token = Token.SOL.mint(), ) val balance = Altude.getBalance(option).getOrNull()?.balance ``` `signer` is the application-owned signer supplied during [client setup](./instantiate-the-altude-client). Balance queries can also use any public account address and do not expose private key material. # Close Account Source: https://docs.altude.so/SDKs/solana/android-kotlin/close-account Before calling this method, [initialize Altude with your app's signer](./instantiate-the-altude-client). You can only close accounts controlled by that signer that are currently empty. ```kotlin theme={null} val result = Altude.closeAccount() ``` Or identify the signer-owned account and token mints explicitly: ```kotlin theme={null} val options = CloseAccountOption( account = signer.publicKey.toBase58(), tokens = listOf(Token.USDC.mint()), ) val result = Altude.closeAccount(options) ``` The configured application signer authorizes the close transaction locally. # Create Account Source: https://docs.altude.so/SDKs/solana/android-kotlin/create-account Before calling this method, [initialize Altude with your app's signer](./instantiate-the-altude-client). Create the required Solana account for the configured signer's public key: ```kotlin theme={null} val result = Altude.createAccount() ``` To create associated token accounts for specific mints: ```kotlin theme={null} val options = CreateAccountOption( tokens = listOf(Token.USDC.mint()), commitment = Commitment.finalized, ) val result = Altude.createAccount(options) ``` The application-provided signer authorizes the transaction locally. The SDK does not create, store, or recover the signer's wallet. # Get Account History Source: https://docs.altude.so/SDKs/solana/android-kotlin/get-account-history Get the full transaction history of any account by passing in the account's Public Key. ```kotlin theme={null} val options = GetHistoryOption( account = signer.publicKey.toBase58(), limit = 20, offset = 0, ) val accountHistory = Altude.getHistory(options) ``` You can query any public account address. `signer` refers to the application-owned signer configured during [client setup](./instantiate-the-altude-client). # Get Account Info Source: https://docs.altude.so/SDKs/solana/android-kotlin/get-account-info Get account information by passing a public account address: ```kotlin theme={null} val option = GetAccountInfoOption( account = signer.publicKey.toBase58(), ) val result = Altude.getAccountInfo(option) ``` You can query any public account address. `signer` refers to the application-owned signer configured during [client setup](./instantiate-the-altude-client); no signing or private key access is required for this query. # Install Android SDK Source: https://docs.altude.so/SDKs/solana/android-kotlin/installation Install the production Altude Core and Gas Station modules. The production Android SDK consists of the `core` and `gasstation` modules. Add your JitPack authentication token to the root `gradle.properties`: ```properties theme={null} authToken=your_jitpack_auth_token_here ``` In `settings.gradle.kts`, include the JitPack repository: ```kotlin theme={null} dependencyResolutionManagement { repositories { google() mavenCentral() maven { url = uri("https://jitpack.io") credentials { username = providers.gradleProperty("authToken").get() } } } } ``` Finally, add both production modules in your app's `build.gradle.kts`: ```kotlin theme={null} dependencies { implementation("com.github.AltudePlatform.AndroidSDK:core:v0.1.7-alpha") implementation("com.github.AltudePlatform.AndroidSDK:gasstation:v0.1.7-alpha") } ``` `core` provides the `TransactionSigner` contract and shared Solana primitives. `gasstation` provides sponsored transaction and account operations. Continue to [client setup](./instantiate-the-altude-client). # Setup Source: https://docs.altude.so/SDKs/solana/android-kotlin/instantiate-the-altude-client Initialize Altude with an application-owned transaction signer. ## Getting Started The **Altude Client** provides the production Core and Gas Station APIs. The API key selects the configured Solana environment, so use a development API key while testing. The Altude SDK uses Kotlin `suspend` functions for asynchronous network requests.\ Ensure these calls are made within a `CoroutineScope`. ```kotlin theme={null} import com.altude.core.model.TransactionSigner import com.altude.gasstation.Altude import com.altude.gasstation.AltudeGasStation import foundation.metaplex.solanapublickeys.PublicKey class AppTransactionSigner( private val wallet: AppWallet ) : TransactionSigner { override val publicKey: PublicKey get() = wallet.publicKey override suspend fun signMessage(message: ByteArray): ByteArray { return wallet.signMessage(message) } } val signer = AppTransactionSigner(appWallet) AltudeGasStation.init( context = context, apiKey = "myAPIKey", signer = signer, ).getOrThrow() ``` You can equivalently initialize through the `Altude` facade: ```kotlin theme={null} Altude.setApiKey( context = context, apiKey = "myAPIKey", signer = signer, ).getOrThrow() ``` Adapt `AppWallet` to your wallet provider, hardware wallet, or other signing implementation. Your application owns wallet creation, storage, authentication, and key custody. The SDK keeps the configured signer reference only to request local signatures; private keys are not sent to or managed by Altude. Don't have an API key? Join our [Discord](https://discord.gg/9gPsQeZD7x) and we'll get you started. # Send Token Source: https://docs.altude.so/SDKs/solana/android-kotlin/send-token ## Transfer a Token Before sending, [initialize Altude with your app's signer](./instantiate-the-altude-client). The API key does not identify or own a wallet. Transfers originate from the application-provided signer's account. ```kotlin theme={null} val options = SendOptions( account = signer.publicKey.toBase58(), toAddress = "EykLriS4Z34YSgyPdTeF6DHHiq7rvTBaG2ipog4V2teq", amount = 0.00001, token = Token.SOL.mint(), ) val result = Altude.send(options) ``` To send a different token, use its mint address: ```kotlin theme={null} val options = SendOptions( account = signer.publicKey.toBase58(), toAddress = "EykLriS4Z34YSgyPdTeF6DHHiq7rvTBaG2ipog4V2teq", amount = 0.00001, token = Token.USDC.mint(), // Token (mint address) for USDC commitment = Commitment.finalized // Optional commitment level ) val result = Altude.send(options) ``` ## Transfer Tokens in Batches You can also send the same or different tokens to multiple recipients in a single batch. ```kotlin theme={null} val options = listOf( SendOptions( account = signer.publicKey.toBase58(), toAddress = "EykLriS4Z34YSgyPdTeF6DHHiq7rvTBaG2ipog4V2teq", amount = 0.00001, token = Token.USDC.mint(), ), SendOptions( account = signer.publicKey.toBase58(), toAddress = "ALZ8NJcf8JDL7j7iVfoyXM8u3fT3DoBXsnAU6ML7Sb5W", amount = 0.00001, token = Token.USDC.mint(), ), ) val result = Altude.sendBatch(options) ``` Each transaction is signed locally through your configured `TransactionSigner`. Altude supplies sponsorship and relay services, not wallet custody. # Check a Balance Source: https://docs.altude.so/SDKs/solana/typescript/check-balance Read SOL or SPL token balances for a Solana address. ## SOL balance ```typescript theme={null} const balance = await gasStation.getBalance({ account: 'WALLET_ADDRESS', }) console.log(balance.lamports) console.log(balance.uiAmount) ``` ## SPL token balance Pass the token mint in `token`: ```typescript theme={null} const usdcBalance = await gasStation.getBalance({ account: 'WALLET_ADDRESS', token: 'MINT_ADDRESS', }) console.log(usdcBalance.amount) console.log(usdcBalance.decimals) console.log(usdcBalance.uiAmount) ``` The response can include: | Field | Description | | ---------- | ----------------------------------- | | `address` | Address represented by the response | | `lamports` | Native SOL balance in lamports | | `amount` | Raw token amount as a string | | `decimals` | Mint decimals | | `uiAmount` | Human-readable amount | Use raw base-unit values for calculations. Display `uiAmount` only when its precision is appropriate for your application. # Close Token Accounts Source: https://docs.altude.so/SDKs/solana/typescript/close-account Close empty token accounts and reclaim their rent. Token accounts must be empty before they can be closed. ## Close associated token accounts Provide a wallet address and one or more token mints. The SDK derives each ATA and returns reclaimed rent to the wallet: ```typescript theme={null} const result = await gasStation.closeAccount({ account: signer.address, tokens: ['MINT_ADDRESS'], signer, }) console.log(result.Signature) ``` If the token account was created by `createAccount()`, Altude's fee payer is its close authority. In that case, omit `signer` so the relay can add the required signature: ```typescript theme={null} await gasStation.closeAccount({ account: 'WALLET_ADDRESS', tokens: ['MINT_ADDRESS'], }) ``` ## Close a specific token account ```typescript theme={null} await gasStation.closeAccount({ accountAddress: 'TOKEN_ACCOUNT_ADDRESS', destination: 'RENT_DESTINATION_ADDRESS', signer, }) ``` Use a signer when the user is the close authority. Omit it only when the Altude fee payer is the close authority. Closing a non-empty account fails on-chain. Transfer or burn its remaining token balance first. # Core Utilities Source: https://docs.altude.so/SDKs/solana/typescript/core-utilities Use Altude errors, mnemonic derivation, and authenticated Gill RPC helpers. `@altude/core` contains the shared primitives used by the TypeScript SDK. ## Mnemonic generation ```typescript theme={null} import { generateMnemonic, deriveSolanaAddress, deriveSolanaKeypair, } from '@altude/core' const mnemonic = generateMnemonic(12) const address = await deriveSolanaAddress(mnemonic) const keypair = await deriveSolanaKeypair(mnemonic) ``` Solana accounts use the hardened path `m/44'/501'/'/0'`. Pass an index to derive another account: ```typescript theme={null} const secondAddress = await deriveSolanaAddress(mnemonic, 1) ``` Mnemonics and derived private keys are secrets. Encrypt them at rest and never log or send them to Altude. ## Direct RPC client Most applications should call `gasStation.getRpcClient()`. If you need to construct the core client directly, use only values returned by transaction config: ```typescript theme={null} import { createAltudeClient } from '@altude/core' const config = await gasStation.getConfig() const client = createAltudeClient({ rpcUrl: config.RpcUrl, rpcToken: config.Token, }) const latestBlockhash = await client.rpc .getLatestBlockhash({ commitment: 'finalized' }) .send() ``` The client validates the URL and token, adds bearer authorization, and lazily initializes subscription support. # Create Token Accounts Source: https://docs.altude.so/SDKs/solana/typescript/create-account Create sponsored associated token accounts with a local signer. `createAccount()` creates associated token accounts (ATAs), sets the Altude fee payer as their close authority, partially signs the transaction locally, and sends it to the relay. ## Create the default token account ```typescript theme={null} const result = await gasStation.createAccount({ account: signer.address, signer, }) console.log(result.Signature) ``` The default mint is USDC for the configured environment. ## Create accounts for specific mints ```typescript theme={null} const result = await gasStation.createAccount({ account: signer.address, tokens: [ '4zMMC9srt5Ri5X14GAgXhaHii3GnPAEERYPJgZJDncDU', ], commitment: 'finalized', signer, }) ``` You can also pass the signer as the second argument: ```typescript theme={null} await gasStation.createAccount( { account: signer.address, tokens: ['MINT_ADDRESS'], }, signer, ) ``` When `account` is provided, it must match `signer.address`. The user signs locally; never send a private key or mnemonic to the Altude API. ## Compute budget options ```typescript theme={null} await gasStation.createAccount({ account: signer.address, tokens: ['MINT_ADDRESS'], signer, computeOptions: { computeUnitLimit: 400_000, computeUnitPriceMicroLamports: 1_000, }, }) ``` The response contains the relay transaction `Signature` and may include `Status` and `Message`. # Get Account History Source: https://docs.altude.so/SDKs/solana/typescript/get-account-history Read paginated transaction history for a Solana wallet. Use `account`, `limit`, and `offset` for Android-compatible pagination: ```typescript theme={null} const history = await gasStation.getHistory({ account: 'WALLET_ADDRESS', limit: 20, offset: 0, }) console.log(history) ``` For compatibility with earlier TypeScript integrations, the client also accepts `walletAddress`, `page`, and `pageSize`: ```typescript theme={null} const history = await gasStation.getHistory({ walletAddress: 'WALLET_ADDRESS', page: 1, pageSize: 20, }) ``` The history response follows the current relay API payload. Treat unknown fields as forward-compatible and guard optional values before rendering them. # Get Account Info Source: https://docs.altude.so/SDKs/solana/typescript/get-account-info Fetch on-chain information for a Solana account. ```typescript theme={null} const accountInfo = await gasStation.getAccountInfo({ account: 'ACCOUNT_ADDRESS', }) console.log(accountInfo) ``` The method accepts wallet addresses, token accounts, program accounts, and other valid Solana account addresses. Earlier TypeScript integrations can continue to use the `accountAddress` alias: ```typescript theme={null} await gasStation.getAccountInfo({ accountAddress: 'ACCOUNT_ADDRESS', }) ``` The response mirrors the relay API and is intentionally forward-compatible. Check for fields before using them rather than assuming every account type has the same shape. # Installation Source: https://docs.altude.so/SDKs/solana/typescript/installation Install the Altude TypeScript SDK in Node.js, browser, or React Native projects. ## Gas Station Install the Gas Station package for sponsored transactions and account queries: ```bash theme={null} npm install @altude/gasstation ``` With pnpm: ```bash theme={null} pnpm add @altude/gasstation ``` ## Core utilities Install `@altude/core` when you need structured error types, mnemonic utilities, or direct access to the authenticated Gill RPC client: ```bash theme={null} npm install @altude/core ``` ## Runtime support | Runtime | Entry point | | --------------------- | ------------------------------- | | Node.js | ESM and CommonJS | | Browser | `browser` export condition | | React Native / Hermes | `react-native` export condition | The package manager and bundler select the correct entrypoint automatically. React Native projects should not add a Metro alias for Gill. ## TypeScript configuration The packages ship their own type declarations. A typical modern configuration uses Node-style package exports: ```json theme={null} { "compilerOptions": { "module": "NodeNext", "moduleResolution": "NodeNext", "target": "ES2022", "strict": true } } ``` Browser and React Native projects can keep the module settings recommended by their framework. The important requirement is support for package export conditions. ## Next step Continue to [client setup](./setup). # TypeScript / JavaScript Source: https://docs.altude.so/SDKs/solana/typescript/overview Build gasless Solana applications with the Altude TypeScript SDK. The [Altude TypeScript SDK](https://github.com/AltudePlatform/altude-js) provides typed clients for building, signing, and relaying sponsored Solana transactions from Node.js, browser, and React Native applications. ## Published packages | Package | Purpose | | -------------------- | --------------------------------------------------------------------------------- | | `@altude/gasstation` | High-level Gas Station client for sponsored transactions and account queries | | `@altude/core` | Shared errors, mnemonic utilities, types, and authenticated Gill RPC construction | The SDK keeps user keys in your application. Your signer signs locally, while Altude supplies the fee payer and relays the transaction. ## Quick start ```bash theme={null} npm install @altude/gasstation @altude/core ``` ```typescript theme={null} import { AltudeGasStation } from '@altude/gasstation' const gasStation = new AltudeGasStation({ apiKey: process.env.ALTUDE_API_KEY!, }) const config = await gasStation.init() console.log('Cluster:', config.RpcEnvironment) console.log('Fee payer:', config.FeePayer) const balance = await gasStation.getBalance({ account: 'YOUR_WALLET_ADDRESS', }) console.log('Balance:', balance.uiAmount) ``` `init()` retrieves the RPC URL, short-lived RPC JWT, fee payer, and cluster selected by your API key. The API key is the only required runtime input. The SDK does not fall back to a public Solana RPC endpoint and callers should not supply a network or fee payer manually. ## Choose a guide Start with installation and client setup, then continue to the guide for the operation you want to add. Add the published packages to a Node.js, browser, or React Native project. Initialize the Gas Station with an API key and API-scoped RPC configuration. Build, partially sign, sponsor, and relay a transfer. Use the dedicated React Native and Hermes-compatible package entrypoints. ## Requirements * Node.js 18 or newer for server-side projects * An Altude API key for live RPC and relay operations * A local signer when the SDK builds a transaction on the user's behalf * Amounts expressed in base units: lamports for SOL and the smallest unit for SPL tokens Do not commit API keys, wallet secrets, mnemonics, or private keys to source control. # React Native and Hermes Source: https://docs.altude.so/SDKs/solana/typescript/react-native Use altude-js in React Native without Node.js Buffer or WebSocket polyfills. `@altude/core` and `@altude/gasstation` publish dedicated `react-native` entrypoints. Metro selects them through the package export condition. ## Install ```bash theme={null} npm install @altude/gasstation @altude/core ``` Use the same public imports as other runtimes: ```typescript theme={null} import { AltudeGasStation } from '@altude/gasstation' const gasStation = new AltudeGasStation({ apiKey: runtimeConfig.altudeApiKey, }) await gasStation.init() ``` The API key is the only required runtime input. `init()` resolves the cluster, RPC URL, JWT, and fee payer from Altude's config API for that key. ## Compatibility behavior * HTTP RPC clients initialize without Node.js `Buffer` * Transaction-building paths avoid `DOMException` assumptions * Gill's React Native entrypoint is selected instead of its Node/WebSocket build * RPC subscriptions initialize only when a subscription-dependent property is accessed Do not add a Metro `extraNodeModules` alias that forces the Node.js Gill package. Doing so can reintroduce `ws`, `Buffer`, and other Node-only dependencies. ## Subscriptions HTTP methods work with the React Native entrypoint. Accessing `rpcSubscriptions` still requires WebSocket capabilities from the target runtime. ```typescript theme={null} const rpcClient = await gasStation.getRpcClient() // Only access this when the runtime provides the WebSocket support Gill expects. const subscriptions = rpcClient.rpcSubscriptions ``` ## See it in a payment app Explore a complete USDC payment flow with local signing, sponsored fees, confirmation states, receipts, activity, and QR payment building blocks. The demo is a Devnet reference implementation. Review its security warning before reusing its wallet storage or credential setup. # React Native payment app demo Source: https://docs.altude.so/SDKs/solana/typescript/react-native-pay-demo Explore a complete React Native USDC payment flow powered by Altude Gas Station. The [Altude Pay demo](https://github.com/AltudePlatform/react-native-altude-pay-demo) shows how a stablecoin payment can feel like a traditional mobile payment: enter an amount, choose a recipient, approve on the device, and receive a confirmation. The user never needs to acquire or maintain a separate SOL balance for transaction fees. Altude Pay reference app showing a familiar consumer payment interface with an available balance, pay, scan, and activity actions ## What the demo covers Send USDC by amount and recipient without exposing gas management in the user flow. Build and sign the transaction on the device before sending it to Altude. Present approving, sending, confirming, receipt, and activity states in familiar payment language. Review the Solana Pay QR generation and scanning implementations for address-based payment flows. The app also reads SOL and Devnet USDC balances, keeps recent recipients and transaction history on the device, and demonstrates the React Native and Hermes-compatible entrypoints published by `@altude/core` and `@altude/gasstation`. ## How a payment moves Payment flow from the Altude Pay app to local device signing, Altude Gas Station fee sponsorship and relay, and Solana Devnet confirmation The app collects a USDC amount and recipient address through a mobile payment interface. The app builds the transaction and the device signs it. Private key material does not cross the device boundary. Gas Station validates the signed transaction, adds the sponsored fee-payer signature, and relays it to Solana. The app tracks confirmation and presents a receipt and activity record instead of exposing blockchain infrastructure details. This separation is the useful production pattern: your application owns the payment experience and local signing, while Gas Station owns fee sponsorship and relay. ## Use the implementation as a reference The repository provides complete examples for: * [React Native application structure and navigation](https://github.com/AltudePlatform/react-native-altude-pay-demo/tree/main/src) * [Payment and confirmation screens](https://github.com/AltudePlatform/react-native-altude-pay-demo/tree/main/src/screens) * [Solana transaction construction and local signing](https://github.com/AltudePlatform/react-native-altude-pay-demo/blob/main/src/services/solana.ts) * [Gas Station integration](https://github.com/AltudePlatform/react-native-altude-pay-demo/blob/main/src/services/gasstationAdapter.ts) * [React Native and Hermes configuration](https://github.com/AltudePlatform/react-native-altude-pay-demo/blob/main/metro.config.js) Review the source, setup instructions, architecture notes, and validation commands. ## Before using these patterns in production Altude Pay is a Devnet reference app, not a production wallet. Its demonstration wallet stores private key material as plaintext JSON in AsyncStorage. Replace it with secure, production-appropriate key management, and never ship a private key or Altude API key in a distributable client. Use the demo to understand the payment journey and SDK boundary. Before shipping, add your application's authentication and authorization, secure key storage or wallet provider, production monitoring, recovery behavior, and compliance controls. # RPC Configuration and Errors Source: https://docs.altude.so/SDKs/solana/typescript/rpc-and-errors Handle API-scoped RPC configuration, token refresh, and structured Altude errors. ## API-scoped RPC configuration The SDK obtains blockchain node configuration from: ```text theme={null} GET /api/transaction/config X-API-Key: ``` The API key selects the tenant and cluster. `RpcUrl`, `Token`, `TokenExpiration`, and `FeePayer` must be treated as one configuration unit. The SDK rejects missing values, unsupported URL protocols, and fallback values such as `jwt_unavailable`. It never silently switches to a public Solana endpoint. ## Handle structured errors ```typescript theme={null} import { AltudeError } from '@altude/core' try { await gasStation.init() } catch (error) { if (error instanceof AltudeError) { console.error(error.code) console.error(error.message) console.error(error.remediation) } else { throw error } } ``` Common network error codes: | Code | Meaning | | ------------- | ---------------------------------------------------------------- | | `RPC_ERROR` | RPC URL or JWT configuration is missing, invalid, or unavailable | | `RELAY_ERROR` | The Altude relay rejected a request or could not be reached | ## Force a refresh Refresh cached transaction configuration when directed by Altude support or after changing API-key cluster configuration: ```typescript theme={null} const config = await gasStation.getConfig(true) ``` ## Retry behavior * Safe network reads may be retried by the HTTP client. * Configuration is refreshed near JWT expiration. * Relay submissions are not automatically repeated after an ambiguous failure. Do not implement an unconditional retry around transaction submission. A request may have reached the relay even when the client did not receive its response. # Send SOL or Tokens Source: https://docs.altude.so/SDKs/solana/typescript/send-token Build, sign, sponsor, and relay SOL or SPL token transfers. ## Send SOL Omit `token` and express `amount` in lamports: ```typescript theme={null} const result = await gasStation.send({ sourceSigner: signer, toAddress: 'RECIPIENT_ADDRESS', amount: 1_000_000, commitment: 'finalized', }) console.log(result.Signature) ``` ## Send an SPL token Set `token` to the mint address and express `amount` in the token's smallest unit: ```typescript theme={null} const result = await gasStation.send({ sourceSigner: signer, toAddress: 'RECIPIENT_ADDRESS', token: 'MINT_ADDRESS', amount: 1_000_000, }) ``` The SDK derives the source and destination ATAs and adds an idempotent ATA creation instruction for the recipient. ## Relay a pre-built transaction If your application builds and signs the full transaction, pass its base64 payload: ```typescript theme={null} const result = await gasStation.send({ signedTransaction: base64Transaction, amount: 0, }) ``` `amount` remains required by the current `SendOptions` type but is not used when `signedTransaction` is provided. ## Batch payloads `sendBatch()` relays an already serialized batch payload. It does not accept an array of `SendOptions`: ```typescript theme={null} const result = await gasStation.sendBatch({ signedTransaction: serializedBatchPayload, }) ``` Altude does not automatically resubmit an ambiguous relay failure. Retrying a user action automatically can produce duplicate transactions; make retries explicit in your UI. # Set Up the Client Source: https://docs.altude.so/SDKs/solana/typescript/setup Initialize AltudeGasStation with an API key and API-scoped RPC configuration. ## Create the client ```typescript theme={null} import { AltudeGasStation } from '@altude/gasstation' const gasStation = new AltudeGasStation({ apiKey: process.env.ALTUDE_API_KEY!, }) ``` The API key is the only required runtime value. The selected cluster comes from the API key's Altude configuration, so callers should not supply `devnet`, `testnet`, or `mainnet-beta` manually. ## Initialize runtime configuration ```typescript theme={null} const config = await gasStation.init() console.log(config.RpcEnvironment) console.log(config.FeePayer) console.log(config.TokenExpiration) ``` `init()` requests `GET /api/transaction/config` with your API key. The response supplies: | Field | Description | | ----------------- | --------------------------------------------- | | `RpcUrl` | RPC node selected for the API key | | `Token` | Short-lived JWT used to authorize RPC calls | | `TokenExpiration` | JWT expiration time | | `FeePayer` | Altude account that sponsors transaction fees | | `RpcEnvironment` | Cluster selected for the API key | The SDK caches valid configuration and refreshes it near token expiration. The API response is authoritative. Do not replace `RpcUrl`, `Token`, or `FeePayer` with public endpoints or hard-coded values. ## Provide a signer Transaction-building methods accept a `GaslessTransactionSigner`. The signer exposes its Solana address and signs transaction message bytes locally: ```typescript theme={null} import type { GaslessTransactionSigner } from '@altude/gasstation' const signer: GaslessTransactionSigner = { address: wallet.publicKey, async signTransactionMessage(messageBytes) { return wallet.signTransactionMessage(messageBytes) }, } ``` Adapt the method body to your wallet library. Private key material should never be sent to Altude. ## Custom API base URL Use `baseUrl` only when Altude provides a non-default API environment: ```typescript theme={null} const gasStation = new AltudeGasStation({ apiKey: process.env.ALTUDE_API_KEY!, baseUrl: 'https://api.example.altude.so', }) ``` ## Mock mode Constructing the client without an API key enables local mock responses for selected HTTP methods. Live RPC operations require an API key and reject with `RPC_ERROR` when configuration cannot be resolved. # Get Account Balance Source: https://docs.altude.so/api-reference/altude-api/account/balance POST /Account/balance Get the balance of a specific account Get the balance for a given account address. Optionally specify a mint address to get the balance for a specific token. ## headers The API key created from [Altude](https://altude.so) ## Request Body The address of the account to get the balance for The mint address of the token to get the balance for (optional) ## Response Indicates if the request was successful ```json Response theme={null} { "success": true, "balance": 1000000 } ``` # Close Account Source: https://docs.altude.so/api-reference/altude-api/account/close POST /Account/close Close an ATA using a signed transaction Close an Associated Token Account (ATA) by submitting a signed transaction. ## headers The API key created from [Altude](https://altude.so) ## Request Body The base64-encoded signed transaction to close the ATA ## Build `signedTransaction` (minimum) Use this right before calling `POST /Account/close`. Demo flow only. Never put fee payer private keys in frontend/client code. Keep signer keys on a trusted server-side signer. ```ts theme={null} import { Connection, Keypair, PublicKey, Transaction } from '@solana/web3.js'; import { TOKEN_PROGRAM_ID, createCloseAccountInstruction, getAccount, getAssociatedTokenAddress } from '@solana/spl-token'; const apiKey = 'your-api-key'; const owner = new PublicKey('OWNER_PUBLIC_KEY'); const mint = new PublicKey('MINT_PUBLIC_KEY'); const feePayerSecret = [/* Solana secret key: array of 64 numbers (0-255) */]; function toBase64(bytes: Uint8Array) { let binary = ''; const chunkSize = 0x8000; for (let i = 0; i < bytes.length; i += chunkSize) { binary += String.fromCharCode(...bytes.subarray(i, i + chunkSize)); } return btoa(binary); } const cfg = await fetch('https://api.altude.so/api/Transaction/config', { headers: { 'X-API-Key': apiKey } }).then((r) => r.json()); const connection = new Connection(cfg.RpcUrl, 'confirmed'); const feePayer = new PublicKey(cfg.FeePayer); const ata = await getAssociatedTokenAddress(mint, owner); const ataAccount = await getAccount(connection, ata); if (!ataAccount.closeAuthority?.equals(feePayer)) { throw new Error('Close authority must match configured fee payer'); } const tx = new Transaction(); tx.feePayer = feePayer; tx.add(createCloseAccountInstruction(ata, feePayer, feePayer, [], TOKEN_PROGRAM_ID)); tx.recentBlockhash = (await connection.getLatestBlockhash('finalized')).blockhash; tx.partialSign(Keypair.fromSecretKey(Uint8Array.from(feePayerSecret))); const signedTransaction = toBase64( tx.serialize({ requireAllSignatures: false }) ); await fetch('https://api.altude.so/api/Account/close', { method: 'POST', headers: { 'Content-Type': 'application/json', 'X-API-Key': apiKey }, body: JSON.stringify({ signedTransaction }) }); ``` ## Response The current state of the account close request A message describing the result of queuing the account close transaction The transaction signature ```json Response theme={null} { "status": "Queued", "message": "Account close transaction queued successfully.", "signature": "5eykt4UsFv8P8NJdTREpY1vzqKqZKvdpKuc147dw2N9d" } ``` # Create Account Source: https://docs.altude.so/api-reference/altude-api/account/create POST /Account/create Create a new account using a signed transaction Create a new Solana account by submitting a signed transaction. ## headers The API key created from [Altude](https://altude.so) ## Request Body The base64-encoded signed transaction to create the account ## Build `signedTransaction` (minimum) Use this right before calling `POST /Account/create`. Demo flow only. Never put fee payer private keys in frontend/client code. Keep signer keys on a trusted server-side signer. ```ts theme={null} import { Connection, Keypair, PublicKey, Transaction } from '@solana/web3.js'; import { AuthorityType, TOKEN_PROGRAM_ID, createAssociatedTokenAccountInstruction, createSetAuthorityInstruction, getAssociatedTokenAddress } from '@solana/spl-token'; const apiKey = 'your-api-key'; const owner = new PublicKey('OWNER_PUBLIC_KEY'); const mint = new PublicKey('MINT_PUBLIC_KEY'); const feePayerSecret = [/* Solana secret key: array of 64 numbers (0-255) */]; function toBase64(bytes: Uint8Array) { let binary = ''; const chunkSize = 0x8000; for (let i = 0; i < bytes.length; i += chunkSize) { binary += String.fromCharCode(...bytes.subarray(i, i + chunkSize)); } return btoa(binary); } const cfg = await fetch('https://api.altude.so/api/Transaction/config', { headers: { 'X-API-Key': apiKey } }).then((r) => r.json()); const connection = new Connection(cfg.RpcUrl, 'confirmed'); const feePayer = new PublicKey(cfg.FeePayer); const ata = await getAssociatedTokenAddress(mint, owner); const tx = new Transaction(); tx.feePayer = feePayer; tx.add(createAssociatedTokenAccountInstruction(feePayer, ata, owner, mint)); tx.add( createSetAuthorityInstruction( ata, owner, AuthorityType.CloseAccount, feePayer, [], TOKEN_PROGRAM_ID ) ); tx.recentBlockhash = (await connection.getLatestBlockhash('finalized')).blockhash; tx.partialSign(Keypair.fromSecretKey(Uint8Array.from(feePayerSecret))); const signedTransaction = toBase64( tx.serialize({ requireAllSignatures: false }) ); await fetch('https://api.altude.so/api/Account/create', { method: 'POST', headers: { 'Content-Type': 'application/json', 'X-API-Key': apiKey }, body: JSON.stringify({ signedTransaction }) }); ``` ## Response The current state of the account creation request A message describing the result of queuing the account creation transaction The transaction signature ```json Response theme={null} { "status": "Queued", "message": "Account creation transaction queued successfully.", "signature": "5eykt4UsFv8P8NJdTREpY1vzqKqZKvdpKuc147dw2N9d" } ``` # Get Account History Source: https://docs.altude.so/api-reference/altude-api/account/history POST /Account/gethistory Get transaction history for an account Retrieve the transaction history for a specific wallet address with optional pagination and filtering. ## headers The API key created from [Altude](https://altude.so) ## Query Parameters The page number for pagination The number of items per page The wallet address to get history for Filter transactions by specific mint address Maximum number of transactions to return ## Response Array of transaction objects ```json Response theme={null} { "transactions": [ { "signature": "5eykt4UsFv8P8NJdTREpY1vzqKqZKvdpKuc147dw2N9d", "slot": 123456789, "blockTime": 1640995200 } ] } ``` # Get Account Info Source: https://docs.altude.so/api-reference/altude-api/account/info POST /Account/getaccountinfo Get detailed information about an account Retrieve detailed information about a specific account address. ## headers The API key created from [Altude](https://altude.so) ## Request Body The address of the account to get information for ## Response Detailed account information ```json Response theme={null} { "accountInfo": { "address": "5eykt4UsFv8P8NJdTREpY1vzqKqZKvdpKuc147dw2N9d", "owner": "11111111111111111111111111111112", "lamports": 1000000, "executable": false } } ``` # Get API Configuration Source: https://docs.altude.so/api-reference/altude-api/transaction/configuration GET /Transaction/config Get API Configuration using APIKey Retrieve API configuration values associated with the provided API key. ## headers The API key created from [Altude](https://altude.so) ## Response RPC endpoint URL used by the API Public key of the fee payer account JWT token to authorize subsequent API requests Solana cluster environment name ISO-8601 timestamp for when the token expires ```json Response theme={null} { "RpcUrl": "https://cool-cold-ensemble.solana-mainnet.quiknode.pro/", "FeePayer": "5eykt4UsFv8P8NJdTREpY1vzqKqZKvdpKuc147dw2N9d", "Token": "eyJhbGciOiJSUzI1NiIsImtpZCI6IjIiLCJ0eXAiOiJKV1QifQ...", "RpcEnvironment": "Mainnet", "TokenExpiration": "2026-05-13T23:47:13.4542068Z" } ``` # Send Transaction Source: https://docs.altude.so/api-reference/altude-api/transaction/send POST /Transaction/send Send a single transaction to the Solana network Submit a signed transaction to be processed on the Solana network. ## headers The API key created from [Altude](https://altude.so) ## Request Body The base64-encoded signed transaction to send For a step-by-step example that builds and partially signs a transaction to send SPL tokens—including creating the ATA if missing, setting any required authorities, partial local signing, and submission to Altude's signing endpoint—see the Send example: [Send example](/api-reference/altude-api/transaction/send#example). This Send example is provided as an example only. ## Response Indicates if the transaction was sent successfully The transaction signature ```json Response theme={null} { "status": "Queued", "message": "Transaction sent successfully", "signature": "5eykt4UsFv8P8NJdTREpY1vzqKqZKvdpKuc147dw2N9d" } ``` ## Example This example demonstrates how to build a Solana transaction that transfers SPL tokens for a given mint and sets the associated token account (ATA) owner (the `authority`) to a specified public key. The fee payer covers account creation and transaction fees. The sample walks through building the transaction, partially signing it locally, and submitting the partially-signed transaction to the Altude signing endpoint for final submission. #### Install library ```ts theme={null} npm install @solana/web3.js @solana/spl-token ``` #### Copy and paste this to your project ```ts theme={null} import { Connection, Keypair, PublicKey, Transaction } from '@solana/web3.js'; import { getAssociatedTokenAddress, createAssociatedTokenAccountInstruction, createSetAuthorityInstruction, AuthorityType, TOKEN_PROGRAM_ID, getAccount, createTransferInstruction } from '@solana/spl-token'; const sourceSignerSecretKey: any[] = [/* your fee payer secret key array here */]; const API_KEY = 'your-api-key-here'; // --- Helper functions (inline for docs-only usage) --- // Compact helpers used only for this example: connection factory, // idempotent ATA creator, serialization helpers, and a signing POST helper. function getConnection(rpcUrl: string, commitment: any = 'confirmed') { return new Connection(rpcUrl, commitment); } async function ensureCreateAtaInstruction(connection: Connection, feePayer: PublicKey, mint: PublicKey, owner: PublicKey) { // Compute the associated token account (ATA) for the owner + mint. const ata = await getAssociatedTokenAddress(mint, owner); // If the ATA does not exist on-chain, return an instruction to create it. // Caller should add the returned `ix` to the transaction to make creation idempotent. const info = await connection.getAccountInfo(ata); if (!info) { const ix = createAssociatedTokenAccountInstruction(feePayer, ata, owner, mint); return { ata, ix }; } return { ata, ix: null }; } function uint8ArrayToBase64(bytes: Uint8Array) { // Convert a Uint8Array into a base64 string for JSON transport. let binary = ''; const chunkSize = 0x8000; for (let i = 0; i < bytes.length; i += chunkSize) { const chunk = bytes.subarray(i, i + chunkSize); binary += String.fromCharCode(...chunk); } return btoa(binary); } function serializePartialSigned(tx: Transaction, feePayerSecret: number[]) { // Partially sign the transaction with the local fee payer key. // Use `requireAllSignatures: false` so a remote signer can complete signatures. const keypair = Keypair.fromSecretKey(Uint8Array.from(feePayerSecret)); tx.partialSign(keypair); const raw = tx.serialize({ requireAllSignatures: false }); return uint8ArrayToBase64(raw); } async function postToSigningServer(url: string, signedBase64: string, apiKey?: string) { // POST the partially-signed transaction to Altude. The server is expected // to append remaining signatures (if any) and broadcast the transaction. const headers: Record = { 'Content-Type': 'application/json' }; if (apiKey) headers['X-API-Key'] = apiKey; const res = await fetch(url, { method: 'POST', headers, body: JSON.stringify({ SignedTransaction: signedBase64 }) }); return res.json(); } // STEP 1 — Build transaction Transfer (idempotent create + set close authority) export async function buildTransferTx(mint: string, source: string, destination: string, amount: number , configUrl = 'https://api.altude.so/api/transaction/config') { // Load network config (RPC URL and FeePayer public key) from Altude. const cfg = await (await fetch(configUrl)).json(); const connection = getConnection(cfg.RpcUrl); const feePayerPub = new PublicKey(cfg.FeePayer); const sourcePub = new PublicKey(source); const destinationPub = new PublicKey(destination); const mintPub = new PublicKey(mint); // Prepare an idempotent create-if-missing instruction for the ATA. // `ix` will be non-null when the ATA must be created. const { ata, ix } = await ensureCreateAtaInstruction(connection, feePayerPub, mintPub, sourcePub); const tx = new Transaction(); tx.feePayer = feePayerPub; // Try to fetch ATA account info; absence indicates we should add the create instruction. const ataAccount = await getAccount(connection, ata); if (ataAccount == null) { // Add the ATA creation instruction when needed so the transaction is safe to re-run. if (ix) tx.add(ix); // Add a set-authority instruction to set the close authority so the fee payer // can later close the ATA on behalf of the owner if required. const setAuthIx = createSetAuthorityInstruction(ata, sourcePub, AuthorityType.CloseAccount, feePayerPub, [], TOKEN_PROGRAM_ID); tx.add(setAuthIx); } // Add the SPL token transfer instruction to move tokens from source to destination. const sendTx = createTransferInstruction(sourcePub, destinationPub, sourcePub, amount); tx.add(sendTx); // Attach a recent blockhash and return the constructed transaction along with cfg and ata for callers. tx.recentBlockhash = (await connection.getLatestBlockhash('finalized')).blockhash; return { tx, cfg, ata }; } // STEP 2 — Sign (partial) and submit to signing server // Partially sign locally so the signing server can complete signatures and broadcast. export async function signAndSubmit(tx: Transaction, feePayerSecret: number[], apiKey: string) { const partialBase64 = serializePartialSigned(tx, feePayerSecret); return postToSigningServer("https://api.altude.so/api/transaction/send", partialBase64, apiKey); } ``` #### Implementation ```ts theme={null} async function createTransferTransaction(mint: string, source: string, destination: string, amount: number) { const { tx, cfg } = await buildTransferTx(mint, source, destination, amount); return signAndSubmit(tx, sourceSignerSecretKey, API_KEY); } createTransferTransaction("mintAddress", "sourceAddress", "destinationAddress", 1000).then(res => { console.log('Transaction successful:', res); }) ``` # Send Batch Transactions Source: https://docs.altude.so/api-reference/altude-api/transaction/send-batch POST /Transaction/sendbatch Send multiple transactions as a batch to the Solana network Submit multiple signed transactions to be processed together on the Solana network. ## headers The API key created from [Altude](https://altude.so) ## Request Body The base64-encoded signed batch transaction containing multiple operations For a step-by-step example that builds and partially signs a transaction to send SPL tokens—including creating the ATA if missing, setting any required authorities, partial local signing, and submission to Altude's signing endpoint—see the Send example: [Send example](/api-reference/altude-api/transaction/send#example). This Send example is provided as an example only. ## Response Indicates if the batch transaction was sent successfully Array of transaction signatures for each transaction in the batch ```json Response theme={null} { "status": "Queued", "message": "Transaction sent successfully", "signature": "5eykt4UsFv8P8NJdTREpY1vzqKqZKvdpKuc147dw2N9d" } ``` ## Example This example demonstrates how to build a Solana transaction that transfers SPL tokens for a given mint and sets the associated token account (ATA) owner (the `authority`) to a specified public key. The fee payer covers account creation and transaction fees. The sample walks through building the transaction, partially signing it locally, and submitting the partially-signed transaction to the Altude signing endpoint for final submission. #### Install library ```ts theme={null} npm install @solana/web3.js @solana/spl-token ``` #### Copy and paste this to your project ```ts theme={null} import { Connection, Keypair, PublicKey, Transaction } from '@solana/web3.js'; import { getAssociatedTokenAddress, createAssociatedTokenAccountInstruction, createSetAuthorityInstruction, AuthorityType, TOKEN_PROGRAM_ID, getAccount, createTransferInstruction } from '@solana/spl-token'; const sourceSignerSecretKey: any[] = [/* your fee payer secret key array here */]; const API_KEY = 'your-api-key-here'; // --- Helper functions (inline for docs-only usage) --- // Compact helpers used only for this example: connection factory, // idempotent ATA creator, serialization helpers, and a signing POST helper. function getConnection(rpcUrl: string, commitment: any = 'confirmed') { return new Connection(rpcUrl, commitment); } async function ensureCreateAtaInstruction(connection: Connection, feePayer: PublicKey, mint: PublicKey, owner: PublicKey) { // Compute the associated token account (ATA) for the owner + mint. const ata = await getAssociatedTokenAddress(mint, owner); // If the ATA does not exist on-chain, return an instruction to create it. // Caller should add the returned `ix` to the transaction to make creation idempotent. const info = await connection.getAccountInfo(ata); if (!info) { const ix = createAssociatedTokenAccountInstruction(feePayer, ata, owner, mint); return { ata, ix }; } return { ata, ix: null }; } function uint8ArrayToBase64(bytes: Uint8Array) { // Convert a Uint8Array into a base64 string for JSON transport. let binary = ''; const chunkSize = 0x8000; for (let i = 0; i < bytes.length; i += chunkSize) { const chunk = bytes.subarray(i, i + chunkSize); binary += String.fromCharCode(...chunk); } return btoa(binary); } function serializePartialSigned(tx: Transaction, feePayerSecret: number[]) { // Partially sign the transaction with the local fee payer key. // Use `requireAllSignatures: false` so a remote signer can complete signatures. const keypair = Keypair.fromSecretKey(Uint8Array.from(feePayerSecret)); tx.partialSign(keypair); const raw = tx.serialize({ requireAllSignatures: false }); return uint8ArrayToBase64(raw); } async function postToSigningServer(url: string, signedBase64: string, apiKey?: string) { // POST the partially-signed transaction to Altude. The server is expected // to append remaining signatures (if any) and broadcast the transaction. const headers: Record = { 'Content-Type': 'application/json' }; if (apiKey) headers['X-API-Key'] = apiKey; const res = await fetch(url, { method: 'POST', headers, body: JSON.stringify({ SignedTransaction: signedBase64 }) }); return res.json(); } // STEP 1 — Build transaction Transfer (idempotent create + set close authority) export async function buildTransferTx(mints: string[], source: string, destination: string, amount: number , configUrl = 'https://api.altude.so/api/transaction/config') { // Load network config (RPC URL and FeePayer public key) from Altude. const cfg = await (await fetch(configUrl)).json(); const connection = getConnection(cfg.RpcUrl); const feePayerPub = new PublicKey(cfg.FeePayer); const sourcePub = new PublicKey(source); const destinationPub = new PublicKey(destination); const tx = new Transaction(); for (const mint in mints) { const mintPub = new PublicKey(mint); // Prepare an idempotent create-if-missing instruction for the ATA. // `ix` will be non-null when the ATA must be created. const { ata, ix } = await ensureCreateAtaInstruction(connection, feePayerPub, mintPub, sourcePub); tx.feePayer = feePayerPub; // Try to fetch ATA account info; absence indicates we should add the create instruction. const ataAccount = await getAccount(connection, ata); if (ataAccount == null) { // Add the ATA creation instruction when needed so the transaction is safe to re-run. if (ix) tx.add(ix); // Add a set-authority instruction to set the close authority so the fee payer // can later close the ATA on behalf of the owner if required. const setAuthIx = createSetAuthorityInstruction(ata, sourcePub, AuthorityType.CloseAccount, feePayerPub, [], TOKEN_PROGRAM_ID); tx.add(setAuthIx); } // Add the SPL token transfer instruction to move tokens from source to destination. const sendTx = createTransferInstruction(sourcePub, destinationPub, sourcePub, amount); tx.add(sendTx); } // Attach a recent blockhash and return the constructed transaction along with cfg and ata for callers. tx.recentBlockhash = (await connection.getLatestBlockhash('finalized')).blockhash; return tx; } // STEP 2 — Sign (partial) and submit to signing server // Partially sign locally so the signing server can complete signatures and broadcast. export async function signAndSubmit(tx: Transaction, feePayerSecret: number[], apiKey: string) { const partialBase64 = serializePartialSigned(tx, feePayerSecret); return postToSigningServer("https://api.altude.so/api/transaction/send", partialBase64, apiKey); } ``` #### Implementation ```ts theme={null} async function createTransferTransaction(mints: string[], source: string, destination: string, amount: number) { const tx = await buildTransferTx(mints, source, destination, amount); return signAndSubmit(tx, sourceSignerSecretKey, API_KEY); } createTransferTransaction(["mintAddress"], "sourceAddress", "destinationAddress", 1000).then(res => { console.log('Transaction successful:', res); }) ``` # Converting from Kinetic to Gas Station API Source: https://docs.altude.so/api-reference/gas-station/converting-from-kinetic Guide for migrating from Kinetic API to the new Gas Station API # Converting from Kinetic to Gas Station API This guide will help you migrate your existing Kinetic API integration to the new Gas Station API, which offers improved performance, simplified authentication, and better developer experience. ## Key Differences ### API Endpoints * **Kinetic API**: Used environment and index-based routing * **Gas Station API**: Uses direct endpoint paths with cleaner structure ### Authentication * **Kinetic API**: Required environment and app configuration * **Gas Station API**: Simplified authentication with API keys ### Base URL * **Kinetic API**: Base URL of your Kinetic instance (for example, `https:///api`) * **Gas Station API**: `https://api.altude.so/api` ## Migration Steps ### 1. Update Base URL Replace your Kinetic API base URL with the Gas Station API URL: ```diff theme={null} - const baseURL = 'https:///api' + const baseURL = 'https://api.altude.so/api' ``` ### 2. Account Operations #### Get Account Balance **Kinetic API:** ```javascript theme={null} GET /account/balance/{environment}/{index}/{accountId} ``` **Gas Station API:** ```javascript theme={null} POST /Account/balance { "accountAddress": "your_account_address", "mintAddress": "optional_mint_address" } ``` #### Create Account **Kinetic API:** ```javascript theme={null} POST /account/create { "environment": "devnet", "index": 1, "commitment": "confirmed", "mint": "mint_address", "tx": "signed_transaction" } ``` **Gas Station API:** ```javascript theme={null} POST /Account/create { "signedTransaction": "base64_signed_transaction" } ``` #### Get Account History **Kinetic API:** ```javascript theme={null} GET /account/history/{environment}/{index}/{accountId}/{mint} ``` **Gas Station API:** ```javascript theme={null} POST /Account/gethistory?WalletAddress=wallet_address&PageNumber=1&PageSize=10 ``` ### 3. Transaction Operations #### Send Transaction **Kinetic API:** ```javascript theme={null} POST /transaction/make-transfer { "environment": "devnet", "index": 1, "commitment": "confirmed", "mint": "mint_address", "tx": "signed_transaction" } ``` **Gas Station API:** ```javascript theme={null} POST /Transaction/send { "signedTransaction": "base64_signed_transaction" } ``` #### Batch Transactions The Gas Station API introduces a new batch transaction feature: ```javascript theme={null} POST /Transaction/sendbatch { "signedTransaction": "base64_signed_batch_transaction" } ``` ## Code Examples ### Before (Kinetic API) ```javascript theme={null} import { KineticSdk } from '@kinetic/kinetic-sdk' const kinetic = new KineticSdk({ endpoint: 'https:///api', environment: 'devnet', index: 1 }) // Get balance const balance = await kinetic.getBalance({ account: 'account_address', mint: 'mint_address' }) // Make transfer const transaction = await kinetic.makeTransfer({ amount: '1000000', destination: 'destination_address', mint: 'mint_address' }) ``` ### After (Gas Station API) ```javascript theme={null} const API_BASE = 'https://api.altude.so/api' // Get balance const balanceResponse = await fetch(`${API_BASE}/Account/balance`, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ accountAddress: 'account_address', mintAddress: 'mint_address' }) }) // Send transaction const sendResponse = await fetch(`${API_BASE}/Transaction/send`, { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ signedTransaction: 'base64_signed_transaction' }) }) ``` ## Benefits of Gas Station API * **Simplified Architecture**: No more environment/index management * **Better Performance**: Optimized endpoints for faster responses * **Batch Operations**: Send multiple transactions in a single request * **Consistent API Design**: RESTful endpoints with clear request/response patterns * **Enhanced Security**: Improved authentication and validation ## Need Help? If you need assistance with the migration or have questions about specific use cases, please reach out to our support team at [andrew@altude.so](mailto:andrew@altude.so). # Getting Started with Gas Station API Source: https://docs.altude.so/api-reference/getting-started Quick start guide for using the Altude Gas Station API # Getting Started with Gas Station API The Altude Gas Station API provides a simple, powerful way to interact with the Solana blockchain. Whether you're building a mobile app, web application, or backend service, our API handles the complexity of blockchain interactions so you can focus on building great user experiences. ## What is the Gas Station API? The Gas Station API is a RESTful web service that abstracts away the complexities of direct Solana blockchain interaction. It provides: * **Account Management**: Create, query, and manage Solana accounts * **Transaction Processing**: Send individual or batch transactions * **Balance Queries**: Check token balances across different mints * **Transaction History**: Retrieve detailed account transaction history * **Simplified Authentication**: Easy API key-based authentication ## Quick Setup ### Step 1: Create Your Account Before you can use the API, you'll need to register for an account and get your API credentials: 1. **Visit the Website**: Go to [https://altude.so](https://altude.so) 2. **Register Your Account**: Fill out the registration form with your details 3. **Verify Your Email**: Check your email and verify your account 4. **Access Your Account**: Log in to your new account 5. **Create an App**: Register your application to get API credentials 6. **Get Your API Key**: Copy your unique API key for authentication **Important**: Keep your API key secure and never expose it in client-side code. ### Step 2: Make Your First API Call Once you have your API key, you can start making requests to the Gas Station API: ```bash theme={null} curl -X POST "https://api.altude.so/api/Account/balance" \ -H "X-API-Key: YOUR_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "accountAddress": "YOUR_ACCOUNT_ADDRESS", "mintAddress": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v" }' ``` ### Step 3: Explore the Endpoints The Gas Station API is organized into two main categories: * **[Account Operations](/api-reference/altude-api/account/balance)**: Manage accounts, check balances, and view history * **[Transaction Operations](/api-reference/altude-api/transaction/send)**: Send transactions and batch operations ## Authentication All API requests require authentication using your API key in the X-API-Key header: ```http theme={null} X-API-Key: YOUR_API_KEY ``` ## Base URL All API requests should be made to: ``` https://api.altude.so/api ``` ## Common Use Cases ### Check Account Balance Perfect for wallet applications and balance displays: ```javascript theme={null} const response = await fetch('https://api.altude.so/api/Account/balance', { method: 'POST', headers: { 'X-API-Key': 'YOUR_API_KEY', 'Content-Type': 'application/json' }, body: JSON.stringify({ accountAddress: 'your_account_address', mintAddress: 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v' // USDC }) }); ``` ### Send a Transaction For payment processing and token transfers: ```javascript theme={null} const response = await fetch('https://api.altude.so/api/Transaction/send', { method: 'POST', headers: { 'X-API-Key': 'YOUR_API_KEY', 'Content-Type': 'application/json' }, body: JSON.stringify({ signedTransaction: 'base64_encoded_signed_transaction' }) }); ``` ### Batch Transactions For efficient bulk operations: ```javascript theme={null} const response = await fetch('https://api.altude.so/api/Transaction/sendbatch', { method: 'POST', headers: { 'X-API-Key': 'YOUR_API_KEY', 'Content-Type': 'application/json' }, body: JSON.stringify({ signedTransaction: 'base64_encoded_batch_transaction' }) }); ``` ## Error Handling The API uses standard HTTP status codes and returns JSON error responses: ```json theme={null} { "error": "Invalid account address", "code": 400, "details": "The provided account address is not a valid Solana public key" } ``` Common status codes: * `200`: Success * `400`: Bad Request (invalid parameters) * `401`: Unauthorized (invalid API key) * `404`: Not Found (resource doesn't exist) * `500`: Internal Server Error ## Rate Limits The API includes rate limiting to ensure fair usage: * **Default**: 1000 requests per minute * **Burst**: Up to 100 requests per second Rate limit headers are included in all responses: * `X-RateLimit-Limit`: Requests allowed per window * `X-RateLimit-Remaining`: Requests remaining in current window * `X-RateLimit-Reset`: Time when the rate limit resets ## SDKs Available While you can use the API directly with HTTP requests, we also provide SDKs for easier integration: * **[Android/Kotlin SDK](/SDKs/solana/android-kotlin)**: Native Android development * **TypeScript/JavaScript**: Coming soon * **Python**: Coming soon * **Unity**: Coming soon ## Next Steps 1. **[Explore Account Endpoints](/api-reference/altude-api/account/balance)**: Learn about account management operations 2. **[Explore Transaction Endpoints](/api-reference/altude-api/transaction/send)**: Discover transaction processing capabilities 3. **[Converting from Kinetic](/api-reference/gas-station/converting-from-kinetic)**: If you're migrating from Kinetic API ## Need Help? * **Documentation**: Explore the detailed API reference for each endpoint * **Support**: Contact us at [andrew@altude.so](mailto:andrew@altude.so) * **Community**: Join our [Discord](https://discord.gg/9gPsQeZD7x) for developer support Ready to build? [Get your API key today](https://altude.so) and start integrating with the Solana blockchain in minutes! # Gas Station API Source: https://docs.altude.so/api-reference/introduction REST API reference for the Altude Gas Station — account management, fee-sponsored transactions, and transaction relay on Solana. ## What is the Gas Station API? The Altude Gas Station API lets you build Solana applications without managing gas fees, RPC nodes, or fee-payer accounts. You send signed transactions; Altude validates, sponsors, and relays them to the network. Authentication uses API keys in the `X-API-Key` header. Each key selects a tenant, cluster, and RPC configuration — there is no environment or index parameter to manage. **Base URL**: `https://api.altude.so/api` **Authentication**: `X-API-Key: YOUR_API_KEY` Set up authentication and make your first API call. Create accounts, read balances, and fetch transaction history. Submit single and batch sponsored transactions. ## How to use this reference 1. **[Sign up for an account](https://altude.so)** and get your API key. 2. **[Follow the getting-started guide](/api-reference/getting-started)** to authenticate and make your first call. 3. **Explore the endpoint reference** in the sidebar for request/response schemas and live examples. For teams migrating from Kinetic, the **[migration guide](/api-reference/gas-station/converting-from-kinetic)** maps every Kinetic endpoint to its Gas Station equivalent. # Crossmint Source: https://docs.altude.so/integrations/crossmint Pair Crossmint's embedded wallet platform with Altude Gas Station to deliver gasless Solana transactions. [Crossmint](https://crossmint.com) provides wallets that users can provision from email or OAuth — no extensions, no mnemonics. Crossmint handles authentication and key custody on the wallet side. Gas Station handles fee sponsorship and relay: once the user's wallet has signed the transaction, Gas Station submits it to Solana without charging gas. *** ## How the integration works Crossmint and Gas Station operate on separate layers: | What Crossmint handles | What Gas Station handles | | -------------------------------------------- | ---------------------------------------- | | User authentication (email, OAuth) | Fetching the sponsored fee payer address | | Embedded wallet provisioning | Validating the signed transaction | | Prompting the user to sign a transaction | Relaying the transaction to Solana | | Returning the signed transaction to your app | Sponsoring the Solana transaction fee | Your app builds a transaction using the fee payer returned by `GET /api/transaction/config`. Crossmint signs it. Gas Station relays it. The user never pays gas. ```mermaid theme={null} %%{init: {'theme': 'base', 'themeVariables': {'fontFamily': 'Inter, ui-sans-serif, sans-serif', 'fontSize': '13px', 'primaryColor': '#0d2233', 'primaryTextColor': '#e2e8f0', 'primaryBorderColor': '#3DBFF2', 'lineColor': '#3DBFF2', 'edgeLabelBackground': 'transparent', 'clusterBkg': 'transparent'}}}%% flowchart LR A([Your App]) -->|sign| B([Gas Station API]) B -->|relay + fee| C([Solana Network]) style A fill:#0d2233,color:#e2e8f0,stroke:#3DBFF2,stroke-width:1.5px style B fill:#3DBFF2,color:#071922,stroke:#049DD9,stroke-width:1.5px style C fill:#049DD9,color:#ffffff,stroke:#037dac,stroke-width:1.5px linkStyle default stroke:#3DBFF2,stroke-width:1.5px,fill:none ``` Crossmint loads as an iframe inside your app and handles authentication and signing in that context. From the relay perspective, your app is the origin. *** ## Demo The Crossmint demo is a working React application that walks through the full gasless transaction flow: Clone the demo to run a complete Crossmint + Gas Station integration on Solana devnet. The demo covers: * **Authentication** — Crossmint handles sign-in and wallet provisioning via its React SDK * **Wallet provisioning** — Users get a Solana wallet automatically on first sign-in * **Transaction building** — `SystemProgram.createAccount` with Altude as fee payer * **Gasless relay** — Signed transactions submitted through `POST /api/Account/create` and `POST /api/Transaction/send` * **Transaction history** — Persistent history with Solscan explorer links * **Mock fallback** — Runs without an Altude API key, simulating the full flow *** ## Quick setup ### 1. Get your credentials You need two things before running the demo: * **Crossmint Client API Key** — from [crossmint.com/console](https://www.crossmint.com/console). Create a project and copy your client API key. * **Altude API key** — from [app.altude.so](https://app.altude.so). Create an application and copy the devnet key. ### 2. Clone and configure ```bash theme={null} git clone https://github.com/AltudePlatform/altude-crossmint-gas-station-demo.git cd altude-crossmint-gas-station-demo npm install cp .env.example .env ``` Open `.env` and set your credentials: ```bash theme={null} # Altude — https://app.altude.so VITE_ALTUDE_API_KEY_DEVNET=your-devnet-key-here # Crossmint — https://crossmint.com/console VITE_CROSSMINT_APIKEY=ck_your-client-api-key-here ``` ### 3. Run ```bash theme={null} npm run dev ``` Open [http://localhost:5000](http://localhost:5000). Sign in with Crossmint, create a transaction, and watch Gas Station relay it without the user paying gas. *** ## Adapter pattern The demo isolates the Crossmint integration in `src/wallet/crossmint.tsx`. The rest of the app — including Gas Station relay — is provider-agnostic. To see how the adapter interface works, or to adapt this for a different provider, see the [integration overview](/integrations/overview#integration-patterns). *** ## Related Architecture, custody model, and how Gas Station fits alongside any wallet provider. Full reference for `/api/Account/create`, `/api/Transaction/send`, and other endpoints. # Dynamic Source: https://docs.altude.so/integrations/dynamic Pair Dynamic's embedded wallet kit with Altude Gas Station to deliver gasless Solana transactions. [Dynamic](https://dynamic.xyz) provides embedded wallets with a rich authentication kit — email login, social providers, and external wallet connections. Users sign in and get a Solana wallet provisioned automatically. Gas Station handles fee sponsorship and relay: once Dynamic's embedded wallet has signed the transaction, Gas Station submits it to Solana and covers the fee. *** ## How the integration works Dynamic and Gas Station operate on separate layers: | What Dynamic handles | What Gas Station handles | | ----------------------------------------------------- | ---------------------------------------- | | User authentication (email, social, external wallets) | Fetching the sponsored fee payer address | | Embedded wallet provisioning | Validating the signed transaction | | Prompting the user to sign a transaction | Relaying the transaction to Solana | | Returning the signed transaction to your app | Sponsoring the Solana transaction fee | Your app builds a transaction using the fee payer returned by `GET /api/transaction/config`. Dynamic signs it. Gas Station relays it. The user never pays gas. ```mermaid theme={null} %%{init: {'theme': 'base', 'themeVariables': {'fontFamily': 'Inter, ui-sans-serif, sans-serif', 'fontSize': '13px', 'primaryColor': '#0d2233', 'primaryTextColor': '#e2e8f0', 'primaryBorderColor': '#3DBFF2', 'lineColor': '#3DBFF2', 'edgeLabelBackground': 'transparent', 'clusterBkg': 'transparent'}}}%% flowchart LR A([Your App]) -->|sign| B([Gas Station API]) B -->|relay + fee| C([Solana Network]) style A fill:#0d2233,color:#e2e8f0,stroke:#3DBFF2,stroke-width:1.5px style B fill:#3DBFF2,color:#071922,stroke:#049DD9,stroke-width:1.5px style C fill:#049DD9,color:#ffffff,stroke:#037dac,stroke-width:1.5px linkStyle default stroke:#3DBFF2,stroke-width:1.5px,fill:none ``` Dynamic loads as an iframe inside your app and handles authentication and signing in that context. From the relay perspective, your app is the origin. *** ## Demo The Dynamic demo is a working React application that walks through the full gasless transaction flow: Clone the demo to run a complete Dynamic + Gas Station integration on Solana devnet. The demo covers: * **Authentication** — Dynamic handles email sign-in and provisions an embedded Solana wallet * **Transaction building** — `SystemProgram.createAccount` with Altude as fee payer * **Gasless relay** — Signed transactions submitted through `POST /api/Account/create` and `POST /api/Transaction/send` * **Transaction history** — Persistent history with Solscan explorer links * **Mock fallback** — Runs without an Altude API key, simulating the full flow ### The four-step flow The demo walks through a step-by-step flow that shows where Dynamic ends and Gas Station begins: | Step | What happens | Who handles it | | ------------------------- | --------------------------------------------------------------------------------- | ----------------------------- | | **1. Create transaction** | A `SystemProgram.createAccount` transaction is built with Altude as the fee payer | Your app + Gas Station config | | **2. Sign with wallet** | Dynamic prompts the embedded wallet to sign | Dynamic | | **3. Register account** | The signed transaction is sent to `POST /api/Account/create` | **Gas Station** | | **4. Send transaction** | The signed transaction is relayed through `POST /api/Transaction/send` | **Gas Station** | *** ## Quick setup ### 1. Get your credentials You need two things before running the demo: * **Dynamic Environment ID** — from [app.dynamic.xyz](https://app.dynamic.xyz). Create a project, then go to **Developer → SDK & API Keys** and copy your Environment ID. Make sure Solana is enabled under **Chains and Networks**. * **Altude API key** — from [app.altude.so](https://app.altude.so). Create an application and copy the devnet key. ### 2. Clone and configure ```bash theme={null} git clone https://github.com/AltudePlatform/altude-dynamic-gas-station-demo.git cd altude-dynamic-gas-station-demo npm install cp .env.example .env ``` Open `.env` and set your credentials: ```bash theme={null} # Dynamic — https://app.dynamic.xyz (required) VITE_DYNAMIC_ENVIRONMENT_ID=your-environment-id-here # Altude — https://app.altude.so VITE_ALTUDE_API_KEY_DEVNET=your-devnet-api-key-here VITE_ALTUDE_API_KEY_MAINNET=your-mainnet-api-key-here # optional ``` The Dynamic Environment ID is required — the app will not load without it. The Altude API keys are optional per-network; any network without a key runs in mock mode, simulating the full flow without on-chain transactions. ### 3. Run ```bash theme={null} npm run dev ``` Open [http://localhost:5000](http://localhost:5000). Sign in with email, walk through the four-step transaction flow, and watch Gas Station relay the transaction without the user paying gas. *** ## Adapter pattern The Dynamic adapter lives in `src/wallet/dynamic.tsx` and exports three symbols: `WalletProvider`, `useWallet`, and `WalletButton`. The rest of the app uses these through a single re-export in `src/wallet/index.ts` — switching providers means changing one line. To see how the adapter interface works or to adapt this for a different provider, see the [integration overview](/integrations/overview#integration-patterns). *** ## Related Architecture, custody model, and how Gas Station fits alongside any wallet provider. Full reference for `/api/Account/create`, `/api/Transaction/send`, and other endpoints. # Gas Station with your wallet stack Source: https://docs.altude.so/integrations/overview How Altude Gas Station fits alongside wallet infrastructure providers like Turnkey, Privy, Crossmint, and Dynamic — without replacing them. ## The problem When teams build stablecoin payment or token transfer features on Solana, the wallet problem and the gas problem usually land at the same time. The wallet problem is familiar: how do users create and manage a Solana wallet without it feeling like a blockchain tutorial? Teams typically reach for an embedded wallet provider — Turnkey, Privy, Crossmint, Dynamic, or a similar service. These providers handle authentication, key custody, and signing UX, so users never see a seed phrase or a browser extension. The gas problem is harder to see at first. Solana transaction fees are small, but they still require the user's wallet to hold a SOL balance. A user with a freshly provisioned embedded wallet can authenticate and sign — but the moment they try to submit a transaction, the network rejects it because the fee payer account has no SOL. The experience breaks before it starts. **Altude Gas Station solves the gas problem without touching the wallet problem.** Your wallet provider stays exactly where it is. Gas Station adds relay and fee sponsorship: your application builds a transaction, the user signs it locally, and Gas Station validates it, attaches the sponsored fee payer, and relays it to the network. *** ## Where Gas Station fits Gas Station is not a wallet provider. It does not hold user keys, it does not decide who can transact, and it does not authenticate users. Those responsibilities stay with your chosen wallet infrastructure. ```mermaid theme={null} %%{init: {'theme': 'base', 'themeVariables': {'fontFamily': 'Inter, ui-sans-serif, sans-serif', 'fontSize': '13px', 'primaryColor': '#0d2233', 'primaryTextColor': '#e2e8f0', 'primaryBorderColor': '#3DBFF2', 'lineColor': '#3DBFF2', 'edgeLabelBackground': 'transparent', 'clusterBkg': 'transparent'}}}%% flowchart LR A([Your App]) -->|sign| B([Gas Station API]) B -->|relay + fee| C([Solana Network]) style A fill:#0d2233,color:#e2e8f0,stroke:#3DBFF2,stroke-width:1.5px style B fill:#3DBFF2,color:#071922,stroke:#049DD9,stroke-width:1.5px style C fill:#049DD9,color:#ffffff,stroke:#037dac,stroke-width:1.5px linkStyle default stroke:#3DBFF2,stroke-width:1.5px,fill:none ``` The wallet provider — Turnkey, Privy, Crossmint, Dynamic — loads as an iframe inside your app and handles authentication and signing in that context. From the relay perspective, your app is the origin: it holds the signed transaction and sends it to Gas Station. The boundary is clean: | Layer | Responsibility | Provider | | ------------------- | ------------------------------------------------ | -------------------------------------- | | Authentication | Sign-in, session, user identity | Wallet provider (Turnkey, Privy, etc.) | | Key custody | Private key creation, storage, and access | Wallet provider | | Transaction signing | Producing a valid signature | Wallet provider | | Fee sponsorship | Paying the Solana transaction fee | **Altude Gas Station** | | Transaction relay | Submitting the signed transaction to the network | **Altude Gas Station** | *** ## How the flow works Construct the Solana transaction in your application. Include Altude's fee payer address as the fee payer — this is returned by `GET /api/transaction/config` using your API key. Your wallet provider prompts the user to sign the transaction. The user's private key never leaves the wallet provider's secure environment. Your app sends the signed transaction to the Gas Station API. Altude validates it, attaches the sponsored fee payer signature, and prepares it for relay. The fully signed transaction is submitted to the Solana network. Your app receives the transaction signature for confirmation tracking. *** ## When to use this pattern You should pair Gas Station with a wallet provider when: * You want users to transact with stablecoins or SPL tokens without holding SOL for gas * You already have a wallet provider chosen and do not want to replace it * You are building an embedded wallet experience and want mainstream UX (no gas dialogs, no SOL top-up flows) * Your users may be new to Solana or may not know what a transaction fee is Gas Station is not the right fit if your application needs users to pay their own transaction fees, or if you are building infrastructure that explicitly manages its own fee payer accounts. *** ## Security and custody considerations * **Altude does not access user keys or key shards.** The wallet provider holds custody. Gas Station only ever receives a signed transaction — the same payload that would be submitted to any Solana RPC node. * **Altude does not control who can transact.** Access control is your application's responsibility. Gas Station validates that a transaction is well-formed and relays it; it does not authenticate users or enforce application-level permissions. * **Users sign locally before relay.** The transaction is valid only if the user's wallet signature is present. Gas Station adds the fee payer signature; it cannot alter the transaction instructions. * **Do not expose API keys client-side.** Your Altude API key should live in a server-side environment or a secure secrets manager. Treat it like any other backend credential. *** ## Integration patterns All four provider demos follow the same adapter pattern. The wallet integration is isolated in a single module (`src/wallet/`). Swapping wallet providers requires changing one import line — the rest of the application, including the Gas Station relay logic, is unchanged. ```ts theme={null} // src/wallet/index.ts — change this one line to swap providers export { WalletProvider, useWallet, WalletButton } from '@/wallet/dynamic' // ^^^^^^^ swap to 'turnkey', 'privy', 'crossmint', etc. ``` This separation is intentional: Gas Station does not depend on the wallet provider, and the wallet provider does not depend on Gas Station. They are composed at the application layer. *** ## Choose your provider Passkeys, email OTP, SMS, and social login. Hardware-backed key custody. Embedded wallets with email, SMS, and social auth. Minimal onboarding friction. Wallets provisioned from email or OAuth. API-first embedded wallet platform. Multi-chain embedded wallets with a rich auth kit and developer dashboard. Not using one of these providers? The demos are built on a provider-agnostic adapter pattern — any wallet that can sign a Solana transaction can be wired into Gas Station using the same approach. # Privy Source: https://docs.altude.so/integrations/privy Pair Privy's embedded wallet platform with Altude Gas Station to deliver gasless Solana transactions. [Privy](https://privy.io) provides embedded wallets with email, SMS, and social authentication. Users sign in and get a wallet provisioned automatically — no browser extension, no seed phrase. Gas Station handles fee sponsorship and relay on the other side of the sign: the user's wallet signs locally, and Gas Station submits the transaction without charging gas. *** ## How the integration works Privy and Gas Station operate on separate layers: | What Privy handles | What Gas Station handles | | -------------------------------------------- | ---------------------------------------- | | User authentication (email, SMS, social) | Fetching the sponsored fee payer address | | Embedded wallet provisioning | Validating the signed transaction | | Prompting the user to sign a transaction | Relaying the transaction to Solana | | Returning the signed transaction to your app | Sponsoring the Solana transaction fee | Your app builds a transaction using the fee payer returned by `GET /api/transaction/config`. Privy signs it. Gas Station relays it. The user never pays gas. ```mermaid theme={null} %%{init: {'theme': 'base', 'themeVariables': {'fontFamily': 'Inter, ui-sans-serif, sans-serif', 'fontSize': '13px', 'primaryColor': '#0d2233', 'primaryTextColor': '#e2e8f0', 'primaryBorderColor': '#3DBFF2', 'lineColor': '#3DBFF2', 'edgeLabelBackground': 'transparent', 'clusterBkg': 'transparent'}}}%% flowchart LR A([Your App]) -->|sign| B([Gas Station API]) B -->|relay + fee| C([Solana Network]) style A fill:#0d2233,color:#e2e8f0,stroke:#3DBFF2,stroke-width:1.5px style B fill:#3DBFF2,color:#071922,stroke:#049DD9,stroke-width:1.5px style C fill:#049DD9,color:#ffffff,stroke:#037dac,stroke-width:1.5px linkStyle default stroke:#3DBFF2,stroke-width:1.5px,fill:none ``` Privy loads as an iframe inside your app and handles authentication and signing in that context. From the relay perspective, your app is the origin. *** ## Demo The Privy demo is a working React application that walks through the full gasless transaction flow: Clone the demo to run a complete Privy + Gas Station integration on Solana devnet. The demo covers: * **Authentication** — Privy handles email, SMS, and social login with its embedded auth modal * **Wallet provisioning** — Users get a Solana wallet automatically on first sign-in * **Transaction building** — `SystemProgram.createAccount` with Altude as fee payer * **Gasless relay** — Signed transactions submitted through `POST /api/Account/create` and `POST /api/Transaction/send` * **Transaction history** — Persistent history with Solscan explorer links * **Mock fallback** — Runs without an Altude API key, simulating the full flow *** ## Quick setup ### 1. Get your credentials You need two things before running the demo: * **Privy App ID** — from [dashboard.privy.io](https://dashboard.privy.io). Create an app and copy the App ID. * **Altude API key** — from [app.altude.so](https://app.altude.so). Create an application and copy the devnet key. ### 2. Clone and configure ```bash theme={null} git clone https://github.com/AltudePlatform/altude-privy-gas-station-demo.git cd altude-privy-gas-station-demo npm install cp .env.example .env ``` Open `.env` and set your credentials: ```bash theme={null} # Altude — https://app.altude.so VITE_ALTUDE_API_KEY_DEVNET=your-devnet-key-here # Privy — https://dashboard.privy.io VITE_PRIVY_APP_ID=your-app-id-here ``` ### 3. Run ```bash theme={null} npm run dev ``` Open [http://localhost:5000](http://localhost:5000). Sign in with Privy, create a transaction, and watch Gas Station relay it without the user paying gas. *** ## Adapter pattern The demo isolates the Privy integration in `src/wallet/privy.tsx`. The rest of the app — including Gas Station relay — is provider-agnostic. To see how the adapter interface works, or to adapt this for a different provider, see the [integration overview](/integrations/overview#integration-patterns). *** ## Related Architecture, custody model, and how Gas Station fits alongside any wallet provider. Full reference for `/api/Account/create`, `/api/Transaction/send`, and other endpoints. # Turnkey Source: https://docs.altude.so/integrations/turnkey Pair Turnkey's passkey-backed wallet infrastructure with Altude Gas Station to deliver gasless Solana transactions. [Turnkey](https://turnkey.com) provides hardware-backed key custody using passkeys (WebAuthn), with support for email OTP, SMS, and social login. Users authenticate once and get a Solana wallet — Turnkey handles key creation, storage, and secure signing. Gas Station handles everything that happens after the user signs. *** ## How the integration works Turnkey and Gas Station operate on separate layers: | What Turnkey handles | What Gas Station handles | | ------------------------------------------------------ | ---------------------------------------- | | User authentication (passkeys, email OTP, SMS, social) | Fetching the sponsored fee payer address | | Secure key custody | Validating the signed transaction | | Prompting the user to sign a transaction | Relaying the transaction to Solana | | Returning the signed transaction to your app | Sponsoring the Solana transaction fee | Your app builds a transaction using the fee payer returned by `GET /api/transaction/config`. Turnkey signs it. Gas Station relays it. The user never pays gas. ```mermaid theme={null} %%{init: {'theme': 'base', 'themeVariables': {'fontFamily': 'Inter, ui-sans-serif, sans-serif', 'fontSize': '13px', 'primaryColor': '#0d2233', 'primaryTextColor': '#e2e8f0', 'primaryBorderColor': '#3DBFF2', 'lineColor': '#3DBFF2', 'edgeLabelBackground': 'transparent', 'clusterBkg': 'transparent'}}}%% flowchart LR A([Your App]) -->|sign| B([Gas Station API]) B -->|relay + fee| C([Solana Network]) style A fill:#0d2233,color:#e2e8f0,stroke:#3DBFF2,stroke-width:1.5px style B fill:#3DBFF2,color:#071922,stroke:#049DD9,stroke-width:1.5px style C fill:#049DD9,color:#ffffff,stroke:#037dac,stroke-width:1.5px linkStyle default stroke:#3DBFF2,stroke-width:1.5px,fill:none ``` Turnkey loads as an iframe inside your app and handles authentication and signing in that context. From the relay perspective, your app is the origin. *** ## Demo The Turnkey demo is a working React application that walks through the full gasless transaction flow: Clone the demo to run a complete Turnkey + Gas Station integration on Solana devnet. The demo covers: * **Authentication** — Turnkey's built-in modal handles passkeys, email OTP, SMS, and social login * **Wallet provisioning** — Users get a Solana wallet automatically on first sign-in * **Transaction building** — `SystemProgram.createAccount` with Altude as fee payer * **Gasless relay** — Signed transactions submitted through `POST /api/Account/create` and `POST /api/Transaction/send` * **Transaction history** — Persistent history with Solscan explorer links * **Mock fallback** — Runs without an Altude API key, simulating the full flow *** ## Quick setup ### 1. Get your credentials You need two things before running the demo: * **Turnkey Organization ID and Auth Proxy Config ID** — from [app.turnkey.com](https://app.turnkey.com). Follow the [Turnkey Getting Started guide](https://docs.turnkey.com/sdks/react/getting-started) to set up your organization and auth proxy. * **Altude API key** — from [app.altude.so](https://app.altude.so). Create an application and copy the devnet key. ### 2. Clone and configure ```bash theme={null} git clone https://github.com/AltudePlatform/altude-turnkey-gas-station-demo.git cd altude-turnkey-gas-station-demo npm install cp .env.example .env ``` Open `.env` and set your credentials: ```bash theme={null} # Altude — https://app.altude.so VITE_ALTUDE_API_KEY_DEVNET=your-devnet-key-here # Turnkey — https://app.turnkey.com VITE_TURNKEY_ORGANIZATION_ID=your-org-id-here VITE_TURNKEY_AUTH_PROXY_CONFIG_ID=your-auth-proxy-config-id-here ``` ### 3. Run ```bash theme={null} npm run dev ``` Open [http://localhost:5000](http://localhost:5000). Sign in with Turnkey's auth modal, create a transaction, and watch Gas Station relay it without the user paying gas. *** ## Adapter pattern The demo isolates the Turnkey integration in `src/wallet/turnkey.tsx`. The rest of the app — including Gas Station relay — is provider-agnostic. To see how the adapter interface works, or to adapt this for a different provider, see the [integration overview](/integrations/overview#integration-patterns). *** ## Related Architecture, custody model, and how Gas Station fits alongside any wallet provider. Full reference for `/api/Account/create`, `/api/Transaction/send`, and other endpoints. # Build on Solana. Keep users in control. Source: https://docs.altude.so/introduction Keep private keys with your users, not your backend. Altude handles transaction validation, fee sponsorship, and relay so your team can ship without building the infrastructure from scratch.
Conceptual illustration of a protected signing processor with layered circuitry and a separate user-held key.
Your keys. Your control. Keys stay on users' devices.
Altude validates and relays signed transactions.
## Your app signs. Altude handles the rest. **Build user-controlled experiences without operating your own transaction relay or fee-sponsorship infrastructure.** Your app builds transactions and users sign locally. Their private keys never go to Altude. The Gas Station API validates the signed transaction, attaches the sponsored fee payer, and relays it to Solana. *** ## Keep control. Reduce what you have to operate. Signing stays with your users. Altude receives signed transactions, not the private keys that authorize them. Keep your existing wallet provider or local signer. Add Altude's validation, fee sponsorship, and relay around it. Your API key selects the cluster, RPC node, and fee payer. The SDK retrieves the configuration instead of asking you to wire each service together. Sponsor Solana network fees so users can transact without a separate SOL top-up. Integrate through REST or the TypeScript and Android SDKs. *** ## From API key to first transaction Sign up at [altude.so](https://altude.so) and create an application to receive your API key. This is the only runtime credential your app needs for Gas Station configuration. Send a sponsored transaction with a single API call — Altude resolves the cluster, RPC node, JWT, and fee payer from that API key, then handles fee payer attachment and relay. Move from `devnet` to `mainnet-beta` by updating the network in your API key configuration. Your client setup should not change. *** ## How Gas Station works Your app creates and signs a transaction locally. Altude validates it, attaches the sponsored fee payer, and relays it to the Solana network. ```mermaid theme={null} %%{init: {'theme': 'base', 'themeVariables': {'fontFamily': 'Inter, ui-sans-serif, sans-serif', 'fontSize': '13px', 'primaryColor': '#0d2233', 'primaryTextColor': '#e2e8f0', 'primaryBorderColor': '#3DBFF2', 'lineColor': '#3DBFF2', 'edgeLabelBackground': 'transparent', 'clusterBkg': 'transparent'}}}%% flowchart LR A([Your App]) -->|sign| B([Gas Station API]) B -->|relay| C([Solana Network]) style A fill:#0d2233,color:#e2e8f0,stroke:#3DBFF2,stroke-width:1.5px style B fill:#3DBFF2,color:#071922,stroke:#049DD9,stroke-width:1.5px style C fill:#049DD9,color:#ffffff,stroke:#037dac,stroke-width:1.5px linkStyle default stroke:#3DBFF2,stroke-width:1.5px,fill:none ``` Your app builds a transaction. The user signs it locally — private keys never leave the device. Altude validates the transaction, adds the fee payer, and optimizes for the selected cluster. The transaction is submitted to Solana. Your app receives the signature for confirmation tracking. *** ## Ready to build? Reference documentation for all Gas Station API endpoints. Use Gas Station alongside Turnkey, Privy, Crossmint, Dynamic, or any wallet provider. See a React Native USDC payment experience with local signing and no SOL top-up flow. Step-by-step guide for teams upgrading from the Kinetic API. Need help? Join the developer community on [Discord](https://discord.gg/9gPsQeZD7x) or reach out at [andrew@altude.so](mailto:andrew@altude.so). # Quickstart Source: https://docs.altude.so/quickstart Make your first sponsored Solana transaction in under five minutes. ## Prerequisites * An Altude API key — [sign up at altude.so](https://altude.so) to get one. * Node.js 18 or newer. ## Install the SDK ```bash theme={null} npm install @altude/gasstation ``` ## Initialize the client ```typescript theme={null} import { AltudeGasStation } from '@altude/gasstation' const gasStation = new AltudeGasStation({ apiKey: process.env.ALTUDE_API_KEY!, }) const config = await gasStation.init() console.log('Cluster:', config.RpcEnvironment) console.log('Fee payer:', config.FeePayer) ``` `init()` calls `GET /api/transaction/config` with your API key. The response provides the RPC endpoint, short-lived JWT, fee payer address, and selected cluster. The SDK uses only these values — it never falls back to a public Solana RPC. The only runtime value you supply is the API key. Do not prompt users to enter a network, RPC URL, JWT, or fee payer address manually; those are determined by the configuration attached to the API key. ## Check a balance ```typescript theme={null} const balance = await gasStation.getBalance({ account: 'YOUR_WALLET_ADDRESS', }) console.log('SOL (lamports):', balance.lamports) console.log('Display amount:', balance.uiAmount) ``` For an SPL token balance, pass the mint address: ```typescript theme={null} const usdcBalance = await gasStation.getBalance({ account: 'YOUR_WALLET_ADDRESS', token: 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v', // USDC }) ``` ## Send a sponsored transaction Provide a local signer and call `send()`. Altude attaches the fee payer and relays the transaction — your user's wallet is never charged for gas. ```typescript theme={null} import type { GaslessTransactionSigner } from '@altude/gasstation' const signer: GaslessTransactionSigner = { address: wallet.publicKey, async signTransactionMessage(messageBytes) { return wallet.signTransactionMessage(messageBytes) }, } const result = await gasStation.send({ sourceSigner: signer, toAddress: 'RECIPIENT_ADDRESS', amount: 1_000_000, // lamports commitment: 'finalized', }) console.log('Signature:', result.Signature) ``` Do not commit API keys, wallet secrets, mnemonics, or private keys to source control. Use environment variables or a secrets manager. ## Next steps Full guide: installation, client setup, and all available operations. Direct REST API documentation for all Gas Station endpoints.