Crossfi RPC and API Setup Guide
Last updated
Last updated
When acquiring a domain, you may choose various providers, but the key step is to move your domain to a Cloudflare account for enhanced performance, security, and DNS management. Here's how to transfer your GoDaddy-purchased domain to Cloudflare:
Create a Cloudflare Account: Go to Cloudflare's website and sign up. After creating your account, click "Add a Site" to start adding your domain to Cloudflare.
Add Your Sites to Cloudflare: Enter the name of your site and click "Add Site". Cloudflare will attempt to automatically fetch your site's DNS records. Review and, if necessary, manually add any missing DNS records. Cloudflare will offer to manage your DNS records at this stage.
Obtain New Name Server Information from Cloudflare: After adding your site and verifying your DNS records, Cloudflare will provide two name server (NS) addresses. These are Cloudflare's DNS servers, which will handle DNS queries for your site.
Log In to Your GoDaddy Account: Go to the "My Products" section. Find the domain you wish to manage and navigate to its settings.
Update Name Server Settings in GoDaddy: In the domain settings, click on "DNS Management" or "Manage DNS". Click "Change" or "Edit" to update your current NS records to the addresses provided by Cloudflare.
Save the New Name Server Addresses: After entering the new name server addresses from Cloudflare, save the changes. It may take some time for the changes to propagate across the internet (usually within 24 hours, but sometimes longer).
Complete Processes in Cloudflare and GoDaddy: Follow the necessary steps in Cloudflare to ensure the name server changes are correctly implemented. Wait for the verifications to complete on both platforms.
Note: DNS changes may not take effect immediately. Wait until the propagation process is complete. If you encounter any errors, you can contact the support teams of both Cloudflare and GoDaddy.
Remember, I have set up my explorer on a different server and the Crossfi node on another. You should accordingly prepare your domain and subdomains as shown in the image below.
First create subdomains like crossfi-api, crossfi-rpc, crossfi-jsonrpc and make them A record with your server ip.
Connect to your Crossfi Node and execute the following commands to install Nginx:
Create a configuration file for your API:
Inside the file, it's time to enter the necessary configuration for your API subdomain. Below is a template designed specifically for a Node.js application. Make sure you understand each directive and modify it to fit the specific needs of your application, especially the proxy_pass
directive, which should point to the port your application is running on:
Replace elessarnodes.xyz
with your domain in the server_name
section, and adjust the port number in the proxy_pass
directory if necessary (default is 1317
). This setup instructs the server to listen on port 80, the default for HTTP. The server_name
should match your project's subdomain. The proxy_pass
directive is crucial as it tells NGINX where to route requests entering this subdomain.
Similarly, create a configuration for your RPC:
Enter the configuration, replacing elessarnodes.xyz
with your domain and adjusting the proxy_pass
for your RPC port (default is 26657
).
Enter the configuration, replacing elessarnodes.xyz
with your domain and adjusting the proxy_pass
for your RPC port (default is 8545
).
Activating Your Configuration
After tailoring the configuration file to your needs and saving your changes, the next step is to link this file to the sites-enabled
directory to activate it:
This command creates a symbolic link between the sites-available
and sites-enabled
directories, effectively activating your configuration.
Finally, test your NGINX configuration for syntax errors:
If the test passes without issues, reload NGINX to apply the changes:
Your subdomains should now be set up and accessible via the specified subdomain addresses. This setup enhances the structure of your project by creating a clear distinction between different parts of your application, facilitating developers and users to interact with your endpoints.
However, all your endpoints are still using unsecure HTTP. In the next section, we'll install SSL for all our endpoints.
We will use CertBot as our SSL manager. Install it using the following commands:
Configure SSL:
Change the indicated false
to true
.
If everything is done correctly, your API and RPC links should now be working as follows:
https://crossfi-api.elessarnodes.xyz/
https://crossfi-rpc.elessarnodes.xyz/
For evm rpc, enter this command in your server and it should give an output curl -X POST https://crossfi-jsonrpc.elessarnodes.xyz -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}'
The easiest way to edit the app.toml
file is to find it using a tool like MoboXterm and right-click to edit, as shown in the image below.