Learning POKT Network bit by bit.
Learning POKT Network bit by bit.

Subscribe to POKT HUB

Subscribe to POKT HUB
Share Dialog
Share Dialog


<100 subscribers
<100 subscribers
Ethereum is one of the over 60 chains that is served by POKT Network,a powerful protocol that is your API to the open internet.
To connect to Ethereum over POKT Network we need to use a Gateway.
Gateways in POKT bridge the consumer of services and the suppliers.To consume RPC services that are at the core of POKT protocol one has to go through a gateway.
Gateways are one of the 5 actors of the protocol.
We will learn how to use ethers.js to connect to Ethereum using a POKT powered gateway endpoint provided by Nodies and Grove.
See a list of all POKT powered gateways here.
Once we have the endpoints ready the next step is to make a connection.
As you'll notice with ether.js the signer and provider are separated.
The provider has read only access to data while signer has authenticated write access backed by a private key.
In our case we will use the provider.
The first step is to use FetchRequest and create a custom request with all the necessary headers and authorization.
For Nodies :-
let nodiesRequest = new FetchRequest(process.env.nodies_url);
nodiesRequest.setHeader("x-api-key",process.env.nodies_api_key);
return nodiesRequest;For grove:-
let groveRequest = new FetchRequest(process.env.grove_url);
groveRequest.setHeader("Content-Type","application/json");
groveRequest.setHeader("Authorization",process.env.grove_api_key);
return groveRequest;As you will notice the function accommodates for different gateways since they all have different methods to authenticate.
Once you have the request set up,you can then use it to instantiate JsonRpcProvider, a provider that will perform all operations over HTTPs.
let _connection = new CreateRequest()._makeRequest('grove');
const provider = new ethers.JsonRpcProvider(_connection,1); //1 is Ethereum ChainUpon the provider being available,you can access the function it exposes,in our case we will check the balance of an address on Ethereum chain.
let balance = await provider.getBalance(_address);
return balance;We have explored how to connect to a POKT powered gateway endpoint.
See complete gist here.
Until next time stay POKT.
Ethereum is one of the over 60 chains that is served by POKT Network,a powerful protocol that is your API to the open internet.
To connect to Ethereum over POKT Network we need to use a Gateway.
Gateways in POKT bridge the consumer of services and the suppliers.To consume RPC services that are at the core of POKT protocol one has to go through a gateway.
Gateways are one of the 5 actors of the protocol.
We will learn how to use ethers.js to connect to Ethereum using a POKT powered gateway endpoint provided by Nodies and Grove.
See a list of all POKT powered gateways here.
Once we have the endpoints ready the next step is to make a connection.
As you'll notice with ether.js the signer and provider are separated.
The provider has read only access to data while signer has authenticated write access backed by a private key.
In our case we will use the provider.
The first step is to use FetchRequest and create a custom request with all the necessary headers and authorization.
For Nodies :-
let nodiesRequest = new FetchRequest(process.env.nodies_url);
nodiesRequest.setHeader("x-api-key",process.env.nodies_api_key);
return nodiesRequest;For grove:-
let groveRequest = new FetchRequest(process.env.grove_url);
groveRequest.setHeader("Content-Type","application/json");
groveRequest.setHeader("Authorization",process.env.grove_api_key);
return groveRequest;As you will notice the function accommodates for different gateways since they all have different methods to authenticate.
Once you have the request set up,you can then use it to instantiate JsonRpcProvider, a provider that will perform all operations over HTTPs.
let _connection = new CreateRequest()._makeRequest('grove');
const provider = new ethers.JsonRpcProvider(_connection,1); //1 is Ethereum ChainUpon the provider being available,you can access the function it exposes,in our case we will check the balance of an address on Ethereum chain.
let balance = await provider.getBalance(_address);
return balance;We have explored how to connect to a POKT powered gateway endpoint.
See complete gist here.
Until next time stay POKT.
No activity yet