diff --git a/search/search_index.json b/search/search_index.json index 022df48..c20ee79 100644 --- a/search/search_index.json +++ b/search/search_index.json @@ -1 +1 @@ -{"config":{"lang":["en"],"separator":"[\\s\\-]+","pipeline":["stopWordFilter"]},"docs":[{"location":"","title":"XDC Network Docs","text":""},{"location":"#xdc-network-revolutionizing-the-future-of-decentralized-finance-and-global-trade","title":"XDC Network: Revolutionizing the Future of Decentralized Finance and Global Trade","text":"
XDC Network is a pioneering blockchain platform tailored to meet the evolving needs of decentralized finance (DeFi) and global trade. With its unparalleled speed, scalability, and cost-efficiency, XDC Network has become the go-to choice for developers creating decentralized applications (DApps) and for users looking to engage in the next generation of financial and trade ecosystems.
"},{"location":"#key-features-and-benefits-of-xdc-network","title":"Key Features and Benefits of XDC Network","text":"Compatibility with the Ethereum Ecosystem
Developers can seamlessly migrate their Ethereum-based projects to the XDC Network, taking advantage of its superior speed, scalability, and lower transaction costs.
Global Trade and Finance Focus
XDC Network is specifically designed to cater to the needs of decentralized finance (DeFi) and global trade, offering optimized solutions for businesses and financial institutions.
Strong Ecosystem Support
Backed by a robust infrastructure, the XDC Network is supported by leading RPC providers, wallets, blockchain explorers, and data indices, along with significant grant programs for developers.
Thriving DeFi Ecosystem
XDC Network hosts a diverse range of DeFi applications, including decentralized exchanges (DEXs), lending platforms, and asset tokenization services, driving innovation in the financial sector.
Community-Driven Growth
The XDC Network is powered by a dynamic community of developers, validators, and users who actively contribute to its continuous development and global expansion.
Comprehensive Asset Support
XDC Network provides extensive support for a wide array of digital assets, ensuring optimal composability and integration opportunities for developers and users alike.
The XDC protocol serves as a messaging and confirmation layer for global payments. Also, the XDC protocol supports smart contracts and Internet of Things (IoT) integrations. As a highly scalable enterprise-grade hybrid blockchain, the XDC protocol boasts a high throughput of 2,000 transactions per second (TPS) and near-instant transaction finality.
XDC ChainXDC Network is a pioneering blockchain platform tailored to meet the evolving needs of decentralized finance (DeFi) and global trade. With its unparalleled speed, scalability, and cost-efficiency, XDC Network has become the go-to choice for developers creating decentralized applications (DApps) and for users looking to engage in the next generation of financial and trade ecosystems.
"},{"location":"#use-cases","title":"Use Cases","text":"Decentralized Finance (DeFi)
XDC Network serves as a hub for DeFi activities, offering users access to a broad spectrum of financial products and services, all powered by its efficient and secure blockchain technology.
Trade Finance and Tokenization
The XDC Network is optimized for trade finance solutions, enabling the tokenization of real-world assets and providing a platform for secure and transparent global trade transactions.
Decentralized Applications (DApps)
Developers can build and deploy a variety of DApps on the XDC Network, leveraging its scalable infrastructure, low transaction costs, and compatibility with the Ethereum ecosystem.
Supply Chain Management
XDC Network offers advanced solutions for decentralized supply chain management, ensuring transparency, efficiency, and traceability across global supply chains.
Blockchain and AI Integration
As the demand for Artificial Intelligence (AI) grows, XDC Network is paving the way for integrating AI with blockchain technology, providing a robust platform for innovative AI-driven applications.
Get started with XDC Network: Unlock the power of decentralized finance and global trade.
AnnouncementsStay updated with the latest XDC Network announcements and developments.
XDC Network: RPC EndpointsObtain the RPC Endpoint for XDC Network
XDC Network: Set up NodeXDC Network Masternodes are the backbone of the network, ensuring lightning-fast transaction validation and enhanced security.
Developer ToolsThe XDC Chain Network provides a variety of tools and resources to help developers build and deploy applications on the blockchain.
XDC SubnetXDC Subnet is a technology that allows you to create a secure, scalable, and decentralized network within the XDC Ecosystem.
"},{"location":"announce/","title":"Announcements","text":""},{"location":"announce/#announcement","title":"Announcement","text":"XDC 2.0 Mainnet Release XDC 2.0 Mainnet Release: Key Features and Enhancements October 2, 2024 XinFin Remix Upgrade XinFin Remix is getting a major upgrade and will be launching soon. Coming Soon! Solidity 0.8.23 Integration on XDC Mainnet This EVM upgrade supports the latest version of the Solidity smart contract programming language, version 0.8.23. 2024 June"},{"location":"join-ecosystem/","title":"Index","text":"Join XDC Ecosystem XDC token lies at the heart of XDC Network, and its transformative capabilities are truly awe-inspiring. As a versatile settlement mechanism, XDC fuels the entire ecosystem, enabling lightning-fast and cost-effective transactions while revolutionizing the way DApps function. All dAppsDiscover top dApps built on XDC Network Chain, the leading blockchain scaling solution.
RWARWA on XDC Network!
DeFiDeFi on XDC Network!
"},{"location":"join-ecosystem/platforms/dapp/","title":"dApps Built On XDC Network!","text":""},{"location":"join-ecosystem/platforms/defi/","title":"DeFi Built On XDC Network!","text":""},{"location":"join-ecosystem/platforms/rwa/","title":"RWA Built On XDC Network!","text":""},{"location":"showcase/","title":"Showcase","text":""},{"location":"showcase/#smart-contract-introduction","title":"Smart Contract Introduction","text":"Blockchain technology is a digital ledger that continuously expands by adding records, known as blocks, which are securely connected through cryptography. Each block includes a cryptographic hash of the preceding block, a timestamp, and transaction data. The structure of blockchain ensures that once data is recorded, it is nearly impossible to alter, providing a high level of security. One of the key advantages of blockchain is its decentralized nature, eliminating the need for middlemen, which reduces both time and potential conflicts. Despite its challenges, blockchain technology is recognized for being faster, more economical, and more secure compared to traditional systems, which is why it\u2019s being increasingly adopted by banks and governments.
Now, imagine a contract that automatically executes when certain conditions are met, with the entire process managed by the blockchain network. This is the concept behind smart contracts.
"},{"location":"showcase/#what-are-smart-contracts","title":"What Are Smart Contracts?","text":"A smart contract is a self-executing program that runs on a blockchain, containing a set of rules agreed upon by the involved parties. Once these predefined rules are satisfied, the contract automatically enforces the terms. Smart contracts facilitate, verify, and enforce the execution of an agreement or transaction without needing an intermediary, representing the simplest form of decentralized automation.
Put simply, a smart contract allows for the exchange of assets\u2014whether money, property, or anything else\u2014without the involvement of a middleman. This leads to trustless execution, where the contract enforces the terms without relying on any party\u2019s honesty or reliability.
Bitcoin was the first blockchain to introduce basic smart contracts, where transactions are only validated if specific conditions are met. Below is an example of a basic smart contract that includes functions to set and retrieve data, with simple operations to modify the data.
"},{"location":"showcase/#overview","title":"Overview","text":""},{"location":"showcase/#key-features-of-smart-contracts","title":"Key Features of Smart Contracts","text":"Trustworthiness: Smart contracts ensure that your agreements are securely stored on a blockchain, making it impossible for any party to lose or alter the contract. The terms are binding, and both parties must adhere to them.
Transparency: Every detail of the smart contract is visible to all participants before they agree, eliminating the possibility of disputes. The information is open to everyone involved, ensuring clarity and preventing misunderstandings.
Self-Governance: Smart contracts eliminate the need for intermediaries, such as brokers or lawyers, to validate the agreement. This also removes the risk of third-party manipulation, as the contract is automatically executed by the blockchain network.
Precision: Automated contracts not only speed up the process but also reduce costs and eliminate human error. The conditions are clearly defined in the smart contract, ensuring that no detail is overlooked.
Efficiency: Smart contracts automate tasks, saving considerable time that would otherwise be spent manually reviewing and processing agreements.
Cost-Effectiveness: By removing the need for intermediaries, smart contracts can significantly reduce costs. For instance, you don\u2019t need to hire a lawyer to enforce the contract; the code itself ensures compliance.
Security: The data in smart contracts is encrypted and protected by blockchain technology, making it highly secure and reliable for critical processes.
Upgradability: Modular smart contracts can address upgrade issues, allowing changes without losing valuable information.
Proxy Contracts: Using delegatecall-based proxies enables smart contracts to be upgraded while keeping the logic and data separate. However, this method requires careful handling to avoid introducing errors.
Legal Considerations: As smart contracts evolve, legal issues will gradually be resolved, but it will take time since they are still in the early stages of development.
Complexity Management: Simplifying smart contracts by avoiding Turing-complete designs can help reduce the complexity involved in writing them.
Oracle Problem: The oracle issue could be tackled by implementing a consensus protocol within the community, ensuring that the blockchain accurately reflects real-world conditions.
Digital Identity Management: Smart contracts allow individuals to maintain control over their digital identities, managing their data, reputation, and assets securely. Businesses can use this technology to streamline the know-your-customer (KYC) process.
Financial Data Integrity: Financial institutions can leverage smart contracts for accurate and transparent data recording, improving financial reporting and reducing auditing expenses. This also enhances market stability by ensuring uniform financial data across organizations.
Healthcare Management: Smart contracts can store personal health records securely on a blockchain, accessible only by authorized personnel. They can also be used to manage various healthcare operations, including drug tracking, compliance with regulations, and managing medical supplies.
Real Estate Transactions: Smart contracts simplify real estate transactions by cutting out intermediaries. For example, rental agreements can be directly managed on the blockchain, reducing costs and making the process more efficient.
Smart contracts offer immense potential and have already shown signs of transforming various industries. However, they are still in the early stages, and much remains to be explored. As organizations become more familiar with blockchain technology and its applications, smart contracts could become easier to implement and more widely trusted. In the future, we might see a blend of traditional and digital contracts, where blockchain technology verifies the terms while physical copies provide additional validation.
"},{"location":"showcase/data-analytics/","title":"Showcase","text":""},{"location":"showcase/data-analytics/#data-and-analytics","title":"Data and Analytics","text":""},{"location":"showcase/data-analytics/#overview","title":"Overview:","text":"The XDC Network\u2019s data and analytics tools are critical for understanding the dynamics of the blockchain. These tools provide detailed insights into how tokens are used, the behavior of smart contracts, and overall network activity. By leveraging these analytics, stakeholders can make informed decisions and optimize their interactions with the network.
"},{"location":"showcase/data-analytics/#key-features","title":"Key Features:","text":"XDCScan is the official block explorer for the XDC Network, providing a user-friendly interface to explore and interact with the blockchain. It allows users to search for transactions, view block details, and explore smart contracts deployed on the network. XDCScan is a vital tool for anyone interacting with the XDC Network, from developers to casual users.
"},{"location":"showcase/data-analytics/#key-features_1","title":"Key Features:","text":"The Apothem XDCScan is the XDC Network\u2019s official test environment. XDCScan Testnet (Apothem) is the block explorer for this testnet, offering all the features of XDCScan but in a testnet context. It is ideal for developers who want to simulate the mainnet environment as closely as possible before deploying their projects.
"},{"location":"showcase/data-analytics/#key-features_2","title":"Key Features:","text":"XDCScan Devnet is a specialized version of XDCScan tailored for the XDC Network\u2019s development environment. It provides a safe and controlled environment for developers to test and debug their smart contracts before deploying them to the mainnet.
"},{"location":"showcase/data-analytics/#key-features_3","title":"Key Features:","text":"When a smart contract imports a contract that it depends on from another source, that top level smart contract and it\u2019s dependencies will have to be flattened before it can be verified on a block explorer. This section explains how to flatten smart contracts using three different development toolchains; Remix, Truffle, and Hardhat.
For a good overview of flattening smart contracts on the XDC Network please refer to this article.
"},{"location":"showcase/flattening-smart-contracts/#flattening-smart-contracts-with-remix","title":"Flattening Smart Contracts with Remix","text":"Remix IDE is one of the most user-friendly tools for smart contract development. To flatten a smart contract in Remix:
Refer to know in detail: https://www.xdc.dev/ivan_blocksscan/learn-how-to-flatten-a-smart-contract-and-verify-on-blocksscan-56on
"},{"location":"showcase/flattening-smart-contracts/#flattening-smart-contracts-with-truffle","title":"Flattening Smart Contracts with Truffle","text":"Truffle is another powerful tool for smart contract development that supports the XDC Network. The process involves:
Refer to know in detail:
"},{"location":"showcase/flattening-smart-contracts/#flattening-smart-contracts-with-hardhat","title":"Flattening Smart Contracts with Hardhat","text":"Hardhat offers advanced tooling for smart contract developers and supports the XDC Network natively. The flattening process using Hardhat involves:
Refer to know in detail: https://www.xdc.dev/jay_kulkarni_842b41d81b23/deploying-and-verifying-a-pepe-token-on-the-xdc-network-using-hardhat-3nc7
"},{"location":"showcase/tokens/","title":"Showcase","text":""},{"location":"showcase/tokens/#tokens-built-on-xdc","title":"Tokens Built On XDC","text":"The XDC Network is a powerful blockchain platform designed to support various digital assets and decentralized applications. One of its key features is the ability to create and manage tokens, which can represent anything from currency to assets, data, or even unique digital items. On the XDC Network, tokens are classified into different standards based on their functionality and use cases. Here\u2019s an overview of the major token standards:
"},{"location":"showcase/tokens/#xrc20","title":"XRC20","text":""},{"location":"showcase/tokens/#overview","title":"Overview:","text":"XRC20 is the most widely used token standard on the XDC Network, similar to the ERC20 standard on Ethereum. XRC20 tokens are fungible, meaning each token is identical in type and value to another token within the same contract. These tokens are primarily used for cryptocurrencies, utility tokens, and other financial instruments.
"},{"location":"showcase/tokens/#key-features","title":"Key Features:","text":"The XRC721 standard allows for the creation of non-fungible tokens (NFTs) on the XDC Network. Unlike XRC20 tokens, XRC721 tokens are unique and cannot be exchanged on a one-to-one basis. Each XRC721 token has a distinct value and set of characteristics, making them ideal for representing ownership of unique items or digital collectibles.
"},{"location":"showcase/tokens/#key-features_1","title":"Key Features:","text":"XRC404 is a specialized token standard designed for hybrid tokens on the XDC Network. These tokens combine features of both fungible and non-fungible tokens, offering a new level of flexibility for developers and businesses.
"},{"location":"showcase/tokens/#key-features_2","title":"Key Features:","text":"XDC Stats is a comprehensive analytics platform designed for the XDC Network. It provides real-time data and insights into various aspects of the blockchain, including token transactions, smart contract activity, and network performance. XDC Stats is essential for developers, investors, and users who need to monitor the network\u2019s health and activity levels.
Mainnet Stats | XinFin Network Stats
"},{"location":"showcase/xdcstats/#key-features","title":"Key Features:","text":"XDC Web wallet: https://betawallet.xinfin.network/
"},{"location":"subnet/","title":"XDC Subnet","text":""},{"location":"subnet/#xdc-subnet","title":"XDC Subnet","text":"XDC Subnet is a technology that allows you to create a secure, scalable, and decentralized network within the XDC Ecosystem. It enables various use cases, including creating private subnets, deploying decentralized applications (dApps), and more. Are you ready to embark on a journey into the world of secure, scalable, and decentralized networks? Look no further than XDC Subnet, the cutting-edge technology that empowers you to create a digital realm tailored to your needs within the thriving XDC Ecosystem.
"},{"location":"subnet/#motivation-design-rationale","title":"Motivation & Design Rationale","text":"As a leading Layer-1 (L1) public blockchain, XinFin\u2019s XDC network has attrated many enterprise and institutional customers. Besides the high performance and high security that XDC already offers, these customers also demand privacy, meaning that their transactions and ledger should not be disclosed to the public. This requirement prohibits them from directly submitting transactions to XDC. Instead, they should only checkpoint snapshots of their ledger to XDC in order to extract XDC\u2019s security.
From a system perspective, \u201csecurity via checkpointing\u201d is achieved via Layer-2 (L2) techniques, such as rollups and subnets. The most popular rollup technique, namely optimistic rollup, is not suitable for our use case. This is because while transaction execution is offloaded to L2, all these L2 transactions are still submitted to L1 as a record. Another popular rollup called zero-knowledge (ZK) rollup solves this problem. But ZK computation is slow, and the type of use cases it can currently support is very limited (such as token transfers), which cannot fulfill the diverse business needs of XDC\u2019s enterprise and institutional customers.
On the other hand, subnet is a perfect solution. By subnet, the customer runs a blockchain and checkpoints its critical consensus data to the parent chain. This way, not only is privacy preserved, the subnet can have its own security and resiliency besides those provided by the parent chain. This is particularly useful to enterprise and institutional customers who may collaborate with untrusted partners. A common criticism against subnet solutions is the high entry bar and operational cost of running a blockchain. However, in XDC\u2019s case, this is indeed welcomed becomes enterprise and institutional customers prefer owning the infrastructure in a private and isolated domain.
Motivated by this opportunity, XDC\u2019s core protocol team has tailor-designed a subnet solution for XDC\u2019s enterprise and institutional customers. It has the following main features: 1. the subnet will be a sovereign, permissioned, and high-performing blockchain wholly owned by the customer. 2. the subnet will be driven by XDC2.0, the most advanced and secure consensus engine originally-built for XDC in-house, and will be deployed to the XDC mainnet, too. 3. a security level equivalent to the sum security of the subnet AND XDC mainnet. 4. native EVM smart contract support. 5. total privacy (i.e., no visibility) of the subset transactions on the XDC mainnet. 6. full access and compatibility to XDC\u2019s abundant SDK and tools, such as the explorer and forensic monitoring system.
"},{"location":"subnet/#architecture","title":"Architecture","text":"The architecture consists of the following key components owned by the customer:
In the rapidly evolving landscape of blockchain technology, staying ahead of the curve is essential. One of the most intriguing advancements in the world of blockchain is the concept of blockchain subnets. In this comprehensive guide, we will dive deep into what blockchain subnets are, how they work, and why they are becoming a game-changer in the blockchain industry.
What Are Blockchain Subnets? Blockchain subnets are like specialized branches of a blockchain network. They allow you to create smaller, independent networks within a larger blockchain ecosystem. Think of them as self-contained mini-blockchains, each with its own unique features and functionalities. These subnets operate alongside the main blockchain but offer more flexibility and scalability.
How Do Blockchain Subnets Work? Blockchain subnets work by segregating the main blockchain into smaller, more manageable parts. This segmentation brings several advantages such as Scalability, Customization, Privacy and Security.
Setting Up Your Own Blockchain Subnet XDC Subnet is a powerful technology that allows you to create a secure, scalable, and decentralized network within the XDC Ecosystem. It enables various use cases, including creating private subnets, deploying decentralized applications (DApps), and more. In this guide, we\u2019ll walk you through the steps to set up your own XDC Subnet, opening doors to a world of possibilities.
Step 1: Uninstall Old Versions
Before you dive into setting up XDC Subnet, ensure that you don\u2019t have any conflicting packages from previous installations. Run the following command to uninstall them:
for pkg in docker.io docker-doc docker-compose podman-docker containerd runc; do sudo apt-get remove $pkg; done\n
Enter fullscreen mode Exit fullscreen mode
Step 2: Set Up the Docker Repository
To install Docker Engine, you need to set up the Docker repository. Follow these steps:
Update the apt package index and install required packages:
$ sudo apt-get update $ sudo apt-get install ca-certificates curl gnupg
Enter fullscreen mode Exit fullscreen mode
Add Docker\u2019s official GPG key:
$ sudo install -m 0755 -d /etc/apt/keyrings $ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg - dearmor -o /etc/apt/keyrings/docker.gpg $ sudo chmod a+r /etc/apt/keyrings/docker.gpg
Enter fullscreen mode Exit fullscreen mode
Use the following command to set up the repository:
$ echo \\ \u201cdeb [arch=\u201d\\((dpkg - print-architecture)\" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \\ \"\\)(. /etc/os-release && echo \u201c$VERSION_CODENAME\u201d)\u201d stable\u201d | \\ sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
Enter fullscreen mode Exit fullscreen mode
Update the apt package index again:
$ sudo apt-get update
Enter fullscreen mode Exit fullscreen mode
Step 3: Install Docker Engine
Now, you can install Docker Engine, containerd, and Docker Compose by running the following command:
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
Enter fullscreen mode Exit fullscreen mode
Verify the installation by running:
$ sudo docker run hello-world
Enter fullscreen mode Exit fullscreen mode
Update the apt package index & Test the installation.
$ sudo apt-get update $ docker compose version
Enter fullscreen mode Exit fullscreen mode
Your Docker installation will be successfully completed using these steps!
"},{"location":"subnet/Installation_guide/#with-docker-set-up-lets-move-on-to-setting-up-xdc-subnet","title":"With Docker set up, let\u2019s move on to setting up XDC Subnet.","text":"Step 4: Clone the Subnet Repository
Clone the Subnet repository and change the directory:
git clone https://github.com/XinFinOrg/XinFin-Node.git\ncd XinFin-Node/subnet/deployment-generator/\n
Enter fullscreen mode Exit fullscreen mode
Step 5: Create a Docker Environment File
Create a docker.env file with parameters similar to docker.env.example, & make necessary configurations by entering below command.
cp docker.env.example docker.env\n
Enter fullscreen mode Exit fullscreen mode
Below is an example of the minimum file required for configs generation, Update the below parameters with your data in the docker.env file. Refer to check out in detail Config Explanation.
To check out exact config path, enter the following command:
pwd
Enter fullscreen mode Exit fullscreen mode
If you don\u2019t have any private key, You can create it using XDC Beta Web wallet or else you can use XDCPay.
For Devnet XDC, you can visit XDC Devnet Faucet.
docekr.env file:
#deployment config\nCONFIG_PATH= /XinFin-Node/subnet/deployment-generator\n#subnet config\nNETWORK_NAME=testsubnet\nNUM_SUBNET=1\nNUM_MACHINE=3\nMAIN_IP=192.168.1.1\n#parentchain config\nPARENTCHAIN=devnet\nPARENTCHAIN_WALLET=0x0000000000000000000000000000000000000000\nPARENTCHAIN_WALLET_PK=0x0000000000000000000000000000000000000000000000000000000000000000\n
Enter fullscreen mode Exit fullscreen mode
Step 6: Pull the Latest Subnet Generator Image
Pull the latest Subnet Generator image with this command:
sudo docker pull xinfinorg/subnet-generator:latest\n
Enter fullscreen mode Exit fullscreen mode
Step 7: Generate Configurations
Generate configurations, this will create a new generated directory.
docker run --env-file docker.env -v $(pwd)/generated:/app/generated xinfinorg/subnet-generator:latest && cd generated\n
Enter fullscreen mode Exit fullscreen mode
Follow the generated instructions in commands.txt to start Subnet Nodes and make sure they are mining.
Deploy subnet on machine1:
docker compose - env-file docker-compose.env - profile machine1 pull\ndocker compose - env-file docker-compose.env - profile machine1 up -d\n
Enter fullscreen mode Exit fullscreen mode
Step 8: Deploy the Checkpoint Smart Contract
Again, follow the generated instructions in commands.txt to deploy the Checkpoint Smart Contract to the \u201cdeployment-generator\u201d folder.
Run \u201ccd..\u201d command to get back to the \u201cdeployment-generator\u201d folder.
cd ~/.XinFin-Node/subnet/deployment-generator\ndocker run --env-file docker.env \\\n -v $(pwd)/generated/deployment.json:/app/generated/deployment.json \\\n --entrypoint 'bash' xinfinorg/subnet-generator:latest ./deploy_csc.sh\n
Enter fullscreen mode Exit fullscreen mode
Execute the following command to deploy the Checkpoint Smart Contract:
This will provide you with the Checkpoint Smart Contract address (checkpoint deployed to:)
Step 9: Deploy Subnet Services
Follow the instructions in commands.txt to deploy Subnet Services (relayer, stats-server, frontend) to the \u201cdeployment-generator/generated\u201d folder:
cd ~/.XinFin-Node/subnet/deployment-generator/generated\ndocker compose --env-file docker-compose.env --profile services pull\ndocker compose --env-file docker-compose.env --profile services up -d\n
Enter fullscreen mode Exit fullscreen mode
Step 10: Check the Status
docker ps -a\n
Enter fullscreen mode Exit fullscreen mode
Step 11: Explore the Subnet UI
Finally, explore the Subnet UI by accessing it at :5000.
Congratulations! You\u2019ve successfully set up your XDC Subnet, enabling you to harness the full potential of XDC Network\u2019s blockchain technology.
Checkout the guide for XDC Subnet user interface.
"},{"location":"subnet/Installation_guide/#some-common-issues-and-solutions","title":"Some Common Issues and Solutions:","text":"Issue 1: Finding the System\u2019s IP Address
Question: If I do not have the private IP, where can I find the IP address of my system?
Answer: To determine your system\u2019s IP address, use the following command:
ip a\n
Enter fullscreen mode Exit fullscreen mode
Issue 2: Locating the Checkpoint Smart Contract Address
Question: Where can I find the checkpoint smart contract address?
Answer: After executing the command below, you will obtain the \u201ccheckpoint smart contract address.\u201d Please consult the \u201ccommand.txt\u201d file for the necessary commands.
cd ~/.XinFin-Node/subnet/deployment-generator\ndocker run - env-file docker.env \\\n-v $(pwd)/generated/deployment.json:/app/generated/deployment.json \\\n - entrypoint 'bash' xinfinorg/subnet-generator:latest ./deploy_csc.sh\n
Enter fullscreen mode Exit fullscreen mode
Issue 3: Resolving \u201cNo Such File or Directory\u201d Errors
Question: What should I do if I encounter the \u201cno such file or directory\u201d error repeatedly?
Answer: To address this, execute the command below to generate new configuration files. This will create a new directory to replace the existing one. Once you have the new directory, follow the subsequent steps as outlined in the \u201ccommand.txt\u201d file.
docker run - env-file docker.env -v $(pwd)/generated:/app/generated xinfinorg/subnet-generator:latest && cd generated\n
Enter fullscreen mode Exit fullscreen mode
Issue 4: Determining the Exact Config Path for \u201cdocker.env\u201d
Question: How can I find the exact configuration path to update in the \u201cdocker.env\u201d file?
Answer: To obtain the precise configuration path, use the \u201cpwd\u201d command, which will provide you with the necessary information.
pwd\n
Enter fullscreen mode Exit fullscreen mode
Issue 5: Troubleshooting \u2018CSC Deployment Failed\u2019 Issue: Checkpoint Smart Contract Deployment
Question: Encountering a \u201cCSC deployment failed\u201d issue during the deployment of the Checkpoint Smart Contract?
Answer: Please verify that the provided Private Key contains sufficient funds for both the Smart Contract deployment and subsequent transactions.
If you don\u2019t have any private key, You can create it using XDC Beta Web wallet or else you can use XDCPay.
For Devnet XDC, you can visit XDC Devnet Faucet.
Blockchain subnets represent a new frontier in blockchain technology. They offer the scalability, customization, and security needed to drive innovation across various industries. As blockchain subnets continue to gain momentum, staying informed about their capabilities and potential applications is crucial for anyone involved in blockchain development or adoption.
If you have any questions or need assistance, don\u2019t hesitate to reach out to the XDC Network community on XDC.Dev. Start your XDC Subnet journey today!
"},{"location":"subnet/components/","title":"Upgrading the Subnet","text":"404 Upgrading the Subnet
"},{"location":"subnet/setting_up_your_subnet/","title":"Setting Up Your Own XDC-Subnet Tutorial","text":"Setting Up Your Own XDC-Subnet Tutorial
"},{"location":"subnet/upgrading_subnet/","title":"Upgrading the Subnet","text":""},{"location":"subnet/upgrading_subnet/#upgrading-the-subnet","title":"Upgrading the Subnet","text":""},{"location":"subnet/upgrading_subnet/#updating-configs","title":"Updating Configs","text":""},{"location":"subnet/upgrading_subnet/#upgrading-subnet-deployment","title":"Upgrading Subnet Deployment","text":""},{"location":"subnet/upgrading_subnet/#create-a-subnet-backup","title":"Create a Subnet backup","text":"Shutdown the subnet
Make a copy of xdcchain
directory
docker-compose.yml
under generated
directory. docker compose --env-file docker-compose.env --profile machine1 up -d\n docker compose --env-file docker-compose.env --profile services up -d\n
Using latest
tag is not recommended since not all components version are not guaranteed to be compatible.
docker compose --env-file docker-compose.env --profile services down\n
Update configuration (usually ENVs inside common.env file)
Start subnet services
docker compose --env-file docker-compose.env --profile services up -d\n
The guide for XDC Subnet user interface
"},{"location":"subnet/using_subnet/#homepage","title":"Homepage","text":"Once subnet is successfully deployed. The homepage will show the following.
In the lower half of the homepage there are more information as shown.
This card shows further details of subnet blocks, including their height, hash, proposer, and confirmation status. The left side of \u2018confirmation status\u2019 shows the block being committed in the Subnet chain and the right side shows the block hash being recorded in the Parent chain.
This card shows a detailed view of the subnet nodes including their address. The status also differrentiates inactive nodes to \u2018penalty\u2019 or \u2018standby\u2019
Additionally, you can select the UI theme (light or dark) by toggling this button.
After navigating with the left menu bar to the Confirmation Checker of the Subnet, this will be shown.
The input box accepts Block height, Block hash, and even TX hash.
After your input, the search engine will traverse the chain and display the info accodingly. Below is an example of Block height search.
Next is another example of a Block hash search.
Subnet management is used for adding and removing Masternodes in the Subnet. To manage the subnet, you need to use the Grandmaster Account, as only the Grandmaster has the right to manage the Subnet.
You can find the Grandmaster Key in the keys.json
file.
After making a modification with Subnet management, the change will take effect in the next epoch (900 blocks).
When adding a Masternode address in the management, the new Masternode server should also be started up and added to the network.
"},{"location":"subnet/using_subnet/#1-log-in-to-the-wallet-and-connect-to-the-subnet","title":"1. Log in to the Wallet and Connect to the Subnet","text":"To manage the subnet, you need to use your Grandmaster Account. Find the Grandmaster Key in the keys.json
file and import this account into your wallet.
Click the Connect Wallet
button.
Choose your wallet and allow the subnet network to be added. The wallet will automatically switch to this network, as shown below:
If the wallet doesn\u2019t switch to the subnet automatically, follow the instructions on the page to fill in the network details manually and connect to the subnet.
You will see a confirmation page like this:
"},{"location":"subnet/using_subnet/#2-node-operations","title":"2. Node Operations","text":""},{"location":"subnet/using_subnet/#21-add-nodes-in-a-subnet","title":"2.1 Add Nodes in a Subnet","text":"Subnet nodes are managed by two files. To add a node, create the corresponding subnetX.env
file and add an entry in docker-compose.yml
. Apply the changes to add the node to the subnet. (To remove a node, delete the related configuration file)
To add a node, follow these steps:
Go to the generated
directory and run the add-node.sh
script. Enter the key when prompted:
cd .scripts/add-node.sh\n
Update the subnet settings with the following commands:
docker-compose --env-file docker-compose.env --profile machine1 up -d\ndocker-compose --env-file docker-compose.env --profile services up -d\n
Add a new master candidate
button to add the node as a master node. Delegation amount must be at least 10,000,000
Subnet tokens. In the list, select the node you want to change the delegation for, then click the Promote
/ Demote
button and enter the new delegation amount.
If increasing the delegation, ensure the total delegation amount is over 10,000,000
Subnet tokens; otherwise, the transaction will fail.There is no extra benefit in delegating more than 10,000,000 tokens to an address
If decreasing the delegation, ensure the remaining amount is still at least 10,000,000
Subnet tokens; otherwise, the transaction will fail.
Remove
button.In Subnets, all native tokens are initially assigned to the Grandmaster Wallet. To allow users to use the Subnet, we have to distribute the tokens out of the Grandmaster. We have provided convenient scripts for you to easily share Subnet tokens to your users.
"},{"location":"subnet/using_subnet/#one-time-transfer","title":"One-time Transfer","text":"Under generated
directory run the Faucet script.
./scripts/faucet.sh\n
The script will ask for your source wallet private key. You can use the Grandmaster Wallet(check keys.json
file for the private key). Then input the destination wallet and the transfer amount.
Under generated
directory run the Faucet server script.
./scripts/faucet-server.sh\n
The script will ask for your source wallet private key. you can use the Grandmaster Wallet(check keys.json
for the private key). By default, the server is hosted on port 5211
of your machine. Then, on your browser, visit the url: http://127.0.0.1:5211
Input your destination wallet or feel free to generate a random wallet via Address Generator.
Submit and wait for confirmation.
You can host this on any server and allow users to make token requests by themselves.
"},{"location":"subnet/using_subnet/#transfer-subnet-funds-without-faucet","title":"Transfer Subnet Funds Without Faucet","text":"The Faucet is not neccessary needed for funds transfer, most Ethereum compatible web3 wallet will also work.
First import a new wallet with the Grandmaster private key. Then add a custom network pointing to your Subnet RPC URL. Finally, use the web3 wallet for tokens transfer.
"},{"location":"subnet/using_subnet/#faucet-source-code","title":"Faucet Source Code","text":"Please feel free to check the below repositories for the Subnet Faucet source code.
https://github.com/XinFinOrg/XinFin-Node/tree/master/subnet/deployment-generator/scripts
https://github.com/XinFinOrg/XinFin-Node/tree/master/subnet/deployment-generator/src/faucet.js
"},{"location":"subnet/using_subnet/#blockchain-explorer","title":"Blockchain Explorer","text":"You may optionally use an external blocks explorer if you require verbose browsing such as block detail, accounts browsing, contracts browsing. We can recommend Chainlens-free as one of the solution. Please follow the instructions as the previous link. You only need to pass one of the Subnet\u2019s RPC as a variable in the docker-compose
command, which will most likely be NODE_ENDPOINT=http://localhost:8545
or NODE_ENDPOINT=http://<MAIN_IP>:8545
.
This section specifies the API library we develop for the subnet users to confirm subnet transactions.
"},{"location":"subnet/components/api_library/#specifications","title":"Specifications","text":"TBW
"},{"location":"subnet/components/checkpoint_contract/","title":"Upgrading the Subnet","text":""},{"location":"subnet/components/checkpoint_contract/#checkpoint-smart-contract","title":"Checkpoint Smart Contract","text":"This section specifies the Checkpoint Smart Contract in the parent chain that protects the child chain.
"},{"location":"subnet/components/checkpoint_contract/#design","title":"Design","text":""},{"location":"subnet/components/checkpoint_contract/#overview","title":"Overview","text":"The primary function of the parent chain smart contract is to receive block data from the subnet node, verify it, and store it.
Noteworthy aspects:
Every block data received will be verified to ensure the signature is signed by validators and has passed with \u2154 of the votes.
In the gap block occurring in the middle of each epoch, a next
may appear, which will be selected for temporary storage.
In each epoch block, a current
may appear, which will choose the next
selected during the gap as validators from the current block to the next epoch.
Only three consecutive blocks of roundNumber
can confirm the previous block, and mainnetNum
will change from -1 to block.number
once the block is committed.
The Checkpoint contract implements a blockchain checkpoint system, which verifies and stores block header information for subnetworks. Here are some key functions and features:
The contract defines several data structures, such as Header
, HeaderInfo
, Validators
and BlockLite
. These structures are used to store block header information, validator information, and more.
The contract employs several mappings and other variables to track the current block header tree, committed blocks, validator set, latest block, and so forth.
The contract\u2019s constructor receives the initial validator set, the genesis block header, the first block header, etc., as parameters and initializes the contract state based on these.
The receiveHeader
function allows users to submit new block headers. This function will verify the meta information of the block header (like block number, parent block hash, etc.), the signature certificate, and update the block\u2019s submission status when specific conditions are met.
Functions such as setLookup
, setCommittedStatus
, checkUniqueness
, and checkCommittedStatus
are used to update or check the contract\u2019s internal status.
Functions like getHeader
, getHeaderByNumber
, getLatestBlocks
and getCurrentValidators
enable users to query block header information, validator sets, etc.
The splitSignature
and recoverSigner
functions are used to recover the signer\u2019s address from the signature, which is necessary for verifying the block header signature.
Logic Flow:
Checkpoint uses the following parameters for contract construction:
address[] initial_validator_set
: List of initial validator addresses
bytes genesis_header
: block0HexRLPbytes block1_header
: block1HexRLPuint64 gap
: GAP block number on public chainuint64 epoch
: EPOCH block number on public chain
Relayers need to fetch every block data from the subnet node.
Users can retrieve the information of each block using methods such as getHeader
.
Lite Checkpoint is a lightweight block header checkpoint. It implements several functions, including:
Logic Flow:
Lite Checkpoint uses the following parameters for contract construction:
address[] initialValidatorSet
: List of initial validator addresses
bytes block1
: block1HexRLPuint64 gap
: GAP block number on public chainuint64 epoch
: EPOCH block number on public chain
Relayers only need to fetch gap/epoch block data and fetch the following consecutive roundNumber
blocks to confirm the signed gap/epoch block from the subnet node.
Users can get gap/epoch block information from methods such as getHeader
.
The Upgradeable module mainly revolves around the concept of transparent proxies and the ability to upgrade the underlying logic contracts without changing the contract\u2019s address.
"},{"location":"subnet/components/checkpoint_contract/#proxygateway-smart-contract","title":"ProxyGateway Smart Contract","text":"The ProxyGateway
smart contract plays a central role in this module. It inherits from ProxyAdmin
and primarily serves the purpose of creating and managing transparent upgradeable proxies (TransparentUpgradeableProxy
).
Key Components and Functionalities:
A mapping used to store two types of transparent upgradeable proxies.
0
represents \u201cfull\u201d1
represents \u201clite\u201dCreateProxy Event:
Emitted whenever a new transparent upgradeable proxy is created.
createProxy Function:
TransparentUpgradeableProxy
.Emits the CreateProxy
event upon creation.
createFullProxy Function:
Ensures the provided logic contract has a MODE
function that returns \u201cfull\u201d.
createLiteProxy Function:
MODE
function that returns \u201clite\u201d.Logic Flow:
The process begins with the ProxyGateway
contract, which serves as a central hub for creating transparent upgradeable proxies. The contract owner has the capability to create either \u201cfull\u201d or \u201clite\u201d proxies.
Proxy Creation:
The owner calls either the createFullProxy
or createLiteProxy
function based on the desired type of proxy.
MODE
is checked to ensure it matches the desired proxy type.TransparentUpgradeableProxy
is created with the specified logic contract, the ProxyGateway
as the admin, and any necessary initialization data.cscProxies
mapping under its corresponding type.The CreateProxy
event is emitted to log the creation of the new proxy.
Upgrading the Proxy:
When there\u2019s a need to upgrade the underlying logic of the proxy (for instance, to introduce new features or fix bugs):
ProxyGateway
contract calls the inherited upgrade
function from ProxyAdmin
to point the proxy to the new logic contract.This enables the system to evolve and implement new functionalities without migrating to a new contract address or affecting the contract\u2019s stored data.
Interacting with the Proxy:
Users and other contracts can interact with the proxy just as they would with a regular contract. However, behind the scenes, all function calls and data accesses are delegated to the current logic contract that the proxy points to.
Users and contracts can still query data, access functions, or invoke transactions on the proxy\u2019s address. The proxy transparently delegates these to the underlying logic contract, ensuring continuity of operations.
Through the ProxyAdmin
functionality, the owner can further manage the proxy, such as changing the admin or even downgrading to a previous version of the logic contract if needed.
Functions that have access restriction to authorized client
reviseValidatorSet(address[], int, int)
: Update subnet block header signer list at destined heightreceiveHeader(bytes[])
: Validate and store subnet headersFunctions that open for public access
getHeader(byte32)
: Return entire block header in RLP encoding formatgetHeaderByNumber(int)
: Return block hash and number at input heightgetHeaderConfirmationStatus(byte32)
: Return block committing statusgetMainnetBlockNumber(byte32)
: Return mainnet block number that processed the subnet block headergetLatestBlocks()
: Return latest committed block and submitted blockBlock header verification follows two principle rules: 1. Received block should have consistent round number and block number associated with its parent block. 2. Received block should have enough certificates signed by the list of block signers.
Once a block header is checked and stored, the contract will examine whether there are 3 consecutive blocks that have 3 consetive round number. If that is the case, all of the direct ancestor blocks that are prior to these 3 consecutive blocks will be committed.
"},{"location":"subnet/components/relayer/","title":"Upgrading the Subnet","text":""},{"location":"subnet/components/relayer/#relayer","title":"Relayer","text":"This section specifies the relayer that checkpoints the subnet chain to the parent chain.
"},{"location":"subnet/components/relayer/#design","title":"Design","text":""},{"location":"subnet/components/relayer/#background","title":"Background","text":"There is a strong demand from the banking industry to adopt XDC. One of the key requirements to enter the field is the ability to support subnets so that banks are able to keep the sensitive transactions within their own domain (privacy concern) but at the same time, have the ability to continuously audit the result (hash) of the subnet transactions on the XDC mainnet (security concern).
Since the mainnet and subnets will be running as two independent node cluster, we will need to figure out a method to bridge them together to perform the auditing feature mentioned above. This is where \u201crelayer\u201d is coming into play.
"},{"location":"subnet/components/relayer/#high-level-architectural-diagram","title":"High-level architectural diagram","text":"At high level, the relayer is able to: 1. Pull necessary data from both subnet and mainnet 2. Process and submit subnet block data as smart contract transactions into mainnet 3. When subnet masternodes list changes, report the new list and change height to the mainnet using grand-master account.
"},{"location":"subnet/components/relayer/#relayer-mode","title":"Relayer Mode","text":"There are 2 relayer modes \u2018Full\u2019 and \u2018Lite\u2019 where the default mode is \u2018Full\u2019. In the full mode, all subnet block headers are checkpointed to the parent chain. In the lite mode, only the Epoch and Epoch gap subnet block headers are checkpointed in the parent chain (blocks 451,900,1351,1800, and so on). The Epoch and Epoch gap blocks stores important information regarding subnet validators selection. For further reading please check Checkpoint Smart Contract.
"},{"location":"subnet/components/relayer/#choosing-full-or-lite-relayer","title":"Choosing Full or Lite Relayer","text":"The Full mode has the advantage of being more \u2018complete\u2019 and more \u2018current\u2019 as blocks are getting confirmed in the parent chain almost immediately. The Lite mode has the advantage of using lower parent chain gas fee as the Relayer is only submitting to once every 450 blocks.
"},{"location":"subnet/components/relayer/#deployment","title":"Deployment","text":"In the deployment RELAYER_MODE
config is only relevant for Checkpoint Smart Contract (CSC) deployment. The relayer itself is able to detect the CSC type automatically and push block headers accordingly.
This section specifies the subnet itself, a sovereign, permissioned, and high-performing blockchain.
"},{"location":"subnet/components/subnet_chain/#design","title":"Design","text":"XDC subnet is a blockchain network tailored for private and consortium use cases. It is powered by XDC2.0, which is the core engine of XDC network and enables state-of-the-art security against Byzantine attacks with forensics, fast transaction confirmation, and low energy consumption. It is also designed to enable secure checkpointing to XDC mainnet, so that it can harness the security, finality, and accountability of mainnet.
"},{"location":"subnet/components/subnet_chain/#xdc20-protocol","title":"XDC2.0 Protocol","text":"As the core engine of both XDC mainnet and subnet, XDC2.0 maintains the consistency of the blockchain with strong security and performance guarantees. The Delegated Proof-of-Stake subprotocol elects a committee of masternodes. The masternodes run the state-of-the-art HotStuff consensus subprotocol to settle block generation and verification and confirm transactions. Besides, XDC2.0 protocol enables its unique feature, namely forensic monitoring. When the adversary corrupts more than \u2153 masternodes and violates safety, forensic monitoring can detect those actions and report irrefutable evidence of the culprits.
The distinction between XDC2.0 for subnet and mainnet is that for subnet the masternodes are permissioned whereas for mainnet they are permissionless.
"},{"location":"subnet/components/subnet_chain/#your-own-blockchain-network","title":"Your Own Blockchain Network","text":"XDC subnet is completely owned by you. You, the owner of the subnet, are capable of controlling several aspects of the subnet.
First, the owner regulates the master node list. More specifically, the join/retire of mater nodes is done by smart contract calls that only the owner has access to. Also, underperforming or misbehaving masternodes could be expelled by the owner. This is in contrast with XDC mainnet, where masternodes join or leave willingly as long as they follow the rule enforced by the protocol.
Second, the blockchain genesis can be configured by the owner. The owner is able to distribute initial tokens and create accounts, as well as deploy system-level smart contracts on the blockchain.
Last, the owner can customize blockchain parameters, such as epoch length, max masternode number, the quorum certificate threshold, the reward per epoch, etc.
"},{"location":"subnet/components/subnet_chain/#integrating-with-xdc-mainnet","title":"Integrating with XDC mainnet","text":"Integrating with XDC mainnet will enable subnet to harness the security, finality, and accountability of XDC mainnet. This requires the subnet owner to deploy a smart contract (XDC will provide) to XDC mainnet and report block headers and masternode changes to the smart contract.
As long as the mainnet is secure, the block header information of the subnet is securely stored on the mainnet. Users can also query the mainnet for finality to enhance the confidence that the subnet transaction is indeed finalized. The subnet can also report the culprits to the forensic server of XDC mainnet when its forensic monitor module detects safety violations. When the culprit report is validated, necessary measurements should be taken by the owner to reestablish the security of the subnet.
It is worth noting that the subnet can be deployed as a standalone, independent blockchain network without integrating with XDC mainnet. The choice is up to the owner whether to harness the advantages of XDC mainnet.
"},{"location":"subnet/components/subnet_chain/#api","title":"API","text":"Subnet-specific APIs
"},{"location":"subnet/components/subswap/","title":"Upgrading the Subnet","text":""},{"location":"subnet/components/subswap/#subswap","title":"Subswap","text":""},{"location":"subnet/components/subswap/#design","title":"Design","text":"Topic: Design of Subswap Cross-Chain Transfer System on XDC Zero
Subswap is cross-chain application built on XDC Zero to provide seamless cross-chain transfer capabilities. It is structured in a multi-layered architecture, with each layer handling distinct functions to ensure smooth, secure, and efficient transactions across blockchain networks. This document provides a design overview of each layer, illustrating the components and their roles within the Subswap system.
"},{"location":"subnet/components/subswap/#system-architecture","title":"System Architecture","text":"Subswap is organized into three layers:
Front-End Management: Handles the user interface and manages interactions with the underlying protocols, offering a streamlined experience for users initiating cross-chain transfers.
Layer 1 - Treasury
Lock/Unlock Contract: Locks assets on the source chain and unlocks them on the target chain, ensuring that the asset\u2019s total supply remains consistent and secure across chains.
Layer 2 - Swap Protocol
Subswap leverages XDC Zero\u2019s powerful infrastructure to deliver an efficient cross-chain transfer service. By layering its architecture, Subswap can maintain security, scalability, and ease of use, meeting the needs of users looking for seamless asset transfers across multiple blockchain networks.
"},{"location":"subnet/components/subswap/#constructionif-you-want-to-make-a-cross-chain-transfer","title":"Construction(if you want to make a cross chain transfer)","text":""},{"location":"subnet/components/subswap/#spec","title":"Spec","text":""},{"location":"subnet/components/subswap/#subswap-api-documentation","title":"Subswap API Documentation","text":"This document provides an API reference for the Subswap contracts, specifically for the ParentnetTreasury
and SubnetTreasury
contracts. These contracts facilitate cross-chain asset transfers by minting, burning, locking, and unlocking tokens between chains.
changeEndpoint(address endpoint) -> void
endpoint
: The address of the new endpoint.Access: onlyOwner
setEndpoint(address endpoint) -> void
endpoint
: The address of the new endpoint.Access: onlyEndpoint
mint(...) -> void
SubnetTreasury
chain in response to a cross-chain transfer.originalToken
: Address of the original token.name
: Name of the token.symbol
: Symbol of the token.account
: Address of the account receiving the minted tokens.amount
: Number of tokens to mint.sid
: Source chain ID.onlyEndpoint
changeEndpoint(address endpoint) -> void
endpoint
: The address of the new endpoint.Access: onlyOwner
setEndpoint(address endpoint) -> void
endpoint
: The address of the new endpoint.Access: onlyEndpoint
unlock(address token, uint256 amount, address recv) -> void
token
: Address of the token to unlock.amount
: Amount of tokens to unlock.recv
: Address of the recipient.onlyEndpoint
burn(...) -> void
ParentnetTreasury
side to initiate a cross-chain transfer, sending a message to SubnetTreasury
to mint tokens.rid
: Destination chain ID.rua
: Receiver\u2019s address on the destination chain.originalToken
: Address of the original token on the source chain.token
: Address of the Treasury token to burn.amount
: Number of tokens to burn.recv
: Address to receive tokens on the destination chain.Events:
Burn
event with details of the burned amount and target chain.test(uint256 rid, address rua, bytes memory data) -> void
Parameters:
rid
: Destination chain ID.rua
: Receiver\u2019s address on the destination chain.data
: Encoded data to send.getEndpoint() -> address
lock(...) -> void
SubnetTreasury
side to initiate a cross-chain transfer, sending a message to ParentnetTreasury
to mint tokens.rid
: Destination chain ID.rua
: Receiver\u2019s address on the destination chain.token
: Address of the token to lock.amount
: Amount of tokens to lock.recv
: Address to receive tokens on the destination chain.Events:
Lock
event with details of the locked amount and target chain.getChainId() -> uint256
Description: Returns the chain ID of the current chain.
getEndpoint() -> address
SubnetTreasury
locks tokens on its chain, it sends a message to ParentnetTreasury
to mint an equivalent amount on the destination chain.If a Treasury token contract does not exist for the original token, a new one is created and mapped to the original token in treasuryMapping
.
Burning (ParentnetTreasury)
burn
function is called to destroy tokens on ParentnetTreasury
. SubnetTreasury
to unlock an equivalent amount on the destination chain.SubnetTreasury
by transferring them from the caller\u2019s address to the contract. The contract then sends a cross-chain message to ParentnetTreasury
to mint equivalent tokens on the destination chain.
Unlocking (SubnetTreasury)
ParentnetTreasury
, the SubnetTreasury
unlocks tokens on its chain and sends them to the specified recipient.IEndpoint
interface, which abstracts the low-level cross-chain communication.abi.encodeWithSelector
to create a message payload, ensuring proper handling of contract-specific calls on the destination chain.XDC-Zero is a cross-chain framework that allows interoperability between XDC-Subnet and the XDC network. It ensures frictionless data transmission and rigorous validation across the Subnet and the Parentchain.
"},{"location":"subnet/components/xdc_zero/#key-components","title":"Key Components","text":""},{"location":"subnet/components/xdc_zero/#oracle","title":"Oracle","text":"Acting as the architectural keystone, the Oracle ensures the safe transfer of pivotal data, notably block headers, bridging source and target blockchains. Utilizing CSC contracts, the system guarantees not just steadfast data transfer but also the safeguarding of crucial block header details on the destination blockchain. Such functionalities affirm the data\u2019s integrity and coherence throughout chains.
"},{"location":"subnet/components/xdc_zero/#relayer","title":"Relayer","text":"The Relayer functions as the essential conduit for transactional precision. Its core duty is to extract payload data from the source chain\u2019s Endpoint contract and channel it to the counterpart on the target chain. With this mechanism in place, XDC ZERO promises the exact and secure relay of transaction data, fostering efficient cross-chain synergies.
"},{"location":"subnet/components/xdc_zero/#endpoint","title":"Endpoint","text":"The XDC Zero Endpoint stands as the nexus for cross-chain communication, adeptly receiving and dispatching data packets across disparate blockchain networks. It offers indispensable services for the fluid operation of the cross-chain paradigm:
At its core, the Endpoint functions as the orchestrator for all cross-chain data activities, ensuring data is meticulously received, processed, and channeled to its rightful destination.
"},{"location":"subnet/components/xdc_zero/#frontend","title":"Frontend","text":"Experience a user-centric interface to manage the endpoint contracts spanning different chains. View the chain entities already synchronized with the current endpoint contract and effortlessly onboard new chain entities as per requirements.
"},{"location":"subnet/components/xdc_zero/#endpoint-workflow","title":"Endpoint workflow","text":""},{"location":"subnet/components/xdc_zero/#workflow","title":"Workflow","text":""},{"location":"subnet/components/xdc_zero/#api-documentation","title":"API Documentation","text":""},{"location":"subnet/components/xdc_zero/#restricted-access-functions","title":"Restricted Access Functions","text":"Functions accessible only by the contract owner or authorized clients.
send(uint256 rid, address rua, bytes data)
Description: Sends a packet to the designated receive chain.
Parameters:
rid
: ID of the receive chain.rua
: Address of the receive application.data
: Data payload for the packet.validateTransactionProof(uint256 csid, bytes key, bytes[] calldata receiptProof, bytes[] calldata transactionProof, bytes32 blockHash)
Description: Validates transaction and receipt proofs, ensuring secure cross-chain communication.
Parameters:
csid
: ID of the send chain.key
: RLP key.receiptProof
: Proof data for the transaction receipt.transactionProof
: Proof data for the transaction.blockHash
: Hash of the relevant block.registerChain(uint256 chainId, IFullCheckpoint csc, Endpoint endpoint)
Description: Registers a new chain for packet reception.
Parameters:
chainId
: ID of the chain being registered.csc
: Checkpoint contract for the receive chain.endpoint
: Endpoint contract for the send chain.approveApplication(uint256 rid, address rua, address sua)
Description: Approves both a receive and send application for cross-chain interaction.
Parameters:
rid
: ID of the receive chain.rua
: Address of the receive application.sua
: Address of the send application.approveRua(uint256 rid, address rua)
Description: Approves a receive application (rua) for a specific chain.
Parameters:
rid
: ID of the receive chain.rua
: Address of the receive application.approveSua(address sua)
Description: Approves a send application (sua) for packet sending.
Parameters:
sua
: Address of the send application.revokeApplication(uint256 rid, address rua, address sua)
Description: Revokes approval for both a receive and send application.
Parameters:
rid
: ID of the receive chain.rua
: Address of the receive application.sua
: Address of the send application.revokeRua(uint256 rid, address rua)
Description: Revokes approval for a specific receive application.
Parameters:
rid
: ID of the receive chain.rua
: Address of the receive application.revokeSua(address sua)
sua
: Address of the send application.Functions accessible by any user or contract on the blockchain.
packetHash() returns (bytes32)
Description: Retrieves the hash for the Packet event.
getRlp(bytes memory key, bytes[] calldata proof, bytes32 root) returns (bytes memory)
Description: Retrieves RLP data based on a Merkle Patricia proof.
getFailureDataLength(uint256 rid) returns (uint256)
Description: Retrieves the count of failed data entries for a specified receive chain.
getReceiveChainLastIndex(uint256 chainId) returns (uint256)
Description: Retrieves the last index for a specified receive chain.
getSendChain(uint256 chainId) returns (Chain memory)
Description: Retrieves details of a send chain based on its ID.
getSendChainIds() returns (uint256[] memory)
Description: Returns an array of all registered send chain IDs.
allowanceRua(uint256 rid, address rua) returns (bool)
Description: Checks if a receive application is approved for a specific chain.
Parameters:
rid
: ID of the receive chain.rua
: Address of the receive application.allowanceSua(address sua) returns (bool)
sua
: Address of the send application.After the generator has succesfully run, all generated files will be under \u2018generated\u2019 directory. These files can be edited if you would like to further customize your subnet. Below is a description of each generated file and how it is used.
subnetX.env
for each individual subnet.BOOTNODE_PORT
under common.env
. Also in each subnetX.env
, BOOTNODES
port has to be changed.Subnet blocks are not being mined.
First confirm that the Subnet nodes are able to communicate with each other through the network layer. Run the check peer script generated/scripts/check-peers.sh
the number of peers should be one less than number of subnet nodes. For example, if there are 3 Subnet nodes in total, each node should have 2 peers.
If the nodes are peering but still not mining, it could be a low memory issue. In Docker configs you can try to increase memory or swap. Then, in case of fresh Subnet, delete data and start the nodes again. !
Docker engine in Mac OS can be inconsistent after long-running or high-load. It could help to restart the machine and hard reset the subnet to get it running.
Subnet node does not boot with error log Fatal: Error starting protocol stack: listen unix /work/xdcchain/XDC.ipc: bind: invalid argument
This is due to the volume mount path being too long. The mounth path is your current directory (also can check with pwd
command). Please move the generated
folder to a shorter path and try again.
Docker image startup fails with SIGKILL
or Error code: 137
found in logs. (Issue found in Frontend image)
This error occurs because Docker ran Out Of Memory (OOM). You can increase the memory limit in Docker settings
generated/scripts/check-mining.sh
This will check your current block in Subnet
generated/scripts/check-peers.sh
This will check the number of peers of your Subnet node
"},{"location":"subnet/install_guide/f%26q/#subnet-node-requirements","title":"Subnet Node Requirements","text":"Even one node is enough to start the Subnet blockchain! However, for better decentralized security, 3+ nodes are recommended. At least \u2154 of all nodes must be online and honest to mine blocks.
"},{"location":"subnet/install_guide/f%26q/#development-and-testing","title":"Development and Testing","text":"It\u2019s recommended to use the testnet, as the devnet will be less stable due to frequent development changes.
"},{"location":"subnet/install_guide/f%26q/#managing-subnet-tokens","title":"Managing Subnet Tokens","text":"In XDC-Subnet, all initial tokens are assigned to the Grandmaster wallet (check keys.json
). You can transfer tokens to any wallet address. For easy transfers, refer to the Faucet documentation.
How can I manage Subnet tokens?
Use the Subnet Faucet to easily transfer Subnet tokens to your users.
Use any Web3 wallet (such as Metamask or OKX wallet), add the Subnet RPC as a custom network then connect to the Subnet and transfer tokens to other addresses.
How can I easily give out Subnet tokens to my users?
A Faucet server script is provided for you to deploy under generated/scripts/faucet-server.sh
. Anyone with access to the faucet page can request tokens. Please refer to the faucet page for more details.
The following files contain sensitive information and should be stored securely:
common.env
contract_deploy.env
keys.json
subnet*.env
You can update the common.env
file to change the Relayer key. Refer to the service configuration documentation for more details.
For troubleshooting support, join our Telegram Support Group. For suggestions or requests, you can also reach out via:
OS: Linux. Only Linux is supported for full deployment.
OS: Mac is only supported for single machine testing environment.
docker, docker compose V2. For manual installation of docker compose V2 please refer to: https://docs.docker.com/compose/install/linux/
Recommended Hardware (per single Subnet node):
Web3 wallet with funds. For testing we have faucets provided:
Pull generator.sh
script from the generator Github repo
curl -O https://raw.githubusercontent.com/XinFinOrg/XinFin-Node/master/subnet/deployment-generator/scripts/generate.sh\n
Run the configuration generator, this will start a local webserver
chmod +x generate.sh\n./generate.sh\ncd generated\n
Go to http://localhost:5210/ in your browser. If you are running this on a remote server.
first use ssh tunnel: ssh -N -L localhost:5210:localhost:5210 USERNAME@IP_ADDRESS -i SERVER_KEY_FILE
Config the Subnet options per your requirement.
follow the generated instructions in commands.txt
. In general, the steps are:
Once successfully deployed, you can check out UI usage guide
Under generated
directory
docker compose --env-file docker-compose.env --profile services down \ndocker compose --env-file docker-compose.env --profile machine1 down\n
"},{"location":"subnet/install_guide/launch_subnet/#deleting-subnet","title":"Deleting Subnet","text":"Remove xdcchain*
, bootnodes
, and stats-service
directories Warning: this cannot be undone
rm -rf xdcchain* bootnodes stats-service\n
"},{"location":"xdcchain/","title":"XDC Chain","text":"XDC Chain The XDC Network is a cutting-edge blockchain platform designed to revolutionize the way businesses manage and exchange data, assets, and financial records. Boasting impressive speed and scalability, the XDC Network is capable of handling a high volume of transactions with minimal delays, making it ideal for enterprise-level applications. Its low transaction fees further enhance its appeal, allowing businesses to conduct operations cost-effectively.
What truly sets the XDC Network apart is its military-grade security, ensuring that all data exchanges and asset transfers are protected against potential threats. This level of security is crucial for industries where trust and confidentiality are paramount. By leveraging the XDC Network, businesses can streamline their operations, improve record-keeping accuracy, and facilitate more efficient and secure data exchanges. Whether it's in finance, supply chain management, or trade, the XDC Network provides a robust and reliable infrastructure that empowers businesses to thrive in the digital age.
DevelopersUser guide to get started on XDC Chain
GovernanceXDC Network is a community-oriented ecosystem, meticulously built upon the foundation of decentralized governance.
XDC EcosystemXDC ecosystem and developer tools
Run a MasterodeHow to run a XDC Masternode
JSON-RPC APIInteracting with XDC requires sending requests to specific JSON-RPC API methods.
"},{"location":"xdcchain/evmtoxdc/","title":"Overview - XDC Chain","text":""},{"location":"xdcchain/evmtoxdc/#migrating-from-evm-to-xdc","title":"Migrating from EVM to XDC","text":"Migrating a Solidity contract from Ethereum to the XDC network with Truffle involves several steps. The XDC network is a public blockchain that is EVM-compatible and designed to support enterprise-level applications. Truffle is a popular development framework for creating and deploying Solidity contracts.
"},{"location":"xdcchain/evmtoxdc/#step-1-install-truffle","title":"Step 1: Install Truffle","text":"The first step is to install the XDC network and Truffle. This can be done by following the installation instructions provided by XDC and Truffle.
Installation - Truffle Suite
"},{"location":"xdcchain/evmtoxdc/#step-2-configure-truffle-for-xdc","title":"Step 2: Configure Truffle for XDC","text":"Next, Truffle needs to be configured to work with the XDC network. This involves creating a new Truffle project and configuring the Truffle config file to connect to the XDC network by using a public RPC connected to the XDC network.
Configuration - Truffle Suite
"},{"location":"xdcchain/evmtoxdc/#step-3-compile-the-contract","title":"Step 3: Compile the Contract","text":"After updating the Solidity contract, it needs to be compiled for the XDC network. This involves using the Truffle compiler to create a bytecode file that can be deployed on the XDC network.
Compile contracts - Truffle Suite
"},{"location":"xdcchain/evmtoxdc/#step-4-deploy-the-contract","title":"Step 4: Deploy the Contract","text":"The next step is to deploy the updated contract on the XDC network. This can be done using Truffle\u2019s deployment commands. It is important to ensure that the contract is deployed correctly and securely.
"},{"location":"xdcchain/evmtoxdc/#step-5-test-the-contract","title":"Step 5: Test the Contract","text":"After deploying the contract, it is important to thoroughly test it on the XDC network. This includes testing all functions and features, as well as testing for security vulnerabilities. You can write tests in Truffle using Javascript to build debug and test contracts ready to be deployed onto the network
Write JavaScript tests - Truffle Suite
"},{"location":"xdcchain/evmtoxdc/#step-6-update-clients-and-interfaces","title":"Step 6: Update Clients and Interfaces","text":"Once the contract has been migrated and tested, any clients or interfaces that interact with the contract must be updated to be compatible with the XDC network by having them point to the appropriate RPCs on the xdc network.
For a How-To guide showing migration of a dApp from Ethereum to the XDC Network please go to this link.
"},{"location":"xdcchain/introduction/","title":"Introduction","text":""},{"location":"xdcchain/introduction/#introduction","title":"Introduction","text":"XinFin\u2019s XDC Network is an enterprise-ready, Layer-1, EVM-compatible, open-source, hybrid blockchain protocol specializing in tokenization for real-world decentralized finance. It uses a special type of delegated proof-of-stake (XDPoS) for consensus to ensure quick transaction times, minimal gas fees, and a remarkable 2,000+ transactions per second (TPS).
XDC Network is backed by the XDC Community, leading to the formation of the XDC Foundation, which was established in 2021 to promote the growth and adoption of XDC through collaboration with a community of developers, trade experts, and content creators.
"},{"location":"xdcchain/introduction/#xinfin-delegated-proof-of-staked-authority","title":"XinFin Delegated Proof of Staked Authority","text":"-
"},{"location":"xdcchain/introduction/#security","title":"Security","text":"-
"},{"location":"xdcchain/introduction/#fast-finality","title":"Fast Finality","text":"-
"},{"location":"xdcchain/introduction/#reward","title":"Reward","text":"-
"},{"location":"xdcchain/introduction/#token-economy","title":"Token Economy","text":"-
"},{"location":"xdcchain/introduction/#staking-and-governance","title":"Staking and Governance","text":"-
"},{"location":"xdcchain/rewards/","title":"Rewards Mechanism","text":""},{"location":"xdcchain/rewards/#rewards-mechanism","title":"Rewards Mechanism","text":"The XDC Network operates on a Delegated Proof of Stake (XDPoS) consensus mechanism, which allows for high transaction throughput, energy efficiency, and security. The network\u2019s rewards mechanism is designed to incentivize Masternode operators and participants who contribute to the stability, security, and growth of the network. This document outlines how the XDC rewards mechanism works, who is eligible for rewards, and how rewards are distributed.
"},{"location":"xdcchain/rewards/#overview-of-xdc-rewards-system","title":"Overview of XDC Rewards System","text":"In the XDC Network, rewards are primarily distributed to Masternode operators who validate transactions, secure the network, and propose new blocks. Additionally, XDC token holders who delegate their tokens to Masternodes also earn a share of the rewards. The rewards mechanism is structured to:
Incentivize decentralization by encouraging more participants to run Masternodes or delegate their tokens. Reward active participation in the network, such as block validation and staking. Ensure the economic sustainability of the XDC Network over time.
"},{"location":"xdcchain/rewards/#masternode-operator-rewards","title":"Masternode Operator Rewards","text":"Masternodes are critical to the XDC Network\u2019s operations, responsible for validating transactions and maintaining consensus. To compensate for their role, Masternode operators receive rewards for every block they validate.
Note: Masternodes with better uptime and performance will receive a higher portion of the rewards.
"},{"location":"xdcchain/xdpos/","title":"Overview - XDC Chain","text":""},{"location":"xdcchain/xdpos/#xdpos-xdcs-consensus-mechanism","title":"XDPoS - XDC\u2019s Consensus Mechanism","text":"XinFin Delegated Proof of Stake(XDPoS) is another form of Proof of Stake(PoS) consensus mechanism to scale up to Thousands of transactions per second. XDPOS concentrates block production in the hands of few semi-trusted entities in order to achieve more scalability than Proof of Work(PoW) or other Proof of Stake blockchains. XDPOS leverages the power of stakeholder to resolve consensus issues in a fair and democratic way. The Self KYC feature added in XinFin XDPoS is more enterprise and regulator friendly.
"},{"location":"xdcchain/xdpos/#common-terms","title":"Common Terms","text":"The traditional PoW mechanism, while effective in securing networks, is highly energy-intensive due to its reliance on solving complex cryptographic puzzles across all nodes in the network. This results in significant electricity consumption and poses environmental concerns. Recognizing these drawbacks, XinFin transitioned away from PoW and adopted Proof of Stake (PoS), a more energy-efficient consensus methodology. Eventually, XinFin advanced to XinFin Delegated Proof of Stake (XDPoS), which further enhances the efficiency and security of the network.
To understand XDC Network\u2019s decision to adopt XDPoS, it\u2019s essential to explore the various consensus mechanisms.
"},{"location":"xdcchain/xdpos/#understanding-consensus-pow-vs-pos-vs-xdpos","title":"Understanding Consensus: PoW vs. PoS vs. XDPoS","text":"In blockchain technology, consensus refers to a general agreement among nodes in the network, which is crucial for maintaining the integrity and accuracy of the distributed ledger. Unlike centralized systems like banks, where a central authority maintains records, blockchain relies on distributed ledgers to record information. Consensus ensures that all nodes agree on the state of the blockchain, including account balances, transactions, and more.
Proof of Work (PoW) PoW relies on nodes solving cryptographic puzzles to validate transactions and create new blocks. This process requires significant computational power and consumes vast amounts of electricity, making it environmentally unsustainable and costly.
Proof of Stake (PoS) PoS eliminates the need for energy-intensive computations. Instead of miners, PoS relies on validators who lock a portion of their cryptocurrency as a stake. Validators are chosen to propose the next block based on their stake and uptime. When a validator discovers a block that can be added to the blockchain, they validate it by placing a bet on it. The validators receive rewards proportional to their bets.
XinFin Delegated Proof of Stake (XDPoS) XDPoS is an evolution of PoS and offers greater efficiency. It uses a reputation-based system to achieve consensus, where master nodes create blocks in a round-robin manner. The network elects block producers (also known as witnesses) who are responsible for validating transactions and creating the next block. The key features of XDPoS include:
XDC Network chose XDPoS for its network due to its superior speed, cost efficiency, and scalability. XDPoS offers a more democratic, faster, and effective way to scale the network, making it the ideal consensus mechanism for XDC\u2019s hybrid blockchain platform.
"},{"location":"xdcchain/xdpos2/","title":"Overview - XDC Chain","text":""},{"location":"xdcchain/xdpos2/#xdpos-20","title":"XDPoS 2.0","text":"Sitting at the core of the XDC Network, XinFin Delegated Proof-of-Stake consensus protocol 2.0 (XDPoS 2.0) regulates the XDC nodes in maintaining the consistency of a decentralized ledger (the blockchain) with strong security and performance guarantees. In this section, we provide an overview of XDPoS 2.0 by introducing its three pillars, including:
Master node election, which specifies how the delegation and proof-of-stake works.
The consensus engine, namely, the HotStuff state machine replication (SMR) protocol, which is the state-of-the-art BFT (Byzantine fault-tolerant) SMR (state-machine replication) protocol. An illustration of its position in XDPoS 2.0 and a brief security analysis will be provided.
Reward mechanism, which incentivizes nodes to join and maintain the XDC Network.
The Apothem Testnet is the test environment for the XDC Network. It mirrors the Mainnet\u2019s functionality but operates with test tokens instead of real assets, making it ideal for developers to test and deploy their applications before going live.
Public Networks Similar to the Mainnet, users can access the Apothem Testnet with an internet connection and full node RPC. They can perform all the same actions as on the Mainnet\u2014reading, creating, or validating transactions\u2014without the risks associated with live transactions.
"},{"location":"xdcchain/developers/apothemrpc/#xdc-testnet-specifications","title":"XDC TestNet Specifications","text":"https://rpc.apothem.network
WebSocket Endpoint: wss://ws.apothem.network
The XDC Devnet is a specialized test environment for the XDC Network, designed to closely mirror the Mainnet\u2019s functionality. The Devnet provides developers with a safe, controlled setting to test, deploy, and refine their applications using test tokens instead of real assets. This environment is crucial for ensuring that applications are robust and secure before they go live on the Mainnet.
Public Networks Similar to the Mainnet, users can access the XDC Devnet via an internet connection and a full node RPC. The Devnet allows developers to perform the same operations they would on the Mainnet, including reading blockchain data, creating and validating transactions, and deploying smart contracts. However, since the Devnet operates with test tokens, developers can experiment freely without the financial risks associated with live transactions.
"},{"location":"xdcchain/developers/devnetrpc/#xdc-devnet-specifications","title":"XDC Devnet Specifications","text":"https://devnetstats.hashlabs.apothem.network/devnet
WebSocket Endpoint: https://devnetstats.hashlabs.apothem.network/devnetws
The XDC Mainnet is the live, operational environment of the XDC Network, where real transactions occur. The Mainnet is designed to support high-performance applications with low transaction fees and quick finality, making it ideal for enterprise use cases. The primary URL for accessing the XDC Mainnet via RPC. This endpoint allows you to interact with the blockchain by sending requests for data, submitting transactions, and more.
Public Networks
Users with an internet connection and access to a full node RPC can easily access the XDC Network\u2019s public blockchain. They can read, create, or validate transactions executed on the blockchain. The network\u2019s consensus mechanism, XDPoS (XinFin Delegated Proof of Stake), ensures that all nodes agree on the state of the network.
"},{"location":"xdcchain/developers/mainnetrpc/#xdc-mainnet-specifications","title":"XDC MainNet Specifications","text":"https://rpc.xdc.org
WebSocket Endpoint: wss://ws.xinfin.network
The Apothem Testnet is the test environment for the XDC Network. It mirrors the Mainnet\u2019s functionality but operates with test tokens instead of real assets, making it ideal for developers to test and deploy their applications before going live.
Public Networks Similar to the Mainnet, users can access the Apothem Testnet with an internet connection and full node RPC. They can perform all the same actions as on the Mainnet\u2014reading, creating, or validating transactions\u2014without the risks associated with live transactions.
"},{"location":"xdcchain/developers/mainnetrpc/#xdc-testnet-specifications","title":"XDC TestNet Specifications","text":"https://rpc.apothem.network
WebSocket Endpoint: wss://ws.apothem.network
The XDC Devnet is a specialized test environment for the XDC Network, designed to closely mirror the Mainnet\u2019s functionality. The Devnet provides developers with a safe, controlled setting to test, deploy, and refine their applications using test tokens instead of real assets. This environment is crucial for ensuring that applications are robust and secure before they go live on the Mainnet.
Public Networks Similar to the Mainnet, users can access the XDC Devnet via an internet connection and a full node RPC. The Devnet allows developers to perform the same operations they would on the Mainnet, including reading blockchain data, creating and validating transactions, and deploying smart contracts. However, since the Devnet operates with test tokens, developers can experiment freely without the financial risks associated with live transactions.
"},{"location":"xdcchain/developers/mainnetrpc/#xdc-testnet-specifications_1","title":"XDC TestNet Specifications","text":"https://devnetstats.apothem.network/devnet
WebSocket Endpoint:
Welcome to the Quick Guide for XDC Chain! This document is designed to provide you with a comprehensive overview of the XDC Network, its technology, and the tools you need to start your journey. Whether you\u2019re new to blockchain or an experienced developer, this guide will help you navigate the key resources and get up to speed with the XDC Network.
"},{"location":"xdcchain/developers/quick-guide/#getting-started","title":"Getting Started","text":"The XDC Network is a powerful, enterprise-grade blockchain platform designed to facilitate secure, efficient, and scalable decentralized applications (DApps) and global trade solutions. If you\u2019re just starting your journey with the XDC Network, this section will help you understand the fundamental concepts, terminology, and processes.
"},{"location":"xdcchain/developers/quick-guide/#mainnet","title":"Mainnet","text":"The XDC Network\u2019s Mainnet is the live, operational blockchain where actual transactions take place. Understanding the Mainnet is crucial for interacting with the XDC Network in a real-world environment.
The Apothem Testnet is the testing environment for the XDC Network. It\u2019s an ideal place to experiment with your DApps, smart contracts, and other blockchain-based solutions before deploying them on the Mainnet.
The XDC Devnet is a development-focused environment that allows developers to test and deploy their projects in a controlled setting. It\u2019s perfect for experimenting with new features, running simulations, and fine-tuning DApps before launching them on the Mainnet or Testnet.
Here are some additional tools and resources that will help you interact with the XDC Network more effectively:
"},{"location":"xdcchain/developers/quick-guide/#xdc-wallets","title":"XDC Wallets:","text":"To start using XDC, you\u2019ll need a secure wallet\u2014a dedicated app for storing your XDC and interacting with other apps on the XDC Network. Ensuring the safety of your XDC is crucial, so choose from a variety of trusted wallets that offer high security and unique features. Here are some of the top options.
"},{"location":"xdcchain/developers/quick-guide/#additional-tools","title":"Additional Tools:","text":"Join the vibrant community of developers, validators, and users who are actively contributing to the XDC Network\u2019s growth and innovation. Engage with the community, ask questions, and share your knowledge.
Dev Forum: Participate in discussions, ask questions, and collaborate with other developers. XDC Dev Forum
Discord: Join the official XDC Network Discord channel for real-time support and community interaction. Join Discord
It\u2019s unnecessary to review every document to have a working knowledge of the XDC Network. Explore the resources as needed, dive deeper into specific sections that interest you, and don\u2019t hesitate to seek support from the community whenever necessary.
Happy building on the XDC Network!
For more tools and details, you can refer to XDC Chain Network Tools and Documents.
"},{"location":"xdcchain/developers/rpc/","title":"XDC Network - RPC","text":""},{"location":"xdcchain/developers/rpc/#network-endpoints","title":"Network Endpoints","text":"The XDC Network is a robust, enterprise-grade blockchain platform designed for decentralized finance (DeFi), global trade, and other high-demand applications. For developers and users interacting with the XDC Network, the Remote Procedure Call (RPC) interface is a critical component. This guide provides a detailed overview of the RPC endpoints for both the XDC Mainnet and the Apothem Testnet, including their specifications and usage.
"},{"location":"xdcchain/developers/rpc/#what-is-rpc","title":"What is RPC?","text":"Remote Procedure Call (RPC) is a protocol that allows communication between a client and a server over a network. In the context of blockchain, RPC is used to interact with the blockchain network by sending requests to full nodes. These requests can include reading blockchain data, creating and broadcasting transactions, and deploying smart contracts.
"},{"location":"xdcchain/developers/rpc/#mainnet-environment","title":"Mainnet Environment","text":"Service URL RPC https://erpc.xinfin.network Chain Id 50 Faucet endpoint https://chains.tools/faucet Explorer https://xdcscan.io/"},{"location":"xdcchain/developers/rpc/#apothem-environment","title":"Apothem Environment","text":"Service URL RPC https://rpc.apothem.network Chain Id 51 Faucet endpoint https://faucet.blocksscan.io/ Explorer https://apothem.xdcscan.io/"},{"location":"xdcchain/developers/rpc/#devnet-environment","title":"Devnet Environment","text":"Service URL RPC https://devnetstats.hashlabs.apothem.network/devnet Chain Id 551 Faucet endpoint https://faucet.blocksscan.io/ Explorer https://devnet.xdcscan.io/"},{"location":"xdcchain/developers/wallet-configuration/","title":"Wallet Configuration - XDC Network","text":""},{"location":"xdcchain/developers/wallet-configuration/#wallet-configuration","title":"Wallet configuration","text":"You can use any Ethereum wallet with XDC. For instance, I will show you how to set up Metamask and Trustwallet for XDC.
Testnet/Apothem
Mainnet
Depending on your location and preference, you can choose from a variety of RPC endpoints for XDC. For more information about the endpoints and their features, please refer to the network information document that we have prepared for you. To ensure the best performance and user experience, you can test the latency of each endpoint before you configure it with your wallet. Refer
"},{"location":"xdcchain/developers/node_operators/bootstrap/","title":"Run XDC Nodes using Bootstrap Script","text":""},{"location":"xdcchain/developers/node_operators/bootstrap/#setup-xdc-masternode-using-bootstrap-script","title":"Setup XDC Masternode using Bootstrap Script","text":""},{"location":"xdcchain/developers/node_operators/bootstrap/#for-mainnet","title":"For Mainnet","text":"Bootstrap Command XinFin Node Setup:
sudo su -c \"bash <(wget -qO- https://raw.githubusercontent.com/XinFinOrg/XinFin-Node/master/setup/bootstrap.sh)\" root\n
Examples: After running the bootstrap command, the system will prompt you to specify the network. To connect to the Mainnet, simply enter \u201cmainnet\u201d.
$ sudo su -c \"bash <(wget -qO- https://raw.githubusercontent.com/XinFinOrg/XinFin-Node/master/setup/bootstrap.sh)\" root\n[sudo] password for user:\nPlease enter your XinFin Network (mainnet/testnet/devnet) :- mainnet\n
Next, you will be asked to input your XinFin Masternode name. Enter your desired Masternode name, such as \u201cDemo_Server.\u201d Your running network is mainnet\nPlease enter your XinFin MasterNode Name :- Demo_Server\nYour Masternode Name is Demo_Server\n
"},{"location":"xdcchain/developers/node_operators/bootstrap/#for-testnet","title":"For Testnet","text":"After running the bootstrap command, the system will prompt you to specify the network. To connect to the Mainnet, simply enter \u201ctestnet\u201d.
sudo su -c \"bash <(wget -qO- https://raw.githubusercontent.com/XinFinOrg/XinFin-Node/master/setup/bootstrap.sh)\" root\nPlease enter your XinFin Network (mainnet/testnet/devnet) :- testnet\n
Next, you will be asked to input your XinFin Masternode name. Enter your desired Masternode name, such as \u201ctest01\u201d Your running network is testnet\nPlease enter your XinFin MasterNode Name :- test01\nYour Masternode Name is test01\n
"},{"location":"xdcchain/developers/node_operators/bootstrap/#for-devnet","title":"For Devnet","text":"After running the bootstrap command, the system will prompt you to specify the network. To connect to the Mainnet, simply enter \u201cdevnet\u201d.
sudo su -c \"bash <(wget -qO- https://raw.githubusercontent.com/XinFinOrg/XinFin-Node/master/setup/bootstrap.sh)\" root\nPlease enter your XinFin Network (mainnet/testnet/devnet) :- devnet\nYour running network is devnet\n
Next, you will be asked to input your XinFin Masternode name. Enter your desired Masternode name, such as \u201ctest01\u201d Please enter your XinFin MasterNode Name :- test01\nYour Masternode Name is test01\nGenerate new private key and wallet address.\nIf you have your own key, you can change after this and restart the node\nType 'Y' or 'y' to continue:\n
"},{"location":"xdcchain/developers/node_operators/docker/","title":"Setup XDC Masternode using Docker","text":""},{"location":"xdcchain/developers/node_operators/docker/#setup-xdc-masternode-using-docker","title":"Setup XDC Masternode using Docker","text":""},{"location":"xdcchain/developers/node_operators/docker/#setting-up-xdc-network-masternode-docker-version","title":"Setting up XDC Network Masternode Docker version","text":"The server or VPS used for the masternode should be directly facing the internet with a public IP and without NAT.
Operating System: Ubuntu 20.04 64-bit or higher
Should be facing internet directly with public IP & without NAT
Tools: Docker, Docker Compose(1.27.4+)
Setup (For Ubuntu 20.04 64-bit or higher Operating System)
Follow the written steps starting from step 1, or you can watch the video tutorials:
"},{"location":"xdcchain/developers/node_operators/docker/#step-1-clone-repository","title":"Step 1: Clone repository","text":"git clone https://github.com/XinFinOrg/XinFin-Node.git\n
"},{"location":"xdcchain/developers/node_operators/docker/#step-2-change-directory","title":"Step 2: Change directory","text":"Then we change the directory to XinFin-Node
cd XinFin-Node\n
"},{"location":"xdcchain/developers/node_operators/docker/#step-3-install-docker","title":"Step 3: Install docker","text":"We need to install Docker and Docker-Compose by running the following command:
sudo ./setup/install_docker.sh\n
"},{"location":"xdcchain/developers/node_operators/docker/#step-4","title":"Step 4:","text":"Create a new .env file and copy the env.example file that exist in the mainnet directory. We will ensure we are in the \u201cmainnet\u201d directory by typing these commands. Once in edit mode for the .env file, name your masternode and use an email address in the respective fields
cd mainnet\ncp env.example .env\nnano .env \n
For Testnet cd testnet\ncp env.example .env\nnano .env\n
"},{"location":"xdcchain/developers/node_operators/docker/#step-5-start-your-node","title":"Step 5: Start your Node","text":"For Mainnet run the following commands:
cd mainnet\nsudo docker-compose -f docker-compose.yml up -d\n
At this point you should be able to see your masternode on the list of nodes here or as shown below: For Testnet run the following commands:
cd testnet\nsudo docker-compose -f docker-compose.yml up -d\n
You should be able to see your node listed on the [Apothem Network] page. Select \u201cSwitch to LiveNet\u201d to check LiveNetwork Stats and Select \u201cSwitch to TestNet\u201d for TestNetwork. Your coinbase address can be found in xdcchain/coinbase.txt file.
For troubleshooting purposes, you can stop the node by using the following command on either Mainnet or Testnet:
sudo docker-compose -f docker-compose.yml down\n
Downloading a Network Snapshot (Mainnet or Apothem)
The following steps are to expedite the syncing process of your node with the XDC Network. If you followed the steps above, your node will take 3-4 days to sync up with the network fully. You can reduce that time by downloading a network snapshot and bringing your node back up after the chain has been downloaded and unpacked.
"},{"location":"xdcchain/developers/node_operators/docker/#mainnet-snapshot","title":"Mainnet Snapshot","text":"Bring down your node:
sudo docker-compose -f docker-compose.yml down\n
Remove the old xdchain file from the server rm -rf xdcchain.tar\n
Download the snapshot wget https://download.xinfin.network/xdcchain.tar\n
Unpack the xdcchain.tar file tar -xvzf xdcchain.tar\n
The unpacking will take some time, and it will look like this: The following command will move the xdcchain/XDC to xdcchain/XDC_backup
mv xdcchain/XDC xdcchain/XDC_backup\nmv XDC xdcchain\n
Then we are going to remove the old \u201cnodekey\u201d file
rm -rf xdcchain/XDC/nodekey\n
The last step is to run the bash upgrade.sh command
bash upgrade.sh\n
This command will bring your node up and it will start syncing to the network. Once up and running, your node will be synced to the network in just a few minutes.
"},{"location":"xdcchain/developers/node_operators/docker/#apothem-snapshot","title":"Apothem Snapshot","text":"Bring down your node:
sudo docker-compose -f docker-compose.yml down\n
Remove the old xdchain file from the server
rm -rf apothem.tar\n
Download the snapshot
wget https://download.apothem.network/apothem.tar\n
Unpack the apothem.tar file
tar -xvzf apothem.tar\n
Move the xdcchain-testnet
mv XDC xdcchain-testnet\n
Bring up the node
sudo docker-compose -f docker-compose.yml up -d\n
"},{"location":"xdcchain/developers/node_operators/dockerimg/","title":"Docker Image for the XDC Network","text":""},{"location":"xdcchain/developers/node_operators/dockerimg/#docker-image-for-the-xdc-network","title":"Docker Image for the XDC Network","text":""},{"location":"xdcchain/developers/node_operators/dockerimg/#what-is-a-docker-image","title":"What is a Docker Image?","text":"A Docker image is a lightweight, stand-alone, executable package that includes everything needed to run an application, including code, runtime, libraries, and configurations. In the context of blockchain, Docker images simplify the deployment and management of nodes by enabling developers to encapsulate the entire blockchain environment into a single, replicable package.
"},{"location":"xdcchain/developers/node_operators/dockerimg/#purpose-of-the-xdc-networks-docker-image","title":"Purpose of the XDC Network\u2019s Docker Image","text":"For the XDC Network, the Docker image provides a standardized and efficient way for developers to deploy, manage, and update their XDC nodes. The XDC Docker image streamlines the node deployment process, reducing configuration errors and minimizing setup time. It allows developers to run nodes in isolated containers, ensuring a consistent environment across different infrastructures.
"},{"location":"xdcchain/developers/node_operators/dockerimg/#key-features-of-the-xdc-docker-image-include","title":"Key features of the XDC Docker image include:","text":"Nodes are computers or servers that run an application software known as clients to perform essential tasks on a blockchain network. These tasks can include transactions, block creation, consensus, network security, and other operational tasks for the network. The tasks and functionalities a node execute depend on the type of node, with each node having different system requirements and deployment processes. This section will provide details and information on how to run and maintain nodes on the XDC Network.
"},{"location":"xdcchain/developers/node_operators/masternode/#masternodes","title":"Masternodes","text":"The XDC Network runs on a globally distributed system of masternodes that participate in a Delegated Proof of Stake (DPoS) consensus mechanism. To enhance network integrity and security, Masternodes are required to complete a KYC process and stake 10,000,000 XDC. Masternodes can be identified as \u201cValidator\u201d or \u201cStandby\u201d Masternodes.
"},{"location":"xdcchain/developers/node_operators/masternode/#standby-masternodes","title":"Standby Masternodes","text":"Standby Masternodes (or \u201cStandby Nodes\u201d) are identical in form and function to Validators but do not participate in validating transactions and block creation. These nodes are on standby to fill the role of Validators that drop from network participation.
To host an XDC Masternode/Standby node, there are specific prerequisites that you need to meet in terms of hardware, software, and staking requirements. Below is a detailed list:
"},{"location":"xdcchain/developers/node_operators/masternode/#hardware-requirements","title":"Hardware Requirements","text":"To ensure smooth operation and optimal performance of the XDC Masternode, the following hardware specifications are recommended:
Ensure that you have the following software and dependencies installed on your server before proceeding with the XDC Masternode setup:
To host an XDC Masternode, a certain amount of XDC tokens must be staked. This ensures that the node operator has a vested interest in the security and performance of the network.
You must set up an XDC wallet to manage your funds and staking:
Bootstrap Command for XDC Masternode Setup:
sudo su -c \"bash <(wget -qO- https://raw.githubusercontent.com/XinFinOrg/XinFin-Node/master/setup/bootstrap.sh)\" root\n
Examples: After running the bootstrap command, the system will prompt you to specify the network. To connect to the Mainnet, simply enter \u201cmainnet\u201d.
$ sudo su -c \"bash <(wget -qO- https://raw.githubusercontent.com/XinFinOrg/XinFin-Node/master/setup/bootstrap.sh)\" root\n[sudo] password for user:\nPlease enter your XinFin Network (mainnet/testnet/devnet) :- mainnet\n
Next, you will be asked to input your XinFin Masternode name. Enter your desired Masternode name, such as \u201cDemo_Server.\u201d Your running network is mainnet\nPlease enter your XinFin MasterNode Name :- Demo_Server\nYour Masternode Name is Demo_Server\n
"},{"location":"xdcchain/developers/node_operators/masternode/#for-testnet","title":"For Testnet","text":"After running the bootstrap command, the system will prompt you to specify the network. To connect to the Mainnet, simply enter \u201ctestnet\u201d.
sudo su -c \"bash <(wget -qO- https://raw.githubusercontent.com/XinFinOrg/XinFin-Node/master/setup/bootstrap.sh)\" root\nPlease enter your XinFin Network (mainnet/testnet/devnet) :- testnet\n
Next, you will be asked to input your XinFin Masternode name. Enter your desired Masternode name, such as \u201ctest01\u201d Your running network is testnet\nPlease enter your XinFin MasterNode Name :- test01\nYour Masternode Name is test01\n
"},{"location":"xdcchain/developers/node_operators/masternode/#for-devnet","title":"For Devnet","text":"After running the bootstrap command, the system will prompt you to specify the network. To connect to the Mainnet, simply enter \u201cdevnet\u201d.
sudo su -c \"bash <(wget -qO- https://raw.githubusercontent.com/XinFinOrg/XinFin-Node/master/setup/bootstrap.sh)\" root\nPlease enter your XinFin Network (mainnet/testnet/devnet) :- devnet\nYour running network is devnet\n
Next, you will be asked to input your XinFin Masternode name. Enter your desired Masternode name, such as \u201ctest01\u201d Please enter your XinFin MasterNode Name :- test01\nYour Masternode Name is test01\nGenerate new private key and wallet address.\nIf you have your own key, you can change after this and restart the node\nType 'Y' or 'y' to continue:\n
"},{"location":"xdcchain/developers/node_operators/masternode/#how-to-stake-xdc-on-a-masternodestandby-node","title":"How to Stake XDC on a Masternode/Standby node","text":""},{"location":"xdcchain/developers/node_operators/masternode/#prerequisites","title":"Prerequisites","text":"To stake XDC and run a masternode, you will need the following:
Note: You do not need 10,000,000 XDC to run a node solely for RPC queries or accessing live data from the blockchain. This guide covers staking for masternode candidates.
"},{"location":"xdcchain/developers/node_operators/masternode/#step-by-step-process-to-stake-your-xdc-node","title":"Step-by-Step Process to Stake Your XDC Node","text":""},{"location":"xdcchain/developers/node_operators/masternode/#1-access-the-staking-platform","title":"1. Access the Staking Platform","text":"To qualify for Masternode on XinFin Network, you need at least 10,000,000 XDC, for the long term.
Operating System:
Download XDC One-Click Installer (to setup Masternode) for Windows, Linux, and Mac OS and Install on your local machine.
"},{"location":"xdcchain/developers/node_operators/masternode/#step-2","title":"Step 2:","text":"Now Run the One Click Installer, Make sure you read the Terms properly then click on I Agree button.
Step 3: Create a wallet for Masternode
Step 4: Host your Masternode
The server or VPS used for the masternode should be directly facing the internet with a public IP and without NAT.
Operating System: Ubuntu 20.04 64-bit or higher
Should be facing internet directly with public IP & without NAT
Tools: Docker, Docker Compose(1.27.4+)
Setup (For Ubuntu 20.04 64-bit or higher Operating System)
Follow the written steps starting from step 1, or you can watch the video tutorials:
"},{"location":"xdcchain/developers/node_operators/masternode/#step-1-clone-repository","title":"Step 1: Clone repository","text":"git clone https://github.com/XinFinOrg/XinFin-Node.git\n
"},{"location":"xdcchain/developers/node_operators/masternode/#step-2-change-directory","title":"Step 2: Change directory","text":"Then we change the directory to XinFin-Node
cd XinFin-Node\n
"},{"location":"xdcchain/developers/node_operators/masternode/#step-3-install-docker","title":"Step 3: Install docker","text":"We need to install Docker and Docker-Compose by running the following command:
sudo ./setup/install_docker.sh\n
"},{"location":"xdcchain/developers/node_operators/masternode/#step-4","title":"Step 4:","text":"Create a new .env file and copy the env.example file that exist in the mainnet directory. We will ensure we are in the \u201cmainnet\u201d directory by typing these commands. Once in edit mode for the .env file, name your masternode and use an email address in the respective fields
cd mainnet\ncp env.example .env\nnano .env \n
For Testnet cd testnet\ncp env.example .env\nnano .env\n
"},{"location":"xdcchain/developers/node_operators/masternode/#step-5-start-your-node","title":"Step 5: Start your Node","text":"For Mainnet run the following commands:
cd mainnet\nsudo docker-compose -f docker-compose.yml up -d\n
At this point you should be able to see your masternode on the list of nodes here or as shown below: For Testnet run the following commands:
cd testnet\nsudo docker-compose -f docker-compose.yml up -d\n
You should be able to see your node listed on the [Apothem Network] page. Select \u201cSwitch to LiveNet\u201d to check LiveNetwork Stats and Select \u201cSwitch to TestNet\u201d for TestNetwork. Your coinbase address can be found in xdcchain/coinbase.txt file.
For troubleshooting purposes, you can stop the node by using the following command on either Mainnet or Testnet:
sudo docker-compose -f docker-compose.yml down\n
"},{"location":"xdcchain/developers/node_operators/masternode/#downloading-a-network-snapshot-mainnet-or-apothem","title":"Downloading a Network Snapshot (Mainnet or Apothem)","text":"The following steps are to expedite the syncing process of your node with the XDC Network. If you followed the steps above, your node will take 3-4 days to sync up with the network fully. You can reduce that time by downloading a network snapshot and bringing your node back up after the chain has been downloaded and unpacked.
"},{"location":"xdcchain/developers/node_operators/masternode/#mainnet-snapshot","title":"Mainnet Snapshot","text":"Bring down your node:
sudo docker-compose -f docker-compose.yml down\n
Remove the old xdchain file from the server rm -rf xdcchain.tar\n
Download the snapshot wget https://download.xinfin.network/xdcchain.tar\n
Unpack the xdcchain.tar file tar -xvzf xdcchain.tar\n
The unpacking will take some time, and it will look like this: img
The following command will move the xdcchain/XDC to xdcchain/XDC_backup
mv xdcchain/XDC xdcchain/XDC_backup\nmv XDC xdcchain\n
Then we are going to remove the old \u201cnodekey\u201d file
rm -rf xdcchain/XDC/nodekey\n
The last step is to run the bash upgrade.sh command
bash upgrade.sh\n
This command will bring your node up and it will start syncing to the network. Once up and running, your node will be synced to the network in just a few minutes.
"},{"location":"xdcchain/developers/node_operators/masternode/#apothem-snapshot","title":"Apothem Snapshot","text":"Bring down your node:
sudo docker-compose -f docker-compose.yml down\n
Remove the old xdchain file from the server
rm -rf apothem.tar\n
Download the snapshot
wget https://download.apothem.network/apothem.tar\n
Unpack the apothem.tar file
tar -xvzf apothem.tar\n
Move the xdcchain-testnet
mv XDC xdcchain-testnet\n
Bring up the node
sudo docker-compose -f docker-compose.yml up -d\n
"},{"location":"xdcchain/developers/node_operators/node_architecture/","title":"XDC Node Architecture","text":""},{"location":"xdcchain/developers/node_operators/node_architecture/#xdc-node-architecture","title":"XDC Node Architecture","text":"The XDC Network is a hybrid blockchain platform designed to support both public and private states, offering enterprises the ability to conduct secure, scalable, and fast transactions. At the core of this network is its node architecture, which plays a crucial role in maintaining the network\u2019s integrity, security, and efficiency. This document provides a comprehensive overview of the XDC Node Architecture, detailing the various components and their functions.
The XDC Network operates on a Delegated Proof of Stake (XDPoS) consensus mechanism, which ensures low energy consumption and high transaction throughput. The network is EVM-compatible, allowing it to support smart contracts and decentralized applications (dApps).
"},{"location":"xdcchain/developers/node_operators/node_architecture/#node-types-in-xdc-network","title":"Node Types in XDC Network","text":"The XDC Network comprises several types of nodes, each serving a unique function within the ecosystem. These nodes are essential for network operations, including transaction validation, block creation, and consensus.
Masternodes (Validator Nodes):
The XDC Network employs a peer-to-peer (P2P) communication model where nodes interact directly with each other to share information and propagate transactions.
Gossip Protocol:
Networking Layers:
To qualify for Masternode on XinFin Network, you need at least 10,000,000 XDC, for the long term.
Operating System:
Download XDC One-Click Installer (to setup Masternode) for Windows, Linux, and Mac OS and Install on your local machine.
"},{"location":"xdcchain/developers/node_operators/one-click-installer/#step-2","title":"Step 2:","text":"Now Run the One Click Installer, Make sure you read the Terms properly then click on I Agree button.
Step 3: Create a wallet for Masternode
Step 4: Host your Masternode
The XDC Network, utilizing the XDPoS (Delegated Proof of Stake) consensus mechanism, ensures that its validators, known as masternodes, maintain optimal performance to keep the network stable and secure. One of the key features designed to ensure this reliability is the slashing mechanism, which acts as a corrective measure for underperforming masternodes.
"},{"location":"xdcchain/developers/node_operators/slashing/#objective-of-the-slashing-mechanism","title":"Objective of the Slashing Mechanism","text":"The primary goal of the slashing mechanism is not to penalize or blame masternodes but to maintain a stable and high-performing network. It serves to mitigate issues arising from underperforming masternodes by holding them accountable while ensuring the overall system remains efficient.
"},{"location":"xdcchain/developers/node_operators/slashing/#how-the-xdc-network-slashing-mechanism-works","title":"How the XDC Network Slashing Mechanism Works","text":"The slashing mechanism operates with a clear set of rules to manage masternode performance:
"},{"location":"xdcchain/developers/node_operators/slashing/#1-non-participation-in-block-signing","title":"1. Non-Participation in Block Signing:","text":"The concept of slashing is not unique to the XDC Network and has been implemented in various other blockchain networks, such as Ethereum\u2019s Casper FFG (Friendly Finality Gadget). Casper\u2019s slashing mechanism is designed to prevent the \u201cnothing-at-stake\u201d problem, where validators can choose to support multiple forks of the blockchain. In Casper, if a validator is found to have validated conflicting forks, they are severely penalized by losing a significant portion, or even all, of their staked tokens.
Unlike Casper\u2019s more punitive approach aimed at preventing malicious behavior, the XDC Network\u2019s slashing mechanism is designed to handle unintentional underperformance. Rather than harshly punishing validators for outages or system failures, XDC\u2019s system focuses on ensuring network performance without creating fear of excessive penalties. The design philosophy behind XDC\u2019s slashing mechanism is to avoid deterring participation by maintaining a fair yet firm system.
"},{"location":"xdcchain/developers/node_operators/slashing/#benefits-of-the-xdc-slashing-mechanism","title":"Benefits of the XDC Slashing Mechanism","text":"Validator Masternodes operate and participate in XDC Network\u2019s DPoS consensus engine, validating transactions and block creation.
"},{"location":"xdcchain/developers/node_operators/validator_node/#standby-masternodes","title":"Standby Masternodes","text":"Standby Masternodes (or \u201cStandby Nodes\u201d) are identical in form and function to Validators but do not participate in validating transactions and block creation. These nodes are on standby to fill the role of Validators that drop from network participation.
"},{"location":"xdcchain/developers/node_operators/validator_node/#setup-xdc-validatorstandby-node-using-bootstrap-script","title":"Setup XDC Validator/Standby Node using Bootstrap Script","text":""},{"location":"xdcchain/developers/node_operators/validator_node/#for-mainnet","title":"For Mainnet","text":"Bootstrap Command XDC Validator/Standby Node Setup:
sudo su -c \"bash <(wget -qO- https://raw.githubusercontent.com/XinFinOrg/XinFin-Node/master/setup/bootstrap.sh)\" root\n
Examples: After running the bootstrap command, the system will prompt you to specify the network. To connect to the Mainnet, simply enter \u201cmainnet\u201d.
$ sudo su -c \"bash <(wget -qO- https://raw.githubusercontent.com/XinFinOrg/XinFin-Node/master/setup/bootstrap.sh)\" root\n[sudo] password for user:\nPlease enter your XinFin Network (mainnet/testnet/devnet) :- mainnet\n
Next, you will be asked to input your XinFin Masternode name. Enter your desired Masternode name, such as \u201cDemo_Server.\u201d Your running network is mainnet\nPlease enter your XinFin MasterNode Name :- Demo_Server\nYour Masternode Name is Demo_Server\n
"},{"location":"xdcchain/developers/node_operators/validator_node/#for-testnet","title":"For Testnet","text":"After running the bootstrap command, the system will prompt you to specify the network. To connect to the Mainnet, simply enter \u201ctestnet\u201d.
sudo su -c \"bash <(wget -qO- https://raw.githubusercontent.com/XinFinOrg/XinFin-Node/master/setup/bootstrap.sh)\" root\nPlease enter your XinFin Network (mainnet/testnet/devnet) :- testnet\n
Next, you will be asked to input your XinFin Masternode name. Enter your desired Masternode name, such as \u201ctest01\u201d Your running network is testnet\nPlease enter your XinFin MasterNode Name :- test01\nYour Masternode Name is test01\n
"},{"location":"xdcchain/developers/node_operators/validator_node/#for-devnet","title":"For Devnet","text":"After running the bootstrap command, the system will prompt you to specify the network. To connect to the Mainnet, simply enter \u201cdevnet\u201d.
sudo su -c \"bash <(wget -qO- https://raw.githubusercontent.com/XinFinOrg/XinFin-Node/master/setup/bootstrap.sh)\" root\nPlease enter your XinFin Network (mainnet/testnet/devnet) :- devnet\nYour running network is devnet\n
Next, you will be asked to input your XinFin Masternode name. Enter your desired Masternode name, such as \u201ctest01\u201d Please enter your XinFin MasterNode Name :- test01\nYour Masternode Name is test01\nGenerate new private key and wallet address.\nIf you have your own key, you can change after this and restart the node\nType 'Y' or 'y' to continue:\n
"},{"location":"xdcchain/developers/node_operators/validator_node/#setup-xdc-masternode-using-one-click-installer","title":"Setup XDC Masternode using One-Click Installer","text":"To Setup XDC Masternode using One-Click Installer, refer
"},{"location":"xdcchain/governance/overview/","title":"Overview - XDCDAO","text":""},{"location":"xdcchain/governance/overview/#xdc-governance-overview","title":"XDC Governance Overview","text":"The DAO Treasury within the XDCDAO framework plays a critical role in the XDC Network\u2019s decentralized governance system. It is meticulously designed to manage the community\u2019s collective resources efficiently, securely, and transparently. This section provides a structured overview of the DAO Treasury, highlighting its purpose, operation, funding sources, and significance within the DAOFIN ecosystem.
"},{"location":"xdcchain/governance/overview/#purpose-of-the-dao-treasury","title":"Purpose of the DAO Treasury","text":"The DAO Treasury\u2019s primary objective is to support the sustainable growth and development of the XDC Network by financing projects and initiatives that align with the community\u2019s goals. It acts as the financial hub for:
XDC Network is a pioneering blockchain platform tailored to meet the evolving needs of decentralized finance (DeFi) and global trade. With its unparalleled speed, scalability, and cost-efficiency, XDC Network has become the go-to choice for developers creating decentralized applications (DApps) and for users looking to engage in the next generation of financial and trade ecosystems.
"},{"location":"#key-features-and-benefits-of-xdc-network","title":"Key Features and Benefits of XDC Network","text":"Compatibility with the Ethereum Ecosystem
Developers can seamlessly migrate their Ethereum-based projects to the XDC Network, taking advantage of its superior speed, scalability, and lower transaction costs.
Global Trade and Finance Focus
XDC Network is specifically designed to cater to the needs of decentralized finance (DeFi) and global trade, offering optimized solutions for businesses and financial institutions.
Strong Ecosystem Support
Backed by a robust infrastructure, the XDC Network is supported by leading RPC providers, wallets, blockchain explorers, and data indices, along with significant grant programs for developers.
Thriving DeFi Ecosystem
XDC Network hosts a diverse range of DeFi applications, including decentralized exchanges (DEXs), lending platforms, and asset tokenization services, driving innovation in the financial sector.
Community-Driven Growth
The XDC Network is powered by a dynamic community of developers, validators, and users who actively contribute to its continuous development and global expansion.
Comprehensive Asset Support
XDC Network provides extensive support for a wide array of digital assets, ensuring optimal composability and integration opportunities for developers and users alike.
The XDC protocol serves as a messaging and confirmation layer for global payments. Also, the XDC protocol supports smart contracts and Internet of Things (IoT) integrations. As a highly scalable enterprise-grade hybrid blockchain, the XDC protocol boasts a high throughput of 2,000 transactions per second (TPS) and near-instant transaction finality.
XDC ChainXDC Network is a pioneering blockchain platform tailored to meet the evolving needs of decentralized finance (DeFi) and global trade. With its unparalleled speed, scalability, and cost-efficiency, XDC Network has become the go-to choice for developers creating decentralized applications (DApps) and for users looking to engage in the next generation of financial and trade ecosystems.
"},{"location":"#use-cases","title":"Use Cases","text":"Decentralized Finance (DeFi)
XDC Network serves as a hub for DeFi activities, offering users access to a broad spectrum of financial products and services, all powered by its efficient and secure blockchain technology.
Trade Finance and Tokenization
The XDC Network is optimized for trade finance solutions, enabling the tokenization of real-world assets and providing a platform for secure and transparent global trade transactions.
Decentralized Applications (DApps)
Developers can build and deploy a variety of DApps on the XDC Network, leveraging its scalable infrastructure, low transaction costs, and compatibility with the Ethereum ecosystem.
Supply Chain Management
XDC Network offers advanced solutions for decentralized supply chain management, ensuring transparency, efficiency, and traceability across global supply chains.
Blockchain and AI Integration
As the demand for Artificial Intelligence (AI) grows, XDC Network is paving the way for integrating AI with blockchain technology, providing a robust platform for innovative AI-driven applications.
Get started with XDC Network: Unlock the power of decentralized finance and global trade.
AnnouncementsStay updated with the latest XDC Network announcements and developments.
XDC Network: RPC EndpointsObtain the RPC Endpoint for XDC Network
XDC Network: Set up NodeXDC Network Masternodes are the backbone of the network, ensuring lightning-fast transaction validation and enhanced security.
Developer ToolsThe XDC Chain Network provides a variety of tools and resources to help developers build and deploy applications on the blockchain.
XDC SubnetXDC Subnet is a technology that allows you to create a secure, scalable, and decentralized network within the XDC Ecosystem.
"},{"location":"announce/","title":"Announcements","text":""},{"location":"announce/#announcement","title":"Announcement","text":"XDC 2.0 Mainnet Release XDC 2.0 Mainnet Release: Key Features and Enhancements October 2, 2024 XinFin Remix Upgrade XinFin Remix is getting a major upgrade and will be launching soon. Coming Soon! Solidity 0.8.23 Integration on XDC Mainnet This EVM upgrade supports the latest version of the Solidity smart contract programming language, version 0.8.23. 2024 June"},{"location":"join-ecosystem/","title":"Index","text":"Join XDC Ecosystem XDC token lies at the heart of XDC Network, and its transformative capabilities are truly awe-inspiring. As a versatile settlement mechanism, XDC fuels the entire ecosystem, enabling lightning-fast and cost-effective transactions while revolutionizing the way DApps function. All dAppsDiscover top dApps built on XDC Network Chain, the leading blockchain scaling solution.
RWARWA on XDC Network!
DeFiDeFi on XDC Network!
"},{"location":"join-ecosystem/platforms/dapp/","title":"dApps Built On XDC Network!","text":""},{"location":"join-ecosystem/platforms/defi/","title":"DeFi Built On XDC Network!","text":""},{"location":"join-ecosystem/platforms/rwa/","title":"RWA Built On XDC Network!","text":""},{"location":"showcase/","title":"Showcase","text":""},{"location":"showcase/#smart-contract-introduction","title":"Smart Contract Introduction","text":"Blockchain technology is a digital ledger that continuously expands by adding records, known as blocks, which are securely connected through cryptography. Each block includes a cryptographic hash of the preceding block, a timestamp, and transaction data. The structure of blockchain ensures that once data is recorded, it is nearly impossible to alter, providing a high level of security. One of the key advantages of blockchain is its decentralized nature, eliminating the need for middlemen, which reduces both time and potential conflicts. Despite its challenges, blockchain technology is recognized for being faster, more economical, and more secure compared to traditional systems, which is why it\u2019s being increasingly adopted by banks and governments.
Now, imagine a contract that automatically executes when certain conditions are met, with the entire process managed by the blockchain network. This is the concept behind smart contracts.
"},{"location":"showcase/#what-are-smart-contracts","title":"What Are Smart Contracts?","text":"A smart contract is a self-executing program that runs on a blockchain, containing a set of rules agreed upon by the involved parties. Once these predefined rules are satisfied, the contract automatically enforces the terms. Smart contracts facilitate, verify, and enforce the execution of an agreement or transaction without needing an intermediary, representing the simplest form of decentralized automation.
Put simply, a smart contract allows for the exchange of assets\u2014whether money, property, or anything else\u2014without the involvement of a middleman. This leads to trustless execution, where the contract enforces the terms without relying on any party\u2019s honesty or reliability.
Bitcoin was the first blockchain to introduce basic smart contracts, where transactions are only validated if specific conditions are met. Below is an example of a basic smart contract that includes functions to set and retrieve data, with simple operations to modify the data.
"},{"location":"showcase/#overview","title":"Overview","text":""},{"location":"showcase/#key-features-of-smart-contracts","title":"Key Features of Smart Contracts","text":"Trustworthiness: Smart contracts ensure that your agreements are securely stored on a blockchain, making it impossible for any party to lose or alter the contract. The terms are binding, and both parties must adhere to them.
Transparency: Every detail of the smart contract is visible to all participants before they agree, eliminating the possibility of disputes. The information is open to everyone involved, ensuring clarity and preventing misunderstandings.
Self-Governance: Smart contracts eliminate the need for intermediaries, such as brokers or lawyers, to validate the agreement. This also removes the risk of third-party manipulation, as the contract is automatically executed by the blockchain network.
Precision: Automated contracts not only speed up the process but also reduce costs and eliminate human error. The conditions are clearly defined in the smart contract, ensuring that no detail is overlooked.
Efficiency: Smart contracts automate tasks, saving considerable time that would otherwise be spent manually reviewing and processing agreements.
Cost-Effectiveness: By removing the need for intermediaries, smart contracts can significantly reduce costs. For instance, you don\u2019t need to hire a lawyer to enforce the contract; the code itself ensures compliance.
Security: The data in smart contracts is encrypted and protected by blockchain technology, making it highly secure and reliable for critical processes.
Upgradability: Modular smart contracts can address upgrade issues, allowing changes without losing valuable information.
Proxy Contracts: Using delegatecall-based proxies enables smart contracts to be upgraded while keeping the logic and data separate. However, this method requires careful handling to avoid introducing errors.
Legal Considerations: As smart contracts evolve, legal issues will gradually be resolved, but it will take time since they are still in the early stages of development.
Complexity Management: Simplifying smart contracts by avoiding Turing-complete designs can help reduce the complexity involved in writing them.
Oracle Problem: The oracle issue could be tackled by implementing a consensus protocol within the community, ensuring that the blockchain accurately reflects real-world conditions.
Digital Identity Management: Smart contracts allow individuals to maintain control over their digital identities, managing their data, reputation, and assets securely. Businesses can use this technology to streamline the know-your-customer (KYC) process.
Financial Data Integrity: Financial institutions can leverage smart contracts for accurate and transparent data recording, improving financial reporting and reducing auditing expenses. This also enhances market stability by ensuring uniform financial data across organizations.
Healthcare Management: Smart contracts can store personal health records securely on a blockchain, accessible only by authorized personnel. They can also be used to manage various healthcare operations, including drug tracking, compliance with regulations, and managing medical supplies.
Real Estate Transactions: Smart contracts simplify real estate transactions by cutting out intermediaries. For example, rental agreements can be directly managed on the blockchain, reducing costs and making the process more efficient.
Smart contracts offer immense potential and have already shown signs of transforming various industries. However, they are still in the early stages, and much remains to be explored. As organizations become more familiar with blockchain technology and its applications, smart contracts could become easier to implement and more widely trusted. In the future, we might see a blend of traditional and digital contracts, where blockchain technology verifies the terms while physical copies provide additional validation.
"},{"location":"showcase/data-analytics/","title":"Showcase","text":""},{"location":"showcase/data-analytics/#data-and-analytics","title":"Data and Analytics","text":""},{"location":"showcase/data-analytics/#overview","title":"Overview:","text":"The XDC Network\u2019s data and analytics tools are critical for understanding the dynamics of the blockchain. These tools provide detailed insights into how tokens are used, the behavior of smart contracts, and overall network activity. By leveraging these analytics, stakeholders can make informed decisions and optimize their interactions with the network.
"},{"location":"showcase/data-analytics/#key-features","title":"Key Features:","text":"XDCScan is the official block explorer for the XDC Network, providing a user-friendly interface to explore and interact with the blockchain. It allows users to search for transactions, view block details, and explore smart contracts deployed on the network. XDCScan is a vital tool for anyone interacting with the XDC Network, from developers to casual users.
"},{"location":"showcase/data-analytics/#key-features_1","title":"Key Features:","text":"The Apothem XDCScan is the XDC Network\u2019s official test environment. XDCScan Testnet (Apothem) is the block explorer for this testnet, offering all the features of XDCScan but in a testnet context. It is ideal for developers who want to simulate the mainnet environment as closely as possible before deploying their projects.
"},{"location":"showcase/data-analytics/#key-features_2","title":"Key Features:","text":"XDCScan Devnet is a specialized version of XDCScan tailored for the XDC Network\u2019s development environment. It provides a safe and controlled environment for developers to test and debug their smart contracts before deploying them to the mainnet.
"},{"location":"showcase/data-analytics/#key-features_3","title":"Key Features:","text":"When a smart contract imports a contract that it depends on from another source, that top level smart contract and it\u2019s dependencies will have to be flattened before it can be verified on a block explorer. This section explains how to flatten smart contracts using three different development toolchains; Remix, Truffle, and Hardhat.
For a good overview of flattening smart contracts on the XDC Network please refer to this article.
"},{"location":"showcase/flattening-smart-contracts/#flattening-smart-contracts-with-remix","title":"Flattening Smart Contracts with Remix","text":"Remix IDE is one of the most user-friendly tools for smart contract development. To flatten a smart contract in Remix:
Refer to know in detail: https://www.xdc.dev/ivan_blocksscan/learn-how-to-flatten-a-smart-contract-and-verify-on-blocksscan-56on
"},{"location":"showcase/flattening-smart-contracts/#flattening-smart-contracts-with-truffle","title":"Flattening Smart Contracts with Truffle","text":"Truffle is another powerful tool for smart contract development that supports the XDC Network. The process involves:
Refer to know in detail:
"},{"location":"showcase/flattening-smart-contracts/#flattening-smart-contracts-with-hardhat","title":"Flattening Smart Contracts with Hardhat","text":"Hardhat offers advanced tooling for smart contract developers and supports the XDC Network natively. The flattening process using Hardhat involves:
Refer to know in detail: https://www.xdc.dev/jay_kulkarni_842b41d81b23/deploying-and-verifying-a-pepe-token-on-the-xdc-network-using-hardhat-3nc7
"},{"location":"showcase/tokens/","title":"Showcase","text":""},{"location":"showcase/tokens/#tokens-built-on-xdc","title":"Tokens Built On XDC","text":"The XDC Network is a powerful blockchain platform designed to support various digital assets and decentralized applications. One of its key features is the ability to create and manage tokens, which can represent anything from currency to assets, data, or even unique digital items. On the XDC Network, tokens are classified into different standards based on their functionality and use cases. Here\u2019s an overview of the major token standards:
"},{"location":"showcase/tokens/#xrc20","title":"XRC20","text":""},{"location":"showcase/tokens/#overview","title":"Overview:","text":"XRC20 is the most widely used token standard on the XDC Network, similar to the ERC20 standard on Ethereum. XRC20 tokens are fungible, meaning each token is identical in type and value to another token within the same contract. These tokens are primarily used for cryptocurrencies, utility tokens, and other financial instruments.
"},{"location":"showcase/tokens/#key-features","title":"Key Features:","text":"The XRC721 standard allows for the creation of non-fungible tokens (NFTs) on the XDC Network. Unlike XRC20 tokens, XRC721 tokens are unique and cannot be exchanged on a one-to-one basis. Each XRC721 token has a distinct value and set of characteristics, making them ideal for representing ownership of unique items or digital collectibles.
"},{"location":"showcase/tokens/#key-features_1","title":"Key Features:","text":"XRC404 is a specialized token standard designed for hybrid tokens on the XDC Network. These tokens combine features of both fungible and non-fungible tokens, offering a new level of flexibility for developers and businesses.
"},{"location":"showcase/tokens/#key-features_2","title":"Key Features:","text":"XDC Stats is a comprehensive analytics platform designed for the XDC Network. It provides real-time data and insights into various aspects of the blockchain, including token transactions, smart contract activity, and network performance. XDC Stats is essential for developers, investors, and users who need to monitor the network\u2019s health and activity levels.
Mainnet Stats | XinFin Network Stats
"},{"location":"showcase/xdcstats/#key-features","title":"Key Features:","text":"XDC Web wallet: https://betawallet.xinfin.network/
"},{"location":"subnet/","title":"XDC Subnet","text":""},{"location":"subnet/#xdc-subnet","title":"XDC Subnet","text":"XDC Subnet is a technology that allows you to create a secure, scalable, and decentralized network within the XDC Ecosystem. It enables various use cases, including creating private subnets, deploying decentralized applications (dApps), and more. Are you ready to embark on a journey into the world of secure, scalable, and decentralized networks? Look no further than XDC Subnet, the cutting-edge technology that empowers you to create a digital realm tailored to your needs within the thriving XDC Ecosystem.
"},{"location":"subnet/#motivation-design-rationale","title":"Motivation & Design Rationale","text":"As a leading Layer-1 (L1) public blockchain, XinFin\u2019s XDC network has attrated many enterprise and institutional customers. Besides the high performance and high security that XDC already offers, these customers also demand privacy, meaning that their transactions and ledger should not be disclosed to the public. This requirement prohibits them from directly submitting transactions to XDC. Instead, they should only checkpoint snapshots of their ledger to XDC in order to extract XDC\u2019s security.
From a system perspective, \u201csecurity via checkpointing\u201d is achieved via Layer-2 (L2) techniques, such as rollups and subnets. The most popular rollup technique, namely optimistic rollup, is not suitable for our use case. This is because while transaction execution is offloaded to L2, all these L2 transactions are still submitted to L1 as a record. Another popular rollup called zero-knowledge (ZK) rollup solves this problem. But ZK computation is slow, and the type of use cases it can currently support is very limited (such as token transfers), which cannot fulfill the diverse business needs of XDC\u2019s enterprise and institutional customers.
On the other hand, subnet is a perfect solution. By subnet, the customer runs a blockchain and checkpoints its critical consensus data to the parent chain. This way, not only is privacy preserved, the subnet can have its own security and resiliency besides those provided by the parent chain. This is particularly useful to enterprise and institutional customers who may collaborate with untrusted partners. A common criticism against subnet solutions is the high entry bar and operational cost of running a blockchain. However, in XDC\u2019s case, this is indeed welcomed becomes enterprise and institutional customers prefer owning the infrastructure in a private and isolated domain.
Motivated by this opportunity, XDC\u2019s core protocol team has tailor-designed a subnet solution for XDC\u2019s enterprise and institutional customers. It has the following main features: 1. the subnet will be a sovereign, permissioned, and high-performing blockchain wholly owned by the customer. 2. the subnet will be driven by XDC2.0, the most advanced and secure consensus engine originally-built for XDC in-house, and will be deployed to the XDC mainnet, too. 3. a security level equivalent to the sum security of the subnet AND XDC mainnet. 4. native EVM smart contract support. 5. total privacy (i.e., no visibility) of the subset transactions on the XDC mainnet. 6. full access and compatibility to XDC\u2019s abundant SDK and tools, such as the explorer and forensic monitoring system.
"},{"location":"subnet/#architecture","title":"Architecture","text":"The architecture consists of the following key components owned by the customer:
In the rapidly evolving landscape of blockchain technology, staying ahead of the curve is essential. One of the most intriguing advancements in the world of blockchain is the concept of blockchain subnets. In this comprehensive guide, we will dive deep into what blockchain subnets are, how they work, and why they are becoming a game-changer in the blockchain industry.
What Are Blockchain Subnets? Blockchain subnets are like specialized branches of a blockchain network. They allow you to create smaller, independent networks within a larger blockchain ecosystem. Think of them as self-contained mini-blockchains, each with its own unique features and functionalities. These subnets operate alongside the main blockchain but offer more flexibility and scalability.
How Do Blockchain Subnets Work? Blockchain subnets work by segregating the main blockchain into smaller, more manageable parts. This segmentation brings several advantages such as Scalability, Customization, Privacy and Security.
Setting Up Your Own Blockchain Subnet XDC Subnet is a powerful technology that allows you to create a secure, scalable, and decentralized network within the XDC Ecosystem. It enables various use cases, including creating private subnets, deploying decentralized applications (DApps), and more. In this guide, we\u2019ll walk you through the steps to set up your own XDC Subnet, opening doors to a world of possibilities.
Step 1: Uninstall Old Versions
Before you dive into setting up XDC Subnet, ensure that you don\u2019t have any conflicting packages from previous installations. Run the following command to uninstall them:
for pkg in docker.io docker-doc docker-compose podman-docker containerd runc; do sudo apt-get remove $pkg; done\n
Enter fullscreen mode Exit fullscreen mode
Step 2: Set Up the Docker Repository
To install Docker Engine, you need to set up the Docker repository. Follow these steps:
Update the apt package index and install required packages:
$ sudo apt-get update $ sudo apt-get install ca-certificates curl gnupg
Enter fullscreen mode Exit fullscreen mode
Add Docker\u2019s official GPG key:
$ sudo install -m 0755 -d /etc/apt/keyrings $ curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg - dearmor -o /etc/apt/keyrings/docker.gpg $ sudo chmod a+r /etc/apt/keyrings/docker.gpg
Enter fullscreen mode Exit fullscreen mode
Use the following command to set up the repository:
$ echo \\ \u201cdeb [arch=\u201d\\((dpkg - print-architecture)\" signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu \\ \"\\)(. /etc/os-release && echo \u201c$VERSION_CODENAME\u201d)\u201d stable\u201d | \\ sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
Enter fullscreen mode Exit fullscreen mode
Update the apt package index again:
$ sudo apt-get update
Enter fullscreen mode Exit fullscreen mode
Step 3: Install Docker Engine
Now, you can install Docker Engine, containerd, and Docker Compose by running the following command:
sudo apt-get install docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin
Enter fullscreen mode Exit fullscreen mode
Verify the installation by running:
$ sudo docker run hello-world
Enter fullscreen mode Exit fullscreen mode
Update the apt package index & Test the installation.
$ sudo apt-get update $ docker compose version
Enter fullscreen mode Exit fullscreen mode
Your Docker installation will be successfully completed using these steps!
"},{"location":"subnet/Installation_guide/#with-docker-set-up-lets-move-on-to-setting-up-xdc-subnet","title":"With Docker set up, let\u2019s move on to setting up XDC Subnet.","text":"Step 4: Clone the Subnet Repository
Clone the Subnet repository and change the directory:
git clone https://github.com/XinFinOrg/XinFin-Node.git\ncd XinFin-Node/subnet/deployment-generator/\n
Enter fullscreen mode Exit fullscreen mode
Step 5: Create a Docker Environment File
Create a docker.env file with parameters similar to docker.env.example, & make necessary configurations by entering below command.
cp docker.env.example docker.env\n
Enter fullscreen mode Exit fullscreen mode
Below is an example of the minimum file required for configs generation, Update the below parameters with your data in the docker.env file. Refer to check out in detail Config Explanation.
To check out exact config path, enter the following command:
pwd
Enter fullscreen mode Exit fullscreen mode
If you don\u2019t have any private key, You can create it using XDC Beta Web wallet or else you can use XDCPay.
For Devnet XDC, you can visit XDC Devnet Faucet.
docekr.env file:
#deployment config\nCONFIG_PATH= /XinFin-Node/subnet/deployment-generator\n#subnet config\nNETWORK_NAME=testsubnet\nNUM_SUBNET=1\nNUM_MACHINE=3\nMAIN_IP=192.168.1.1\n#parentchain config\nPARENTCHAIN=devnet\nPARENTCHAIN_WALLET=0x0000000000000000000000000000000000000000\nPARENTCHAIN_WALLET_PK=0x0000000000000000000000000000000000000000000000000000000000000000\n
Enter fullscreen mode Exit fullscreen mode
Step 6: Pull the Latest Subnet Generator Image
Pull the latest Subnet Generator image with this command:
sudo docker pull xinfinorg/subnet-generator:latest\n
Enter fullscreen mode Exit fullscreen mode
Step 7: Generate Configurations
Generate configurations, this will create a new generated directory.
docker run --env-file docker.env -v $(pwd)/generated:/app/generated xinfinorg/subnet-generator:latest && cd generated\n
Enter fullscreen mode Exit fullscreen mode
Follow the generated instructions in commands.txt to start Subnet Nodes and make sure they are mining.
Deploy subnet on machine1:
docker compose - env-file docker-compose.env - profile machine1 pull\ndocker compose - env-file docker-compose.env - profile machine1 up -d\n
Enter fullscreen mode Exit fullscreen mode
Step 8: Deploy the Checkpoint Smart Contract
Again, follow the generated instructions in commands.txt to deploy the Checkpoint Smart Contract to the \u201cdeployment-generator\u201d folder.
Run \u201ccd..\u201d command to get back to the \u201cdeployment-generator\u201d folder.
cd ~/.XinFin-Node/subnet/deployment-generator\ndocker run --env-file docker.env \\\n -v $(pwd)/generated/deployment.json:/app/generated/deployment.json \\\n --entrypoint 'bash' xinfinorg/subnet-generator:latest ./deploy_csc.sh\n
Enter fullscreen mode Exit fullscreen mode
Execute the following command to deploy the Checkpoint Smart Contract:
This will provide you with the Checkpoint Smart Contract address (checkpoint deployed to:)
Step 9: Deploy Subnet Services
Follow the instructions in commands.txt to deploy Subnet Services (relayer, stats-server, frontend) to the \u201cdeployment-generator/generated\u201d folder:
cd ~/.XinFin-Node/subnet/deployment-generator/generated\ndocker compose --env-file docker-compose.env --profile services pull\ndocker compose --env-file docker-compose.env --profile services up -d\n
Enter fullscreen mode Exit fullscreen mode
Step 10: Check the Status
docker ps -a\n
Enter fullscreen mode Exit fullscreen mode
Step 11: Explore the Subnet UI
Finally, explore the Subnet UI by accessing it at :5000.
Congratulations! You\u2019ve successfully set up your XDC Subnet, enabling you to harness the full potential of XDC Network\u2019s blockchain technology.
Checkout the guide for XDC Subnet user interface.
"},{"location":"subnet/Installation_guide/#some-common-issues-and-solutions","title":"Some Common Issues and Solutions:","text":"Issue 1: Finding the System\u2019s IP Address
Question: If I do not have the private IP, where can I find the IP address of my system?
Answer: To determine your system\u2019s IP address, use the following command:
ip a\n
Enter fullscreen mode Exit fullscreen mode
Issue 2: Locating the Checkpoint Smart Contract Address
Question: Where can I find the checkpoint smart contract address?
Answer: After executing the command below, you will obtain the \u201ccheckpoint smart contract address.\u201d Please consult the \u201ccommand.txt\u201d file for the necessary commands.
cd ~/.XinFin-Node/subnet/deployment-generator\ndocker run - env-file docker.env \\\n-v $(pwd)/generated/deployment.json:/app/generated/deployment.json \\\n - entrypoint 'bash' xinfinorg/subnet-generator:latest ./deploy_csc.sh\n
Enter fullscreen mode Exit fullscreen mode
Issue 3: Resolving \u201cNo Such File or Directory\u201d Errors
Question: What should I do if I encounter the \u201cno such file or directory\u201d error repeatedly?
Answer: To address this, execute the command below to generate new configuration files. This will create a new directory to replace the existing one. Once you have the new directory, follow the subsequent steps as outlined in the \u201ccommand.txt\u201d file.
docker run - env-file docker.env -v $(pwd)/generated:/app/generated xinfinorg/subnet-generator:latest && cd generated\n
Enter fullscreen mode Exit fullscreen mode
Issue 4: Determining the Exact Config Path for \u201cdocker.env\u201d
Question: How can I find the exact configuration path to update in the \u201cdocker.env\u201d file?
Answer: To obtain the precise configuration path, use the \u201cpwd\u201d command, which will provide you with the necessary information.
pwd\n
Enter fullscreen mode Exit fullscreen mode
Issue 5: Troubleshooting \u2018CSC Deployment Failed\u2019 Issue: Checkpoint Smart Contract Deployment
Question: Encountering a \u201cCSC deployment failed\u201d issue during the deployment of the Checkpoint Smart Contract?
Answer: Please verify that the provided Private Key contains sufficient funds for both the Smart Contract deployment and subsequent transactions.
If you don\u2019t have any private key, You can create it using XDC Beta Web wallet or else you can use XDCPay.
For Devnet XDC, you can visit XDC Devnet Faucet.
Blockchain subnets represent a new frontier in blockchain technology. They offer the scalability, customization, and security needed to drive innovation across various industries. As blockchain subnets continue to gain momentum, staying informed about their capabilities and potential applications is crucial for anyone involved in blockchain development or adoption.
If you have any questions or need assistance, don\u2019t hesitate to reach out to the XDC Network community on XDC.Dev. Start your XDC Subnet journey today!
"},{"location":"subnet/components/","title":"Upgrading the Subnet","text":"404 Upgrading the Subnet
"},{"location":"subnet/setting_up_your_subnet/","title":"Setting Up Your Own XDC-Subnet Tutorial","text":"Setting Up Your Own XDC-Subnet Tutorial
"},{"location":"subnet/upgrading_subnet/","title":"Upgrading the Subnet","text":""},{"location":"subnet/upgrading_subnet/#upgrading-the-subnet","title":"Upgrading the Subnet","text":""},{"location":"subnet/upgrading_subnet/#updating-configs","title":"Updating Configs","text":""},{"location":"subnet/upgrading_subnet/#upgrading-subnet-deployment","title":"Upgrading Subnet Deployment","text":""},{"location":"subnet/upgrading_subnet/#create-a-subnet-backup","title":"Create a Subnet backup","text":"Shutdown the subnet
Make a copy of xdcchain
directory
docker-compose.yml
under generated
directory. docker compose --env-file docker-compose.env --profile machine1 up -d\n docker compose --env-file docker-compose.env --profile services up -d\n
Using latest
tag is not recommended since not all components version are not guaranteed to be compatible.
docker compose --env-file docker-compose.env --profile services down\n
Update configuration (usually ENVs inside common.env file)
Start subnet services
docker compose --env-file docker-compose.env --profile services up -d\n
The guide for XDC Subnet user interface
"},{"location":"subnet/using_subnet/#homepage","title":"Homepage","text":"Once subnet is successfully deployed. The homepage will show the following.
In the lower half of the homepage there are more information as shown.
This card shows further details of subnet blocks, including their height, hash, proposer, and confirmation status. The left side of \u2018confirmation status\u2019 shows the block being committed in the Subnet chain and the right side shows the block hash being recorded in the Parent chain.
This card shows a detailed view of the subnet nodes including their address. The status also differrentiates inactive nodes to \u2018penalty\u2019 or \u2018standby\u2019
Additionally, you can select the UI theme (light or dark) by toggling this button.
After navigating with the left menu bar to the Confirmation Checker of the Subnet, this will be shown.
The input box accepts Block height, Block hash, and even TX hash.
After your input, the search engine will traverse the chain and display the info accodingly. Below is an example of Block height search.
Next is another example of a Block hash search.
Subnet management is used for adding and removing Masternodes in the Subnet. To manage the subnet, you need to use the Grandmaster Account, as only the Grandmaster has the right to manage the Subnet.
You can find the Grandmaster Key in the keys.json
file.
After making a modification with Subnet management, the change will take effect in the next epoch (900 blocks).
When adding a Masternode address in the management, the new Masternode server should also be started up and added to the network.
"},{"location":"subnet/using_subnet/#1-log-in-to-the-wallet-and-connect-to-the-subnet","title":"1. Log in to the Wallet and Connect to the Subnet","text":"To manage the subnet, you need to use your Grandmaster Account. Find the Grandmaster Key in the keys.json
file and import this account into your wallet.
Click the Connect Wallet
button.
Choose your wallet and allow the subnet network to be added. The wallet will automatically switch to this network, as shown below:
If the wallet doesn\u2019t switch to the subnet automatically, follow the instructions on the page to fill in the network details manually and connect to the subnet.
You will see a confirmation page like this:
"},{"location":"subnet/using_subnet/#2-node-operations","title":"2. Node Operations","text":""},{"location":"subnet/using_subnet/#21-add-nodes-in-a-subnet","title":"2.1 Add Nodes in a Subnet","text":"Subnet nodes are managed by two files. To add a node, create the corresponding subnetX.env
file and add an entry in docker-compose.yml
. Apply the changes to add the node to the subnet. (To remove a node, delete the related configuration file)
To add a node, follow these steps:
Go to the generated
directory and run the add-node.sh
script. Enter the key when prompted:
cd .scripts/add-node.sh\n
Update the subnet settings with the following commands:
docker-compose --env-file docker-compose.env --profile machine1 up -d\ndocker-compose --env-file docker-compose.env --profile services up -d\n
Add a new master candidate
button to add the node as a master node. Delegation amount must be at least 10,000,000
Subnet tokens. In the list, select the node you want to change the delegation for, then click the Promote
/ Demote
button and enter the new delegation amount.
If increasing the delegation, ensure the total delegation amount is over 10,000,000
Subnet tokens; otherwise, the transaction will fail.There is no extra benefit in delegating more than 10,000,000 tokens to an address
If decreasing the delegation, ensure the remaining amount is still at least 10,000,000
Subnet tokens; otherwise, the transaction will fail.
Remove
button.In Subnets, all native tokens are initially assigned to the Grandmaster Wallet. To allow users to use the Subnet, we have to distribute the tokens out of the Grandmaster. We have provided convenient scripts for you to easily share Subnet tokens to your users.
"},{"location":"subnet/using_subnet/#one-time-transfer","title":"One-time Transfer","text":"Under generated
directory run the Faucet script.
./scripts/faucet.sh\n
The script will ask for your source wallet private key. You can use the Grandmaster Wallet(check keys.json
file for the private key). Then input the destination wallet and the transfer amount.
Under generated
directory run the Faucet server script.
./scripts/faucet-server.sh\n
The script will ask for your source wallet private key. you can use the Grandmaster Wallet(check keys.json
for the private key). By default, the server is hosted on port 5211
of your machine. Then, on your browser, visit the url: http://127.0.0.1:5211
Input your destination wallet or feel free to generate a random wallet via Address Generator.
Submit and wait for confirmation.
You can host this on any server and allow users to make token requests by themselves.
"},{"location":"subnet/using_subnet/#transfer-subnet-funds-without-faucet","title":"Transfer Subnet Funds Without Faucet","text":"The Faucet is not neccessary needed for funds transfer, most Ethereum compatible web3 wallet will also work.
First import a new wallet with the Grandmaster private key. Then add a custom network pointing to your Subnet RPC URL. Finally, use the web3 wallet for tokens transfer.
"},{"location":"subnet/using_subnet/#faucet-source-code","title":"Faucet Source Code","text":"Please feel free to check the below repositories for the Subnet Faucet source code.
https://github.com/XinFinOrg/XinFin-Node/tree/master/subnet/deployment-generator/scripts
https://github.com/XinFinOrg/XinFin-Node/tree/master/subnet/deployment-generator/src/faucet.js
"},{"location":"subnet/using_subnet/#blockchain-explorer","title":"Blockchain Explorer","text":"You may optionally use an external blocks explorer if you require verbose browsing such as block detail, accounts browsing, contracts browsing. We can recommend Chainlens-free as one of the solution. Please follow the instructions as the previous link. You only need to pass one of the Subnet\u2019s RPC as a variable in the docker-compose
command, which will most likely be NODE_ENDPOINT=http://localhost:8545
or NODE_ENDPOINT=http://<MAIN_IP>:8545
.
This section specifies the API library we develop for the subnet users to confirm subnet transactions.
"},{"location":"subnet/components/api_library/#specifications","title":"Specifications","text":"TBW
"},{"location":"subnet/components/checkpoint_contract/","title":"Upgrading the Subnet","text":""},{"location":"subnet/components/checkpoint_contract/#checkpoint-smart-contract","title":"Checkpoint Smart Contract","text":"This section specifies the Checkpoint Smart Contract in the parent chain that protects the child chain.
"},{"location":"subnet/components/checkpoint_contract/#design","title":"Design","text":""},{"location":"subnet/components/checkpoint_contract/#overview","title":"Overview","text":"The primary function of the parent chain smart contract is to receive block data from the subnet node, verify it, and store it.
Noteworthy aspects:
Every block data received will be verified to ensure the signature is signed by validators and has passed with \u2154 of the votes.
In the gap block occurring in the middle of each epoch, a next
may appear, which will be selected for temporary storage.
In each epoch block, a current
may appear, which will choose the next
selected during the gap as validators from the current block to the next epoch.
Only three consecutive blocks of roundNumber
can confirm the previous block, and mainnetNum
will change from -1 to block.number
once the block is committed.
The Checkpoint contract implements a blockchain checkpoint system, which verifies and stores block header information for subnetworks. Here are some key functions and features:
The contract defines several data structures, such as Header
, HeaderInfo
, Validators
and BlockLite
. These structures are used to store block header information, validator information, and more.
The contract employs several mappings and other variables to track the current block header tree, committed blocks, validator set, latest block, and so forth.
The contract\u2019s constructor receives the initial validator set, the genesis block header, the first block header, etc., as parameters and initializes the contract state based on these.
The receiveHeader
function allows users to submit new block headers. This function will verify the meta information of the block header (like block number, parent block hash, etc.), the signature certificate, and update the block\u2019s submission status when specific conditions are met.
Functions such as setLookup
, setCommittedStatus
, checkUniqueness
, and checkCommittedStatus
are used to update or check the contract\u2019s internal status.
Functions like getHeader
, getHeaderByNumber
, getLatestBlocks
and getCurrentValidators
enable users to query block header information, validator sets, etc.
The splitSignature
and recoverSigner
functions are used to recover the signer\u2019s address from the signature, which is necessary for verifying the block header signature.
Logic Flow:
Checkpoint uses the following parameters for contract construction:
address[] initial_validator_set
: List of initial validator addresses
bytes genesis_header
: block0HexRLPbytes block1_header
: block1HexRLPuint64 gap
: GAP block number on public chainuint64 epoch
: EPOCH block number on public chain
Relayers need to fetch every block data from the subnet node.
Users can retrieve the information of each block using methods such as getHeader
.
Lite Checkpoint is a lightweight block header checkpoint. It implements several functions, including:
Logic Flow:
Lite Checkpoint uses the following parameters for contract construction:
address[] initialValidatorSet
: List of initial validator addresses
bytes block1
: block1HexRLPuint64 gap
: GAP block number on public chainuint64 epoch
: EPOCH block number on public chain
Relayers only need to fetch gap/epoch block data and fetch the following consecutive roundNumber
blocks to confirm the signed gap/epoch block from the subnet node.
Users can get gap/epoch block information from methods such as getHeader
.
The Upgradeable module mainly revolves around the concept of transparent proxies and the ability to upgrade the underlying logic contracts without changing the contract\u2019s address.
"},{"location":"subnet/components/checkpoint_contract/#proxygateway-smart-contract","title":"ProxyGateway Smart Contract","text":"The ProxyGateway
smart contract plays a central role in this module. It inherits from ProxyAdmin
and primarily serves the purpose of creating and managing transparent upgradeable proxies (TransparentUpgradeableProxy
).
Key Components and Functionalities:
A mapping used to store two types of transparent upgradeable proxies.
0
represents \u201cfull\u201d1
represents \u201clite\u201dCreateProxy Event:
Emitted whenever a new transparent upgradeable proxy is created.
createProxy Function:
TransparentUpgradeableProxy
.Emits the CreateProxy
event upon creation.
createFullProxy Function:
Ensures the provided logic contract has a MODE
function that returns \u201cfull\u201d.
createLiteProxy Function:
MODE
function that returns \u201clite\u201d.Logic Flow:
The process begins with the ProxyGateway
contract, which serves as a central hub for creating transparent upgradeable proxies. The contract owner has the capability to create either \u201cfull\u201d or \u201clite\u201d proxies.
Proxy Creation:
The owner calls either the createFullProxy
or createLiteProxy
function based on the desired type of proxy.
MODE
is checked to ensure it matches the desired proxy type.TransparentUpgradeableProxy
is created with the specified logic contract, the ProxyGateway
as the admin, and any necessary initialization data.cscProxies
mapping under its corresponding type.The CreateProxy
event is emitted to log the creation of the new proxy.
Upgrading the Proxy:
When there\u2019s a need to upgrade the underlying logic of the proxy (for instance, to introduce new features or fix bugs):
ProxyGateway
contract calls the inherited upgrade
function from ProxyAdmin
to point the proxy to the new logic contract.This enables the system to evolve and implement new functionalities without migrating to a new contract address or affecting the contract\u2019s stored data.
Interacting with the Proxy:
Users and other contracts can interact with the proxy just as they would with a regular contract. However, behind the scenes, all function calls and data accesses are delegated to the current logic contract that the proxy points to.
Users and contracts can still query data, access functions, or invoke transactions on the proxy\u2019s address. The proxy transparently delegates these to the underlying logic contract, ensuring continuity of operations.
Through the ProxyAdmin
functionality, the owner can further manage the proxy, such as changing the admin or even downgrading to a previous version of the logic contract if needed.
Functions that have access restriction to authorized client
reviseValidatorSet(address[], int, int)
: Update subnet block header signer list at destined heightreceiveHeader(bytes[])
: Validate and store subnet headersFunctions that open for public access
getHeader(byte32)
: Return entire block header in RLP encoding formatgetHeaderByNumber(int)
: Return block hash and number at input heightgetHeaderConfirmationStatus(byte32)
: Return block committing statusgetMainnetBlockNumber(byte32)
: Return mainnet block number that processed the subnet block headergetLatestBlocks()
: Return latest committed block and submitted blockBlock header verification follows two principle rules: 1. Received block should have consistent round number and block number associated with its parent block. 2. Received block should have enough certificates signed by the list of block signers.
Once a block header is checked and stored, the contract will examine whether there are 3 consecutive blocks that have 3 consetive round number. If that is the case, all of the direct ancestor blocks that are prior to these 3 consecutive blocks will be committed.
"},{"location":"subnet/components/relayer/","title":"Upgrading the Subnet","text":""},{"location":"subnet/components/relayer/#relayer","title":"Relayer","text":"This section specifies the relayer that checkpoints the subnet chain to the parent chain.
"},{"location":"subnet/components/relayer/#design","title":"Design","text":""},{"location":"subnet/components/relayer/#background","title":"Background","text":"There is a strong demand from the banking industry to adopt XDC. One of the key requirements to enter the field is the ability to support subnets so that banks are able to keep the sensitive transactions within their own domain (privacy concern) but at the same time, have the ability to continuously audit the result (hash) of the subnet transactions on the XDC mainnet (security concern).
Since the mainnet and subnets will be running as two independent node cluster, we will need to figure out a method to bridge them together to perform the auditing feature mentioned above. This is where \u201crelayer\u201d is coming into play.
"},{"location":"subnet/components/relayer/#high-level-architectural-diagram","title":"High-level architectural diagram","text":"At high level, the relayer is able to: 1. Pull necessary data from both subnet and mainnet 2. Process and submit subnet block data as smart contract transactions into mainnet 3. When subnet masternodes list changes, report the new list and change height to the mainnet using grand-master account.
"},{"location":"subnet/components/relayer/#relayer-mode","title":"Relayer Mode","text":"There are 2 relayer modes \u2018Full\u2019 and \u2018Lite\u2019 where the default mode is \u2018Full\u2019. In the full mode, all subnet block headers are checkpointed to the parent chain. In the lite mode, only the Epoch and Epoch gap subnet block headers are checkpointed in the parent chain (blocks 451,900,1351,1800, and so on). The Epoch and Epoch gap blocks stores important information regarding subnet validators selection. For further reading please check Checkpoint Smart Contract.
"},{"location":"subnet/components/relayer/#choosing-full-or-lite-relayer","title":"Choosing Full or Lite Relayer","text":"The Full mode has the advantage of being more \u2018complete\u2019 and more \u2018current\u2019 as blocks are getting confirmed in the parent chain almost immediately. The Lite mode has the advantage of using lower parent chain gas fee as the Relayer is only submitting to once every 450 blocks.
"},{"location":"subnet/components/relayer/#deployment","title":"Deployment","text":"In the deployment RELAYER_MODE
config is only relevant for Checkpoint Smart Contract (CSC) deployment. The relayer itself is able to detect the CSC type automatically and push block headers accordingly.
This section specifies the subnet itself, a sovereign, permissioned, and high-performing blockchain.
"},{"location":"subnet/components/subnet_chain/#design","title":"Design","text":"XDC subnet is a blockchain network tailored for private and consortium use cases. It is powered by XDC2.0, which is the core engine of XDC network and enables state-of-the-art security against Byzantine attacks with forensics, fast transaction confirmation, and low energy consumption. It is also designed to enable secure checkpointing to XDC mainnet, so that it can harness the security, finality, and accountability of mainnet.
"},{"location":"subnet/components/subnet_chain/#xdc20-protocol","title":"XDC2.0 Protocol","text":"As the core engine of both XDC mainnet and subnet, XDC2.0 maintains the consistency of the blockchain with strong security and performance guarantees. The Delegated Proof-of-Stake subprotocol elects a committee of masternodes. The masternodes run the state-of-the-art HotStuff consensus subprotocol to settle block generation and verification and confirm transactions. Besides, XDC2.0 protocol enables its unique feature, namely forensic monitoring. When the adversary corrupts more than \u2153 masternodes and violates safety, forensic monitoring can detect those actions and report irrefutable evidence of the culprits.
The distinction between XDC2.0 for subnet and mainnet is that for subnet the masternodes are permissioned whereas for mainnet they are permissionless.
"},{"location":"subnet/components/subnet_chain/#your-own-blockchain-network","title":"Your Own Blockchain Network","text":"XDC subnet is completely owned by you. You, the owner of the subnet, are capable of controlling several aspects of the subnet.
First, the owner regulates the master node list. More specifically, the join/retire of mater nodes is done by smart contract calls that only the owner has access to. Also, underperforming or misbehaving masternodes could be expelled by the owner. This is in contrast with XDC mainnet, where masternodes join or leave willingly as long as they follow the rule enforced by the protocol.
Second, the blockchain genesis can be configured by the owner. The owner is able to distribute initial tokens and create accounts, as well as deploy system-level smart contracts on the blockchain.
Last, the owner can customize blockchain parameters, such as epoch length, max masternode number, the quorum certificate threshold, the reward per epoch, etc.
"},{"location":"subnet/components/subnet_chain/#integrating-with-xdc-mainnet","title":"Integrating with XDC mainnet","text":"Integrating with XDC mainnet will enable subnet to harness the security, finality, and accountability of XDC mainnet. This requires the subnet owner to deploy a smart contract (XDC will provide) to XDC mainnet and report block headers and masternode changes to the smart contract.
As long as the mainnet is secure, the block header information of the subnet is securely stored on the mainnet. Users can also query the mainnet for finality to enhance the confidence that the subnet transaction is indeed finalized. The subnet can also report the culprits to the forensic server of XDC mainnet when its forensic monitor module detects safety violations. When the culprit report is validated, necessary measurements should be taken by the owner to reestablish the security of the subnet.
It is worth noting that the subnet can be deployed as a standalone, independent blockchain network without integrating with XDC mainnet. The choice is up to the owner whether to harness the advantages of XDC mainnet.
"},{"location":"subnet/components/subnet_chain/#api","title":"API","text":"Subnet-specific APIs
"},{"location":"subnet/components/subswap/","title":"Upgrading the Subnet","text":""},{"location":"subnet/components/subswap/#subswap","title":"Subswap","text":""},{"location":"subnet/components/subswap/#design","title":"Design","text":"Topic: Design of Subswap Cross-Chain Transfer System on XDC Zero
Subswap is cross-chain application built on XDC Zero to provide seamless cross-chain transfer capabilities. It is structured in a multi-layered architecture, with each layer handling distinct functions to ensure smooth, secure, and efficient transactions across blockchain networks. This document provides a design overview of each layer, illustrating the components and their roles within the Subswap system.
"},{"location":"subnet/components/subswap/#system-architecture","title":"System Architecture","text":"Subswap is organized into three layers:
Front-End Management: Handles the user interface and manages interactions with the underlying protocols, offering a streamlined experience for users initiating cross-chain transfers.
Layer 1 - Treasury
Lock/Unlock Contract: Locks assets on the source chain and unlocks them on the target chain, ensuring that the asset\u2019s total supply remains consistent and secure across chains.
Layer 2 - Swap Protocol
Subswap leverages XDC Zero\u2019s powerful infrastructure to deliver an efficient cross-chain transfer service. By layering its architecture, Subswap can maintain security, scalability, and ease of use, meeting the needs of users looking for seamless asset transfers across multiple blockchain networks.
"},{"location":"subnet/components/subswap/#constructionif-you-want-to-make-a-cross-chain-transfer","title":"Construction(if you want to make a cross chain transfer)","text":""},{"location":"subnet/components/subswap/#spec","title":"Spec","text":""},{"location":"subnet/components/subswap/#subswap-api-documentation","title":"Subswap API Documentation","text":"This document provides an API reference for the Subswap contracts, specifically for the ParentnetTreasury
and SubnetTreasury
contracts. These contracts facilitate cross-chain asset transfers by minting, burning, locking, and unlocking tokens between chains.
changeEndpoint(address endpoint) -> void
endpoint
: The address of the new endpoint.Access: onlyOwner
setEndpoint(address endpoint) -> void
endpoint
: The address of the new endpoint.Access: onlyEndpoint
mint(...) -> void
SubnetTreasury
chain in response to a cross-chain transfer.originalToken
: Address of the original token.name
: Name of the token.symbol
: Symbol of the token.account
: Address of the account receiving the minted tokens.amount
: Number of tokens to mint.sid
: Source chain ID.onlyEndpoint
changeEndpoint(address endpoint) -> void
endpoint
: The address of the new endpoint.Access: onlyOwner
setEndpoint(address endpoint) -> void
endpoint
: The address of the new endpoint.Access: onlyEndpoint
unlock(address token, uint256 amount, address recv) -> void
token
: Address of the token to unlock.amount
: Amount of tokens to unlock.recv
: Address of the recipient.onlyEndpoint
burn(...) -> void
ParentnetTreasury
side to initiate a cross-chain transfer, sending a message to SubnetTreasury
to mint tokens.rid
: Destination chain ID.rua
: Receiver\u2019s address on the destination chain.originalToken
: Address of the original token on the source chain.token
: Address of the Treasury token to burn.amount
: Number of tokens to burn.recv
: Address to receive tokens on the destination chain.Events:
Burn
event with details of the burned amount and target chain.test(uint256 rid, address rua, bytes memory data) -> void
Parameters:
rid
: Destination chain ID.rua
: Receiver\u2019s address on the destination chain.data
: Encoded data to send.getEndpoint() -> address
lock(...) -> void
SubnetTreasury
side to initiate a cross-chain transfer, sending a message to ParentnetTreasury
to mint tokens.rid
: Destination chain ID.rua
: Receiver\u2019s address on the destination chain.token
: Address of the token to lock.amount
: Amount of tokens to lock.recv
: Address to receive tokens on the destination chain.Events:
Lock
event with details of the locked amount and target chain.getChainId() -> uint256
Description: Returns the chain ID of the current chain.
getEndpoint() -> address
SubnetTreasury
locks tokens on its chain, it sends a message to ParentnetTreasury
to mint an equivalent amount on the destination chain.If a Treasury token contract does not exist for the original token, a new one is created and mapped to the original token in treasuryMapping
.
Burning (ParentnetTreasury)
burn
function is called to destroy tokens on ParentnetTreasury
. SubnetTreasury
to unlock an equivalent amount on the destination chain.SubnetTreasury
by transferring them from the caller\u2019s address to the contract. The contract then sends a cross-chain message to ParentnetTreasury
to mint equivalent tokens on the destination chain.
Unlocking (SubnetTreasury)
ParentnetTreasury
, the SubnetTreasury
unlocks tokens on its chain and sends them to the specified recipient.IEndpoint
interface, which abstracts the low-level cross-chain communication.abi.encodeWithSelector
to create a message payload, ensuring proper handling of contract-specific calls on the destination chain.XDC-Zero is a cross-chain framework that allows interoperability between XDC-Subnet and the XDC network. It ensures frictionless data transmission and rigorous validation across the Subnet and the Parentchain.
"},{"location":"subnet/components/xdc_zero/#key-components","title":"Key Components","text":""},{"location":"subnet/components/xdc_zero/#oracle","title":"Oracle","text":"Acting as the architectural keystone, the Oracle ensures the safe transfer of pivotal data, notably block headers, bridging source and target blockchains. Utilizing CSC contracts, the system guarantees not just steadfast data transfer but also the safeguarding of crucial block header details on the destination blockchain. Such functionalities affirm the data\u2019s integrity and coherence throughout chains.
"},{"location":"subnet/components/xdc_zero/#relayer","title":"Relayer","text":"The Relayer functions as the essential conduit for transactional precision. Its core duty is to extract payload data from the source chain\u2019s Endpoint contract and channel it to the counterpart on the target chain. With this mechanism in place, XDC ZERO promises the exact and secure relay of transaction data, fostering efficient cross-chain synergies.
"},{"location":"subnet/components/xdc_zero/#endpoint","title":"Endpoint","text":"The XDC Zero Endpoint stands as the nexus for cross-chain communication, adeptly receiving and dispatching data packets across disparate blockchain networks. It offers indispensable services for the fluid operation of the cross-chain paradigm:
At its core, the Endpoint functions as the orchestrator for all cross-chain data activities, ensuring data is meticulously received, processed, and channeled to its rightful destination.
"},{"location":"subnet/components/xdc_zero/#frontend","title":"Frontend","text":"Experience a user-centric interface to manage the endpoint contracts spanning different chains. View the chain entities already synchronized with the current endpoint contract and effortlessly onboard new chain entities as per requirements.
"},{"location":"subnet/components/xdc_zero/#endpoint-workflow","title":"Endpoint workflow","text":""},{"location":"subnet/components/xdc_zero/#workflow","title":"Workflow","text":""},{"location":"subnet/components/xdc_zero/#api-documentation","title":"API Documentation","text":""},{"location":"subnet/components/xdc_zero/#restricted-access-functions","title":"Restricted Access Functions","text":"Functions accessible only by the contract owner or authorized clients.
send(uint256 rid, address rua, bytes data)
Description: Sends a packet to the designated receive chain.
Parameters:
rid
: ID of the receive chain.rua
: Address of the receive application.data
: Data payload for the packet.validateTransactionProof(uint256 csid, bytes key, bytes[] calldata receiptProof, bytes[] calldata transactionProof, bytes32 blockHash)
Description: Validates transaction and receipt proofs, ensuring secure cross-chain communication.
Parameters:
csid
: ID of the send chain.key
: RLP key.receiptProof
: Proof data for the transaction receipt.transactionProof
: Proof data for the transaction.blockHash
: Hash of the relevant block.registerChain(uint256 chainId, IFullCheckpoint csc, Endpoint endpoint)
Description: Registers a new chain for packet reception.
Parameters:
chainId
: ID of the chain being registered.csc
: Checkpoint contract for the receive chain.endpoint
: Endpoint contract for the send chain.approveApplication(uint256 rid, address rua, address sua)
Description: Approves both a receive and send application for cross-chain interaction.
Parameters:
rid
: ID of the receive chain.rua
: Address of the receive application.sua
: Address of the send application.approveRua(uint256 rid, address rua)
Description: Approves a receive application (rua) for a specific chain.
Parameters:
rid
: ID of the receive chain.rua
: Address of the receive application.approveSua(address sua)
Description: Approves a send application (sua) for packet sending.
Parameters:
sua
: Address of the send application.revokeApplication(uint256 rid, address rua, address sua)
Description: Revokes approval for both a receive and send application.
Parameters:
rid
: ID of the receive chain.rua
: Address of the receive application.sua
: Address of the send application.revokeRua(uint256 rid, address rua)
Description: Revokes approval for a specific receive application.
Parameters:
rid
: ID of the receive chain.rua
: Address of the receive application.revokeSua(address sua)
sua
: Address of the send application.Functions accessible by any user or contract on the blockchain.
packetHash() returns (bytes32)
Description: Retrieves the hash for the Packet event.
getRlp(bytes memory key, bytes[] calldata proof, bytes32 root) returns (bytes memory)
Description: Retrieves RLP data based on a Merkle Patricia proof.
getFailureDataLength(uint256 rid) returns (uint256)
Description: Retrieves the count of failed data entries for a specified receive chain.
getReceiveChainLastIndex(uint256 chainId) returns (uint256)
Description: Retrieves the last index for a specified receive chain.
getSendChain(uint256 chainId) returns (Chain memory)
Description: Retrieves details of a send chain based on its ID.
getSendChainIds() returns (uint256[] memory)
Description: Returns an array of all registered send chain IDs.
allowanceRua(uint256 rid, address rua) returns (bool)
Description: Checks if a receive application is approved for a specific chain.
Parameters:
rid
: ID of the receive chain.rua
: Address of the receive application.allowanceSua(address sua) returns (bool)
sua
: Address of the send application.After the generator has succesfully run, all generated files will be under \u2018generated\u2019 directory. These files can be edited if you would like to further customize your subnet. Below is a description of each generated file and how it is used.
subnetX.env
for each individual subnet.BOOTNODE_PORT
under common.env
. Also in each subnetX.env
, BOOTNODES
port has to be changed.Subnet blocks are not being mined.
First confirm that the Subnet nodes are able to communicate with each other through the network layer. Run the check peer script generated/scripts/check-peers.sh
the number of peers should be one less than number of subnet nodes. For example, if there are 3 Subnet nodes in total, each node should have 2 peers.
If the nodes are peering but still not mining, it could be a low memory issue. In Docker configs you can try to increase memory or swap. Then, in case of fresh Subnet, delete data and start the nodes again. !
Docker engine in Mac OS can be inconsistent after long-running or high-load. It could help to restart the machine and hard reset the subnet to get it running.
Subnet node does not boot with error log Fatal: Error starting protocol stack: listen unix /work/xdcchain/XDC.ipc: bind: invalid argument
This is due to the volume mount path being too long. The mounth path is your current directory (also can check with pwd
command). Please move the generated
folder to a shorter path and try again.
Docker image startup fails with SIGKILL
or Error code: 137
found in logs. (Issue found in Frontend image)
This error occurs because Docker ran Out Of Memory (OOM). You can increase the memory limit in Docker settings
generated/scripts/check-mining.sh
This will check your current block in Subnet
generated/scripts/check-peers.sh
This will check the number of peers of your Subnet node
"},{"location":"subnet/install_guide/f%26q/#subnet-node-requirements","title":"Subnet Node Requirements","text":"Even one node is enough to start the Subnet blockchain! However, for better decentralized security, 3+ nodes are recommended. At least \u2154 of all nodes must be online and honest to mine blocks.
"},{"location":"subnet/install_guide/f%26q/#development-and-testing","title":"Development and Testing","text":"It\u2019s recommended to use the testnet, as the devnet will be less stable due to frequent development changes.
"},{"location":"subnet/install_guide/f%26q/#managing-subnet-tokens","title":"Managing Subnet Tokens","text":"In XDC-Subnet, all initial tokens are assigned to the Grandmaster wallet (check keys.json
). You can transfer tokens to any wallet address. For easy transfers, refer to the Faucet documentation.
How can I manage Subnet tokens?
Use the Subnet Faucet to easily transfer Subnet tokens to your users.
Use any Web3 wallet (such as Metamask or OKX wallet), add the Subnet RPC as a custom network then connect to the Subnet and transfer tokens to other addresses.
How can I easily give out Subnet tokens to my users?
A Faucet server script is provided for you to deploy under generated/scripts/faucet-server.sh
. Anyone with access to the faucet page can request tokens. Please refer to the faucet page for more details.
The following files contain sensitive information and should be stored securely:
common.env
contract_deploy.env
keys.json
subnet*.env
You can update the common.env
file to change the Relayer key. Refer to the service configuration documentation for more details.
For troubleshooting support, join our Telegram Support Group. For suggestions or requests, you can also reach out via:
OS: Linux. Only Linux is supported for full deployment.
OS: Mac is only supported for single machine testing environment.
docker, docker compose V2. For manual installation of docker compose V2 please refer to: https://docs.docker.com/compose/install/linux/
Recommended Hardware (per single Subnet node):
Web3 wallet with funds. For testing we have faucets provided:
Pull generator.sh
script from the generator Github repo
curl -O https://raw.githubusercontent.com/XinFinOrg/XinFin-Node/master/subnet/deployment-generator/scripts/generate.sh\n
Run the configuration generator, this will start a local webserver
chmod +x generate.sh\n./generate.sh\ncd generated\n
Go to http://localhost:5210/ in your browser. If you are running this on a remote server.
first use ssh tunnel: ssh -N -L localhost:5210:localhost:5210 USERNAME@IP_ADDRESS -i SERVER_KEY_FILE
**if you're using VSCode to SSH, the port might be forwarded to your machine automatically (no need for above step)
Config the Subnet options per your requirement.
follow the generated instructions in commands.txt
. In general, the steps are:
Once successfully deployed, you can check out UI usage guide
Under generated
directory
docker compose --env-file docker-compose.env --profile services down \ndocker compose --env-file docker-compose.env --profile machine1 down\n
"},{"location":"subnet/install_guide/launch_subnet/#deleting-subnet","title":"Deleting Subnet","text":"Remove xdcchain*
, bootnodes
, and stats-service
directories Warning: this cannot be undone
rm -rf xdcchain* bootnodes stats-service\n
"},{"location":"xdcchain/","title":"XDC Chain","text":"XDC Chain The XDC Network is a cutting-edge blockchain platform designed to revolutionize the way businesses manage and exchange data, assets, and financial records. Boasting impressive speed and scalability, the XDC Network is capable of handling a high volume of transactions with minimal delays, making it ideal for enterprise-level applications. Its low transaction fees further enhance its appeal, allowing businesses to conduct operations cost-effectively.
What truly sets the XDC Network apart is its military-grade security, ensuring that all data exchanges and asset transfers are protected against potential threats. This level of security is crucial for industries where trust and confidentiality are paramount. By leveraging the XDC Network, businesses can streamline their operations, improve record-keeping accuracy, and facilitate more efficient and secure data exchanges. Whether it's in finance, supply chain management, or trade, the XDC Network provides a robust and reliable infrastructure that empowers businesses to thrive in the digital age.
DevelopersUser guide to get started on XDC Chain
GovernanceXDC Network is a community-oriented ecosystem, meticulously built upon the foundation of decentralized governance.
XDC EcosystemXDC ecosystem and developer tools
Run a MasterodeHow to run a XDC Masternode
JSON-RPC APIInteracting with XDC requires sending requests to specific JSON-RPC API methods.
"},{"location":"xdcchain/evmtoxdc/","title":"Overview - XDC Chain","text":""},{"location":"xdcchain/evmtoxdc/#migrating-from-evm-to-xdc","title":"Migrating from EVM to XDC","text":"Migrating a Solidity contract from Ethereum to the XDC network with Truffle involves several steps. The XDC network is a public blockchain that is EVM-compatible and designed to support enterprise-level applications. Truffle is a popular development framework for creating and deploying Solidity contracts.
"},{"location":"xdcchain/evmtoxdc/#step-1-install-truffle","title":"Step 1: Install Truffle","text":"The first step is to install the XDC network and Truffle. This can be done by following the installation instructions provided by XDC and Truffle.
Installation - Truffle Suite
"},{"location":"xdcchain/evmtoxdc/#step-2-configure-truffle-for-xdc","title":"Step 2: Configure Truffle for XDC","text":"Next, Truffle needs to be configured to work with the XDC network. This involves creating a new Truffle project and configuring the Truffle config file to connect to the XDC network by using a public RPC connected to the XDC network.
Configuration - Truffle Suite
"},{"location":"xdcchain/evmtoxdc/#step-3-compile-the-contract","title":"Step 3: Compile the Contract","text":"After updating the Solidity contract, it needs to be compiled for the XDC network. This involves using the Truffle compiler to create a bytecode file that can be deployed on the XDC network.
Compile contracts - Truffle Suite
"},{"location":"xdcchain/evmtoxdc/#step-4-deploy-the-contract","title":"Step 4: Deploy the Contract","text":"The next step is to deploy the updated contract on the XDC network. This can be done using Truffle\u2019s deployment commands. It is important to ensure that the contract is deployed correctly and securely.
"},{"location":"xdcchain/evmtoxdc/#step-5-test-the-contract","title":"Step 5: Test the Contract","text":"After deploying the contract, it is important to thoroughly test it on the XDC network. This includes testing all functions and features, as well as testing for security vulnerabilities. You can write tests in Truffle using Javascript to build debug and test contracts ready to be deployed onto the network
Write JavaScript tests - Truffle Suite
"},{"location":"xdcchain/evmtoxdc/#step-6-update-clients-and-interfaces","title":"Step 6: Update Clients and Interfaces","text":"Once the contract has been migrated and tested, any clients or interfaces that interact with the contract must be updated to be compatible with the XDC network by having them point to the appropriate RPCs on the xdc network.
For a How-To guide showing migration of a dApp from Ethereum to the XDC Network please go to this link.
"},{"location":"xdcchain/introduction/","title":"Introduction","text":""},{"location":"xdcchain/introduction/#introduction","title":"Introduction","text":"XinFin\u2019s XDC Network is an enterprise-ready, Layer-1, EVM-compatible, open-source, hybrid blockchain protocol specializing in tokenization for real-world decentralized finance. It uses a special type of delegated proof-of-stake (XDPoS) for consensus to ensure quick transaction times, minimal gas fees, and a remarkable 2,000+ transactions per second (TPS).
XDC Network is backed by the XDC Community, leading to the formation of the XDC Foundation, which was established in 2021 to promote the growth and adoption of XDC through collaboration with a community of developers, trade experts, and content creators.
"},{"location":"xdcchain/introduction/#xinfin-delegated-proof-of-staked-authority","title":"XinFin Delegated Proof of Staked Authority","text":"-
"},{"location":"xdcchain/introduction/#security","title":"Security","text":"-
"},{"location":"xdcchain/introduction/#fast-finality","title":"Fast Finality","text":"-
"},{"location":"xdcchain/introduction/#reward","title":"Reward","text":"-
"},{"location":"xdcchain/introduction/#token-economy","title":"Token Economy","text":"-
"},{"location":"xdcchain/introduction/#staking-and-governance","title":"Staking and Governance","text":"-
"},{"location":"xdcchain/rewards/","title":"Rewards Mechanism","text":""},{"location":"xdcchain/rewards/#rewards-mechanism","title":"Rewards Mechanism","text":"The XDC Network operates on a Delegated Proof of Stake (XDPoS) consensus mechanism, which allows for high transaction throughput, energy efficiency, and security. The network\u2019s rewards mechanism is designed to incentivize Masternode operators and participants who contribute to the stability, security, and growth of the network. This document outlines how the XDC rewards mechanism works, who is eligible for rewards, and how rewards are distributed.
"},{"location":"xdcchain/rewards/#overview-of-xdc-rewards-system","title":"Overview of XDC Rewards System","text":"In the XDC Network, rewards are primarily distributed to Masternode operators who validate transactions, secure the network, and propose new blocks. Additionally, XDC token holders who delegate their tokens to Masternodes also earn a share of the rewards. The rewards mechanism is structured to:
Incentivize decentralization by encouraging more participants to run Masternodes or delegate their tokens. Reward active participation in the network, such as block validation and staking. Ensure the economic sustainability of the XDC Network over time.
"},{"location":"xdcchain/rewards/#masternode-operator-rewards","title":"Masternode Operator Rewards","text":"Masternodes are critical to the XDC Network\u2019s operations, responsible for validating transactions and maintaining consensus. To compensate for their role, Masternode operators receive rewards for every block they validate.
Note: Masternodes with better uptime and performance will receive a higher portion of the rewards.
"},{"location":"xdcchain/xdpos/","title":"Overview - XDC Chain","text":""},{"location":"xdcchain/xdpos/#xdpos-xdcs-consensus-mechanism","title":"XDPoS - XDC\u2019s Consensus Mechanism","text":"XinFin Delegated Proof of Stake(XDPoS) is another form of Proof of Stake(PoS) consensus mechanism to scale up to Thousands of transactions per second. XDPOS concentrates block production in the hands of few semi-trusted entities in order to achieve more scalability than Proof of Work(PoW) or other Proof of Stake blockchains. XDPOS leverages the power of stakeholder to resolve consensus issues in a fair and democratic way. The Self KYC feature added in XinFin XDPoS is more enterprise and regulator friendly.
"},{"location":"xdcchain/xdpos/#common-terms","title":"Common Terms","text":"The traditional PoW mechanism, while effective in securing networks, is highly energy-intensive due to its reliance on solving complex cryptographic puzzles across all nodes in the network. This results in significant electricity consumption and poses environmental concerns. Recognizing these drawbacks, XinFin transitioned away from PoW and adopted Proof of Stake (PoS), a more energy-efficient consensus methodology. Eventually, XinFin advanced to XinFin Delegated Proof of Stake (XDPoS), which further enhances the efficiency and security of the network.
To understand XDC Network\u2019s decision to adopt XDPoS, it\u2019s essential to explore the various consensus mechanisms.
"},{"location":"xdcchain/xdpos/#understanding-consensus-pow-vs-pos-vs-xdpos","title":"Understanding Consensus: PoW vs. PoS vs. XDPoS","text":"In blockchain technology, consensus refers to a general agreement among nodes in the network, which is crucial for maintaining the integrity and accuracy of the distributed ledger. Unlike centralized systems like banks, where a central authority maintains records, blockchain relies on distributed ledgers to record information. Consensus ensures that all nodes agree on the state of the blockchain, including account balances, transactions, and more.
Proof of Work (PoW) PoW relies on nodes solving cryptographic puzzles to validate transactions and create new blocks. This process requires significant computational power and consumes vast amounts of electricity, making it environmentally unsustainable and costly.
Proof of Stake (PoS) PoS eliminates the need for energy-intensive computations. Instead of miners, PoS relies on validators who lock a portion of their cryptocurrency as a stake. Validators are chosen to propose the next block based on their stake and uptime. When a validator discovers a block that can be added to the blockchain, they validate it by placing a bet on it. The validators receive rewards proportional to their bets.
XinFin Delegated Proof of Stake (XDPoS) XDPoS is an evolution of PoS and offers greater efficiency. It uses a reputation-based system to achieve consensus, where master nodes create blocks in a round-robin manner. The network elects block producers (also known as witnesses) who are responsible for validating transactions and creating the next block. The key features of XDPoS include:
XDC Network chose XDPoS for its network due to its superior speed, cost efficiency, and scalability. XDPoS offers a more democratic, faster, and effective way to scale the network, making it the ideal consensus mechanism for XDC\u2019s hybrid blockchain platform.
"},{"location":"xdcchain/xdpos2/","title":"Overview - XDC Chain","text":""},{"location":"xdcchain/xdpos2/#xdpos-20","title":"XDPoS 2.0","text":"Sitting at the core of the XDC Network, XinFin Delegated Proof-of-Stake consensus protocol 2.0 (XDPoS 2.0) regulates the XDC nodes in maintaining the consistency of a decentralized ledger (the blockchain) with strong security and performance guarantees. In this section, we provide an overview of XDPoS 2.0 by introducing its three pillars, including:
Master node election, which specifies how the delegation and proof-of-stake works.
The consensus engine, namely, the HotStuff state machine replication (SMR) protocol, which is the state-of-the-art BFT (Byzantine fault-tolerant) SMR (state-machine replication) protocol. An illustration of its position in XDPoS 2.0 and a brief security analysis will be provided.
Reward mechanism, which incentivizes nodes to join and maintain the XDC Network.
The Apothem Testnet is the test environment for the XDC Network. It mirrors the Mainnet\u2019s functionality but operates with test tokens instead of real assets, making it ideal for developers to test and deploy their applications before going live.
Public Networks Similar to the Mainnet, users can access the Apothem Testnet with an internet connection and full node RPC. They can perform all the same actions as on the Mainnet\u2014reading, creating, or validating transactions\u2014without the risks associated with live transactions.
"},{"location":"xdcchain/developers/apothemrpc/#xdc-testnet-specifications","title":"XDC TestNet Specifications","text":"https://rpc.apothem.network
WebSocket Endpoint: wss://ws.apothem.network
The XDC Devnet is a specialized test environment for the XDC Network, designed to closely mirror the Mainnet\u2019s functionality. The Devnet provides developers with a safe, controlled setting to test, deploy, and refine their applications using test tokens instead of real assets. This environment is crucial for ensuring that applications are robust and secure before they go live on the Mainnet.
Public Networks Similar to the Mainnet, users can access the XDC Devnet via an internet connection and a full node RPC. The Devnet allows developers to perform the same operations they would on the Mainnet, including reading blockchain data, creating and validating transactions, and deploying smart contracts. However, since the Devnet operates with test tokens, developers can experiment freely without the financial risks associated with live transactions.
"},{"location":"xdcchain/developers/devnetrpc/#xdc-devnet-specifications","title":"XDC Devnet Specifications","text":"https://devnetstats.hashlabs.apothem.network/devnet
WebSocket Endpoint: https://devnetstats.hashlabs.apothem.network/devnetws
The XDC Mainnet is the live, operational environment of the XDC Network, where real transactions occur. The Mainnet is designed to support high-performance applications with low transaction fees and quick finality, making it ideal for enterprise use cases. The primary URL for accessing the XDC Mainnet via RPC. This endpoint allows you to interact with the blockchain by sending requests for data, submitting transactions, and more.
Public Networks
Users with an internet connection and access to a full node RPC can easily access the XDC Network\u2019s public blockchain. They can read, create, or validate transactions executed on the blockchain. The network\u2019s consensus mechanism, XDPoS (XinFin Delegated Proof of Stake), ensures that all nodes agree on the state of the network.
"},{"location":"xdcchain/developers/mainnetrpc/#xdc-mainnet-specifications","title":"XDC MainNet Specifications","text":"https://rpc.xdc.org
WebSocket Endpoint: wss://ws.xinfin.network
The Apothem Testnet is the test environment for the XDC Network. It mirrors the Mainnet\u2019s functionality but operates with test tokens instead of real assets, making it ideal for developers to test and deploy their applications before going live.
Public Networks Similar to the Mainnet, users can access the Apothem Testnet with an internet connection and full node RPC. They can perform all the same actions as on the Mainnet\u2014reading, creating, or validating transactions\u2014without the risks associated with live transactions.
"},{"location":"xdcchain/developers/mainnetrpc/#xdc-testnet-specifications","title":"XDC TestNet Specifications","text":"https://rpc.apothem.network
WebSocket Endpoint: wss://ws.apothem.network
The XDC Devnet is a specialized test environment for the XDC Network, designed to closely mirror the Mainnet\u2019s functionality. The Devnet provides developers with a safe, controlled setting to test, deploy, and refine their applications using test tokens instead of real assets. This environment is crucial for ensuring that applications are robust and secure before they go live on the Mainnet.
Public Networks Similar to the Mainnet, users can access the XDC Devnet via an internet connection and a full node RPC. The Devnet allows developers to perform the same operations they would on the Mainnet, including reading blockchain data, creating and validating transactions, and deploying smart contracts. However, since the Devnet operates with test tokens, developers can experiment freely without the financial risks associated with live transactions.
"},{"location":"xdcchain/developers/mainnetrpc/#xdc-testnet-specifications_1","title":"XDC TestNet Specifications","text":"https://devnetstats.apothem.network/devnet
WebSocket Endpoint:
Welcome to the Quick Guide for XDC Chain! This document is designed to provide you with a comprehensive overview of the XDC Network, its technology, and the tools you need to start your journey. Whether you\u2019re new to blockchain or an experienced developer, this guide will help you navigate the key resources and get up to speed with the XDC Network.
"},{"location":"xdcchain/developers/quick-guide/#getting-started","title":"Getting Started","text":"The XDC Network is a powerful, enterprise-grade blockchain platform designed to facilitate secure, efficient, and scalable decentralized applications (DApps) and global trade solutions. If you\u2019re just starting your journey with the XDC Network, this section will help you understand the fundamental concepts, terminology, and processes.
"},{"location":"xdcchain/developers/quick-guide/#mainnet","title":"Mainnet","text":"The XDC Network\u2019s Mainnet is the live, operational blockchain where actual transactions take place. Understanding the Mainnet is crucial for interacting with the XDC Network in a real-world environment.
The Apothem Testnet is the testing environment for the XDC Network. It\u2019s an ideal place to experiment with your DApps, smart contracts, and other blockchain-based solutions before deploying them on the Mainnet.
The XDC Devnet is a development-focused environment that allows developers to test and deploy their projects in a controlled setting. It\u2019s perfect for experimenting with new features, running simulations, and fine-tuning DApps before launching them on the Mainnet or Testnet.
Here are some additional tools and resources that will help you interact with the XDC Network more effectively:
"},{"location":"xdcchain/developers/quick-guide/#xdc-wallets","title":"XDC Wallets:","text":"To start using XDC, you\u2019ll need a secure wallet\u2014a dedicated app for storing your XDC and interacting with other apps on the XDC Network. Ensuring the safety of your XDC is crucial, so choose from a variety of trusted wallets that offer high security and unique features. Here are some of the top options.
"},{"location":"xdcchain/developers/quick-guide/#additional-tools","title":"Additional Tools:","text":"Join the vibrant community of developers, validators, and users who are actively contributing to the XDC Network\u2019s growth and innovation. Engage with the community, ask questions, and share your knowledge.
Dev Forum: Participate in discussions, ask questions, and collaborate with other developers. XDC Dev Forum
Discord: Join the official XDC Network Discord channel for real-time support and community interaction. Join Discord
It\u2019s unnecessary to review every document to have a working knowledge of the XDC Network. Explore the resources as needed, dive deeper into specific sections that interest you, and don\u2019t hesitate to seek support from the community whenever necessary.
Happy building on the XDC Network!
For more tools and details, you can refer to XDC Chain Network Tools and Documents.
"},{"location":"xdcchain/developers/rpc/","title":"XDC Network - RPC","text":""},{"location":"xdcchain/developers/rpc/#network-endpoints","title":"Network Endpoints","text":"The XDC Network is a robust, enterprise-grade blockchain platform designed for decentralized finance (DeFi), global trade, and other high-demand applications. For developers and users interacting with the XDC Network, the Remote Procedure Call (RPC) interface is a critical component. This guide provides a detailed overview of the RPC endpoints for both the XDC Mainnet and the Apothem Testnet, including their specifications and usage.
"},{"location":"xdcchain/developers/rpc/#what-is-rpc","title":"What is RPC?","text":"Remote Procedure Call (RPC) is a protocol that allows communication between a client and a server over a network. In the context of blockchain, RPC is used to interact with the blockchain network by sending requests to full nodes. These requests can include reading blockchain data, creating and broadcasting transactions, and deploying smart contracts.
"},{"location":"xdcchain/developers/rpc/#mainnet-environment","title":"Mainnet Environment","text":"Service URL RPC https://erpc.xinfin.network Chain Id 50 Faucet endpoint https://chains.tools/faucet Explorer https://xdcscan.io/"},{"location":"xdcchain/developers/rpc/#apothem-environment","title":"Apothem Environment","text":"Service URL RPC https://rpc.apothem.network Chain Id 51 Faucet endpoint https://faucet.blocksscan.io/ Explorer https://apothem.xdcscan.io/"},{"location":"xdcchain/developers/rpc/#devnet-environment","title":"Devnet Environment","text":"Service URL RPC https://devnetstats.hashlabs.apothem.network/devnet Chain Id 551 Faucet endpoint https://faucet.blocksscan.io/ Explorer https://devnet.xdcscan.io/"},{"location":"xdcchain/developers/wallet-configuration/","title":"Wallet Configuration - XDC Network","text":""},{"location":"xdcchain/developers/wallet-configuration/#wallet-configuration","title":"Wallet configuration","text":"You can use any Ethereum wallet with XDC. For instance, I will show you how to set up Metamask and Trustwallet for XDC.
Testnet/Apothem
Mainnet
Depending on your location and preference, you can choose from a variety of RPC endpoints for XDC. For more information about the endpoints and their features, please refer to the network information document that we have prepared for you. To ensure the best performance and user experience, you can test the latency of each endpoint before you configure it with your wallet. Refer
"},{"location":"xdcchain/developers/node_operators/bootstrap/","title":"Run XDC Nodes using Bootstrap Script","text":""},{"location":"xdcchain/developers/node_operators/bootstrap/#setup-xdc-masternode-using-bootstrap-script","title":"Setup XDC Masternode using Bootstrap Script","text":""},{"location":"xdcchain/developers/node_operators/bootstrap/#for-mainnet","title":"For Mainnet","text":"Bootstrap Command XinFin Node Setup:
sudo su -c \"bash <(wget -qO- https://raw.githubusercontent.com/XinFinOrg/XinFin-Node/master/setup/bootstrap.sh)\" root\n
Examples: After running the bootstrap command, the system will prompt you to specify the network. To connect to the Mainnet, simply enter \u201cmainnet\u201d.
$ sudo su -c \"bash <(wget -qO- https://raw.githubusercontent.com/XinFinOrg/XinFin-Node/master/setup/bootstrap.sh)\" root\n[sudo] password for user:\nPlease enter your XinFin Network (mainnet/testnet/devnet) :- mainnet\n
Next, you will be asked to input your XinFin Masternode name. Enter your desired Masternode name, such as \u201cDemo_Server.\u201d Your running network is mainnet\nPlease enter your XinFin MasterNode Name :- Demo_Server\nYour Masternode Name is Demo_Server\n
"},{"location":"xdcchain/developers/node_operators/bootstrap/#for-testnet","title":"For Testnet","text":"After running the bootstrap command, the system will prompt you to specify the network. To connect to the Mainnet, simply enter \u201ctestnet\u201d.
sudo su -c \"bash <(wget -qO- https://raw.githubusercontent.com/XinFinOrg/XinFin-Node/master/setup/bootstrap.sh)\" root\nPlease enter your XinFin Network (mainnet/testnet/devnet) :- testnet\n
Next, you will be asked to input your XinFin Masternode name. Enter your desired Masternode name, such as \u201ctest01\u201d Your running network is testnet\nPlease enter your XinFin MasterNode Name :- test01\nYour Masternode Name is test01\n
"},{"location":"xdcchain/developers/node_operators/bootstrap/#for-devnet","title":"For Devnet","text":"After running the bootstrap command, the system will prompt you to specify the network. To connect to the Mainnet, simply enter \u201cdevnet\u201d.
sudo su -c \"bash <(wget -qO- https://raw.githubusercontent.com/XinFinOrg/XinFin-Node/master/setup/bootstrap.sh)\" root\nPlease enter your XinFin Network (mainnet/testnet/devnet) :- devnet\nYour running network is devnet\n
Next, you will be asked to input your XinFin Masternode name. Enter your desired Masternode name, such as \u201ctest01\u201d Please enter your XinFin MasterNode Name :- test01\nYour Masternode Name is test01\nGenerate new private key and wallet address.\nIf you have your own key, you can change after this and restart the node\nType 'Y' or 'y' to continue:\n
"},{"location":"xdcchain/developers/node_operators/docker/","title":"Setup XDC Masternode using Docker","text":""},{"location":"xdcchain/developers/node_operators/docker/#setup-xdc-masternode-using-docker","title":"Setup XDC Masternode using Docker","text":""},{"location":"xdcchain/developers/node_operators/docker/#setting-up-xdc-network-masternode-docker-version","title":"Setting up XDC Network Masternode Docker version","text":"The server or VPS used for the masternode should be directly facing the internet with a public IP and without NAT.
Operating System: Ubuntu 20.04 64-bit or higher
Should be facing internet directly with public IP & without NAT
Tools: Docker, Docker Compose(1.27.4+)
Setup (For Ubuntu 20.04 64-bit or higher Operating System)
Follow the written steps starting from step 1, or you can watch the video tutorials:
"},{"location":"xdcchain/developers/node_operators/docker/#step-1-clone-repository","title":"Step 1: Clone repository","text":"git clone https://github.com/XinFinOrg/XinFin-Node.git\n
"},{"location":"xdcchain/developers/node_operators/docker/#step-2-change-directory","title":"Step 2: Change directory","text":"Then we change the directory to XinFin-Node
cd XinFin-Node\n
"},{"location":"xdcchain/developers/node_operators/docker/#step-3-install-docker","title":"Step 3: Install docker","text":"We need to install Docker and Docker-Compose by running the following command:
sudo ./setup/install_docker.sh\n
"},{"location":"xdcchain/developers/node_operators/docker/#step-4","title":"Step 4:","text":"Create a new .env file and copy the env.example file that exist in the mainnet directory. We will ensure we are in the \u201cmainnet\u201d directory by typing these commands. Once in edit mode for the .env file, name your masternode and use an email address in the respective fields
cd mainnet\ncp env.example .env\nnano .env \n
For Testnet cd testnet\ncp env.example .env\nnano .env\n
"},{"location":"xdcchain/developers/node_operators/docker/#step-5-start-your-node","title":"Step 5: Start your Node","text":"For Mainnet run the following commands:
cd mainnet\nsudo docker-compose -f docker-compose.yml up -d\n
At this point you should be able to see your masternode on the list of nodes here or as shown below: For Testnet run the following commands:
cd testnet\nsudo docker-compose -f docker-compose.yml up -d\n
You should be able to see your node listed on the [Apothem Network] page. Select \u201cSwitch to LiveNet\u201d to check LiveNetwork Stats and Select \u201cSwitch to TestNet\u201d for TestNetwork. Your coinbase address can be found in xdcchain/coinbase.txt file.
For troubleshooting purposes, you can stop the node by using the following command on either Mainnet or Testnet:
sudo docker-compose -f docker-compose.yml down\n
Downloading a Network Snapshot (Mainnet or Apothem)
The following steps are to expedite the syncing process of your node with the XDC Network. If you followed the steps above, your node will take 3-4 days to sync up with the network fully. You can reduce that time by downloading a network snapshot and bringing your node back up after the chain has been downloaded and unpacked.
"},{"location":"xdcchain/developers/node_operators/docker/#mainnet-snapshot","title":"Mainnet Snapshot","text":"Bring down your node:
sudo docker-compose -f docker-compose.yml down\n
Remove the old xdchain file from the server rm -rf xdcchain.tar\n
Download the snapshot wget https://download.xinfin.network/xdcchain.tar\n
Unpack the xdcchain.tar file tar -xvzf xdcchain.tar\n
The unpacking will take some time, and it will look like this: The following command will move the xdcchain/XDC to xdcchain/XDC_backup
mv xdcchain/XDC xdcchain/XDC_backup\nmv XDC xdcchain\n
Then we are going to remove the old \u201cnodekey\u201d file
rm -rf xdcchain/XDC/nodekey\n
The last step is to run the bash upgrade.sh command
bash upgrade.sh\n
This command will bring your node up and it will start syncing to the network. Once up and running, your node will be synced to the network in just a few minutes.
"},{"location":"xdcchain/developers/node_operators/docker/#apothem-snapshot","title":"Apothem Snapshot","text":"Bring down your node:
sudo docker-compose -f docker-compose.yml down\n
Remove the old xdchain file from the server
rm -rf apothem.tar\n
Download the snapshot
wget https://download.apothem.network/apothem.tar\n
Unpack the apothem.tar file
tar -xvzf apothem.tar\n
Move the xdcchain-testnet
mv XDC xdcchain-testnet\n
Bring up the node
sudo docker-compose -f docker-compose.yml up -d\n
"},{"location":"xdcchain/developers/node_operators/dockerimg/","title":"Docker Image for the XDC Network","text":""},{"location":"xdcchain/developers/node_operators/dockerimg/#docker-image-for-the-xdc-network","title":"Docker Image for the XDC Network","text":""},{"location":"xdcchain/developers/node_operators/dockerimg/#what-is-a-docker-image","title":"What is a Docker Image?","text":"A Docker image is a lightweight, stand-alone, executable package that includes everything needed to run an application, including code, runtime, libraries, and configurations. In the context of blockchain, Docker images simplify the deployment and management of nodes by enabling developers to encapsulate the entire blockchain environment into a single, replicable package.
"},{"location":"xdcchain/developers/node_operators/dockerimg/#purpose-of-the-xdc-networks-docker-image","title":"Purpose of the XDC Network\u2019s Docker Image","text":"For the XDC Network, the Docker image provides a standardized and efficient way for developers to deploy, manage, and update their XDC nodes. The XDC Docker image streamlines the node deployment process, reducing configuration errors and minimizing setup time. It allows developers to run nodes in isolated containers, ensuring a consistent environment across different infrastructures.
"},{"location":"xdcchain/developers/node_operators/dockerimg/#key-features-of-the-xdc-docker-image-include","title":"Key features of the XDC Docker image include:","text":"Nodes are computers or servers that run an application software known as clients to perform essential tasks on a blockchain network. These tasks can include transactions, block creation, consensus, network security, and other operational tasks for the network. The tasks and functionalities a node execute depend on the type of node, with each node having different system requirements and deployment processes. This section will provide details and information on how to run and maintain nodes on the XDC Network.
"},{"location":"xdcchain/developers/node_operators/masternode/#masternodes","title":"Masternodes","text":"The XDC Network runs on a globally distributed system of masternodes that participate in a Delegated Proof of Stake (DPoS) consensus mechanism. To enhance network integrity and security, Masternodes are required to complete a KYC process and stake 10,000,000 XDC. Masternodes can be identified as \u201cValidator\u201d or \u201cStandby\u201d Masternodes.
"},{"location":"xdcchain/developers/node_operators/masternode/#standby-masternodes","title":"Standby Masternodes","text":"Standby Masternodes (or \u201cStandby Nodes\u201d) are identical in form and function to Validators but do not participate in validating transactions and block creation. These nodes are on standby to fill the role of Validators that drop from network participation.
To host an XDC Masternode/Standby node, there are specific prerequisites that you need to meet in terms of hardware, software, and staking requirements. Below is a detailed list:
"},{"location":"xdcchain/developers/node_operators/masternode/#hardware-requirements","title":"Hardware Requirements","text":"To ensure smooth operation and optimal performance of the XDC Masternode, the following hardware specifications are recommended:
Ensure that you have the following software and dependencies installed on your server before proceeding with the XDC Masternode setup:
To host an XDC Masternode, a certain amount of XDC tokens must be staked. This ensures that the node operator has a vested interest in the security and performance of the network.
You must set up an XDC wallet to manage your funds and staking:
Bootstrap Command for XDC Masternode Setup:
sudo su -c \"bash <(wget -qO- https://raw.githubusercontent.com/XinFinOrg/XinFin-Node/master/setup/bootstrap.sh)\" root\n
Examples: After running the bootstrap command, the system will prompt you to specify the network. To connect to the Mainnet, simply enter \u201cmainnet\u201d.
$ sudo su -c \"bash <(wget -qO- https://raw.githubusercontent.com/XinFinOrg/XinFin-Node/master/setup/bootstrap.sh)\" root\n[sudo] password for user:\nPlease enter your XinFin Network (mainnet/testnet/devnet) :- mainnet\n
Next, you will be asked to input your XinFin Masternode name. Enter your desired Masternode name, such as \u201cDemo_Server.\u201d Your running network is mainnet\nPlease enter your XinFin MasterNode Name :- Demo_Server\nYour Masternode Name is Demo_Server\n
"},{"location":"xdcchain/developers/node_operators/masternode/#for-testnet","title":"For Testnet","text":"After running the bootstrap command, the system will prompt you to specify the network. To connect to the Mainnet, simply enter \u201ctestnet\u201d.
sudo su -c \"bash <(wget -qO- https://raw.githubusercontent.com/XinFinOrg/XinFin-Node/master/setup/bootstrap.sh)\" root\nPlease enter your XinFin Network (mainnet/testnet/devnet) :- testnet\n
Next, you will be asked to input your XinFin Masternode name. Enter your desired Masternode name, such as \u201ctest01\u201d Your running network is testnet\nPlease enter your XinFin MasterNode Name :- test01\nYour Masternode Name is test01\n
"},{"location":"xdcchain/developers/node_operators/masternode/#for-devnet","title":"For Devnet","text":"After running the bootstrap command, the system will prompt you to specify the network. To connect to the Mainnet, simply enter \u201cdevnet\u201d.
sudo su -c \"bash <(wget -qO- https://raw.githubusercontent.com/XinFinOrg/XinFin-Node/master/setup/bootstrap.sh)\" root\nPlease enter your XinFin Network (mainnet/testnet/devnet) :- devnet\nYour running network is devnet\n
Next, you will be asked to input your XinFin Masternode name. Enter your desired Masternode name, such as \u201ctest01\u201d Please enter your XinFin MasterNode Name :- test01\nYour Masternode Name is test01\nGenerate new private key and wallet address.\nIf you have your own key, you can change after this and restart the node\nType 'Y' or 'y' to continue:\n
"},{"location":"xdcchain/developers/node_operators/masternode/#how-to-stake-xdc-on-a-masternodestandby-node","title":"How to Stake XDC on a Masternode/Standby node","text":""},{"location":"xdcchain/developers/node_operators/masternode/#prerequisites","title":"Prerequisites","text":"To stake XDC and run a masternode, you will need the following:
Note: You do not need 10,000,000 XDC to run a node solely for RPC queries or accessing live data from the blockchain. This guide covers staking for masternode candidates.
"},{"location":"xdcchain/developers/node_operators/masternode/#step-by-step-process-to-stake-your-xdc-node","title":"Step-by-Step Process to Stake Your XDC Node","text":""},{"location":"xdcchain/developers/node_operators/masternode/#1-access-the-staking-platform","title":"1. Access the Staking Platform","text":"To qualify for Masternode on XinFin Network, you need at least 10,000,000 XDC, for the long term.
Operating System:
Download XDC One-Click Installer (to setup Masternode) for Windows, Linux, and Mac OS and Install on your local machine.
"},{"location":"xdcchain/developers/node_operators/masternode/#step-2","title":"Step 2:","text":"Now Run the One Click Installer, Make sure you read the Terms properly then click on I Agree button.
Step 3: Create a wallet for Masternode
Step 4: Host your Masternode
The server or VPS used for the masternode should be directly facing the internet with a public IP and without NAT.
Operating System: Ubuntu 20.04 64-bit or higher
Should be facing internet directly with public IP & without NAT
Tools: Docker, Docker Compose(1.27.4+)
Setup (For Ubuntu 20.04 64-bit or higher Operating System)
Follow the written steps starting from step 1, or you can watch the video tutorials:
"},{"location":"xdcchain/developers/node_operators/masternode/#step-1-clone-repository","title":"Step 1: Clone repository","text":"git clone https://github.com/XinFinOrg/XinFin-Node.git\n
"},{"location":"xdcchain/developers/node_operators/masternode/#step-2-change-directory","title":"Step 2: Change directory","text":"Then we change the directory to XinFin-Node
cd XinFin-Node\n
"},{"location":"xdcchain/developers/node_operators/masternode/#step-3-install-docker","title":"Step 3: Install docker","text":"We need to install Docker and Docker-Compose by running the following command:
sudo ./setup/install_docker.sh\n
"},{"location":"xdcchain/developers/node_operators/masternode/#step-4","title":"Step 4:","text":"Create a new .env file and copy the env.example file that exist in the mainnet directory. We will ensure we are in the \u201cmainnet\u201d directory by typing these commands. Once in edit mode for the .env file, name your masternode and use an email address in the respective fields
cd mainnet\ncp env.example .env\nnano .env \n
For Testnet cd testnet\ncp env.example .env\nnano .env\n
"},{"location":"xdcchain/developers/node_operators/masternode/#step-5-start-your-node","title":"Step 5: Start your Node","text":"For Mainnet run the following commands:
cd mainnet\nsudo docker-compose -f docker-compose.yml up -d\n
At this point you should be able to see your masternode on the list of nodes here or as shown below: For Testnet run the following commands:
cd testnet\nsudo docker-compose -f docker-compose.yml up -d\n
You should be able to see your node listed on the [Apothem Network] page. Select \u201cSwitch to LiveNet\u201d to check LiveNetwork Stats and Select \u201cSwitch to TestNet\u201d for TestNetwork. Your coinbase address can be found in xdcchain/coinbase.txt file.
For troubleshooting purposes, you can stop the node by using the following command on either Mainnet or Testnet:
sudo docker-compose -f docker-compose.yml down\n
"},{"location":"xdcchain/developers/node_operators/masternode/#downloading-a-network-snapshot-mainnet-or-apothem","title":"Downloading a Network Snapshot (Mainnet or Apothem)","text":"The following steps are to expedite the syncing process of your node with the XDC Network. If you followed the steps above, your node will take 3-4 days to sync up with the network fully. You can reduce that time by downloading a network snapshot and bringing your node back up after the chain has been downloaded and unpacked.
"},{"location":"xdcchain/developers/node_operators/masternode/#mainnet-snapshot","title":"Mainnet Snapshot","text":"Bring down your node:
sudo docker-compose -f docker-compose.yml down\n
Remove the old xdchain file from the server rm -rf xdcchain.tar\n
Download the snapshot wget https://download.xinfin.network/xdcchain.tar\n
Unpack the xdcchain.tar file tar -xvzf xdcchain.tar\n
The unpacking will take some time, and it will look like this: img
The following command will move the xdcchain/XDC to xdcchain/XDC_backup
mv xdcchain/XDC xdcchain/XDC_backup\nmv XDC xdcchain\n
Then we are going to remove the old \u201cnodekey\u201d file
rm -rf xdcchain/XDC/nodekey\n
The last step is to run the bash upgrade.sh command
bash upgrade.sh\n
This command will bring your node up and it will start syncing to the network. Once up and running, your node will be synced to the network in just a few minutes.
"},{"location":"xdcchain/developers/node_operators/masternode/#apothem-snapshot","title":"Apothem Snapshot","text":"Bring down your node:
sudo docker-compose -f docker-compose.yml down\n
Remove the old xdchain file from the server
rm -rf apothem.tar\n
Download the snapshot
wget https://download.apothem.network/apothem.tar\n
Unpack the apothem.tar file
tar -xvzf apothem.tar\n
Move the xdcchain-testnet
mv XDC xdcchain-testnet\n
Bring up the node
sudo docker-compose -f docker-compose.yml up -d\n
"},{"location":"xdcchain/developers/node_operators/node_architecture/","title":"XDC Node Architecture","text":""},{"location":"xdcchain/developers/node_operators/node_architecture/#xdc-node-architecture","title":"XDC Node Architecture","text":"The XDC Network is a hybrid blockchain platform designed to support both public and private states, offering enterprises the ability to conduct secure, scalable, and fast transactions. At the core of this network is its node architecture, which plays a crucial role in maintaining the network\u2019s integrity, security, and efficiency. This document provides a comprehensive overview of the XDC Node Architecture, detailing the various components and their functions.
The XDC Network operates on a Delegated Proof of Stake (XDPoS) consensus mechanism, which ensures low energy consumption and high transaction throughput. The network is EVM-compatible, allowing it to support smart contracts and decentralized applications (dApps).
"},{"location":"xdcchain/developers/node_operators/node_architecture/#node-types-in-xdc-network","title":"Node Types in XDC Network","text":"The XDC Network comprises several types of nodes, each serving a unique function within the ecosystem. These nodes are essential for network operations, including transaction validation, block creation, and consensus.
Masternodes (Validator Nodes):
The XDC Network employs a peer-to-peer (P2P) communication model where nodes interact directly with each other to share information and propagate transactions.
Gossip Protocol:
Networking Layers:
To qualify for Masternode on XinFin Network, you need at least 10,000,000 XDC, for the long term.
Operating System:
Download XDC One-Click Installer (to setup Masternode) for Windows, Linux, and Mac OS and Install on your local machine.
"},{"location":"xdcchain/developers/node_operators/one-click-installer/#step-2","title":"Step 2:","text":"Now Run the One Click Installer, Make sure you read the Terms properly then click on I Agree button.
Step 3: Create a wallet for Masternode
Step 4: Host your Masternode
The XDC Network, utilizing the XDPoS (Delegated Proof of Stake) consensus mechanism, ensures that its validators, known as masternodes, maintain optimal performance to keep the network stable and secure. One of the key features designed to ensure this reliability is the slashing mechanism, which acts as a corrective measure for underperforming masternodes.
"},{"location":"xdcchain/developers/node_operators/slashing/#objective-of-the-slashing-mechanism","title":"Objective of the Slashing Mechanism","text":"The primary goal of the slashing mechanism is not to penalize or blame masternodes but to maintain a stable and high-performing network. It serves to mitigate issues arising from underperforming masternodes by holding them accountable while ensuring the overall system remains efficient.
"},{"location":"xdcchain/developers/node_operators/slashing/#how-the-xdc-network-slashing-mechanism-works","title":"How the XDC Network Slashing Mechanism Works","text":"The slashing mechanism operates with a clear set of rules to manage masternode performance:
"},{"location":"xdcchain/developers/node_operators/slashing/#1-non-participation-in-block-signing","title":"1. Non-Participation in Block Signing:","text":"The concept of slashing is not unique to the XDC Network and has been implemented in various other blockchain networks, such as Ethereum\u2019s Casper FFG (Friendly Finality Gadget). Casper\u2019s slashing mechanism is designed to prevent the \u201cnothing-at-stake\u201d problem, where validators can choose to support multiple forks of the blockchain. In Casper, if a validator is found to have validated conflicting forks, they are severely penalized by losing a significant portion, or even all, of their staked tokens.
Unlike Casper\u2019s more punitive approach aimed at preventing malicious behavior, the XDC Network\u2019s slashing mechanism is designed to handle unintentional underperformance. Rather than harshly punishing validators for outages or system failures, XDC\u2019s system focuses on ensuring network performance without creating fear of excessive penalties. The design philosophy behind XDC\u2019s slashing mechanism is to avoid deterring participation by maintaining a fair yet firm system.
"},{"location":"xdcchain/developers/node_operators/slashing/#benefits-of-the-xdc-slashing-mechanism","title":"Benefits of the XDC Slashing Mechanism","text":"Validator Masternodes operate and participate in XDC Network\u2019s DPoS consensus engine, validating transactions and block creation.
"},{"location":"xdcchain/developers/node_operators/validator_node/#standby-masternodes","title":"Standby Masternodes","text":"Standby Masternodes (or \u201cStandby Nodes\u201d) are identical in form and function to Validators but do not participate in validating transactions and block creation. These nodes are on standby to fill the role of Validators that drop from network participation.
"},{"location":"xdcchain/developers/node_operators/validator_node/#setup-xdc-validatorstandby-node-using-bootstrap-script","title":"Setup XDC Validator/Standby Node using Bootstrap Script","text":""},{"location":"xdcchain/developers/node_operators/validator_node/#for-mainnet","title":"For Mainnet","text":"Bootstrap Command XDC Validator/Standby Node Setup:
sudo su -c \"bash <(wget -qO- https://raw.githubusercontent.com/XinFinOrg/XinFin-Node/master/setup/bootstrap.sh)\" root\n
Examples: After running the bootstrap command, the system will prompt you to specify the network. To connect to the Mainnet, simply enter \u201cmainnet\u201d.
$ sudo su -c \"bash <(wget -qO- https://raw.githubusercontent.com/XinFinOrg/XinFin-Node/master/setup/bootstrap.sh)\" root\n[sudo] password for user:\nPlease enter your XinFin Network (mainnet/testnet/devnet) :- mainnet\n
Next, you will be asked to input your XinFin Masternode name. Enter your desired Masternode name, such as \u201cDemo_Server.\u201d Your running network is mainnet\nPlease enter your XinFin MasterNode Name :- Demo_Server\nYour Masternode Name is Demo_Server\n
"},{"location":"xdcchain/developers/node_operators/validator_node/#for-testnet","title":"For Testnet","text":"After running the bootstrap command, the system will prompt you to specify the network. To connect to the Mainnet, simply enter \u201ctestnet\u201d.
sudo su -c \"bash <(wget -qO- https://raw.githubusercontent.com/XinFinOrg/XinFin-Node/master/setup/bootstrap.sh)\" root\nPlease enter your XinFin Network (mainnet/testnet/devnet) :- testnet\n
Next, you will be asked to input your XinFin Masternode name. Enter your desired Masternode name, such as \u201ctest01\u201d Your running network is testnet\nPlease enter your XinFin MasterNode Name :- test01\nYour Masternode Name is test01\n
"},{"location":"xdcchain/developers/node_operators/validator_node/#for-devnet","title":"For Devnet","text":"After running the bootstrap command, the system will prompt you to specify the network. To connect to the Mainnet, simply enter \u201cdevnet\u201d.
sudo su -c \"bash <(wget -qO- https://raw.githubusercontent.com/XinFinOrg/XinFin-Node/master/setup/bootstrap.sh)\" root\nPlease enter your XinFin Network (mainnet/testnet/devnet) :- devnet\nYour running network is devnet\n
Next, you will be asked to input your XinFin Masternode name. Enter your desired Masternode name, such as \u201ctest01\u201d Please enter your XinFin MasterNode Name :- test01\nYour Masternode Name is test01\nGenerate new private key and wallet address.\nIf you have your own key, you can change after this and restart the node\nType 'Y' or 'y' to continue:\n
"},{"location":"xdcchain/developers/node_operators/validator_node/#setup-xdc-masternode-using-one-click-installer","title":"Setup XDC Masternode using One-Click Installer","text":"To Setup XDC Masternode using One-Click Installer, refer
"},{"location":"xdcchain/governance/overview/","title":"Overview - XDCDAO","text":""},{"location":"xdcchain/governance/overview/#xdc-governance-overview","title":"XDC Governance Overview","text":"The DAO Treasury within the XDCDAO framework plays a critical role in the XDC Network\u2019s decentralized governance system. It is meticulously designed to manage the community\u2019s collective resources efficiently, securely, and transparently. This section provides a structured overview of the DAO Treasury, highlighting its purpose, operation, funding sources, and significance within the DAOFIN ecosystem.
"},{"location":"xdcchain/governance/overview/#purpose-of-the-dao-treasury","title":"Purpose of the DAO Treasury","text":"The DAO Treasury\u2019s primary objective is to support the sustainable growth and development of the XDC Network by financing projects and initiatives that align with the community\u2019s goals. It acts as the financial hub for:
first use ssh tunnel: ssh -N -L localhost:5210:localhost:5210 USERNAME@IP_ADDRESS -i SERVER_KEY_FILE
+ **if you're using VSCode to SSH, the port might be forwarded to your machine automatically (no need for above step)