Setting Up an RPC Node Server for Your DApp on XDC Network: A Comprehensive Guide

ruslan wing
3 min readMar 30, 2023

--

A dedicated RPC (Remote Procedure Call) on the XDC network refers to an RPC server that is exclusively used by a specific DApp or application rather than shared by multiple clients.

When a DApp or application needs to interact with the Ethereum network, it typically sends requests to an RPC server, communicating with a node on the Ethereum network to execute the requested action or retrieve information. In a shared RPC server environment, multiple DApps or applications send requests to the same server, potentially causing congestion and slowdowns.

By contrast, a dedicated RPC server is set up specifically for a particular DApp or application, providing its own dedicated resources and eliminating the potential for congestion from other clients. This can result in faster response times and more reliable performance, which can be important for high-traffic or mission-critical applications.

Setting up a dedicated RPC server typically involves setting up a full node on the XDC network, configuring it to enable RPC communication, and opening the necessary ports to allow external access to the server. Once the server is set up, the DApp or application can configure its connection to the dedicated RPC server to begin interacting with the XDC network.

Overall, a dedicated RPC server can be a valuable tool for DApps or applications that require high performance and reliability in their interactions with the XDC network.

XDC Network is a high-performance blockchain designed for enterprise-grade applications. If you’re building a decentralized application (DApp) on the XDC Network, you must set up a full node and a dedicated RPC server to interact with the network.

This comprehensive guide will walk you through a step-by-step process of setting up a full node and a dedicated RPC server for your DApp on the XDC Network.

Prerequisites

Before we get started, make sure you have the following prerequisites:

  • A server or cloud instance with at least 16 GB of RAM and 500 GB of storage.
  • Ubuntu 20.04 LTS operating system.
  • Basic knowledge of the Linux command line.

Step:-1 setting up the full node with the Bootstrap command

sudo su -c “bash <(wget -qO- https://raw.githubusercontent.com/XinFinOrg/XinFin-Node/master/setup/bootstrap.sh)" root

Example:-

$ sudo su -c “bash <(wget -qO- https://raw.githubusercontent.com/XinFinOrg/XinFin-Node/master/setup/bootstrap.sh)" root
[sudo] password for user:
Please enter your XinFin Network (mainnet/testnet/devnet) :- mainnet
Your running network is mainnet
Please enter your XinFin MasterNode Name :- Demo_Server
Your Masternode Name is Demo_Server

Step:2 Setting up the full node with docker

Clone repository

git clone https://github.com/XinFinOrg/XinFin-Node.git

Enter XinFin-Node directory

cd XinFin-Node

Install docker & docker-compose

sudo ./setup/install_docker.sh

Update the .env file with details Create a .env file by using the sample — .env.example

Enter either your company or product name in the INSTANCE_NAME field.

Enter your email address in the CONTACT_DETAILS field.

cd mainnet # testnet
cp env.example .env
nano .env

Start your Node

cd mainnet
sudo docker-compose -f docker-compose.yml up -d

To stop the node, or if you encounter, any issues use

sudo docker-compose -f docker-compose.yml down

Attach XDC Console:

cd mainnet
sudo bash xdc-attach.sh

You can check the status of your full node on the stats page at https://stats1.xinfin.network, and if you want your full node to get sync faster, you can download the latest snapshot from https://download.xinfin.network/xdcchain.tar

Follow the snapshot steps to get your full node to sync faster

After downloading the snapshot, monitor your node on the stats page. Once your node is fully synced, you can start using the dedicated RPC for your Dapp. Please note that the RPC port used is 8989, and for WebSocket, the port used is 8888.

To enable the 0x prefix RPC Endpoint, you can add the flag “ — enable-0x-prefix” to your “startnode.sh” script. This will allow the RPC Endpoint to recognize and process 0x-prefixed addresses.

If you have any questions, please feel free to post them on https://xdc.dev

--

--

No responses yet