-
Notifications
You must be signed in to change notification settings - Fork 105
API Documentation
This page is a static representation of the Pocket Core API. It is important to note that this project is constantly under heavy development and it is likely that these docs will be outdated and revised throughout the process. For the most up to date representation of the API, we recommend the dynamic web app representation that updates automatically with our release candidates. // TODO Add link
If you are hosting Pocket Core on your local machine, each available endpoint can be found at:
localhost:<relay port>/v1/routes
and localhost:<client port>/v1/routes
This simple API guide is an easy to use reference for Pocket Core (MVP). Pocket Core's API may be designed differently then API's you have seen before. It is a blend between a RESTful and a JSON RPC architecture. Using the guide below, it should be very apparent how to access the API from each endpoint.
In addition to this guide, we have created 3 different client SDKs that will enhance your development experience when interacting with the Pocket Core MVP ecosystem, you can find them below:
- Android: Pocket Android
- iOS (Swift): Pocket Swift
- Javascript: Pocket JS
Just a tip: this guide is simply a front end to a series of already exposed GET requests. So if you're running a PC instance, just go to localhost:port/v1/routes to see all the possible routes and visit each route through your browser to see a local JSON version of this guide!
Pocket Core's Relay RPC is for all things 2nd layer specific. What is meant by this is any API call that does not pertain to the Pocket Blockchain will be accessed through this endpoint. Think dispatching, servicing, validating, and sessions.
Report
localhost:8081/v1/report
{
"IP": "string",
"Message": "string"
}
Success or failure message
curl --data {params object} localhost:8081/v1/report
Dispatch
localhost:8081/v1/dispatch
{
"DevID": "string",
"Blockchains": [
{
"Name": "string",
"NetID": "string"
}
]
}
[
{
"name": "ETH"
"netid": "4",
"ips": [
"8.8.8.8:8081"
]
},
{
"name": "BTC"
"netid": "1",
"ips": [
"8.8.8.9:8081"
]
}
]
curl --data {params object} localhost:8081/v1/dispatch
Relay
localhost:8081/v1/relay/
{
"Blockchain": "string",
"NetworkID": "string"
"Data": "string",
"DevID": "string"
}
Response from hosted chain
curl --data {params object} localhost:8081/v1/relay/
{"blockchain":"ethereum","netid":"0","data":"<Ethereum JSONRPC string>","devid":"DEVID1"}
Register
localhost:8081/v1/register
{
"GID": "string",
"IP": "string",
"RelayPort": "string",
"ClientPort": "string",
"ClientID": "string",
"CliVersion": "string",
"Blockchains": [
{
"Name": "string",
"NetID": "string"
}
]
}
Success or failure message
curl --data {params object} localhost:8080/v1/register
UnRegister
localhost:8081/v1/unregister
{
"GID": "string",
"IP": "string",
"RelayPort": "string",
"ClientPort": "string",
"ClientID": "string",
"CliVersion": "string",
"Blockchains": [
{
"Name": "string",
"NetID": "string"
}
]
}
Success or failure message
curl --data {params object} localhost:8080/v1/unregister