Atomic composability
Programs call each other through cross-program invocations inside one transaction. If any step fails, the whole transaction reverts, so a multi-protocol strategy never settles halfway.
DeFi developers
Every Solana program reads and writes the same state, so a swap, a loan repayment and an oracle update can run in one atomic transaction. Start from a working Anchor app, integrate live liquidity and ship with production practices.
npx -y create-solana-dapp@latest -t solana-foundation/templates/kit/nextjs-anchorWhy Solana
Programs call each other through cross-program invocations inside one transaction. If any step fails, the whole transaction reverts, so a multi-protocol strategy never settles halfway.
Each transaction declares the accounts it reads and writes up front. The runtime executes transactions that don't touch the same writable accounts in parallel, so one busy market doesn't stall unrelated ones.
Transactions that write to a contested account compete for that account's share of the block. Price priority fees from the accounts you write, not from network-wide averages.
Mainnet slot times are being cut in stages, and Alpenglow will replace the current voting and finality protocol. Track both before you tune quote expiry, timeouts and liquidation windows.
Developer stack
The default path for a new protocol: Anchor for the program, LiteSVM and Surfpool for tests, Codama for clients and Kit for the app.
01Write the program
Anchor is the recommended framework for most programs, with account validation, IDL generation and CPI helpers built in. Reach for Pinocchio, a zero-dependency library, on hot paths where every compute unit counts.
02Test it
Run fast in-process tests with LiteSVM or Mollusk. Then run integration tests on Surfpool, a local network that loads mainnet accounts on demand, so you can test against real pools and oracles.
03Generate clients
Generate typed TypeScript and Rust clients from your program's IDL, so instruction builders and account decoders stay in step with each deploy.
04Build the app
@solana/kit is the standard JavaScript SDK. Its wallet plugin finds installed wallets through Wallet Standard, with no per-wallet adapter packages.
Building blocks
These protocols publish developer documentation for their programs and APIs. Read each protocol's docs and audit reports before you route user funds through it.
Route swaps across Solana liquidity with an aggregator API, or request raw instructions to compose a swap inside your own transaction.
Create pools, provide concentrated liquidity and quote prices directly against on-chain AMMs.
Supply collateral, borrow and read reserve state through lending market SDKs.
Open, manage and liquidate leveraged positions, or design your own fully on-chain perps market.
Pull signed price updates into your transaction, and check confidence and staleness before you use a price.
Accept liquid staking tokens as collateral, or route SOL into stake pools that earn validator rewards.
Settle in fiat-backed stablecoins issued natively on Solana.
Move USDC natively with Circle's CCTP, or bridge other assets and messages between chains.
Issue assets with built-in behavior that your protocol must handle: transfer hooks, interest-bearing balances, scaled UI amounts and confidential transfers.
Examples only. Listing a protocol is not an endorsement by the Solana Foundation.
Transaction delivery
DeFi traffic peaks during volatility, exactly when users need their transactions to land. Build these into your client before mainnet.
Simulate to measure compute units, set a tight limit and price priority fees from recent fees on the accounts you write.
v1 transactions raise the size limit; address lookup tables compress long account lists. Each carries a trade-off for complex routes.
Stake-weighted QoS reserves leader capacity for transactions forwarded by staked validators. Choose an RPC provider that supports it.
Send user swaps through sandwich protection, and enforce slippage limits in the program as well as the interface.
Track blockhash expiry, rebroadcast until the transaction lands or expires, and confirm at the commitment level your logic needs.
Security
A DeFi program can hold user funds from its first deploy. Control who can change it, prove what's deployed and watch what it does.
Hold program upgrade and admin authorities in a Squads multisig, with a time lock on changes.
Let users and integrators confirm that the deployed program matches its public source.
Get independent audits before mainnet and run a bug bounty. The Solana Foundation funds STRIDE security evaluations and free tooling for ecosystem teams.
Microscope decodes your program's instructions and Squads proposals into self-hosted dashboards and alerts.
Ask technical questions, review designs and find teams to build with.