Book a free call

How to Build a dApp on Solana, Step by Step

A Solana dApp pairs an on-chain program with a web app that connects a wallet and sends transactions. Here is the stack and the steps to build it.

Hertiv engineering teamReviewed by a senior engineer
6 min read
How to Build a dApp on Solana, Step by Step
On this page

Short answer

A Solana dApp is a web or mobile app that talks to a program on the Solana blockchain: the program holds the rules and the data, while the app handles the interface, wallet connection and transaction signing. Building one means writing the program, connecting a wallet, wiring the frontend to the program's instructions, and testing everything on devnet before real funds are involved.

What is a Solana dApp?

A Solana dApp is a web or mobile app that talks to a program on the Solana blockchain. The program holds the rules and the data — for example, who owns what, or how a vote is counted — while the app provides the screens, connects the user's wallet and sends transactions to the program.

The split matters because the two halves run in different places. The program runs on Solana's validators and is the same for every user; the app runs in the user's browser and is different for every session. A bug in the app affects one user at a time, while a bug in the program affects everyone who uses it.

Most Solana dApps have the same shape: a wallet connection, a list of accounts the program owns, and a set of instructions the app can send. If you understand that shape, you can build a marketplace, a voting tool or a staking page with the same pattern. The wider Solana offering is covered in Solana development.

What do you need before you start?

Before you start building a Solana dApp, you need the toolchain, a test network and a clear picture of what the program will store. Setting these up first saves the most common beginner frustration: writing app code against a program that does not exist yet.

PieceWhat it isCommon choice
Solana CLICommand-line tools for keys, airdrops and deploymentSolana CLI
Program frameworkThe toolkit for writing the on-chain programAnchor
Wallet adapterThe library that connects wallets to a web appSolana wallet adapter
RPC connectionThe connection your app uses to read chain dataA public or paid RPC endpoint
Test networkA free network for testing with play tokensDevnet

Anchor is the usual starting point for the program, because it generates the interface the app needs to call it. Without that generated interface, the app team has to hand-write every instruction, which is slower and easier to get wrong.

Pick your RPC endpoint early. A free public endpoint is fine for learning, but a real app needs a reliable one, because every balance, account read and transaction goes through it. For the chain itself, see what is Solana.

How do you build a Solana dApp, step by step?

You build a Solana dApp by writing the program first, then the app that talks to it, and testing each layer before moving to the next. The order matters: the app cannot be finished until the program's instructions are fixed.

  1. Define the program's data. List every account the program will own and what each one stores, such as a vote count or an item price.
  2. Write the program with Anchor. Each instruction is one action the app can ask for, such as creating an item or casting a vote.
  3. Deploy to devnet and test the instructions. Call each one from the command line before any app code exists.
  4. Build the wallet connection. Use the wallet adapter so users can connect Phantom, Solflare or another wallet and sign transactions.
  5. Wire the app to the program. Use the generated interface to build transactions, send them, and read the program's accounts back into the screens.
  6. Add error handling for failed transactions. Show the user what happened — insufficient funds, a rejected signature, a stale account — instead of a blank screen.
  7. Test the full flow on devnet with real wallets. Run through every screen as a user would, then audit the program before mainnet.

Keep the program small. Every instruction is code that handles other people's assets, so a program with three instructions that are well tested beats one with twenty that are not. The general guide to building on the chain is how to build on Solana.

How do wallets and transactions work in a Solana dApp?

In a Solana dApp, the wallet holds the user's keys and signs transactions; the app never sees the private key. When the user clicks a button, the app builds a transaction, asks the wallet to sign it, and sends it to the network. The program then runs the instruction and updates its accounts.

A transaction can carry several instructions, and they either all succeed or all fail. That atomicity is useful: a swap that also updates a balance cannot leave the two out of step. Design your flows to use it, so a half-finished action is impossible by construction.

Fees on Solana are small — a basic transaction costs a fraction of a cent — but they are not zero, and the user's wallet must hold enough SOL to pay them. Tell the user the fee before they sign, and handle the case where their balance is too low with a clear message, not a silent failure.

How do you test a Solana dApp before launch?

You test a Solana dApp on devnet first, where tokens are free and mistakes cost nothing, and you test the program and the app separately before testing them together. A program bug found on devnet is a fix; the same bug on mainnet is an incident.

