How to Build a Decentralized App on the XDC Blockchain
The XDC Network is EVM-compatible with two-second finality and near-zero fees. Here is how to build and deploy a decentralized app on it.
On this page
Short answer
A decentralized app on the XDC Network is built with Solidity and standard EVM tools such as Hardhat or Remix, tested on the Apothem testnet, and deployed to mainnet after an audit. XDC is fully EVM-compatible, so Ethereum contracts need only small changes to run on it.
What is the XDC Network?
The XDC Network is an enterprise-grade, open source Layer 1 blockchain built for real-world finance, tokenization and trade. It runs smart contracts, supports decentralized applications, and is designed to work with the messaging standards that banks and trade systems already use.
The network launched its mainnet in June 2019 and is maintained by the XDC Foundation, which was set up in 2021. Its focus has stayed narrow: payments, trade finance and tokenized real-world assets, rather than trying to cover every kind of application.
Three features define it. It uses a delegated proof of stake consensus called XDPoS, it is fully compatible with the Ethereum Virtual Machine, and it supports the ISO 20022 messaging standard that banks use for payment instructions. That combination is why it is described as a hybrid chain: public and open, but built for business workflows.
For a builder, the practical meaning is simple. You write smart contracts in Solidity, you use the same tools you would use on Ethereum, and you deploy onto a network with two-second finality and very low transaction fees. The XDC coin pays for gas, and tokens follow the XRC-20, XRC-721 and XRC-1155 standards.
Why build a dapp on XDC?
You build a dapp on XDC when your application works with real-world assets, trade documents or payments, and when low fees and fast finality matter more than the size of the developer community. A trade finance app that settles many small transactions gains more from cheap, fast settlement than from the largest ecosystem.
| Factor | Ethereum | XDC Network |
|---|---|---|
| Consensus | Proof of stake | Delegated proof of stake (XDPoS) |
| Finality | Minutes to be certain | About 2 seconds |
| Transaction fees | Varies, often high at peak times | Near zero |
| EVM compatibility | Native | Fully compatible |
| Token standards | ERC-20, ERC-721, ERC-1155 | XRC-20, XRC-721, XRC-1155 |
| Best fit | Largest DeFi and NFT ecosystem | Trade finance, payments, tokenized assets |
The trade-off is ecosystem size. Ethereum has far more developers, libraries and audited contracts, and its tooling is the reference that every other chain copies. XDC has a smaller community, so some libraries need checking and some answers take longer to find.
That trade-off is acceptable when the application's users are businesses rather than the general public. A trade finance platform, a tokenized invoice market or a payment app cares about settlement speed, fee predictability and bank messaging standards. Those are the areas where XDC was designed to be strong.
What do you need before you start?
You need four things before you start building on XDC: a development environment, a wallet with testnet funds, a plan for the contracts, and a testnet to deploy on. None of them is unusual if you have built on Ethereum before.
The environment is the standard EVM toolchain. Hardhat or Foundry for compiling and testing, Remix for quick experiments, and a wallet such as MetaMask configured for the XDC network. The official documentation covers the SDKs, RPC endpoints and node options, and it is the place to check the current setup.
The testnet is called Apothem, and its chain ID is 51. You configure it in your wallet, get test XDC from a faucet, and deploy the same way you would on a mainnet. Nothing on Apothem has real value, so it is the safe place to break things.
The contract plan matters most. Write down what each contract does, who can call it, and what happens when something goes wrong. A dapp that moves trade documents or money needs its permission model decided before the first line of code, not after. For the audit step that follows, see what a smart contract audit covers.
How do you build and deploy a dapp on XDC, step by step?
You build and deploy a dapp on XDC by writing Solidity contracts with the standard EVM tools, testing them on the Apothem testnet, and then deploying to mainnet with a verified contract and a working front end. The steps below assume you can already write a basic smart contract.
- Define the use case. Pick one workflow, such as issuing a tokenized invoice or settling a payment, and write down every actor, every state change and every rule. One workflow done well beats three half-built ones.
- Set up the project. Create a Hardhat or Foundry project, add the XDC network configuration, and connect a wallet. Confirm the setup by compiling a small contract and reading its address.
- Write the contracts. Use Solidity and the XRC token standards where they fit. Keep contracts small, give each one a single job, and put access control in from the start.
- Test on Apothem. Deploy to the Apothem testnet with chain ID 51, run the full workflow with test XDC, and test the failure cases: wrong caller, wrong amount, duplicate submission.
- Audit the contracts. Get an external review before mainnet, even for a small dapp. The cost of an audit is small next to the cost of a contract that cannot be fixed after deployment.
- Deploy to mainnet. Deploy with the same code that was tested and audited, verify the contract so anyone can read it, and record the addresses and the deployment parameters.
- Build the front end. Connect the interface to wallets and contracts, show transaction status clearly, and handle the common failures: rejected signature, wrong network, insufficient gas.
Keep the front end thin. The contracts enforce the rules; the interface only presents them. That separation makes the dapp easier to test, easier to audit and easier to fix when the interface changes. The same pattern applies to token work on other chains, such as how to create a token on Solana.
How do tokens work on XDC?
Tokens on XDC work the same way they do on Ethereum, because the network is EVM-compatible and the standards are direct ports of the Ethereum ones. A fungible token follows XRC-20, a unique asset follows XRC-721, and a contract that needs both follows XRC-1155.
| Standard | What it covers | Typical use |
|---|---|---|
| XRC-20 | Fungible tokens, all units identical | Stablecoins, loyalty points, invoice tokens |
| XRC-721 | Unique tokens, each one distinct | Trade documents, certificates, property records |
| XRC-1155 | Many token types in one contract | Games, memberships, mixed asset sets |
Because the standards mirror Ethereum's, wallets and exchanges that support XDC already understand them, and developers can reuse familiar libraries with small changes. A token contract written for Ethereum usually needs only configuration changes to run on XDC.
One detail to plan early is how the token gets its value. A stablecoin needs a reserve and a redemption path, which is covered in how to create a stablecoin on XDC. A token that represents an invoice or a shipment needs an off-chain record that links the token to the real asset, and someone must maintain that link honestly.
Example: a tokenized invoice dapp on XDC
Example (hypothetical): a small trade finance company wants to let suppliers sell their unpaid invoices early. A supplier uploads an invoice for $50,000, a funder buys the token that represents it, and the buyer pays the invoice 60 days later. The dapp records each step on XDC.
The contracts are simple. An XRC-721 token represents the invoice, with the invoice number, amount and due date in its metadata. A second contract holds the payment in escrow and releases it to the funder when the buyer pays. The supplier receives the funding up front, minus a fee.
The arithmetic is straightforward. The funder advances 80% of the $50,000 invoice, which is $40,000, and charges a 1.5% fee of $600, so the supplier receives $39,400 on day one. At day 60 the buyer pays $50,000 into escrow, the contract sends $40,000 back to the funder, and the remaining $10,000 goes to the supplier, less any late-payment handling.
On XDC the transaction fees for these steps are near zero, and each step settles in about two seconds, so the cost of running the workflow is dominated by the funding fee, not the network. That is the point of choosing a low-fee chain for a high-volume, low-margin business.
What are the common mistakes?
The most common mistakes when building on XDC are treating it as identical to Ethereum, skipping the audit, and building a token with no link to the real asset. Each one is easy to avoid with a short checklist.
- Assuming Ethereum behaviour. XDC is EVM-compatible, but finality, fees and some network details differ. Test on Apothem rather than assuming Ethereum behaviour carries over.
- Skipping the audit. A deployed contract cannot be changed easily. Audit before mainnet, even for a small dapp, and fix what the audit finds.
- Token with no asset link. A token that claims to represent an invoice or a shipment needs a real record behind it. Without one, the token is just a number.
- No upgrade plan. Contracts need a way to fix bugs or change rules. Decide the upgrade path before deployment, and write it down.
- Ignoring the front end. Users judge the dapp by the interface. If the wallet connection fails silently or the transaction status is unclear, users leave.
- Building for the wrong chain. If the application's users are already on Ethereum or Solana, moving them to XDC needs a reason. Low fees alone rarely move a whole user base.
Key takeaways
- XDC is an EVM-compatible Layer 1 built for trade finance and tokenized assets
- Solidity contracts and standard EVM tools work with minimal changes
- Finality is about two seconds and transaction fees are near zero
- XRC-20, XRC-721 and XRC-1155 mirror the Ethereum token standards
- Test on the Apothem testnet and audit before deploying to mainnet
Frequently asked questions
What is the XDC Network?
The XDC Network is an enterprise-grade, open source Layer 1 blockchain built for real-world finance, tokenization and trade. It runs smart contracts, supports decentralized applications, and uses a delegated proof of stake consensus with two-second finality and very low fees.
Is XDC compatible with Ethereum tools?
Yes. XDC is fully EVM-compatible, so Solidity contracts and tools such as Hardhat, Foundry and Remix work with minimal changes. Tokens follow the XRC-20, XRC-721 and XRC-1155 standards, which mirror the Ethereum equivalents.
What is the Apothem testnet?
Apothem is the XDC testnet, with chain ID 51. Developers configure it in a wallet, get test XDC from a faucet, and deploy contracts there before mainnet. Nothing on Apothem has real value, so it is the safe place to test a full workflow.
What kinds of dapps suit XDC?
XDC suits dapps that work with real-world assets, trade documents and payments, where fast settlement and low fees matter. Examples include tokenized invoices, trade finance platforms and payment apps. Consumer apps with no link to real assets usually fit larger ecosystems better.
How much does it cost to deploy on XDC?
Transaction fees on XDC are near zero, so deployment and contract calls cost very little in network fees. The real cost is development, testing and the audit. For a small dapp, those are the budget lines that matter, not the gas.
Do I need to audit a contract before mainnet?
Yes. A deployed contract is hard to change, so an external audit before mainnet is the standard step for any dapp that moves money or assets. The audit should cover access control, token logic and the upgrade path, and its findings should be fixed before deployment.