JSON-RPC API Overview

Kora implements a JSON-RPC 2.0 interface for gasless transaction processing on Solana.

Using Kora v2.2.0-beta? See the Beta docs for new bundle methods (signBundle, signAndSendBundle, estimateBundleFee) and getVersion.

TypeScript SDK

The @solana/kora package provides three client options for interacting with a Kora server:

KoraClient (Standalone)

Use KoraClient for standalone usage. Works with @solana/kit v5.0+.

import { KoraClient } from '@solana/kora';

const kora = new KoraClient({ rpcUrl: 'https://your-kora-server.com' });
const config = await kora.getConfig();

koraPlugin (Kit Composable)

Use koraPlugin() to compose Kora methods into an existing Kit client. Requires @solana/kit v5.4+ for the createEmptyClient().use() pattern.

import { createEmptyClient } from '@solana/kit';
import { koraPlugin } from '@solana/kora';

const client = createEmptyClient()
  .use(koraPlugin({ endpoint: 'https://your-kora-server.com' }));

const config = await client.kora.getConfig();

The plugin provides Kit-typed responses (Address, Blockhash, Base64EncodedWireTransaction) and exports the KoraPlugin type for composition with other plugins.

createKitKoraClient (Kit Client)

Use createKitKoraClient() for full Kit integration with automatic transaction planning, fee estimation, payment injection, and execution. This is the recommended approach for most applications. Requires @solana/kit v6.1+.

The Kit client composes Kora with Kit's plugin architecture (planner, executor, payer plugins) so you can use Kit program plugins like tokenProgram() directly.

import { createKitKoraClient } from '@solana/kora';
import { address } from '@solana/kit';
import { tokenProgram } from '@solana-program/token';

const client = await createKitKoraClient({
  endpoint: 'https://your-kora-server.com',
  rpcUrl: 'https://api.mainnet-beta.solana.com',
  feeToken: address('EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v'), // USDC
  feePayerWallet: userSigner, // TransactionSigner that authorizes SPL fee payment
});

// Compose with Kit program plugins
const tokenClient = client.use(tokenProgram());

// Send transactions — Kora handles blockhash, fee estimation,
// payment instruction injection, signing, and submission
await tokenClient.token.instructions
  .transferToATA({ /* ... */ })
  .sendTransaction();

Configuration options:

OptionRequiredDescription
endpointYesKora RPC endpoint URL
rpcUrlYesSolana RPC URL for compute unit estimation and program plugin compatibility
feeTokenYesSPL mint address for fee payment
feePayerWalletYesTransactionSigner that authorizes the SPL fee payment
apiKeyNoAPI key for authentication
hmacSecretNoHMAC secret for signature-based authentication
computeUnitLimitNoFixed compute unit limit (uses simulation-based estimation if not set)
computeUnitPriceNoPriority fee in micro-lamports
tokenProgramIdNoToken program ID (defaults to Token Program; use Token-2022 address for Token-2022 tokens)

Protocol

  • Standard: JSON-RPC 2.0
  • Transport: HTTP POST
  • Content-Type: application/json
  • Endpoint: http://your-kora-instance/

Available Methods

MethodDescription
estimateTransactionFeeEstimates the transaction fee in both lamports and the specified token.
getBlockhashGets the latest blockhash from the Solana RPC that the Kora server is connected to.
getConfigRetrieves the current Kora server configuration.
getPayerSignerRetrieves the payer signer and payment destination from the Kora server.
getPaymentInstructionCreates a payment instruction to append to a transaction for fee payment to the Kora paymaster.
getSupportedTokensRetrieves the list of tokens supported for fee payment.
signAndSendTransactionSigns a transaction and immediately broadcasts it to the Solana network.
signTransactionSigns a transaction with the Kora fee payer if the transaction includes necessary payment to the fee payer without broadcasting it.
transferTransactionCreates a token transfer transaction with Kora as the fee payer.

Request Format

All requests follow the JSON-RPC 2.0 standard:

{
  "jsonrpc": "2.0",
  "id": 1,
  "method": "methodName",
  "params": {}
}

Response Format

Successful responses:

{
  "jsonrpc": "2.0",
  "id": 1,
  "result": {}
}

Error responses:

{
  "jsonrpc": "2.0",
  "id": 1,
  "error": {
    "code": -32600,
    "message": "Invalid request"
  }
}