Test the program with automated tests that call every instruction, including the ones that should fail. A vote that should be rejected, an amount that should be too large, a signer who should not be allowed — each of these needs a test that proves the program says no.

Test the app with real wallets on devnet, not only with a test key. Wallet behaviour differs between providers, and a flow that works with one wallet can fail with another. Run the full user journey — connect, sign, confirm, refresh — on at least two wallets before launch. Trading-focused dApps add their own checks, as in how to build a Solana DEX.

Example (hypothetical): a simple voting dApp

Example (hypothetical): a team builds a voting dApp where 200 members each cast 3 votes, so the program must record 600 votes in total. Each vote is one transaction, and each transaction costs about 0.000005 SOL in fees.

The total fee for all votes is 600 times 0.000005 SOL, which is 0.003 SOL. The team funds a test wallet with 2 SOL on devnet, which covers the votes many times over and leaves room for the program deployment and the team's own testing.

The numbers are small, and that is the point: on Solana, the cost of the votes is not the problem. The hard part is making sure each member can vote only 3 times, which the program enforces by checking a per-member counter before accepting a vote.

What are the common mistakes?

The most common mistakes in a first Solana dApp are skipping the program tests, trusting the frontend to enforce rules, and ignoring wallet differences.

  • Enforcing rules in the app, not the program. Anyone can call the program directly, so every rule must live on chain.
  • Skipping failure tests. Testing only the happy path leaves the program open to the first bad input it meets.
  • Testing with one wallet. Wallet behaviour differs, and users will arrive with several.
  • Leaving the program upgradeable without a plan. Decide who can upgrade it and how, before launch.
  • No fee handling. Users with too little SOL see a failed transaction and no explanation.

Key takeaways

  • A Solana dApp pairs an on-chain program with a web or mobile app that connects a wallet
  • Write the program first; the app cannot be finished until the program's instructions are fixed
  • Every rule must live in the program, because anyone can call it directly
  • Test the program's failure cases, not only the happy path
  • Run the full user journey on devnet with at least two wallets before mainnet

Frequently asked questions

Do I need to know Rust to build a Solana dApp?

It helps, because Anchor programs are written in Rust. You can build the app itself in TypeScript, and many teams split the work that way. If you are the only developer, expect to learn enough Rust to write and test a small program.

How much does it cost to deploy a program on Solana?

Deployment costs rent for the program account plus transaction fees, and the amount depends on the program's size. On devnet it costs nothing but test tokens. On mainnet, budget a small amount of SOL and check the current rent costs before you deploy, since they change with the network.

What is Anchor?

Anchor is the most used framework for writing Solana programs. It handles account validation, instruction routing and the interface the app uses to call the program, which removes a large amount of repetitive code and a common source of bugs.

Can I build a Solana dApp without a wallet?

No, not for actions that change state. Reading chain data needs no wallet, but any transaction that writes data must be signed by a wallet. Design your app so visitors can browse without connecting, and only ask for a wallet when they take an action.

What is devnet?

Devnet is Solana's public test network. Tokens there have no value, and you can request them free from a faucet. Use devnet for all development and testing, and only move to mainnet after the program is audited and the app is tested with real wallets.

How is a Solana dApp different from an Ethereum dApp?

The idea is the same — an app plus an on-chain program — but Solana programs are stateless and store data in separate accounts, while Ethereum contracts hold their own state. Solana transactions are also cheaper and faster, which changes what is practical to put on chain.

Found this useful? Share it.
Hertiv engineering team

Written from projects we build for clients: blockchain systems in production. Every post is reviewed by a senior engineer before publishing and updated when practice changes.

About HertivHow we work

Planning a Solana dApp and want the program built right? Talk to Hertiv.

A senior engineer replies within one business day. Or see our Solana Development service.

Book a free call

Keep reading

All posts

Tell us what you want to build

A senior engineer reads every request and replies within one business day with questions, a rough range, or a call link.

  • NDA on request before any details
  • You own all code, models and IP
  • US, UK and EU time-zone overlap

Your email app should open with your message ready to send. If it does not, write to [email protected].

Prefer email? Write to [email protected]
Estimate costBook a call