A dedicated RPC server on the XDC network is a server exclusively used by a specific DApp or application rather than being shared by multiple clients. This allows for faster response times and more reliable performance, which is important for high-traffic or mission-critical applications.
To set up a dedicated RPC server for your DApp on the XDC Network, you need to set up a full node, enable RPC communication, and open the ports for external access. Our guide provides a step-by-step process for setting up a full node and a dedicated RPC server to interact with the XDC network.
If you're building a DApp on the XDC Network, a dedicated RPC server can be a valuable tool to ensure the performance and reliability of your application.
Before we get started, make sure you have the following prerequisites:
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
$ 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
git clone https://github.com/XinFinOrg/XinFin-Node.git
Enter XinFin-Node directory
Install docker & docker-compose
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.
Once you have set up the full node, you can access the dedicated RPC server at http://(your server IP):8989, and the WebSocket at ws://(your server IP):8888. These URLs allow you to communicate with the XDC network and interact with your DApp or application.
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