How to Build a dApp on Polkadot, Step by Step
A Polkadot dApp runs on a Substrate chain or an ink! contract, with a wallet and a frontend on top. This guide walks through the stack and the seven build steps.
On this page
Short answer
To build a dApp on Polkadot, write the on-chain logic as an ink! smart contract or a Substrate chain, connect it to a frontend through the Polkadot.js API, add a wallet for signing, and test the full flow on the Westend testnet before launch. Start with a contract on an existing chain and build your own chain only when you need custom rules or throughput.
What is a Polkadot dApp?
A Polkadot dApp is an application whose core logic runs on a Polkadot-based chain while its interface runs in a browser or a mobile app. The chain stores state, enforces rules and settles transactions; the frontend reads chain data and asks the user's wallet to sign each action.
Polkadot is a network of chains rather than a single chain. A relay chain provides shared security, and connected chains called parachains run their own logic while passing messages to each other. A dApp can live on a parachain, on a smart contract, or on its own chain built with Substrate, the framework Polkadot is built from.
| Part | What it does | Example |
|---|---|---|
| On-chain logic | Stores state and enforces the rules | ink! contract or Substrate pallets |
| Wallet | Holds keys and signs transactions | Polkadot.js extension, Talisman |
| Frontend | Shows data and builds transactions | Web app using the Polkadot.js API |
| Indexer | Turns chain events into fast queries | Subsquid, SubQuery |
| RPC node | Serves chain data to the frontend | Public endpoint or your own node |
Most teams start with the smallest option that fits. A contract on an existing parachain is enough for a token, a marketplace or a voting app, while a full chain makes sense when the app needs its own rules, fees or throughput. The choice shapes everything that follows, so it is worth deciding before writing code.
Should you build a contract or your own chain?
The contract path and the chain path solve different problems. A contract is a program that runs on someone else's chain; a chain is a whole network that you design, secure and run. Contracts ship faster and cost less to start, while chains give you control over block time, fees and governance.
| Path | What it is | Best for | Effort |
|---|---|---|---|
| ink! contract | A program on an existing parachain | Tokens, marketplaces, voting | Low to medium |
| Substrate chain | Your own chain with custom logic | Custom fees, rules, throughput | High |
| Parachain slot | Your chain plugged into shared security | Products that need the relay chain | High |
A useful rule is to build a contract first and move to a chain only when the contract limits what you can do. Many products never need their own chain. If you do need one, Substrate lets you reuse the same Rust code and tooling, so the contract work is not wasted. Substrate app-chain development follows the same pattern of starting small and growing the chain only when the product needs it.
What does the Polkadot dApp stack look like?
The Polkadot dApp stack has five layers: the chain or contract, the wallet, the frontend, the data layer and the test network. Each layer has a standard tool, so you rarely need to build from scratch.
Smart contracts on Polkadot are written in ink!, a Rust-based language, and built with cargo-contract. Full chains are built with Substrate, using pallets, which are reusable modules for balances, governance, staking and more. The frontend talks to the chain through the Polkadot.js API, and users sign with a wallet such as the Polkadot.js extension, Talisman or SubWallet.
Reading chain data directly is slow, so most apps add an indexer such as Subsquid or SubQuery, which turns chain events into a queryable database. Testing happens on Westend, the public testnet, where tokens are free and mistakes cost nothing. The dApp development guide covers the same stack from the product side.
How to build a Polkadot dApp in seven steps
Building a Polkadot dApp follows a fixed order: define the on-chain rules, write them, test them, connect the wallet, build the interface, test on a live network, then launch. Skipping the testnet step is the most common way a launch goes wrong.
- Define the rules. Decide what state the app stores, who can change it, and what each action costs.
- Pick the path. Choose an ink! contract on a parachain, or a Substrate chain if you need custom logic.
- Write the on-chain code in Rust and cover the main paths with unit tests.
- Deploy to Westend and test with real wallets and real transaction signing.
- Build the frontend with the Polkadot.js API and add wallet connection first, not last.
- Add an indexer so lists, balances and history load fast.
- Audit the contract or the chain logic, fix the findings, then launch with limits on value at risk.
Each step has a clear check before you move on. The contract tests pass, the wallet signs on Westend, the frontend shows real chain data, and the audit findings are fixed. If a step fails its check, fix it before adding more features.
How wallets, signing and fees work
A Polkadot wallet holds the user's keys and signs transactions; the app never sees the private key. When a user clicks a button, the app builds the transaction, the wallet shows the details for approval, and the signed transaction goes to the chain. This is the same pattern used on other chains, so users who have used a wallet before will find it familiar.
Fees on Polkadot chains are small and based on the work a transaction does, not on its value. Accounts also need a small minimum balance, called the existential deposit, to stay active on the chain. Design the first-run flow around this: tell new users what the fee is before they sign, and explain the minimum balance instead of letting the wallet show a confusing error.
Cross-chain features come from XCM, Polkadot's messaging format, which lets chains send assets and calls to each other. You do not need XCM for a first version, but it is worth knowing it exists: it is how a dApp on one parachain reads state or moves assets from another. The Solana guide, how to build a dApp on Solana, shows the same wallet pattern on a different chain.
Example (hypothetical): a voting dApp on Polkadot
Example (hypothetical): a community of 200 members wants to vote on three grant proposals using a contract on a Polkadot parachain. Each member gets three votes, one per proposal, so the contract must record 600 votes in total.
The tally comes to 240 votes for the first proposal, 210 for the second and 150 for the third, which adds to 600. The contract rejects any fourth vote from the same account, and the frontend shows the running total by reading an indexer instead of scanning the chain.
The build took the team four weeks: one week for the contract, one for the wallet and frontend, one for Westend testing, and one for fixes. The contract held no funds, so the launch risk was low, and the team capped the first vote at the 200 founding members before opening it up.
What are the common mistakes?
The most common mistakes in a Polkadot dApp are picking the wrong path, testing too late, and treating the wallet flow as an afterthought. Each one is easy to avoid with a short check before you start.
- Building your own chain when a contract would do, and paying for a network you do not need.
- Testing only with a local node and finding wallet problems on the first real user.
- Hiding fees and minimum balances, so users abandon the first transaction.
- Reading chain data directly in the frontend, which makes lists slow to load.
- Skipping an audit for a contract that holds user funds.
A short review before launch catches most of these: run the full flow on Westend with a fresh wallet, read the audit notes, and watch a new user try the app without help. If they finish the first action without asking a question, the flow is ready. The NEAR guide, how to build a dApp on NEAR, makes the same point about testing with a fresh wallet.
Key takeaways
- A Polkadot dApp pairs on-chain logic with a browser frontend and a wallet for signing
- Start with an ink! contract on an existing chain; build your own Substrate chain only when you need custom rules
- The standard stack is Rust, cargo-contract, the Polkadot.js API, a wallet and an indexer
- Test the full flow on Westend with a real wallet before launch
- Fees follow the work a transaction does, and accounts need a small minimum balance
Frequently asked questions
Do I need my own parachain to build a Polkadot dApp?
No. Most dApps run as ink! smart contracts on an existing parachain, which is faster and cheaper to start. Your own chain, or a parachain slot, only makes sense when you need custom block time, fees or governance that a contract cannot provide.
What language do Polkadot smart contracts use?
Contracts are written in ink!, which is based on Rust, and built with the cargo-contract tool. If your team already writes Rust, the learning curve is short; if not, budget time to learn Rust basics before writing contract code.
Which wallet should a Polkadot dApp support?
Support the Polkadot.js extension first, since it is the reference wallet, then add Talisman and SubWallet, which many users prefer. All three sign the same way, so adding a second wallet is mostly interface work.
What is the Westend testnet for?
Westend is Polkadot's public test network, where tokens are free and mistakes cost nothing. Use it to test the contract, the wallet flow and the frontend with real signing before you deploy anything that holds real value.
How does XCM help a dApp?
XCM is Polkadot's cross-chain messaging format. It lets your dApp move assets or read state from another parachain without a bridge. You do not need it for a first version, but it matters once your app works across more than one chain.
How long does a first Polkadot dApp take to build?
A simple contract-based dApp with a wallet and a frontend usually takes four to eight weeks for a small team, including Westend testing. A full Substrate chain takes longer, since you must also plan the network, the token and the launch.