Skip to main content

Every Solana transaction requires SOL to pay network fees (around 0.001 USD) and in some cases you need to create a token account (around 0.30 USD with SPL). Light Token lets your application cover both rent and transaction fees for around 0.001 USD.
Rent sponsorship is a built-in feature of the Light SDK’s that sponsors rent-exemption for all account types to reduce creation cost. This is dealt with under the hood in a way that doesn’t disrupt the UX of what your users are used to with SPL-token.Rent-exemption: paid by a rent sponsor PDA.Top-ups: paid by the fee payer.The feePayer on the transaction bumps a small virtual rent balance (766 lamports by default) on each write to keep the account active (hot balance). Set your application as the fee payer so users never interact with SOL.Hot-Cold Lifecycle of Accounts.Accounts get auto-compressed (cold balance) when the virtual rent balance goes below a threshold (eg 24h without write bump). The cold account’s state is cryptographically preserved on the Solana ledger. Users only interact with hot accounts and load the cold balance in-flight when using the account again.
Account lifecycle
Account lifecycle
Solana transactions have a designated fee payer, the account that pays the network fee. By default, this is the first signer. You can specify a different account as the fee payer, allowing a third party (the “sponsor”) to cover fees on behalf of the sender. Light Token extends this further. The payer parameter on any Light Token instruction determines who pays rent top-ups in addition to transaction fees. Set your application server as the payer so users never interact with SOL. Your sponsor covers three costs:
Account creationaround 11,000 lamports (0.001 USD)Initial bump on virtual rent balance. Rent-exemption is sponsored.
Rent top-ups~766 lamports per writeFee payer bumps the virtual rent balance on each write to keep accounts active. Set payer parameter on any Light Token instruction.
Transaction fees~5,000 lamports per txStandard Solana fee payer. Set feePayer on the transaction.

Send a gasless transfer

Find a full code example here.
1

Create a sponsor account

Generate or load a keypair for the sponsor who will pay transaction fees and rent top-ups. The sponsor needs SOL but doesn’t need to hold the tokens being transferred.
import { Keypair } from "@solana/web3.js";
import { createRpc } from "@lightprotocol/stateless.js";

const rpc = createRpc(RPC_ENDPOINT);

// Sponsor: your application server
const sponsor = Keypair.fromSecretKey(/* your server keypair */);

// User: only signs to authorize the transfer
const sender = Keypair.fromSecretKey(/* user's keypair */);
2

Create the transfer instruction

Create the transfer instruction with the sponsor as payer and the sender as authority. The sender owns the tokens and must sign the transfer.
import { createTransferInterfaceInstructions } from "@lightprotocol/compressed-token/unified";

const instructions = await createTransferInterfaceInstructions(
  rpc,
  sponsor.publicKey,      // payer: covers rent top-ups and transaction fees
  mint,
  amount,
  sender.publicKey,       // authority: user signs to authorize
  recipient.publicKey
);
3

Send with both signers

Both the sponsor and sender must sign the transaction:
ParameterWhat it does
Payer (fee payer)First positional argSigns to authorize payment of rent top-ups and transaction fees. Can be your application server.
Authority (owner)owner / authority argSigns to authorize the token transfer. The account holder.
import { Transaction, sendAndConfirmTransaction } from "@solana/web3.js";

for (const ixs of instructions) {
  const tx = new Transaction().add(...ixs);
  // Both sponsor and sender must sign
  await sendAndConfirmTransaction(rpc, tx, [sponsor, sender]);
}
import { Keypair, Transaction, sendAndConfirmTransaction } from "@solana/web3.js";
import { createRpc } from "@lightprotocol/stateless.js";
import {
    createAtaInterface,
    createLightTokenTransferInstruction,
    getAssociatedTokenAddressInterface,
} from "@lightprotocol/compressed-token";
import { PublicKey } from "@solana/web3.js";

const rpc = createRpc();

// Top-Up Sponsor: your application server, pays SOL for rent top-ups
const sponsor: Keypair = /* your server keypair */;

// User: only signs to authorize the transfer
const sender: Keypair = /* user's keypair */;
const recipient = new PublicKey(/* recipient address */);
const mint = new PublicKey(/* e.g. USDC mint */);

(async function () {
    const senderAta = getAssociatedTokenAddressInterface(mint, sender.publicKey);
    const recipientAta = getAssociatedTokenAddressInterface(mint, recipient);

    // Create recipient associated token account if it doesn't exist
    await createAtaInterface(rpc, sponsor, mint, recipient);

    const ix = createLightTokenTransferInstruction(
        senderAta,
        recipientAta,
        sender.publicKey,
        500_000,
        sponsor.publicKey, 
    );

    const tx = new Transaction().add(ix);
    const sig = await sendAndConfirmTransaction(rpc, tx, [sponsor, sender]);

    console.log("Tx:", sig);
})();

Basic payment

Send a single token transfer.

Receive payments

Load cold accounts and prepare to receive.

Didn’t find what you were looking for?

Reach out! Telegram | email | Discord