index.js
.
We’ll also need a Chainstack node and API key.
web3.js
library as we normally do. Here is an example of fetching the chain_id
:
web3.js
in the Chainstack API docs.
NOTE: web3.js is running without provider. You need to pass a provider in order to interact with the network!
But you can ignore it.web3
instance, we include a Chainstack API key; this key is used to interact with the platform API, so you can use the regular web3
instance:
nodes
object, and that is where you’ll find all the data on your nodes. You can extract the node’s data like this:
web3
instance, but you can also fetch the username
and password
to use in userAuth
for the Chainstack plugin directly like in the first example..env
files with all your endpoints: Create a .env file with all your Chainstack endpoints with JavaScript.