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 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.
Solana Gill versus Kite
How does Solana Gill compare to Solana Kite?
Solana Kite is a high-level library for interacting with the Solana blockchain, created by the original author of @solana/helpers
, the most popular high-level library for @solana/web3.js
version 1, that has been going since 2023 - and even before that, back in 2022, when the code was part of Portal Payments.
Gill is a library by a different author, 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.
Installation
You’ll want to start by installing Kite.
npm install solana-kite
You’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.
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: