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
  • Introduction
  • Prerequisites
  • Steps to add BlockDAG Network in Metamask Wallet
  • Part 1: Connecting to the BlockDAG Network
  • Part 2: Deploying Contracts Using BlockDAG IDE Pro
  • Ready to compile
  • Overview of the Ready to Compile Interface
  • Step-by-Step Instructions
  • Compile
  • Step-by-Step Instructions
  • Deploy
  • Step-by-Step Instructions
  • Deployed

Was this helpful?

Edit on GitHub
  1. BlockDAG Tools

Contracts Wizard

PreviousHow to create and deployNextEVM RPC

Last updated 1 month ago

Was this helpful?

Introduction

This guide provides step-by-step instructions to deploy any smart contract on the BlockDAG blockchain. You’ll learn how to set up your development environment, write and compile the contract, and deploy it using the BlockDAG IDE Pro.

Wizard Link:

Prerequisites

Before you start, ensure you have:

  • Basic knowledge of Solidity and smart contracts.

  • An EVM-compatible wallet such as metamask with the BlockDAG network.

Steps to add BlockDAG Network in Metamask Wallet

  1. Open Metamask: Launch the Metamask extension

  1. Access Network Settings

  • Click on the Network Selector dropdown at the top of the Metamask interface (usually showing "Ethereum Mainnet" by default).

  • Select "Add Network" or "Add a Network Manually".

  1. Add a Custom RPC Network: In the "Add a network" screen, click "Add a network manually" to input the custom details.

  2. Fill in Network Details Enter the required blockchain network information:

    1. Network Name: BlockDag.

    2. Chain ID: The unique ID for the BlockDAG blockchain (1043).

    3. Currency Symbol: The native token symbol (BDAG).

    4. Tools: BlockDAG IDE Pro.

Part 1: Connecting to the BlockDAG Network

To add the BlockDAG network to the metamask, there are 2 options:

Method 1: To add the network with a single click

  1. Connect MetaMask to BlockDAG Network

    • Open the BlockDAG Explorer.

    • Click on "Add BlockDAG Network" to automatically connect your wallet to the BlockDAG blockchain.

Method 2: Manually Adding Network

  1. Alternatively, if you want to add the network manually, ensure your MetaMask is upgraded to version 12.9.2 or higher. Enter the following details in MetaMask:

  • Network Name: BlockDag

  • Chain ID: 1043

  • Currency Symbol: BDAG

  1. Confirm Connection: Once the network is added, your MetaMask wallet will connect to the BlockDAG blockchain. Ensure you can see your wallet address and balance.

Part 2: Deploying Contracts Using BlockDAG IDE Pro

  1. Open BlockDAG IDE Pro

    • Visit BlockDAG IDE Pro, link:

    • To open the File Explorer module, click on the Workspace option in the left-side menu. The File Explorer helps you manage your workspaces and files easily.

    • You can also right-click on any file or folder to see a menu with quick options for different actions.

Ready to compile

Overview of the Ready to Compile Interface

  • Select Contract Navigation Panel

    • Located on the left-hand side, this panel provides quick navigation between the following key actions:

    • ERC20: For creating fungible tokens.

    • ERC721: For creating non-fungible tokens (NFTs).

    • ERC1155: For multi-token standards.

    • Stablecoin: For creating pegged assets.

    • Real-World Asset: For tokenizing tangible assets.

    • Governor: For building governance contracts.

  • Settings Panel

    • Located on the left side of the workspace, this section allows you to customize your smart contract with various options:

      • Name and Symbol: Specify the token's name and symbol (e.g., "My Token," "MTK").

      • Pre-mint: Define the initial supply of tokens to be minted upon contract creation.

      • Features:

        • Mintable: Enables token minting after deployment.

        • Burnable: Allows token holders to burn (destroy) tokens.

        • Pausable: Adds the ability to pause contract functionality in certain scenarios.

        • Permit: Enables gasless approvals using EIP-2612.

        • Flash Minting: Supports flash loans with immediate repayment.

      • Voting Options:

        • Block Number: Voting based on blockchain block numbers.

        • Timestamp: Voting based on timestamps.

      • Access Control:

        • Ownable: Grants ownership-based access control.

        • Roles: Enables role-based permissions for contract management.

        • Managed: Allows for advanced management of contract functionalities.

      • Upgradeability: Adds support for upgradable contracts.

  • Code Editor

    • The central area displays the generated Solidity code based on the selected options in the settings panel.

    • Users can preview, edit, or copy the code for further modifications.

    • The editor includes comments and import statements for necessary libraries like ERC20 and ERC20Permit.

  • Download Button

    • Located in the top-right corner, the "Download" button lets you export the generated Solidity code file for external use.

  • Copy Button

    • Located in the top-right corner, the "Copy" button lets you copy the code easily.

