Application and client development
Application clients use Solana Kit to connect to a cluster, read account state, build typed instructions, obtain signatures, and submit transactions. React bindings place this client in the application tree, while codecs and generated interfaces keep application values aligned with on-chain data. Token clients also require an explicit choice between the base Token program and Token-2022. See the parent page for wider development guidance. Related topics include on-chain program development, testing and local simulation, and secure token and payment features.
Client composition
The Kit client is the boundary between application code and the Solana network. It gains capabilities through plugins, so the same application model can use a hosted cluster, a local cluster, a test chain, or a browser wallet.
Client capabilities
An application normally combines these capabilities into one client:
| Capability | Purpose |
|---|---|
| RPC and subscriptions | Read cluster state and receive live updates |
| Payer | Pay transaction fees and account rent |
| Identity | Authorize actions for the application or user |
| Transaction planning and execution | Turn instructions into signed, submitted transactions |
| Wallet connection | Discover and connect Wallet Standard wallets in a browser |
| Program plugin | Add domain-specific instruction and account operations |
The payer and identity can be the same signer. They are separate roles when an application uses a fee payer that differs from the user or authority. The client type grows with each plugin, which lets TypeScript check that a needed capability exists before application code uses it. Server-side applications should use a managed signer such as Solana Keychain when custody must stay outside keypair files.
References: skills/…/overview.md• L6-9 skills/…/plugins.md• L6-9 skills/…/plugins.md• L176-196 skills/…/SKILL.md• L42-50
Plugin composition
Plugins must be added in dependency order. A signer or wallet supplies the payer before an RPC bundle installs transaction planning and sending. Program plugins then add a domain API on top of the shared client.
The all-in-one RPC clients suit most applications. Low-level plugins remain useful for a custom planner, a different executor, or a read-only client. Async plugins make client creation asynchronous, so application startup must await the resulting client. The same composition model supports Kit-backed LiteSVM and embedded Surfpool clients for tests. Use LiteSVM when an in-process test is enough, and use Surfpool when a test needs RPC or WebSocket access, forked account state, or test cheatcodes. This keeps test transaction code close to production client code.
References: skills/…/plugins.md• L19-42 skills/…/plugins.md• L77-124 skills/…/plugins.md• L227-279 skills/…/advanced.md• L397-449 skills/…/gotchas.md• L10-44 skills/…/testing.md• L76-107 skills/…/testing.md• L231-240
web3.js interop
New application code should use @solana/kit and its plugins directly. The current @solana/web3.js v3 line is built on Kit and is the migration target for v1 codebases, but legacy dependencies that require v1 objects should stay behind an adapter until they can be upgraded. This keeps old class-based types from crossing the application boundary.
Kit and web3.js v3 share compatible address and signer shapes, so a v3 keypair can pass into Kit APIs and generated clients. Migration work still needs the official v1-to-v3 guidance because signing is asynchronous and several RPC values now use bigint or Uint8Array.
References: skills/…/kit-web3-interop.md• L8-34 skills/…/SKILL.md• L59-63
Application state and RPC access
RPC access supplies the input that clients need before they can build a transaction. Applications use it for balances, program accounts, token accounts, blockhashes, and transaction status. A read can be a single request or a live stream. Both forms must use the cluster and commitment that match the product’s view of state.
Lookup patterns
Use the smallest lookup pattern that matches the task:
| Need | Pattern |
|---|---|
| One quick read for a human or script | A direct JSON-RPC request to the selected cluster |
| Repeated application reads | The Kit RPC client with typed request results |
| Non-parsed account data | Fetch the encoded account and decode it with a matching decoder |
| Many known accounts | A multiple-account request or a generated batch fetcher |
| Accounts selected by owner or program | Token-owner or program-account queries with explicit filters |
| Address history with transaction details | getTransactionsForAddress when the RPC provider supports it |
| Changing application state | An RPC subscription or a tracked read-plus-subscription flow |
Public RPC endpoints are rate limited. Production applications and repeated reads should use a provider that fits the expected load. The cluster is part of the application contract. An address or signature has meaning only with the correct cluster.
Transaction and block reads must declare maxSupportedTransactionVersion: 1. The value is the JSON number 1, not a string. This keeps reads and block streams compatible with transaction v1, which is the current format for new sends.
References: skills/…/rpc-quick-lookups.md• L1-5 skills/…/rpc-quick-lookups.md• L11-19 skills/…/rpc-quick-lookups.md• L57-65 skills/…/rpc-quick-lookups.md• L89-97 skills/…/advanced.md• L277-370 skills/…/transactions-v1.md• L135-161 skills/…/common-errors.md• L438-466
Account state
Account data is first fetched as encoded bytes or parsed RPC data. When an account can be missing, the client must handle that state before decoding. Generated clients provide typed fetch helpers for common program accounts. Custom program accounts use a decoder that matches the account layout.
Addresses derived from program seeds, such as associated token accounts and other program-derived addresses, are part of the lookup and instruction contract. The same derivation rules must produce the account address used for reads and the account address passed to the instruction.
Token accounts add one important choice to this contract. A mint belongs to either the base Token program or Token-2022, and its token accounts belong to the same program. The client must inspect the mint owner and use that program for account operations and associated token account derivation. Token-2022 extensions can change account size and behavior, so account creation must use the extension set rather than a fixed base size.
Anchor v1 no longer places external account types such as token mints and token accounts in the application program’s generated IDL. Clients must use the owning token program’s client for those accounts instead of assuming that the application IDL supplies their decoder.
For live data such as balances or program state, tracked data combines the first RPC value with a subscription and orders values by slot. This avoids a stale subscription event replacing a newer initial read. In React, use the tracked data hooks or their SWR and TanStack Query adapters instead of pairing a read with a subscription by hand.
References: skills/…/accounts.md• L8-16 skills/…/accounts.md• L27-49 skills/…/accounts.md• L79-116 skills/…/react.md• L52-67 skills/…/token.md• L18-59 skills/…/token-2022.md• L18-75 skills/…/tokens.md• L19-37 skills/…/migrating-v0.32-to-v1.md• L439-450
Data representation
Solana transactions and accounts use byte data, while application code needs named values such as amounts, names, flags, and records. Solana Kit codecs define this boundary. A codec can encode values into bytes, decode bytes into values, or provide only one direction when the other direction is not needed.
Codec boundaries
A client must use the same field order, byte size, endianness, prefixes, and variants as the program that owns the data. Structs, arrays, tuples, enums, options, and tagged unions express common account and instruction layouts. Numeric values that can exceed JavaScript’s safe integer range use bigint-based codecs.
Addresses, signatures, lamports, and SOL use Kit’s branded types. Lamports are integer units used by instructions, while SOL is a fixed-point display value. Convert between them with Kit helpers so display math does not lose precision.
References: skills/…/codecs.md• L8-26 skills/…/codecs.md• L30-62 skills/…/codecs.md• L64-142 skills/…/overview.md• L108-159
Generated interfaces
IDL-driven generation turns a program description into a shared client contract. Codama-generated @solana-program/* packages expose program addresses, instruction builders, account fetch and decode helpers, PDA helpers, codecs, and program errors. They keep application clients aligned with the program without requiring each application to maintain its own serializer.
Applications should use generated instruction builders when a generated client exists. Generated packages can also provide program plugins. These plugins attach a domain API to the Kit client, while lower-level builders remain available for explicit instruction composition. System program clients cover account creation, SOL transfers, and nonce operations. Token clients cover mints, token accounts, associated token accounts, and token plans for both the base Token program and Token-2022 where supported.
Anchor v1 treats the IDL as a published product artifact managed through Program Metadata. The Anchor TypeScript client remains usable alongside Kit, but new client work should prefer Codama-generated Kit clients. When a program or account contract changes, the IDL or Codama description and the generated client must move together.
References: skills/…/idl-codegen.md• L8-16 skills/…/idl-codegen.md• L18-45 skills/…/codama.md• L8-25 skills/…/overview.md• L281-296 skills/…/system.md• L6-10 skills/…/token.md• L6-10 skills/…/token-2022.md• L8-16 skills/…/anchor.md• L323-340 skills/…/migrating-v0.32-to-v1.md• L323-357
Transaction format compatibility
Application clients must keep their read and send paths aware of the transaction formats accepted by the target cluster and wallet. New code should explicitly configure transaction v1. Legacy and v0 remain useful for older wallets and downstream clients.
Version-aware reads
RPC reads for transactions, blocks, and block subscriptions should declare maxSupportedTransactionVersion: 1. This prevents a newer transaction record from failing a whole block read or stopping a block stream. Consumers that index transaction data must also read v1 transaction configuration instead of relying only on ComputeBudget instructions. In v1, resource limits and priority fees live in the message configuration.
The same distinction applies to gRPC consumers. Detect v1 from the presence of message configuration before checking the older versioned flag. A stale generated protobuf client can silently report a v1 transaction as v0 and lose its budget data.
References: skills/…/transactions-v1.md• L135-221 skills/…/common-errors.md• L438-466 skills/…/compatibility-matrix.md• L325-354
Version-aware sends
For new application clients, use a current Kit client with transactionConfig: { version: 1 } on the RPC or local test plugin. The planner otherwise uses its configured default, so the application must set version 1 when v1 is required. Current RPC and LiteSVM planners support v1 natively. The normal planner reserves and estimates both the compute unit and loaded-account data limits before sending. On v1, the priority fee is a total number of lamports. Resource values live in the message configuration rather than in ComputeBudget instructions.
Manual transaction assembly remains an escape hatch for custom lifetimes, multi-party signing, custom execution, or transaction formats that the normal planner does not support. The manual path must set or estimate both resource limits, refresh the blockhash after simulation, use base64 for larger transactions, and validate the lifetime and size before sending. A browser wallet must report support for v1 before the application sends a v1 transaction. Otherwise, route the flow through a compatible legacy or v0 client.
Anchor’s current TypeScript client line does not yet read transaction v1 in its 1.x releases. Use Kit or a generated Kit client for application flows that must send or read v1. Keep version-0 support for wallets or downstream clients that cannot use it.
This diagram shows the choice between the configured planner path and the manual path for a transaction format.
flowchart TD
A[Application transaction] --> B{Use configured v1 planner?}
B -->|Yes| C[Configure RPC or local client for v1]
C --> D[Estimate resources]
D --> E[Sign, submit, and confirm]
B -->|No| F[Build a manual message]
F --> G[Set or estimate limits and refresh lifetime]
G --> H[Sign, size-check, submit, and confirm]
References: skills/…/overview.md• L55-73 skills/…/plugins.md• L44-54 skills/…/advanced.md• L26-57 skills/…/advanced.md• L127-151 skills/…/compute-budget.md• L16-49 skills/…/gotchas.md• L193-282 skills/…/transactions-v1.md• L30-87 skills/…/transactions-v1.md• L228-350 skills/…/compatibility-matrix.md• L325-342 skills/…/SKILL.md• L30-41
React integration
React applications provide one configured Kit client near the application root. ClientProvider makes that client available to components, while a shared exported client type keeps RPC, wallet, and transaction capabilities typed across the tree. In Next.js, only components that use client hooks need to run on the client.
Wallet connection
The wallet plugin uses Wallet Standard discovery instead of a wallet-specific adapter. Its React hooks expose wallet discovery, connection state, account selection, signing actions, and transaction-version support. The wallet becomes the payer and identity when the client uses the combined wallet signer capability.
Wallet discovery has a warm-up state. Applications should keep wallet controls behind WalletReadyGate or an equivalent readiness boundary so the UI does not treat an incomplete discovery result as an empty wallet list. Connection and signing actions expose pending and error state through action hooks. New code should use wallet hooks from @solana/kit-plugin-wallet/react; the older wallet hooks from @solana/react are being replaced. For v1 sends, gate the action on the connected wallet’s supported transaction versions and retain a v0 route when version 1 is absent.
References: skills/…/react.md• L8-14 skills/…/react.md• L169-214 skills/…/plugins.md• L126-162 skills/…/frontend.md• L62-107 skills/…/transactions-v1.md• L89-100 skills/…/SKILL.md• L53-57
Data hooks
The React bindings separate one-shot reads, live subscriptions, combined tracked data, and imperative actions. SWR and TanStack Query adapters add cache sharing and revalidation when the application already uses one of those data layers. A live account hook should include the cluster in its cache identity when the application can switch clusters.
The client type is required when calling useClient. This preserves the link between the client created at the application boundary and the capabilities used by leaf components. An action hook is the UI boundary for sends and connects because it provides pending, error, abort, and result state without a separate hand-built state machine. Singular send hooks suit one transaction. Plural hooks support plans that may split into several transactions.
References: skills/…/react.md• L15-63 skills/…/react.md• L65-118 skills/…/react.md• L137-153 skills/…/frontend.md• L151-199
Transaction lifecycle
An application transaction starts as a product action and ends as a network result. The client turns program instructions into a transaction plan, obtains the required signatures, sends the transaction to the cluster, and returns a result that the UI can use for status and follow-up reads.
Instruction construction
The application first resolves the accounts and values needed by the instruction. It then uses a generated program builder or a domain plugin to express the requested operation. The builder carries account roles and encoded arguments into a transaction-ready instruction.
Some operations need several instructions or more than one transaction. The planning layer can group and split those instructions before execution. Token plans can include setup work such as creating an associated token account when it does not exist. The application must select the base Token program or Token-2022 from the mint contract. Token-2022 plans also need extension-aware account sizing and initialization rules when a mint or account is created. The application should choose the singular send path when one transaction is expected and the plural plan path when the work can span multiple transactions.
References: skills/…/overview.md• L89-106 skills/…/react.md• L137-153 skills/…/advanced.md• L26-105 skills/…/system.md• L32-83 skills/…/token.md• L47-59 skills/…/token.md• L141-177 skills/…/token-2022.md• L29-64 skills/…/tokens.md• L73-102
Signing and submission
The client’s send operation covers planning, resource setup, lifetime selection, signing, and submission for the normal case. A browser wallet signs through its sending signer. A local or server client signs through its configured keypair or other signer. The fee payer pays fees and rent, while the identity authorizes the operation.
After submission, the application should surface the signature and track confirmation at the level the product needs. A user-facing send flow should disable duplicate input and distinguish wallet rejection, insufficient funds, an expired blockhash, and a program error. Manual transaction assembly is an escape hatch for custom lifetimes, multi-party signing, custom execution, or unsupported transaction formats. It must validate lifetime and size before sending.
This diagram shows how application intent becomes a submitted transaction and then a user-visible result.
flowchart LR
A[Application action] --> B[Resolve accounts and values]
B --> C[Build typed instructions]
C --> D[Plan transaction or transaction set]
D --> E[Sign with wallet or signer]
E --> F[Submit through RPC]
F --> G[Return signature and confirmation state]
G --> H[Refresh account data]
References: skills/…/frontend.md• L109-149 skills/…/overview.md• L95-112 skills/…/advanced.md• L109-149 skills/…/advanced.md• L198-229 skills/…/gotchas.md• L62-178 skills/…/transactions-v1.md• L228-350
Change checklist
When these files or sections are changed, remember to consider these:
- When changing a program account or instruction layout, update its IDL or Codama description and regenerate the clients, codecs, typed fetchers, PDA helpers, and error names that depend on it.
- When changing a client plugin’s required capability, review plugin order and every client factory that uses the plugin. Type errors may be the only signal that a composition contract changed.
- When changing cluster selection, update the RPC endpoint, wallet chain identifier, subscription source, and cache key as one contract.
- When changing transaction planning or execution, review both singular and plural React send hooks and the UI confirmation path.
- When changing an account’s existence rules, review both throwing generated fetchers and nullable
fetchMaybe*consumers. - When adding or changing transaction-version support, update transaction and block read options, wallet capability checks, resource-limit and fee handling, cluster activation checks, and any manual fallback together.
- When changing token setup or account derivation, review the mint owner, token program address, derived associated token account, extension-driven account size, and the plan that creates the account when it is missing.
- When changing a program’s Anchor version or published IDL location, update the client package, IDL fetch path, generated interfaces, and deployment order together.
- When changing a v1 reader or indexer, update both JSON-RPC version ceilings and generated gRPC schemas so message configuration is preserved.
- When upgrading a web3.js dependency, keep v1 class types behind an adapter and review async key generation, signing, numeric types, and commitment defaults at the Kit boundary.
Important failure modes
| Trigger | Consequence | Guard |
|---|---|---|
| RPC or planner plugin is added before its signer dependency | Client creation fails at the type boundary or lacks a payer | Add signer or wallet capabilities before dependent plugins |
| Async client composition is used without awaiting the client | Application calls methods on a promise | Await the final client when any installed plugin is async |
| A missing account is decoded as if it exists | Account read fails at runtime | Check existence or use a generated nullable fetch helper |
| Account bytes use a codec that does not match the program layout | Values are corrupt or instruction data is rejected | Use the generated codec or keep the custom codec aligned with the program contract |
| A live-data cache key omits the selected cluster | Data from one cluster appears under another cluster | Derive the cluster and client from the same source and include it in the key |
| A send action is repeated while the first request is pending | Duplicate prompts or transactions reach the wallet | Use an action hook, disable the control, and pass its abort signal through the send |
| A manual transaction lacks a valid lifetime or size proof | Signing or submission fails before the network accepts it | Set a lifetime and apply the required transaction assertions |
| v1 resource limits are left unset or have no headroom | The transaction cannot run or fails after state changes its loaded data size | Let the plugin estimate limits or estimate them manually and add suitable margin |
| v1 priority fee is read from ComputeBudget instructions | Fee data appears as zero without a read error | Read the v1 message configuration and use the version-aware Kit accessors |
| A wallet that does not support v1 receives a v1 transaction | Signing fails in the wallet | Check supportedTransactionVersions and route to a supported transaction version |
| A transaction reader omits or misstates the supported version | New transaction or block reads fail, or a stream stops at the first unsupported record | Send the numeric maxSupportedTransactionVersion: 1 value |
| A stale gRPC schema drops v1 message configuration | An indexer classifies v1 as v0 and loses budget data without an error | Use a schema with the configuration field and check configuration presence before versioned |
| A token plan assumes an associated token account exists | The transaction fails when the recipient has no token account | Use the token plan or fluent token API that checks and creates the account |
| A client derives an associated token account with the wrong token program | The lookup points to an unrelated or missing account | Derive it with the mint’s owning program, including Token-2022 when applicable |
| A Token-2022 account uses a fixed base size despite extensions | Account creation or rent allocation fails | Compute the size from the extension set before creating the account |
| A client reads an external token account through the application IDL after Anchor v1 migration | The generated account lookup or decoder is unavailable | Use the owning token program’s generated client |
| A v1-only Kit boundary receives a legacy web3.js v1 object | Type or runtime mismatches appear at the adapter boundary | Upgrade the dependency or isolate conversion in one adapter module |
Key files
| File | Why to read it |
|---|---|
| skills/…/SKILL.md | Current stack choices for Kit, React, wallet support, transaction v1, token program selection, and signer custody |
| skills/…/overview.md | Main Kit model for clients, RPC, signers, account reads, sends, generated program packages, and transaction defaults |
| skills/…/plugins.md | Client composition, capability dependencies, wallet clients, test clients, and custom domain clients |
| skills/…/kit-web3-interop.md | Boundary between Kit, web3.js v3, and legacy web3.js v1 dependencies |
| skills/…/react.md | React provider, typed client access, data hooks, wallet actions, and transaction actions |
| skills/…/frontend.md | End-to-end React and Next.js client, wallet, data, and transaction flow |
| skills/…/accounts.md | Account existence, decoding, PDA derivation, subscriptions, and account query choices |
| skills/…/codecs.md | The byte-to-value boundary for account and instruction data |
| skills/…/codama.md | Naming and capabilities of generated program interfaces |
| skills/…/idl-codegen.md | IDL-to-client generation workflow and its contract with program code |
| skills/…/anchor.md | Anchor’s IDL and client guidance, including the relationship between Anchor clients and Kit clients |
| skills/…/migrating-v0.32-to-v1.md | Client-facing Anchor v1 changes to IDL management, package names, and external account interfaces |
| skills/…/tokens.md | Token and Token-2022 account ownership, ATA derivation, authorities, sizing, and extensions |
| skills/…/token.md | Generated base Token account types, associated token account derivation, and multi-step token plans |
| skills/…/token-2022.md | Token-2022 program selection, extension-aware sizing, ATA derivation, and extension access |
| skills/…/system.md | Generated system-program operations for account creation, SOL transfer, and nonce lifetimes |
| skills/…/compute-budget.md | Transaction-version differences in resource limits, priority fees, and estimation |
| skills/…/advanced.md | Manual transaction lifecycle, direct RPC use, and custom plugin composition when the normal client path is not enough |
| skills/…/gotchas.md | Common composition, account, signing, lifetime, wallet, and transaction-version failures |
| skills/…/rpc-quick-lookups.md | Boundary between one-shot RPC inspection and application-grade Kit access |
| skills/…/transactions-v1.md | Version-aware transaction reads, indexing, and v1 resource and fee behavior |
| skills/…/compatibility-matrix.md | Minimum client and wallet library versions for transaction v1 and current Anchor client limits |
| skills/…/testing.md | Kit-backed LiteSVM and Surfpool clients for local application testing |
For adjacent topics, see on-chain program development, testing and local simulation, and secure token and payment features.