Creating decentralized applications (dApps) has become increasingly accessible thanks to modern development toolkits. One of the most powerful tools available today is Scaffold-ETH 2, an open-source boilerplate designed to streamline dApp development on Ethereum and other EVM-compatible blockchains — including Kaia.
With Scaffold-ETH 2, developers can rapidly deploy Solidity smart contracts and launch interactive React-based frontends with minimal setup. Built using modern tools like Next.js, RainbowKit, Hardhat, Foundry, Wagmi, and TypeScript, this toolkit empowers both beginners and experienced developers to focus on innovation rather than infrastructure.
In this comprehensive guide, you’ll learn how to set up a development environment, configure Scaffold-ETH 2 for the Kaia blockchain, deploy smart contracts, verify them on-chain, and run a fully functional dApp locally.
Prerequisites
Before diving into the setup process, ensure your system meets the following requirements:
- Node.js (version >= v18.17) — Download from nodejs.org
- Yarn (v1 or v2+) — Install via Yarn's official guide
- Basic knowledge of JavaScript and React, especially hooks
- A MetaMask wallet installed and configured
- Test KAIA tokens from the Kaia faucet
- Access to a Kaia RPC endpoint — retrieve from one of the supported providers
Once these prerequisites are in place, you're ready to begin building.
Setting Up Your Development Environment
Scaffold-ETH 2 can be initialized in two ways: by cloning the GitHub repository or using the npx
command. For simplicity and speed, we’ll use the latter method.
Run the following command in your terminal:
npx create-eth@latest
You'll be prompted with several configuration options:
- Project Name: Enter a name such as
kaia-scaffold-example
- Framework: Choose between Hardhat or Foundry. In this tutorial, we'll use Hardhat
- Install Packages?: Press Enter to accept the default "Yes"
After setup completes, navigate into your project directory:
cd kaia-scaffold-example
This initializes a full-stack dApp environment with both backend (smart contracts) and frontend (React UI) pre-configured.
👉 Get started with blockchain development using powerful tools today.
Key Steps in the Scaffold-ETH 2 Workflow
The typical development cycle using Scaffold-ETH 2 involves the following stages:
- Update network configuration in Hardhat for Kaia
- Add smart contracts to
packages/hardhat/contracts
- Edit deployment scripts in
packages/hardhat/deploy
- Deploy contracts to the Kaia testnet
- Verify deployed contracts using Hardhat plugins
- Configure the frontend in
packages/nextjs/scaffold.config.ts
to target Kaia - Customize UI components under
packages/nextjs/pages
as needed
In this guide, we’ll use the default example contract and frontend included in Scaffold-ETH 2, modifying only what’s necessary for Kaia integration.
Configuring Hardhat for Kaia
To deploy contracts on Kaia, you must configure Hardhat to recognize the Kaia network — specifically the Kairos Testnet (chain ID: 1001).
Step 1: Create a .env
File
First, create a .env
file inside the Hardhat package to securely store sensitive data:
touch packages/hardhat/.env
Refer to .env.example
for guidance on structure. For Kaia, you only need one variable:
deployer_private_key=insert_your_private_key_here
🔐 Never commit this file to version control. The private key corresponds to the wallet funding and deploying contracts.
Step 2: Update hardhat.config.ts
Modify the network configuration in packages/hardhat/hardhat.config.ts
. Add the following network definition under networks
:
kairos: {
chainId: 1001,
url: "https://public-en-kairos.node.kaia.io", // Official public endpoint
accounts: [process.env.deployer_private_key],
},
Set defaultNetwork
to "kairos"
if you want deployments to target Kaia by default.
For more details, see Kaia’s official Hardhat integration guide.
Deploying Contracts to Kaia
With configuration complete, it's time to compile and deploy your smart contract.
First, compile the contract:
yarn compile
Then deploy using:
yarn deploy --network kairos
If no default network is set, always specify --network kairos
explicitly.
Upon successful deployment, the terminal will display the deployed contract address — copy this for verification and frontend integration.
Verifying Your Deployed Contract
Source code verification increases transparency and trust. On Kaia, you can verify contracts via Kaiascope, equivalent to Etherscan.
Add this configuration to hardhat.config.ts
under the etherscan
object:
etherscan: {
apiKey: {
kairos: "unnecessary",
},
customChains: [
{
network: "kairos",
chainId: 1001,
urls: {
apiURL: "https://api-kairos.kaiascope.com/api",
browserURL: "https://kairos.kaiascope.com",
},
},
],
},
Now verify your contract:
yarn hardhat verify --network kairos CONTRACT_ADDRESS "constructorArg1"
Example:
yarn hardhat verify --network kairos 0x7fc9656fc8c8ab433867e58b7c6afc19ec4275da
After a few moments, you’ll receive confirmation and a link to view the verified contract on Kaiascope.
Frontend Configuration with Next.js
Now that your contract is live, connect your frontend so users can interact with it.
Update Target Network in scaffold.config.ts
Navigate to packages/nextjs/scaffold.config.ts
and locate the targetNetworks
array. Replace its value with Kaia’s testnet:
targetNetworks: [chains.klaytnBaobab],
This ensures the frontend connects to the correct chain and enables wallet interactions via RainbowKit and Wagmi.
Launching Your dApp Locally
With all configurations complete, start the development server:
yarn dev
Visit http://localhost:3001 in your browser. You should now see your dApp interface.
👉 Start building and testing dApps with real-time blockchain interactions now.
Connect your MetaMask wallet (ensure it’s switched to Kairos Testnet), interact with the contract functions, and explore features like transaction debugging and address management built into the Scaffold-ETH 2 UI.
Frequently Asked Questions (FAQ)
Q: What is Scaffold-ETH 2 used for?
A: Scaffold-ETH 2 is a full-stack development kit that accelerates dApp creation on EVM-compatible chains like Ethereum, Polygon, and Kaia. It includes smart contract tooling, deployment scripts, and a React frontend boilerplate.
Q: Can I use Foundry instead of Hardhat?
A: Yes! During project initialization, you can select Foundry as your preferred framework. Both support Kaia deployment with minor configuration tweaks.
Q: Why do I need a .env
file?
A: The .env
file securely stores private keys and API secrets without exposing them in code. This prevents accidental leaks when sharing or publishing code.
Q: Is Kaia fully EVM-compatible?
A: Yes. Kaia supports EVM-based smart contracts written in Solidity, allowing seamless migration from Ethereum or other EVM chains using tools like Hardhat and Foundry.
Q: How do I get testnet KAIA tokens?
A: Visit the official Kaia faucet, connect your wallet, and request test tokens for development and testing.
Q: Can I customize the React frontend?
A: Absolutely. The Next.js frontend is highly modular. You can modify pages, styles, components, and add new features tailored to your dApp’s functionality.
Conclusion
You’ve successfully built and deployed a dApp on the Kaia blockchain using Scaffold-ETH 2! From setting up your environment to deploying verified smart contracts and launching an interactive frontend, you now have a solid foundation for further exploration.
Whether you're prototyping a DeFi platform, NFT marketplace, or Web3 social app, Scaffold-ETH 2 dramatically reduces development time while maintaining flexibility and scalability.
Continue experimenting with custom contracts, advanced UI components, and cross-chain integrations. For deeper learning, refer to the official Scaffold-ETH 2 documentation or engage with the community on the Kaia Developer Forum.
👉 Accelerate your next blockchain project with seamless tools and resources.