Skip to content

API Documentation

Luis de Leon edited this page Apr 3, 2019 · 7 revisions

Disclaimer

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

Welcome to Pocket Core Docs

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:

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!

Relay API Reference

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.


Name

Report

Path

localhost:8081/v1/report

Parameters

{
  "IP": "string",
  "Message": "string"
}

Returns

Success or failure message

Example

curl --data {params object} localhost:8081/v1/report


Name

Dispatch

Path

localhost:8081/v1/dispatch

Parameters

{
  "DevID": "string",
  "Blockchains": [
    {
      "Name": "string",
      "NetID": "string"
    }
  ]
}

Returns

[
  {
   "name": "ETH"
   "netid": "4",
   "ips": [
    "8.8.8.8:8081"
   ]
  },
 {
   "name": "BTC"
   "netid": "1",
   "ips": [
    "8.8.8.9:8081"
   ]
 }
]

Example

curl --data {params object} localhost:8081/v1/dispatch


Name

Relay

Path

localhost:8081/v1/relay/

Parameters

{
  "Blockchain": "string",
  "NetworkID": "string"
  "Data": "string",
  "DevID": "string"
}

Returns

Response from hosted chain

Example

curl --data {params object} localhost:8081/v1/relay/

Params Object Example:

{"blockchain":"ethereum","netid":"0","data":"<Ethereum JSONRPC string>","devid":"DEVID1"}

Name

Register

Path

localhost:8081/v1/register

Parameters

{
  "GID": "string",
  "IP": "string",
  "RelayPort": "string",
  "ClientPort": "string",
  "ClientID": "string",
  "CliVersion": "string",
  "Blockchains": [
    {
      "Name": "string",
      "NetID": "string"
    }
  ]
}

Returns

Success or failure message

Example

curl --data {params object} localhost:8080/v1/register

Name

UnRegister

Path

localhost:8081/v1/unregister

Parameters

{
  "GID": "string",
  "IP": "string",
  "RelayPort": "string",
  "ClientPort": "string",
  "ClientID": "string",
  "CliVersion": "string",
  "Blockchains": [
    {
      "Name": "string",
      "NetID": "string"
    }
  ]
}

Returns

Success or failure message

Example

curl --data {params object} localhost:8080/v1/unregister