Step-by-Step Instructions

  1. Choose a Contract Type

    • Select the desired contract type (e.g., ERC20) from the tabs at the top.

  2. Configure Contract Settings

    • Enter the Name and Symbol for your token.

    • Adjust additional settings like pre-minting, mintability, burnability, and more, depending on your use case.

  3. Customize Access Control

    • Enable access control mechanisms such as ownership or roles.

    • Configure voting mechanisms based on block numbers or timestamps if applicable.

  4. Preview and Edit the Code

    • Review the generated Solidity code in the editor.

    • Make manual changes if necessary to meet advanced or unique requirements.

  5. Download the Code

    • Once satisfied with the contract, click the "Download" button to save the Solidity file for further compilation or deployment.

Compile

The Compile Tab is designed to simplify the compilation process for smart contracts. It ensures compatibility with different Solidity versions and EVM configurations, giving developers flexibility and control.

Step-by-Step Instructions

  1. Select Contract Type

  • At the top, you will find options for different contract types such as ERC20, ERC721, ERC1155, Stablecoin, Real-World Asset, Governor, and Custom.

  • Click on the desired contract type to load the associated code template.

  1. Configure Solidity Compiler

  • Compiler Dropdown:

    • Choose the Solidity compiler version compatible with your contract requirements (e.g., 0.8.22 or 0.8.19).

    • The dropdown allows you to select the compiler version for compatibility with various blockchain networks.

  • EVM Version Dropdown:

    • Select the EVM version (e.g., London, Istanbul) to ensure the contract complies with the target blockchain specifications.

  1. View and Edit Code

  • The main editor displays the Solidity code for your selected contract template.

  • You can modify the code directly in the editor to customize parameters such as:

    • Token Name

    • Symbol

    • Premint Amount

  1. Compile the Contract

  • Once you have configured the settings and edited the code:

    • Click the Compile button to generate the bytecode and ABI (Application Binary Interface).

      Comment

    • A progress indicator will show the compilation status.

  • Successful Compilation:

    • If the contract compiles successfully, the interface will display the output.

      Comment

    • Errors or warnings will be highlighted in the editor for easy debugging.

Deploy

The Deploy Tab simplifies the deployment process for smart contracts, making it user-friendly and efficient. Here's how to navigate and use this section:

Step-by-Step Instructions

Step 1: Connect MetaMask Establishes a secure connection between your MetaMask wallet and BlockDAG IDE Pro for seamless deployment. Click the "Connect With MetaMask" button to link your wallet. Ensure that MetaMask is installed in your browser and you are logged in.

Step 2: Compile Your Contract

Ensure your contract is error-free and compiled successfully in the Compile Tab before proceeding to deployment.

Step 3: Deploy the Contract

  • Once connected to MetaMask, click the "Deploy" button. Confirm the transaction in MetaMask to initiate deployment.

  • Wait for the deployment process to complete. A transaction hash will be generated, and the Contract Address field will populate with the address.

Note: Ensure that your MetaMask wallet has sufficient funds for gas fees.

Tips for Using the Deploying Contract:

  • Check Gas Fees: Always ensure your wallet has enough funds to cover gas fees for deployment.

    Comment

  • Network Selection: Double-check that the selected network in MetaMask matches the intended deployment network.

    Comment

  • Save the Address: After deployment, save your contract address for future reference or integration.

Deployed

The "Deployed" screen confirms that the contract has been successfully deployed. Once deployment is complete, the contract address will appear in the left-side contract address field, where you can easily copy it for future use.

Step 1: Verify & Publish

Click the Verify & Publish button after deployment. This action validates your contract’s source code and publishes it within BlockDAG IDE Pro, and users don't need to verify the contract on BlockDAG Explorer, allowing users to interact with and review the contract within BlockDAG IDE Pro.

Step 2: Verified

Once the contract is successfully verified and published, the status will update to "Verified". Users can then copy the contract address and search for it on BDAG Scan to check its status in the Contract List screen.

Additionally, users can verify the contract directly on BDAG Scan by clicking the block icon next to the copy button. This will take them to a page where they can generate a flattened file, copy the contract code, and proceed with verification on the BDAG Scan Contract Verification screen.

You can also watch our tutorial video to learn how to deploy any smart contract using the Contract Wizard.

RPC URL: The endpoint URL for the blockchain for Testnet: ""

Default RPC URL:

https://rpc.primordial.bdagscan.com
https://rpc.primordial.bdagscan.com
https://wizard.primordial.bdagscan.com/