Getting Started with Kite and Solana Kit
These docs provide a guide to getting started with Kite and Solana Kit.
What is Solana?
Solana is a most popular blockchain for payments. Transactions complete in seconds, transaction fees are less than a fraction of a penny.
What is Kite?
Kite leverages the speed and elegance of @solana/kit (previously known as @solana/web3.js version 2) but allows you to complete most Solana tasks in a single step. Since Kite uses @solana/kit for the heavy lifting, Kite is fully compatible with @solana/kit. If you decide you no longer need Kite, you can easily remove it and use plain @solana/kit.
Users of Cursor, VSCode, Sublime and other popular editors will see TSDoc comments with parameters, return types, and usage examples right in their editor.
Kite is the @solana/kit update of @solana-developers/helpers, the most popular high-level library for @solana/web3.js version 1, by the original author. The kite package includes updated versions of most of the original helpers, including contributions from QuickNode, Helius, the Solana Foundation, Anza, Turbin3, Unboxed Software, and StarAtlas.
Kite works both in the browser and node.js, is small, and has minimal dependencies.
What is Solana Kit?
@solana/kit is a low-level library for interacting with the Solana blockchain. It is a collection of functions for creating tools that will create transactions.
Think of making a token. In Kite, you make a token. In @solana/kit, you run a series of instructions to create a token, sign it, get a recent blockhash, send the transaction, and wait for confirmation.
Kite uses the same types as @solana/kit.
@solana/kit is by Anza, and replaces the @solana/web3.js library.
Can I make my own programs / smart contracts with Kite and Kit?
Kite is for making transactions with instructions to existing programs. You can use it to call any program on Solana, but you can’t use it to create your own programs.
To create your own programs, you’ll use Anchor. Anchor is a framework for building Solana programs, and is the most popular way to build programs on Solana. Kite is designed to work seamlessly with Anchor programs.
How does Gill compare to Solana Kite?
- Kite uses just over half the code of Gill, thanks to sensible defaults
- Real documentation, compare Kite Docs to Gill’s auto-generated documentation
- Created by the original author of
@solana/helpers, the most popular high-level library for@solana/web3.jsversion 1, that has been going since 2023 - and even before that, back in 2022, when the code was part of Portal Payments. - More minimal 230K compared to 2.3MB - since Kite uses Anza’s existing packages, it also doesn’t
Gill is a library by Decal, and Gill is not related to @solana/helpers despite claims to the contrary. Gill focuses on smaller size - Gill allows for tree-shaking, but also requires developers to write more code to accomplish most tasks.
Kite prioritizes developer experience, assuming that if you want to use Solana in TypeScript, you probably also want to transfer tokens, work out PDA addresses, get the values from data accounts, and do all the other things that are ready to go in Kite.
Comparison - connecting, making a wallet, and sending a memo instruction:
Solana Kite - 43 tokens
import { lamports } from "@solana/kit";
import { connect, SOL } from "solana-kite";
import { getAddMemoInstruction } from "@solana-program/memo";
const connection = connect("devnet")
const user = await connection.createWallet({
airdropAmount: lamports(1n * SOL),
})
const memoInstruction = getAddMemoInstruction({
memo: "hello world!",
})
const signature = await connection.sendTransactionFromInstructions({
feePayer: user,
instructions: [memoInstruction]
});
console.log(signature)Gill - 82 tokens (1.9 X increase over Solana Kite)
Following the docs at https://www.gillsdk.com/api/gill
import { airdropFactory, createSolanaClient, createTransaction, generateKeyPairSigner, lamports } from "gill";
import { getAddMemoInstruction } from "gill/programs";
const user = await generateKeyPairSigner();
const SOL = 1_000_000_000n;
const memoInstruction = getAddMemoInstruction({
memo: "hello world!",
})
const { rpc, rpcSubscriptions, sendAndConfirmTransaction } =
createSolanaClient({
urlOrMoniker: "devnet",
});
const slot = await rpc.getSlot().send();
const airdrop = airdropFactory({ rpc, rpcSubscriptions })
await airdrop({
commitment: "confirmed",
lamports: lamports(1n * SOL),
recipientAddress: user.address,
});
const { value: latestBlockhash } = await rpc.getLatestBlockhash().send();
const transaction = createTransaction({
version: "legacy",
feePayer: user,
instructions: [memoInstruction],
latestBlockhash,
computeUnitLimit: 5000,
computeUnitPrice: 1000,
});
const signature = await sendAndConfirmTransaction(transaction);
console.log(signature)Installation
You’ll want to start by installing Kite.
npm install solana-kiteYou’ll then need to connect to a Solana cluster.
Explorer
The Solana Explorer is a web interface to explore the state of your Solana cluster - and yes, it can connect to the localnet cluster. You can and should use the Explorer to see wallets, their token balances, transactions and their instructions, and more. See getExplorerLink.
Wallets
You can create a wallet with easily-memorable names, and have them funded with SOL (on localnet or devnet). If you need multiple wallets, you can create them in bulk. You can also load existing wallets from a secret key file or an environment variable. You can validate addresses and verify private keys.
SOL
If you need more SOL, you can use airdropIfRequired to request SOL on localnet or devnet. You can also get the SOL balance of a wallet or transfer SOL between wallets.
Tokens
Tokens on Solana (other than SOL) are called ‘SPL-Tokens’. You can:
- Create a new token
- Get a token account address
- Get token mint information
- Get token account balance
- Check if a token account is closed
- Mint tokens to a wallet
- Transfer tokens between wallets
Data Accounts
Transactions
Transactions are how you make changes to the state of the blockchain. They combine instructions to different programs together, and if all the instructions complete successfully, the transaction happens, otherwise no state changes.
Kite can easily create and send transactions for any Solana program.
You can: