### DuckChain Developer Transition Guide Source: https://diary.duckchain.io/8.-appendices/8 DuckChain facilitates developer transitions from other ecosystems by offering full EVM compatibility with popular tools like MetaMask, Hardhat, and Foundry. It provides comprehensive guides and an active community to simplify the onboarding process. ```markdown ### How does DuckChain supports developers transitioning from other ecosystems? DuckChain offers full EVM compatibility with tools like MetaMask, Hardhat, and Foundry, ensuring developers can easily migrate and deploy dApps. Comprehensive guides and an active developer community further simplify onboarding. ``` -------------------------------- ### DuckChain Developer Resources Source: https://diary.duckchain.io/2.-users-and-developers/2.3-developer-hub/2.3.2-builder-guide/deploying-smart-contracts/links-and-tools Find essential developer resources for DuckChain, including guides for smart contract deployment and node operation. Access the faucet for testnet tokens and the GitHub repository for open-source code. ```text Faucet: https://t.me/Duckchain_Testnet_Faucet_bot GitHub Repository: (link to be added) ``` -------------------------------- ### Install Hardhat Toolbox Source: https://diary.duckchain.io/2.-users-and-developers/2.3-developer-hub/2.3.2-builder-guide/deploying-smart-contracts/using-hardhat Installs the Hardhat Toolbox, which provides additional utilities and plugins for Hardhat projects, such as task runners and network configurations. ```bash npm install --save-dev @nomicfoundation/hardhat-toolbox ``` -------------------------------- ### Running a DuckChain Node Source: https://diary.duckchain.io/2.-users-and-developers/2.3-developer-hub/2 This guide explains how to set up and run a DuckChain node. Running a node is essential for interacting directly with the DuckChain network, validating transactions, and participating in the ecosystem. ```bash # Conceptual command to run a DuckChain node # duckchain --datadir /path/to/node/data --config /path/to/node/config.toml --networkid ``` -------------------------------- ### Install libusb with Homebrew Source: https://diary.duckchain.io/2.-users-and-developers/2.3-developer-hub/2.3.2-builder-guide/deploying-smart-contracts/using-foundry Installs the libusb library using the Homebrew package manager, which may be a dependency for certain development tools like Foundry. ```Shell brew install libusb ``` -------------------------------- ### Install DuckChain Node Script Source: https://diary.duckchain.io/2.-users-and-developers/2.3-developer-hub/2.3.2-builder-guide/deploying-smart-contracts/run-a-duckchain-node This snippet shows the command to download and execute the installation script for a DuckChain node. It includes prerequisites like Docker and specifies how to select the network (Mainnet or Testnet) during the process. ```Shell wget -c https://download.duckchain.io/duckchain/install.sh && chmod +x ./install.sh && ./install.sh ``` -------------------------------- ### Install OpenZeppelin Contracts Upgradeable Source: https://diary.duckchain.io/2.-users-and-developers/2.3-developer-hub/2.3.2-builder-guide/deploying-smart-contracts/using-foundry Installs the OpenZeppelin Contracts Upgradeable library using npm. This library provides secure and upgradeable smart contract components. ```Shell npm install @openzeppelin/contracts-upgradeable ``` -------------------------------- ### Deploying Smart Contracts with Foundry Source: https://diary.duckchain.io/2.-users-and-developers/2.3-developer-hub/2 This section outlines the steps for deploying smart contracts using Foundry, a fast and flexible toolkit for Ethereum application development. It provides guidance on setting up Foundry for deployment on DuckChain. ```bash # Example Foundry deployment script (conceptual) # Ensure you have Foundry installed and configured for DuckChain # forge create --rpc-url --private-key src/MyContract.sol:MyContract ``` -------------------------------- ### Configure MetaMask for DuckChain Source: https://diary.duckchain.io/2.-users-and-developers/2.3-developer-hub/2.3.2-builder-guide/evm-wallet Instructions for manually adding the DuckChain network to MetaMask, enabling connection to the EVM-compatible blockchain. ```text 1. Open the MetaMask browser extension. 2. Click the network selection dropdown. 3. Select "Add Network Manually." 4. Enter the DuckChain network details. ``` -------------------------------- ### Install Hardhat Dependencies Source: https://diary.duckchain.io/2.-users-and-developers/2.3-developer-hub/2.3.2-builder-guide/deploying-smart-contracts/using-hardhat Installs necessary packages for Hardhat development, including ethers, waffle, chai, and dotenv, for deploying and interacting with smart contracts. ```bash npm install --save-dev ethers hardhat @nomiclabs/hardhat-waffle ethereum-waffle chai @nomiclabs/hardhat-ethers dotenv ``` -------------------------------- ### Deploying Smart Contracts with Hardhat Source: https://diary.duckchain.io/2.-users-and-developers/2.3-developer-hub/2 This section details the process of deploying smart contracts using Hardhat, a popular Ethereum development environment. It covers the necessary steps and configurations for a smooth deployment on the DuckChain network. ```bash # Example Hardhat deployment script (conceptual) # Ensure you have Hardhat installed and configured for DuckChain # npx hardhat run scripts/deploy.js --network duckchain ``` -------------------------------- ### Deploy Smart Contracts with Hardhat Source: https://diary.duckchain.io/2.-users-and-developers/2.3-developer-hub/2.3.2-builder-guide/deploying-smart-contracts/using-foundry Guides on deploying smart contracts using the Hardhat development environment. This typically involves configuration files and script execution within the Hardhat framework. ```bash # Example Hardhat deployment script (conceptual) npx hardhat run scripts/deploy.js --network duckchain ``` -------------------------------- ### DuckChain Partner Integration Guide Source: https://diary.duckchain.io/8.-appendices/8 Partners can integrate with DuckChain using its bridge solutions and APIs for seamless service integration. DuckChain also provides support for building custom modules to facilitate deeper collaboration. ```markdown ### **How can partners integrate with DuckChain?** Partners can use DuckChain’s bridge solutions and APIs for seamless service integration, with support available for building custom modules. ``` -------------------------------- ### DuckChain Storage Smart Contract Source: https://diary.duckchain.io/2.-users-and-developers/2.3-developer-hub/2.3.2-builder-guide/deploying-smart-contracts/using-hardhat A simple Solidity smart contract named 'Storage' that allows users to set and get an unsigned integer value. It demonstrates basic state management within a smart contract. ```solidity // SPDX-License-Identifier: MIT pragma solidity ^0.8.9; contract Storage { uint256 _count = 0; function set(uint256 count) public { _count = count; } function get() public view returns (uint256) { return _count; } } ``` -------------------------------- ### Run a DuckChain Node Source: https://diary.duckchain.io/2.-users-and-developers/2.3-developer-hub/2.3.2-builder-guide/deploying-smart-contracts/using-foundry Information and steps required to run a DuckChain node. This is crucial for interacting with the network, deploying contracts, and participating in the ecosystem. ```bash # Example command to start a DuckChain node (conceptual) git clone cd duckchain make geth ./build/bin/geth --datadir /path/to/your/data --networkid --http --ws ``` -------------------------------- ### Initialize Hardhat Project Source: https://diary.duckchain.io/2.-users-and-developers/2.3-developer-hub/2.3.2-builder-guide/deploying-smart-contracts/using-hardhat Initializes a new Hardhat project, setting up the basic directory structure and configuration files required for smart contract development. ```bash npx hardhat init ``` -------------------------------- ### Configure Environment Variables for DuckChain Testnet Source: https://diary.duckchain.io/2.-users-and-developers/2.3-developer-hub/2.3.2-builder-guide/deploying-smart-contracts/using-foundry This snippet shows how to populate the `.env.sample` file with necessary credentials like the RPC URL and private key for the DuckChain Testnet. It also demonstrates copying these settings to the `.env` file. ```bash RPC_URL="https://testnet-rpc.duckchain.io" PVTKEY="" ``` ```bash cp .env.sample .env ``` -------------------------------- ### Initialize a new Foundry project Source: https://diary.duckchain.io/2.-users-and-developers/2.3-developer-hub/2.3.2-builder-guide/deploying-smart-contracts/using-foundry Initializes a new Foundry project with a specified name. This command sets up the basic directory structure and configuration files for a smart contract development project. ```Shell forge init zkevm-sbt ``` -------------------------------- ### Load Environment Variables and Echo RPC URL Source: https://diary.duckchain.io/2.-users-and-developers/2.3-developer-hub/2.3.2-builder-guide/deploying-smart-contracts/using-foundry This section demonstrates how to load environment variables from the `.env` file using the `source` command and then verify that the `RPC_URL` is correctly read. ```bash source .env ``` ```bash echo $RPC_URL ``` -------------------------------- ### Get Gas Token for DuckChain Source: https://diary.duckchain.io/2.-users-and-developers/2.3-developer-hub/2.3.2-builder-guide/gas Instructions on how to obtain gas tokens for both the testnet and mainnet of DuckChain. For testnet, a Telegram bot is provided. For mainnet, users can bridge TON or swap for it. ```text Testnet : Click https://t.me/Duckchain_Testnet_Faucet_bot to get Testnet gas. Mainnet : Bridge TON via the DuckChain official bridge or swap for TON as gas. ``` -------------------------------- ### Compile and Deploy Storage Contract Source: https://diary.duckchain.io/2.-users-and-developers/2.3-developer-hub/2.3.2-builder-guide/deploying-smart-contracts/using-hardhat Compiles the Solidity smart contracts and runs the deployment script for the 'Storage' contract on the DuckChain testnet using Hardhat. ```bash npx hardhat compile npx hardhat run scripts/deploy-storage.js --network DuckChainTestnet ``` -------------------------------- ### Deploy Smart Contracts with Foundry Source: https://diary.duckchain.io/2.-users-and-developers/2.3-developer-hub/2.3.2-builder-guide/deploying-smart-contracts/using-foundry Instructions for deploying smart contracts using the Foundry toolkit. Foundry provides tools like Forge for contract deployment and testing. ```bash # Example Forge deployment command (conceptual) forge create --rpc-url --private-key src/MyContract.sol:MyContract ``` -------------------------------- ### DuckChain API Documentation Source: https://diary.duckchain.io/2.-users-and-developers/2.3-developer-hub/2.3.2-builder-guide/deploying-smart-contracts/links-and-tools Integrate DuckChain's functionalities into your decentralized applications by accessing its comprehensive API documentation. This allows for seamless interaction with the DuckChain network. ```text DuckChain API Documentation: https://api.duckchain.io ``` -------------------------------- ### Build a Foundry project Source: https://diary.duckchain.io/2.-users-and-developers/2.3-developer-hub/2.3.2-builder-guide/deploying-smart-contracts/using-foundry Compiles the smart contracts within a Foundry project. This command processes the Solidity code and generates the necessary artifacts for testing and deployment. ```Shell forge build ``` -------------------------------- ### Deploy Smart Contract using Forge Source: https://diary.duckchain.io/2.-users-and-developers/2.3-developer-hub/2.3.2-builder-guide/deploying-smart-contracts/using-foundry This command deploys a smart contract to the DuckChain Testnet using Forge. It requires the RPC URL, private key, the contract file path, and the contract name. The `--legacy` flag is used for deployment. ```bash forge create --rpc-url $RPC_URL --private-key $PRIVATE_KEY src/{ContractFile.sol}:{ContractName} --legacy ``` ```bash forge create --rpc-url $RPC_URL --private-key $PRIVATE_KEY src/Sbt.sol:SoEarly --legacy ``` -------------------------------- ### Test a Foundry project Source: https://diary.duckchain.io/2.-users-and-developers/2.3-developer-hub/2.3.2-builder-guide/deploying-smart-contracts/using-foundry Executes the tests defined for the smart contracts in a Foundry project. This command helps ensure the correctness and functionality of the contracts. ```Shell forge test ``` -------------------------------- ### Generate Foundry remappings Source: https://diary.duckchain.io/2.-users-and-developers/2.3-developer-hub/2.3.2-builder-guide/deploying-smart-contracts/using-foundry Generates a remappings file for Foundry, which helps in aliasing contract paths for easier imports. This is often used to simplify dependency management. ```Shell forge remappings > remappings.txt ``` -------------------------------- ### Configure Hardhat for DuckChain Testnet Source: https://diary.duckchain.io/2.-users-and-developers/2.3-developer-hub/2.3.2-builder-guide/deploying-smart-contracts/using-hardhat Configures the hardhat.config.js file to specify the Solidity compiler version, artifact output path, and network settings for the DuckChain testnet, including the RPC URL and account private key. ```javascript require("dotenv").config(); require("@nomicfoundation/hardhat-toolbox"); module.exports = { solidity: "0.8.9", paths: { artifacts: "./src", }, networks: { DuckChainTestnet: { url: `https://testnet-rpc.duckchain.io`, accounts: [process.env.ACCOUNT_PRIVATE_KEY], }, }, }; ``` -------------------------------- ### DuckChain Contract Deployment Script Source: https://diary.duckchain.io/2.-users-and-developers/2.3-developer-hub/2.3.2-builder-guide/deploying-smart-contracts/using-hardhat A JavaScript script using Hardhat's ethers library to deploy the 'Storage' smart contract to the DuckChain testnet and log the deployed contract's address. ```javascript const hre = require("hardhat"); async function main() { const deployedContract = await hre.ethers.deployContract("Storage"); await deployedContract.waitForDeployment(); console.log( `Storage contract deployed to https://testnet-scan.duckchain.io/address/${deployedContract.target}` ); } main().catch((error) => { console.error(error); process.exitCode = 1; }); ``` -------------------------------- ### Define Token URI Metadata Source: https://diary.duckchain.io/2.-users-and-developers/2.3-developer-hub/2.3.2-builder-guide/deploying-smart-contracts/using-foundry A JSON structure defining the metadata for an NFT token, including its title, description, and a link to its associated image stored on IPFS. ```JSON { "title": "So Early", "description": "I was super duper early to the Duck Chain", "image": "" /* remove the forward-slash at the end of the URL, if any */ } ``` -------------------------------- ### Deploy Smart Contracts with Solidity on DuckChain Source: https://diary.duckchain.io/2.-users-and-developers/2.3-developer-hub/2.3.2-builder-guide/deploying-smart-contracts This section details the process of deploying smart contracts on DuckChain, emphasizing the use of Solidity, an industry-standard language. It highlights DuckChain's compatibility with Ethereum-based tools, low transaction costs, rapid finality, and integrated debugging environments, making it suitable for Web3 development. ```Solidity pragma solidity ^0.8.0; contract SimpleStorage { uint256 private storedData; function set(uint256 x) public { storedData = x; } function get() public view returns (uint256) { return storedData; } } ``` -------------------------------- ### DuckChain Staking Information Source: https://diary.duckchain.io/2.-users-and-developers/2.3-developer-hub/2.3.1-network-information/other-general-contracts Links to a Medium article detailing the DuckChain's 'stake to earn' program, explaining how users can earn rewards by staking. ```URL https://medium.com/@duckchain/duckchain-new-era-stake-to-earn-stars-and-eggs-52bd1c808384 ``` -------------------------------- ### DuckChain Network Explorers Source: https://diary.duckchain.io/2.-users-and-developers/2.3-developer-hub/2.3.2-builder-guide/deploying-smart-contracts/links-and-tools Access real-time transaction and block data for DuckChain's mainnet and testnet. These explorers are crucial for monitoring network activity and verifying transactions. ```text DuckChain Mainnet Explorer: https://scan.duckchain.io DuckChain Testnet Explorer: https://testnet-scan.duckchain.io ``` -------------------------------- ### DuckChain Execution Layer Overview Source: https://diary.duckchain.io/3.-duckchain-architecture/3.3-pool-infrastructure/duckchain-execution-layer Explains the DuckChain Execution Layer, built on Arbitrum Orbit technology. It details how Arbitrum Orbit enhances blockchain efficiency by batching transactions, reducing parent chain load, and lowering costs while ensuring security and EVM compatibility. ```English The DuckChain Execution Layer is a blockchain built on Arbitrum Orbit technology, with one of its core components being Arbitrum Orbit. Arbitrum Orbit is a Layer 2 scaling technology designed to enhance the processing capacity and efficiency of blockchains. By batching multiple transactions and submitting them together, it significantly reduces the load on the parent chain while maintaining full compatibility with it. Although most transaction processing occurs off-chain, the final confirmation of all transactions still takes place on the main parent chain, ensuring security. Additionally, this approach significantly lowers transaction costs. DuckChain architecture has the following key advantages: * High Throughput: The optimized design enables DuckChain to handle a large number of transactions, providing excellent throughput. * Fast Finality: Through deterministic execution and an efficient fraud-proof mechanism, the transaction finalization process is accelerated. * More Efficient Dispute Resolution: Allows for more efficient resolution of transaction disputes, reducing the time and cost associated with dispute resolution. * Compatibility with Ethereum: Runs on Ethereum Virtual Machine (EVM) code, supporting the same APIs as Ethereum, allowing developers and users to migrate and use seamlessly. * Security and Liveness Guarantees: With the underlying security and liveness of the TON blockchain, the DuckChain Execution Layer ensures the security and liveness of the Layer 2 chain. * Data Availability: Through the AnyTrust variant, costs can be reduced with an external data availability committee while maintaining data availability and security. DuckChain, launched by TONSCALE LABS, not only meets the market demand for high-performance blockchain solutions but also opens new possibilities for the expansion and innovation of the TON ecosystem, driving further development and application of blockchain technology. ``` -------------------------------- ### DuckChain Testnet Network Details Source: https://diary.duckchain.io/2.-users-and-developers/2.3-developer-hub/2.3.1-network-information/testnet This snippet outlines the configuration parameters for the DuckChain Testnet. It includes the network name, type, RPC endpoint, Chain ID, currency symbol, and relevant explorer URLs for monitoring network activity. ```text Network Name: DuckChain Testnet Type: Testnet RPC URL: https://testnet-rpc.duckchain.io Chain ID: 202105 Currency Symbol: TON Chainlist URL: https://chainlist.org/chain/202105 Explorer: https://www.oklink.com/duckchain-testnet https://www.okx.com/web3/explorer/duckchain-testnet https://testnet-scan.duckchain.io ``` -------------------------------- ### DuckChain Partner Support Source: https://diary.duckchain.io/8.-appendices/8 DuckChain offers comprehensive support to its partners, including technical assistance, marketing resources, and ecosystem grants provided through its foundation to foster successful collaborations. ```markdown ### **What kind of support does DuckChain provide to its partners?** DuckChain offers technical assistance, marketing resources, and ecosystem grants through its foundation to foster successful collaborations. ``` -------------------------------- ### DuckChain Testnet Faucet Usage Source: https://diary.duckchain.io/2.-users-and-developers/2.3-developer-hub/2.3.1-network-information/testnet Instructions for obtaining testnet tokens using the DuckChain Testnet Faucet Bot on Telegram. It highlights the process of claiming test TON and mentions usage restrictions, such as one claim per 24 hours and a maximum of 0.1 TON per claim, along with potential risk controls for bulk claiming. ```text Open Telegram and use the DuckChain Testnet Faucet Bot to claim test TON. Please adhere to the rules on the Faucet page, such as the limit of one claim every 24 hours and a maximum of 0.1 TON per claim. DuckChain may also implement risk controls against bulk claiming activities. https://t.me/Duckchain_Testnet_Faucet_bot ```