While a direct integration with PocketJS is the best way to optimize for reliability and censorship-resistance, we understand the need to build an MVP. Most teams need to move fast and build prototypes quickly—and making sure these integrations are failsafe can take some time. Sometimes you just need an endpoint to query data or send transactions. This is what the Pocket Portal provides, an abstraction layer that integrates with PocketJS on your behalf and generates the endpoint you need.
The Portal lets you create an endpoint for the chain you want in just a few clicks and provides you with the features you've come to expect in centralized API services, such as usage/uptime metrics and notifications/alerts.
Go to the Pocket Portal, sign up and verify your email.
Once you've done so, log in and you'll be greeted by the Network Overview section.
{% hint style="info" %} In this section, you'll see all the important parts of the network: how many relays are being served daily, the overall success rate of the network, and the number of apps, nodes, and POKT staked. A summary of chains being served by the network is also available. {% endhint %}
Head over to the "My Apps" section and create your app.
{% hint style="info" %} In this section, you'll be able to select one of the available chains that are currently available. More will be made available depending on demand. {% endhint %}
Once you've hit "Launch Application", all is done and you can start using your endpoint! You should be greeted by the main application screen, which will show all the metrics, which as soon as you start submitting requests, should start appearing.
The view you see is the main view for your application. Here, you'll see key details:
- On the top left, you'll see and will be able to copy your endpoint URL.
- On the right, first you'll see key information about your Pocket application:
- The app status, which indicates if the app is currently staked or unstaked. The app must be staked in order to be eligible for service.
- The amount of POKT staked, which will be enough to add up to the free tier.
- The max amount of relays you can send per day, which currently is 1M as per the free tier.
- On the bottom right, you'll see important identifying information:
- The Gateway ID, used by the Dashboard to fetch your app's information. It's part of your endpoint URL as well.
- The App's public key, which will let you inspect your application on-chain.
- The Secret Key, which is a security feature you can use to make your Pocket Dashboard endpoint more secure.
- On the left side, you'll see all the metrics available for your app.
Turning on notifications is a great way to stay up to date with your app. We respect our users' privacy, and therefore we only send important emails, such as usage notifications. To activate them:
- Click on the "Notifications" button on your app's dashboard, and you'll see the notifications screen.
- Turn on any notifications you're interested in receiving, and then click "Save changes" when you're done.
For securing your endpoint, you can go to the "App Security" section of the Portal. This section of the app contains all the security settings you'll have at your disposal for security. We provide whitelisting for both origins and user agents and also let you enable and disable secret key usage.
Mainly useful for mobile apps, whitelisting user agents lets you limit requests to only the ones you've put in the whitelist. An example user agent would be com.example.bobapp
. This would let Bob's mobile app use the endpoint as his user agent would be whitelisted. If Alice, with user agent com.example.aliceapp
tried to use the endpoint, she wouldn't be able to, as her requests would be blocked before they're sent to the network.
To whitelist origins, just write the URL of the domain you want to allow. All requests from other domains will be blocked. This is a very effective way to only use your app in production, staging, or test environments and to stop malicious users from stealing your endpoint and using it in their project.
For origins, we support wildcard domains as well as normal domains. An example URL would be https://portal.pokt.network
.
Every application has a secret key associated with it, which can be enabled so that every request has to send it using HTTP Basic Authentication to be accepted. An example cURL request with the secret key enabled would be:
{% tabs %} {% tab title="macOS/Linux" %}
curl --user :YOUR-SECRET-KEY \\
...
https://<NETWORK>.gateway.pokt.network/v1/YOUR-GATEWAY-ID
{% endtab %}
{% tab title="Windows" %}
curl --user :YOUR-SECRET-KEY ^
...
https://<NETWORK>.gateway.pokt.network/v1/YOUR-GATEWAY-ID
{% endtab %} {% endtabs %}
This is a truncated example of a call that does not actually send a request. See below for a more detailed example.
Once you've set up your endpoint as per your liking, you can test it however you'd like. In the main application view of the dashboard, you'll be able to see and copy your endpoint to the clipboard. The way endpoints are used in terms of content sent in the body will depend on the chain.
For EVM-based chains (Ethereum, BSC, and others), which see the majority of traffic in Pocket Network, you can refer to the official JSON-RPC specification. Below we have a few examples of requests for Pocket compatible chains.
{% tabs %} {% tab title="macOS/Linux" %}
curl -X POST \\
-H "Content-Type: application/json" \\
--data '{"jsonrpc": "2.0", "id": 1, "method": "eth_blockNumber", "params": []}' \\
"https://<NETWORK>.gateway.pokt.network/v1/<YOUR-GATEWAY-ID>"
{% endtab %}
{% tab title="Windows" %}
curl -X POST ^
-H "Content-Type: application/json" ^
--data "{\"jsonrpc\": \"2.0\", \"id\": 1, \"method\": \"eth_blockNumber\", \"params\": []}" ^
"https://<NETWORK>.gateway.pokt.network/v1/<YOUR-GATEWAY-ID>"
{% endtab %} {% endtabs %}
All endpoints have a similar structure, as they all have:
- The network prefix; see the RelayChainIDs here
- The main URL (
gateway.pokt.network/v1/
) - If it's a load-balanced endpoint, it will also have the LB prefix (
/lb/
) - The Gateway ID.
If you ever need to switch chains for your endpoint, you have the ability to do so once a week. Click on the "Switch chains" button to do so.
You can earn a vote in the DAO and help shape the future of Pocket Network, including deciding which ecosystem tooling our treasury supports and how we configure important on-chain parameters such as the cost of a relay.
Once you've sent 1k relays through the Portal, join our Discord and report this in the 🏆trophies channel.
This is your first trophy on the path to earning a vote in the DAO:
{% content-ref url="../governor/claim-your-vote/app-developer-path.md" %} app-developer-path.md {% endcontent-ref %}
For more details on how to join the DAO, go here:
{% content-ref url="../governor/claim-your-vote/" %} claim-your-vote {% endcontent-ref %}