Create dApps
Overview
Create BlockDAG dApp is a lightweight CLI tool that scaffolds a full-featured BlockDAG decentralized application in seconds. It generates a “batteries-included” project with a modern frontend, dual smart-contract environments, and Web3 integration, bootstrapping everything—from Git initialization to basic wallet connection—for you.
Quick Start
Install and run the generator with a single command:
// npx create-blockdag-dapp@latestThis will prompt you for a project name, clone the starter kit, and install all initial dependencies automatically.
Features
Streamlined Setup: One command creates a complete BlockDAG app foundation.
Modern Stack: Next.js 14+ frontend with TypeScript and Tailwind CSS.
Dual Smart Contract Environments: Includes both Hardhat (JS/TS) and Foundry (Solidity) setups.
Web3 Integration: Out-of-the-box wallet connection UI.
Clean Start: Initializes a fresh Git repository.
Project Structure
The scaffolded project follows this layout:
Environment Setup
After scaffold completes, configure environment variables:
1. Frontend (frontend/.env.local)
frontend/.env.local)Copy frontend/.env.example to .env.local, then add:
// NEXT_PUBLIC_WALLET_CONNECT_PROJECT_ID=your_wallet_connect_project_id(Get your ID from WalletConnect Cloud.)
2. Smart Contracts (contracts/hardhat/.env & contracts/foundry/.env)
contracts/hardhat/.env & contracts/foundry/.env)In each contracts subfolder, copy .env.example → .env and add:
// PRIVATE_KEY=your_private_key_here
RPC_URL=your_rpc_url_hereDevelopment Workflow
Create Project
// npx create-blockdag-dapp@latest
cd your-project-nameInstall Dependencies & Set Up Envs
// # Frontend
cd frontend
cp .env.example .env.local
yarn install
yarn devFoundry Setup
// cd ../contracts/foundry
cp .env.example .env
forge install
forge buildHardhat Setup
// cd ../hardhat
yarn install
npx hardhat compile(Optional) Add Submodules
// git submodule add https://github.com/OpenZeppelin/openzeppelin-contracts.git contracts/foundry/lib/openzeppelin-contracts
git submodule add https://github.com/foundry-rs/forge-std contracts/foundry/lib/forge-stdRunning Commands
Frontend
// cd frontend
npm run dev # or yarn devHardhat
// cd contracts/hardhat
npm run compile # or npx hardhat compile
npm run test # or npx hardhat test Foundry
// cd contracts/foundry
forge build
forge test
forge install # if not installed earlier Links
Last updated
Was this helpful?