BlockDAG Docs
  • 🎯Introduction to BlockDAG
  • ⭐GETTING STARTED
    • What is BDAG?
    • Introductory Concepts
      • Decentralized Application (dApps)
      • Accounts
        • EVM Account
        • UTXO Account
      • Transactions
      • Blocks
      • EVM
        • Opcodes
      • Gas Fees
    • Nodes and Mining
      • Testnet Node Setup
    • BlockDAG Architecture
      • Architecture Overview
      • Core Modules and Components
      • Development and Implementation
      • Blockchain Features
      • Consensus Algorithm
  • TEST/MAIN NETWORKS
    • Testnet Alpha
    • Testnet Beta 1: Primordial
      • Network Details
  • BlockDAG Tools
    • Block Explorer
    • Faucet
    • Smart Contract IDE
      • IDE Layout
      • How to create and deploy
    • Contracts Wizard
  • BlockDAG Client APIs
    • EVM RPC
    • WebSocket
  • BlockDAG dApps
    • Create dApps
    • dApps Overview
    • Reflection User Guide
      • Home
      • Reflection Dashboard
      • Reflection
    • Lottery User Guide
      • Lottery Dashboard
      • Lottery
      • Participants
  • Block Explorer
    • EVM
      • Home
      • Block List
        • Block Detail
      • Transaction List
        • Transaction Detail
      • Address Details
      • Contract Listing
        • Contract Details
          • Transfer Tab
          • Holders Tab
          • Events Tab
          • Info Tab
          • Contract Tab
            • Code Tab
            • Read Tab
            • Write Tab
        • Contract Owner
        • Contract Verification
        • Contract Transaction Details
      • Tokens List
        • Token Detail
          • Transfer Tab
            • Transfer Detail Tab (Overview)
            • Transfer Detail (Logs)
          • Holders Tab
            • Holders Detail
          • Events Tab
          • Info Tab
          • Contracts Tab
        • Token Transfer
      • Node Visualizer
      • Faucet
    • UTXO
      • UTXO Home
      • Block List (UTXO)
        • Block Details (UTXO)
      • Transaction List (UTXO)
        • Transaction Details (UTXO)
      • Address Details (UTXO)
Powered by GitBook

Copyright Β© BlockDAG

On this page
  • Overview
  • Quick Start
  • Features
  • Project Structure
  • Environment Setup
  • Development Workflow
  • Running Commands
  • Links

Was this helpful?

Edit on GitHub
  1. BlockDAG dApps

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@latest

This 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:

your-app/ β”œβ”€β”€ frontend/ β”‚ β”œβ”€β”€ src/ # React components & pages β”‚ β”œβ”€β”€ public/ # Static assets β”‚ β”œβ”€β”€ tailwind.config.ts # Tailwind CSS config β”‚ └── package.json # Frontend dependencies & scripts └── contracts/ β”œβ”€β”€ hardhat/ β”‚ β”œβ”€β”€ contracts/ # Solidity contracts β”‚ β”œβ”€β”€ scripts/ # Deployment scripts β”‚ β”œβ”€β”€ test/ # Contract tests β”‚ └── hardhat.config.ts └── foundry/ β”œβ”€β”€ src/ # Solidity contracts β”œβ”€β”€ test/ # Contract tests β”œβ”€β”€ script/ # Deployment scripts └── foundry.toml

Environment Setup

After scaffold completes, configure environment variables:

1. Frontend (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)

In each contracts subfolder, copy .env.example β†’ .env and add:

// PRIVATE_KEY=your_private_key_here  
RPC_URL=your_rpc_url_here

Development Workflow

  1. Create Project

// npx create-blockdag-dapp@latest
   cd your-project-name
  1. Install Dependencies & Set Up Envs

// # Frontend
   cd frontend
   cp .env.example .env.local
   yarn install
   yarn dev
  1. Foundry Setup

// cd ../contracts/foundry
   cp .env.example .env
   forge install
   forge build
  1. Hardhat Setup

// cd ../hardhat
   yarn install
   npx hardhat compile
  1. (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-std

Running Commands

Frontend

// cd frontend  
   npm run dev  # or yarn dev

Hardhat

// 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

PreviousWebSocketNextdApps Overview

Last updated 13 days ago

Was this helpful?

GitHub:

npm:

https://github.com/BlockdagNetworkLabs/blockdag_starter_kit
https://www.npmjs.com/package/create-blockdag-dapp