Developers Forum for XinFin XDC Network

Trahwidhi
Trahwidhi

Posted on

Archive RPC

Hey everyone,

I'm currently working on a project and encountering some issues trying to query from block 1. I need an archive node, but the RPCs I've tried so far don't exactly works.

Here is what I've tested:

https://rpc.ankr.com/xdc - This throws an error whenever I query block 1 (I suspect it’s a standard full node and trims historical state).

https://arpc.xinfin.network & https://rpc.xdcrpc.com/ - These seem to have the archive data, but they block my frontend requests (http://localhost:5173) due to CORS policies.

Here is the exact error I get on the latter two:

Access to fetch at 'https://arpc.xinfin.network/' from origin 'http://localhost:5173' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
Enter fullscreen mode Exit fullscreen mode

My questions:

  1. Are there any free, public Archive RPC nodes available for XDC that support frontend/CORS requests?

  2. If free options aren't available, are there any recommended paid providers that guarantee genesis block queries and allow custom origin headers?

Thanks in advance for any recommendations!

Discussion (16)

Collapse
s4njk4n profile image
s4njk4n

Are you encountering it by using a webpage/html file on your local machine? I’m thinking back and from memory I THINK I got around it by just hosting the page remotely on GitHub Pages for free (so it would have a valid domain as its origin).

The epoch rewards calculator page I linked in my other reply I think may have been the page that had it but now queries RPCs fine.. also I’ve just been using the Ankr RPC and not getting any missing Trie errors , and have managed to query quite far back so I figured it was an archive node but I think u may be right. Could’ve been pruned at some point if can’t get block 1?

the earpc RPC address mentioned by someone else is def an archive node.

Collapse
scarzerolab profile image
Trahwidhi Author

hey, i have deployed the app with Vercel with this endpoint: earpc.xinfin.network/

but i still have and encounter the same CORS error

(index):1 Access to fetch at 'https://earpc.xinfin.network/' from origin 'http://localhost:5173' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
Enter fullscreen mode Exit fullscreen mode

is there someway to contact the RPC to open it's CORS for us or ways to register for it to happend

Collapse
s4njk4n profile image
s4njk4n

You’d have to contact XinFin to ask that.. easier solution to test is just deploy an archive node locally in your office. Then set your local NAT to forward the public-facing RPC port of the NAT to the RPC port on your local archive node machine. That will let you test it. If it works on your own archive node then it means everything is working on your app fine. And then you know that the issue is purely the CORS issue.

Another option is to reach out to blockscan and/or ankr and ask them directly via their support if they have a CORS-permissive archive node you can use for your app. If they say yes then I imagine access would be quite affordable

Thread Thread
s4njk4n profile image
s4njk4n

Also plugin.global have an RPC service available as well but I think at present it was aiming for full nodes…. You could ask them if they have archive nodes as well, and if so how to access and whether you can test on it or how much access will cost. I imagine they’ll be competitive with the other commercial RPC providers..

Collapse
scarzerolab profile image
Trahwidhi Author

yes, i am working on XDC archive node. maybe i should try hosting it on vercel because yes i am using localhost to access it. also i'm gonna try the new earpc RPC

Collapse
s4njk4n profile image
s4njk4n

The issue will likely be localhost as the origin

Thread Thread
scarzerolab profile image
Trahwidhi Author

is there possible way i can use archive RPC that's available with localhost?

Thread Thread
s4njk4n profile image
s4njk4n

Sure is. Just run an archive node locally and I think it should be available at localhost:

Collapse
s4njk4n profile image
s4njk4n

To clarify.. if ur using a html page on ur local machine then it doesn’t have a domain so the origin will show as null and it will get rejected. But if hosted remotely, it shows as the domain instead of null.

Another option is to just run an archive node urself locally. Just set up a mainnet node as normal. Start the node. Stop the node. Delete any initial chain data. Set gcmode=archive then restart the node and let it sync from genesis (or download the latest archive chain snapshot and sync from wherever that gets the node up to.

Good luck

Collapse
s4njk4n profile image
s4njk4n

Hey I used the ankr one in this webpage. If you click on the instructions link at the top it will take u to the GitHub repository where u can view all the JavaScript in a single index.html file

s4njk4n.github.io/XDC_Masternode_R...

Collapse
naresh_mohanraj profile image
Naresh Mohanraj

Please checkout latest RPC as Service by Plugin RPC : rpc.plugin.global/home

Collapse
scarzerolab profile image
Trahwidhi Author

interesting, i did make an email asking regarding Plugin services and they said the RPC are full node not archive node. can you confirm is it archive or full node

Collapse
sean_ profile image
Sean

Plugin RPCs are full node not archive node. You can try with earpc.xinfin.network (archive node).

Collapse
kapil_54c57f35a3474d5deba profile image
Kapil

Please try “Plugin RPC” which has been recently launched by XDC’s native Oracle, Plugin DON core team members:
rpc.plugin.global/

Collapse
scarzerolab profile image
Trahwidhi Author

I did make an email asking regarding Plugin services and they said the RPC are full node not archive node. i tried it and i believe it have the same error (CORS error which i believe because it's in localhost). Does Plugin provide mainnet RPC for that customizable for local development

Collapse
sean_ profile image
Sean

Hello @scarzerolab

Please try with earpc.xinfin.network