Kora Basics
Kora is a JSON-RPC server that provides fee payment services for Solana transactions. It allows users to pay transaction fees with SPL tokens instead of SOL, enabling better UX for applications where users may not hold SOL. Kora RPC validates client requests based on a configuration (kora.toml) that
defines allowable programs, wallets, tokens, etc. Once validated, the Kora
server will sign the transaction and send it to the network (or return a
serialized signed transaction to the client).
Requirements
- Solana CLI v2.2.x or greater
- Rust/Cargo (for Kora RPC installation)
- Node.js 20.18+ and pnpm (the demo client has a pnpm lockfile)
Install Kora RPC
Install the Kora RPC server globally:--locked builds Kora with the dependency versions it was released with.
Without it, the install needs Rust 1.89 or later.
Important: Kora’s main branch is an integration branch and may contain
unreleased or beta changes. Always use the latest stable release tag for
production and tutorial use. You can find the latest stable release on the
Kora releases page.
Create Project
Clone the repository, checkout the latest stable tag, and navigate to the getting started demo directory:Project Structure
The demo contains three main components: Client Directory (client/src/)
setup.ts- Local environment setup (creates keypairs & writes them to .env, airdrops SOL, initializes test token)quick-start.ts- Quick start demonstration script showing establishing a Kora connection and making a simple call to the Kora RPC serverfull-demo.ts- Full demo script demonstration multiple Kora RPC methods
server/)
kora.toml- Kora RPC configuration defining validation rules, allowed tokens, and fee parameterssigners.toml- Signers configuration defining signers for the Kora server
.env- Environment variables for keypairs and addresses (create.envin root -demo/.env). The environment variables will be created by the setup script.
Setup Environment
First, create .env for your environment :Setup Client
Install client dependencies:Setup Kora RPC Server
The Kora server requires configuration to specify which tokens can be used for fee payment. Openserver/kora.toml and note the validation section. Here we
can specify several parameters that will be validated prior to signing a
transaction:
max_allowed_lamports: maximum transaction fee you are willing to pay on behalf of the usermax_signatures: maximum number of signatures a transaction can haveprice_source: oracle for determining token price (“Mock” or “Jupiter”)allowed_programs: whitelist of program IDs that can be executed (e.g., System Program, Token Program)allowed_tokens: whitelist of tokens that are allowed to be transferredallowed_spl_paid_tokens: array of mint addresses your program accepts as paymentdisallowed_accounts: blacklist of accounts not allowed to interact with your kora RPC
Setup Signers
Openserver/signers.toml and note the signers section. Here we can specify
which signers will be used to sign transactions and (if using multiple signers)
a strategy for selecting which signer to use. For now, let’s use a single-signer
using the default values—you can come back here and change these later (for
more information on the signers configuration, see the
Signers Guide documentation).
Test Server
Open five terminals and run the following commands:Terminal 1: Start Local Test Validator
Terminal 2: Initialize Environment
- Generate keypairs and save them to
.env - Airdrop SOL to test accounts
- Create and initialize a local USDC token
- Fund test accounts with tokens
allowed_tokens and allowed_spl_paid_tokens in
./server/kora.toml.
Terminal 3: Initialize Payment ATAs (Optional)
In order to receive payments, you’ll need to initialize Associated Token Accounts (ATAs) for your payment tokens. You can do this by running the following command:- Read your payment address from
kora.toml(or if you have not specified a payment address, all of the signers listed insigners.toml) - Create ATAs for all tokens listed in
allowed_spl_paid_tokens - Skip any ATAs that already exist
- You can optionally specify a custom fee payer for ATA generation by using the
--fee-payer-keyflag.
Terminal 4: Start Kora RPC Server
Note: For production deployments usingThe server reads configuration fromprice_source = "Jupiter", you must set theJUPITER_API_KEYenvironment variable. The server will fail to start without it:
kora.toml and signers.toml and uses
environment variables from the shared .env file. If you are using a different
folder structure than specified here, you may need to use the --config to
specify the location of kora.toml and --signers-config to specify the
directory of your signers configuration:
kora rpc -h for help on the RPC server options.
Terminal 5: Run Client Demo
Next Steps
Once you have the basic setup working, check out the full Kora flow demo: → Kora Complete Gasless Transaction Flow explore additional Kora RPC methods:estimateTransactionFee- Calculate fees for transactionsgetPayerSigner- Get the payer signer and payment destinationgetSupportedTokens- Returns an array of supported payment tokenssignTransaction- Conditionally sign transactions when fees are coveredtransferTransaction- Create transfer SOL or SPL token transfer transactions (signed by the Kora feepayer)signAndSendTransaction- Conditionally signs a transaction with the Kora feepayer and sends it to the configured Solana RPCgetPaymentInstruction- Get a payment instruction for a transaction
Kora tag.