NAV Navigation
cURL Node.js GO Ruby Python Java

TomoChain APIs v1.0.0

Scroll down for code samples, example requests and responses. Select a language for code samples from the tabs above or the mobile navigation menu.

Happy to code TomoChain APIs

License: Github

Tomochain JSON-RPC v1.0.0

Scroll down for code samples, example requests and responses. Select a language for code samples from the tabs above or the mobile navigation menu.

A collection holding all the Tomochain JSON​ RPC API calls

Base URLs:

web3

API for web3 request

clientRequest

Code samples

curl --request POST \
  --url https://rpc.tomochain.com/clientVersion \
  --header 'content-type: application/json' \
  --data '{"jsonrpc":"2.0","method":"web3_clientVersion","params":[],"id":1}'
var http = require("https");

var options = {
  "method": "POST",
  "hostname": "rpc.tomochain.com",
  "port": null,
  "path": "/clientVersion",
  "headers": {
    "content-type": "application/json"
  }
};

var req = http.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.write(JSON.stringify({ jsonrpc: '2.0',
  method: 'web3_clientVersion',
  params: [],
  id: 1 }));
req.end();
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io/ioutil"
)

func main() {

	url := "https://rpc.tomochain.com/clientVersion"

	payload := strings.NewReader("{\"jsonrpc\":\"2.0\",\"method\":\"web3_clientVersion\",\"params\":[],\"id\":1}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("content-type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
require 'uri'
require 'net/http'

url = URI("https://rpc.tomochain.com/clientVersion")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\"jsonrpc\":\"2.0\",\"method\":\"web3_clientVersion\",\"params\":[],\"id\":1}"

response = http.request(request)
puts response.read_body
import http.client

conn = http.client.HTTPSConnection("rpc.tomochain.com")

payload = "{\"jsonrpc\":\"2.0\",\"method\":\"web3_clientVersion\",\"params\":[],\"id\":1}"

headers = { 'content-type': "application/json" }

conn.request("POST", "/clientVersion", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
HttpResponse response = Unirest.post("https://rpc.tomochain.com/clientVersion")
  .header("content-type", "application/json")
  .body("{\"jsonrpc\":\"2.0\",\"method\":\"web3_clientVersion\",\"params\":[],\"id\":1}")
  .asString();

POST /clientVersion

Returns the current client version.

Parameters

none

Returns

String - The current client version

Body parameter

{
  "jsonrpc": "2.0",
  "method": "web3_clientVersion",
  "params": [],
  "id": 1
}

Parameters

Name In Type Required Description
body body clientVersionRequest true none

Responses

Status Meaning Description Schema
200 OK Successful Operation None
500 Internal Server Error Internal Server Error None

sha3Request

Code samples

curl --request POST \
  --url https://rpc.tomochain.com/sha3 \
  --header 'content-type: application/json' \
  --data '{"jsonrpc":"2.0","method":"web3_sha3","params":["0x68656c6c6f20776f726c64"],"id":64}'
var http = require("https");

var options = {
  "method": "POST",
  "hostname": "rpc.tomochain.com",
  "port": null,
  "path": "/sha3",
  "headers": {
    "content-type": "application/json"
  }
};

var req = http.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.write(JSON.stringify({ jsonrpc: '2.0',
  method: 'web3_sha3',
  params: [ '0x68656c6c6f20776f726c64' ],
  id: 64 }));
req.end();
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io/ioutil"
)

func main() {

	url := "https://rpc.tomochain.com/sha3"

	payload := strings.NewReader("{\"jsonrpc\":\"2.0\",\"method\":\"web3_sha3\",\"params\":[\"0x68656c6c6f20776f726c64\"],\"id\":64}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("content-type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
require 'uri'
require 'net/http'

url = URI("https://rpc.tomochain.com/sha3")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\"jsonrpc\":\"2.0\",\"method\":\"web3_sha3\",\"params\":[\"0x68656c6c6f20776f726c64\"],\"id\":64}"

response = http.request(request)
puts response.read_body
import http.client

conn = http.client.HTTPSConnection("rpc.tomochain.com")

payload = "{\"jsonrpc\":\"2.0\",\"method\":\"web3_sha3\",\"params\":[\"0x68656c6c6f20776f726c64\"],\"id\":64}"

headers = { 'content-type': "application/json" }

conn.request("POST", "/sha3", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
HttpResponse response = Unirest.post("https://rpc.tomochain.com/sha3")
  .header("content-type", "application/json")
  .body("{\"jsonrpc\":\"2.0\",\"method\":\"web3_sha3\",\"params\":[\"0x68656c6c6f20776f726c64\"],\"id\":64}")
  .asString();

POST /sha3

Returns Keccak-256 (not the standardized SHA3-256) of the given data.

Parameters

params: [ "0x68656c6c6f20776f726c64" ]

Returns

DATA - The SHA3 result of the given string.

Body parameter

{
  "jsonrpc": "2.0",
  "method": "web3_sha3",
  "params": [
    "0x68656c6c6f20776f726c64"
  ],
  "id": 64
}

Parameters

Name In Type Required Description
body body sha3request true none

Responses

Status Meaning Description Schema
200 OK Successful Operation None
500 Internal Server Error Internal Server Error None

net

API for network request

versionRequest

Code samples

curl --request POST \
  --url https://rpc.tomochain.com/version \
  --header 'content-type: application/json' \
  --data '{"jsonrpc":"2.0","method":"net_version","params":[],"id":67}'
var http = require("https");

var options = {
  "method": "POST",
  "hostname": "rpc.tomochain.com",
  "port": null,
  "path": "/version",
  "headers": {
    "content-type": "application/json"
  }
};

var req = http.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.write(JSON.stringify({ jsonrpc: '2.0', method: 'net_version', params: [], id: 67 }));
req.end();
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io/ioutil"
)

func main() {

	url := "https://rpc.tomochain.com/version"

	payload := strings.NewReader("{\"jsonrpc\":\"2.0\",\"method\":\"net_version\",\"params\":[],\"id\":67}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("content-type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
require 'uri'
require 'net/http'

url = URI("https://rpc.tomochain.com/version")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\"jsonrpc\":\"2.0\",\"method\":\"net_version\",\"params\":[],\"id\":67}"

response = http.request(request)
puts response.read_body
import http.client

conn = http.client.HTTPSConnection("rpc.tomochain.com")

payload = "{\"jsonrpc\":\"2.0\",\"method\":\"net_version\",\"params\":[],\"id\":67}"

headers = { 'content-type': "application/json" }

conn.request("POST", "/version", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
HttpResponse response = Unirest.post("https://rpc.tomochain.com/version")
  .header("content-type", "application/json")
  .body("{\"jsonrpc\":\"2.0\",\"method\":\"net_version\",\"params\":[],\"id\":67}")
  .asString();

POST /version

Returns the current network id.

Parameters

none

Returns

Body parameter

{
  "jsonrpc": "2.0",
  "method": "net_version",
  "params": [],
  "id": 67
}

Parameters

Name In Type Required Description
body body versionrequest true none

Responses

Status Meaning Description Schema
200 OK Successful Operation None
500 Internal Server Error Internal Server Error None

listeningRequest

Code samples

curl --request POST \
  --url https://rpc.tomochain.com/listening \
  --header 'content-type: application/json' \
  --data '{"jsonrpc":"2.0","method":"net_listening","params":[],"id":67}'
var http = require("https");

var options = {
  "method": "POST",
  "hostname": "rpc.tomochain.com",
  "port": null,
  "path": "/listening",
  "headers": {
    "content-type": "application/json"
  }
};

var req = http.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.write(JSON.stringify({ jsonrpc: '2.0', method: 'net_listening', params: [], id: 67 }));
req.end();
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io/ioutil"
)

func main() {

	url := "https://rpc.tomochain.com/listening"

	payload := strings.NewReader("{\"jsonrpc\":\"2.0\",\"method\":\"net_listening\",\"params\":[],\"id\":67}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("content-type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
require 'uri'
require 'net/http'

url = URI("https://rpc.tomochain.com/listening")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\"jsonrpc\":\"2.0\",\"method\":\"net_listening\",\"params\":[],\"id\":67}"

response = http.request(request)
puts response.read_body
import http.client

conn = http.client.HTTPSConnection("rpc.tomochain.com")

payload = "{\"jsonrpc\":\"2.0\",\"method\":\"net_listening\",\"params\":[],\"id\":67}"

headers = { 'content-type': "application/json" }

conn.request("POST", "/listening", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
HttpResponse response = Unirest.post("https://rpc.tomochain.com/listening")
  .header("content-type", "application/json")
  .body("{\"jsonrpc\":\"2.0\",\"method\":\"net_listening\",\"params\":[],\"id\":67}")
  .asString();

POST /listening

Returns true if client is actively listening for network connections.

Parameters

none

Returns

Body parameter

{
  "jsonrpc": "2.0",
  "method": "net_listening",
  "params": [],
  "id": 67
}

Parameters

Name In Type Required Description
body body listeningrequest true none

Responses

Status Meaning Description Schema
200 OK Successful Operation None
500 Internal Server Error Internal Server Error None

peerCountRequest

Code samples

curl --request POST \
  --url https://rpc.tomochain.com/peerCount \
  --header 'content-type: application/json' \
  --data '{"jsonrpc":"2.0","method":"net_peerCount","params":[],"id":74}'
var http = require("https");

var options = {
  "method": "POST",
  "hostname": "rpc.tomochain.com",
  "port": null,
  "path": "/peerCount",
  "headers": {
    "content-type": "application/json"
  }
};

var req = http.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.write(JSON.stringify({ jsonrpc: '2.0', method: 'net_peerCount', params: [], id: 74 }));
req.end();
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io/ioutil"
)

func main() {

	url := "https://rpc.tomochain.com/peerCount"

	payload := strings.NewReader("{\"jsonrpc\":\"2.0\",\"method\":\"net_peerCount\",\"params\":[],\"id\":74}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("content-type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
require 'uri'
require 'net/http'

url = URI("https://rpc.tomochain.com/peerCount")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\"jsonrpc\":\"2.0\",\"method\":\"net_peerCount\",\"params\":[],\"id\":74}"

response = http.request(request)
puts response.read_body
import http.client

conn = http.client.HTTPSConnection("rpc.tomochain.com")

payload = "{\"jsonrpc\":\"2.0\",\"method\":\"net_peerCount\",\"params\":[],\"id\":74}"

headers = { 'content-type': "application/json" }

conn.request("POST", "/peerCount", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
HttpResponse response = Unirest.post("https://rpc.tomochain.com/peerCount")
  .header("content-type", "application/json")
  .body("{\"jsonrpc\":\"2.0\",\"method\":\"net_peerCount\",\"params\":[],\"id\":74}")
  .asString();

POST /peerCount

Returns number of peers currently connected to the client.

Parameters

none

Returns

Body parameter

{
  "jsonrpc": "2.0",
  "method": "net_peerCount",
  "params": [],
  "id": 74
}

Parameters

Name In Type Required Description
body body peerCountRequest true none

Responses

Status Meaning Description Schema
200 OK Successful Operation None
500 Internal Server Error Internal Server Error None

eth

API for eth information

protocolVersionRequest

Code samples

curl --request POST \
  --url https://rpc.tomochain.com/protocolVersion \
  --header 'content-type: application/json' \
  --data '{"jsonrpc":"2.0","method":"eth_protocolVersion","params":[],"id":67}'
var http = require("https");

var options = {
  "method": "POST",
  "hostname": "rpc.tomochain.com",
  "port": null,
  "path": "/protocolVersion",
  "headers": {
    "content-type": "application/json"
  }
};

var req = http.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.write(JSON.stringify({ jsonrpc: '2.0',
  method: 'eth_protocolVersion',
  params: [],
  id: 67 }));
req.end();
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io/ioutil"
)

func main() {

	url := "https://rpc.tomochain.com/protocolVersion"

	payload := strings.NewReader("{\"jsonrpc\":\"2.0\",\"method\":\"eth_protocolVersion\",\"params\":[],\"id\":67}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("content-type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
require 'uri'
require 'net/http'

url = URI("https://rpc.tomochain.com/protocolVersion")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\"jsonrpc\":\"2.0\",\"method\":\"eth_protocolVersion\",\"params\":[],\"id\":67}"

response = http.request(request)
puts response.read_body
import http.client

conn = http.client.HTTPSConnection("rpc.tomochain.com")

payload = "{\"jsonrpc\":\"2.0\",\"method\":\"eth_protocolVersion\",\"params\":[],\"id\":67}"

headers = { 'content-type': "application/json" }

conn.request("POST", "/protocolVersion", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
HttpResponse response = Unirest.post("https://rpc.tomochain.com/protocolVersion")
  .header("content-type", "application/json")
  .body("{\"jsonrpc\":\"2.0\",\"method\":\"eth_protocolVersion\",\"params\":[],\"id\":67}")
  .asString();

POST /protocolVersion

Returns the current ethereum protocol version.

Parameters

none

Returns

Body parameter

{
  "jsonrpc": "2.0",
  "method": "eth_protocolVersion",
  "params": [],
  "id": 67
}

Parameters

Name In Type Required Description
body body protocolVersionRequest true none

Responses

Status Meaning Description Schema
200 OK Successful Operation None
500 Internal Server Error Internal Server Error None

syncingrequest

Code samples

curl --request POST \
  --url https://rpc.tomochain.com/syncing \
  --header 'content-type: application/json' \
  --data '{"jsonrpc":"2.0","method":"eth_syncing","params":[],"id":1}'
var http = require("https");

var options = {
  "method": "POST",
  "hostname": "rpc.tomochain.com",
  "port": null,
  "path": "/syncing",
  "headers": {
    "content-type": "application/json"
  }
};

var req = http.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.write(JSON.stringify({ jsonrpc: '2.0', method: 'eth_syncing', params: [], id: 1 }));
req.end();
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io/ioutil"
)

func main() {

	url := "https://rpc.tomochain.com/syncing"

	payload := strings.NewReader("{\"jsonrpc\":\"2.0\",\"method\":\"eth_syncing\",\"params\":[],\"id\":1}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("content-type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
require 'uri'
require 'net/http'

url = URI("https://rpc.tomochain.com/syncing")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\"jsonrpc\":\"2.0\",\"method\":\"eth_syncing\",\"params\":[],\"id\":1}"

response = http.request(request)
puts response.read_body
import http.client

conn = http.client.HTTPSConnection("rpc.tomochain.com")

payload = "{\"jsonrpc\":\"2.0\",\"method\":\"eth_syncing\",\"params\":[],\"id\":1}"

headers = { 'content-type': "application/json" }

conn.request("POST", "/syncing", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
HttpResponse response = Unirest.post("https://rpc.tomochain.com/syncing")
  .header("content-type", "application/json")
  .body("{\"jsonrpc\":\"2.0\",\"method\":\"eth_syncing\",\"params\":[],\"id\":1}")
  .asString();

POST /syncing

Returns an object with data about the sync status or false.

Parameters

none

Returns

Body parameter

{
  "jsonrpc": "2.0",
  "method": "eth_syncing",
  "params": [],
  "id": 1
}

Parameters

Name In Type Required Description
body body syncingrequest true none

Responses

Status Meaning Description Schema
200 OK Successful Operation None
500 Internal Server Error Internal Server Error None

coinbase

Code samples

curl --request POST \
  --url https://rpc.tomochain.com/coinbase \
  --header 'content-type: application/json' \
  --data '{"jsonrpc":"2.0","method":"eth_coinbase","params":[],"id":64}'
var http = require("https");

var options = {
  "method": "POST",
  "hostname": "rpc.tomochain.com",
  "port": null,
  "path": "/coinbase",
  "headers": {
    "content-type": "application/json"
  }
};

var req = http.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.write(JSON.stringify({ jsonrpc: '2.0', method: 'eth_coinbase', params: [], id: 64 }));
req.end();
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io/ioutil"
)

func main() {

	url := "https://rpc.tomochain.com/coinbase"

	payload := strings.NewReader("{\"jsonrpc\":\"2.0\",\"method\":\"eth_coinbase\",\"params\":[],\"id\":64}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("content-type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
require 'uri'
require 'net/http'

url = URI("https://rpc.tomochain.com/coinbase")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\"jsonrpc\":\"2.0\",\"method\":\"eth_coinbase\",\"params\":[],\"id\":64}"

response = http.request(request)
puts response.read_body
import http.client

conn = http.client.HTTPSConnection("rpc.tomochain.com")

payload = "{\"jsonrpc\":\"2.0\",\"method\":\"eth_coinbase\",\"params\":[],\"id\":64}"

headers = { 'content-type': "application/json" }

conn.request("POST", "/coinbase", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
HttpResponse response = Unirest.post("https://rpc.tomochain.com/coinbase")
  .header("content-type", "application/json")
  .body("{\"jsonrpc\":\"2.0\",\"method\":\"eth_coinbase\",\"params\":[],\"id\":64}")
  .asString();

POST /coinbase

Returns the client coinbase address. Parameters none Returns

Body parameter

{
  "jsonrpc": "2.0",
  "method": "eth_coinbase",
  "params": [],
  "id": 64
}

Parameters

Name In Type Required Description
body body coinbaserequest true none

Responses

Status Meaning Description Schema
200 OK Successful operation None
500 Internal Server Error Internal Server Error None

gasPrice

Code samples

curl --request POST \
  --url https://rpc.tomochain.com/gasPrice \
  --header 'content-type: application/json' \
  --data '{"jsonrpc":"2.0","method":"eth_gasPrice","params":[],"id":73}'
var http = require("https");

var options = {
  "method": "POST",
  "hostname": "rpc.tomochain.com",
  "port": null,
  "path": "/gasPrice",
  "headers": {
    "content-type": "application/json"
  }
};

var req = http.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.write(JSON.stringify({ jsonrpc: '2.0', method: 'eth_gasPrice', params: [], id: 73 }));
req.end();
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io/ioutil"
)

func main() {

	url := "https://rpc.tomochain.com/gasPrice"

	payload := strings.NewReader("{\"jsonrpc\":\"2.0\",\"method\":\"eth_gasPrice\",\"params\":[],\"id\":73}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("content-type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
require 'uri'
require 'net/http'

url = URI("https://rpc.tomochain.com/gasPrice")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\"jsonrpc\":\"2.0\",\"method\":\"eth_gasPrice\",\"params\":[],\"id\":73}"

response = http.request(request)
puts response.read_body
import http.client

conn = http.client.HTTPSConnection("rpc.tomochain.com")

payload = "{\"jsonrpc\":\"2.0\",\"method\":\"eth_gasPrice\",\"params\":[],\"id\":73}"

headers = { 'content-type': "application/json" }

conn.request("POST", "/gasPrice", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
HttpResponse response = Unirest.post("https://rpc.tomochain.com/gasPrice")
  .header("content-type", "application/json")
  .body("{\"jsonrpc\":\"2.0\",\"method\":\"eth_gasPrice\",\"params\":[],\"id\":73}")
  .asString();

POST /gasPrice

Returns the current price per gas in wei. Parameters none Returns

Body parameter

{
  "jsonrpc": "2.0",
  "method": "eth_gasPrice",
  "params": [],
  "id": 73
}

Parameters

Name In Type Required Description
body body gasPriceRequest true none

Responses

Status Meaning Description Schema
200 OK Successful operation None
500 Internal Server Error Internal Server Error None

accounts

Code samples

curl --request POST \
  --url https://rpc.tomochain.com/accounts \
  --header 'content-type: application/json' \
  --data '{"jsonrpc":"2.0","method":"eth_accounts","params":[],"id":1}'
var http = require("https");

var options = {
  "method": "POST",
  "hostname": "rpc.tomochain.com",
  "port": null,
  "path": "/accounts",
  "headers": {
    "content-type": "application/json"
  }
};

var req = http.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.write(JSON.stringify({ jsonrpc: '2.0', method: 'eth_accounts', params: [], id: 1 }));
req.end();
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io/ioutil"
)

func main() {

	url := "https://rpc.tomochain.com/accounts"

	payload := strings.NewReader("{\"jsonrpc\":\"2.0\",\"method\":\"eth_accounts\",\"params\":[],\"id\":1}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("content-type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
require 'uri'
require 'net/http'

url = URI("https://rpc.tomochain.com/accounts")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\"jsonrpc\":\"2.0\",\"method\":\"eth_accounts\",\"params\":[],\"id\":1}"

response = http.request(request)
puts response.read_body
import http.client

conn = http.client.HTTPSConnection("rpc.tomochain.com")

payload = "{\"jsonrpc\":\"2.0\",\"method\":\"eth_accounts\",\"params\":[],\"id\":1}"

headers = { 'content-type': "application/json" }

conn.request("POST", "/accounts", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
HttpResponse response = Unirest.post("https://rpc.tomochain.com/accounts")
  .header("content-type", "application/json")
  .body("{\"jsonrpc\":\"2.0\",\"method\":\"eth_accounts\",\"params\":[],\"id\":1}")
  .asString();

POST /accounts

Returns a list of addresses owned by client.

Parameters

none

Returns

Body parameter

{
  "jsonrpc": "2.0",
  "method": "eth_accounts",
  "params": [],
  "id": 1
}

Parameters

Name In Type Required Description
body body accountsrequest true none

Responses

Status Meaning Description Schema
200 OK Successful operation None
500 Internal Server Error Internal Server Error None

blockNumber

Code samples

curl --request POST \
  --url https://rpc.tomochain.com/blockNumber \
  --header 'content-type: application/json' \
  --data '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":83}'
var http = require("https");

var options = {
  "method": "POST",
  "hostname": "rpc.tomochain.com",
  "port": null,
  "path": "/blockNumber",
  "headers": {
    "content-type": "application/json"
  }
};

var req = http.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.write(JSON.stringify({ jsonrpc: '2.0', method: 'eth_blockNumber', params: [], id: 83 }));
req.end();
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io/ioutil"
)

func main() {

	url := "https://rpc.tomochain.com/blockNumber"

	payload := strings.NewReader("{\"jsonrpc\":\"2.0\",\"method\":\"eth_blockNumber\",\"params\":[],\"id\":83}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("content-type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
require 'uri'
require 'net/http'

url = URI("https://rpc.tomochain.com/blockNumber")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\"jsonrpc\":\"2.0\",\"method\":\"eth_blockNumber\",\"params\":[],\"id\":83}"

response = http.request(request)
puts response.read_body
import http.client

conn = http.client.HTTPSConnection("rpc.tomochain.com")

payload = "{\"jsonrpc\":\"2.0\",\"method\":\"eth_blockNumber\",\"params\":[],\"id\":83}"

headers = { 'content-type': "application/json" }

conn.request("POST", "/blockNumber", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
HttpResponse response = Unirest.post("https://rpc.tomochain.com/blockNumber")
  .header("content-type", "application/json")
  .body("{\"jsonrpc\":\"2.0\",\"method\":\"eth_blockNumber\",\"params\":[],\"id\":83}")
  .asString();

POST /blockNumber

Returns the number of most recent block. Parameters none Returns

Body parameter

{
  "jsonrpc": "2.0",
  "method": "eth_blockNumber",
  "params": [],
  "id": 83
}

Parameters

Name In Type Required Description
body body blockNumberRequest true none

Responses

Status Meaning Description Schema
200 OK Successful operation None
500 Internal Server Error Internal Server Error None

getBalance

Code samples

curl --request POST \
  --url https://rpc.tomochain.com/getBalance \
  --header 'content-type: application/json' \
  --data '{"jsonrpc":"2.0","method":"eth_getBalance","params":["0x2b5634c42055806a59e9107ed44d43c426e58258","latest"],"id":1}'
var http = require("https");

var options = {
  "method": "POST",
  "hostname": "rpc.tomochain.com",
  "port": null,
  "path": "/getBalance",
  "headers": {
    "content-type": "application/json"
  }
};

var req = http.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.write(JSON.stringify({ jsonrpc: '2.0',
  method: 'eth_getBalance',
  params: [ '0x2b5634c42055806a59e9107ed44d43c426e58258', 'latest' ],
  id: 1 }));
req.end();
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io/ioutil"
)

func main() {

	url := "https://rpc.tomochain.com/getBalance"

	payload := strings.NewReader("{\"jsonrpc\":\"2.0\",\"method\":\"eth_getBalance\",\"params\":[\"0x2b5634c42055806a59e9107ed44d43c426e58258\",\"latest\"],\"id\":1}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("content-type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
require 'uri'
require 'net/http'

url = URI("https://rpc.tomochain.com/getBalance")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\"jsonrpc\":\"2.0\",\"method\":\"eth_getBalance\",\"params\":[\"0x2b5634c42055806a59e9107ed44d43c426e58258\",\"latest\"],\"id\":1}"

response = http.request(request)
puts response.read_body
import http.client

conn = http.client.HTTPSConnection("rpc.tomochain.com")

payload = "{\"jsonrpc\":\"2.0\",\"method\":\"eth_getBalance\",\"params\":[\"0x2b5634c42055806a59e9107ed44d43c426e58258\",\"latest\"],\"id\":1}"

headers = { 'content-type': "application/json" }

conn.request("POST", "/getBalance", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
HttpResponse response = Unirest.post("https://rpc.tomochain.com/getBalance")
  .header("content-type", "application/json")
  .body("{\"jsonrpc\":\"2.0\",\"method\":\"eth_getBalance\",\"params\":[\"0x2b5634c42055806a59e9107ed44d43c426e58258\",\"latest\"],\"id\":1}")
  .asString();

POST /getBalance

Returns the balance of the account of given address.

Parameters

Returns

Body parameter

{
  "jsonrpc": "2.0",
  "method": "eth_getBalance",
  "params": [
    "0x2b5634c42055806a59e9107ed44d43c426e58258",
    "latest"
  ],
  "id": 1
}

Parameters

Name In Type Required Description
body body getBalanceRequest true none

Responses

Status Meaning Description Schema
200 OK Successful operation None
500 Internal Server Error Internal Server Error None

getStorageAt

Code samples

curl --request POST \
  --url https://rpc.tomochain.com/getStorageAt \
  --header 'content-type: application/json' \
  --data '{"jsonrpc":"2.0","method":"eth_getStorageAt","params":["0x295a70b2de5e3953354a6a8344e616ed314d7251","0x0","latest"],"id":1}'
var http = require("https");

var options = {
  "method": "POST",
  "hostname": "rpc.tomochain.com",
  "port": null,
  "path": "/getStorageAt",
  "headers": {
    "content-type": "application/json"
  }
};

var req = http.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.write(JSON.stringify({ jsonrpc: '2.0',
  method: 'eth_getStorageAt',
  params: [ '0x295a70b2de5e3953354a6a8344e616ed314d7251', '0x0', 'latest' ],
  id: 1 }));
req.end();
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io/ioutil"
)

func main() {

	url := "https://rpc.tomochain.com/getStorageAt"

	payload := strings.NewReader("{\"jsonrpc\":\"2.0\",\"method\":\"eth_getStorageAt\",\"params\":[\"0x295a70b2de5e3953354a6a8344e616ed314d7251\",\"0x0\",\"latest\"],\"id\":1}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("content-type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
require 'uri'
require 'net/http'

url = URI("https://rpc.tomochain.com/getStorageAt")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\"jsonrpc\":\"2.0\",\"method\":\"eth_getStorageAt\",\"params\":[\"0x295a70b2de5e3953354a6a8344e616ed314d7251\",\"0x0\",\"latest\"],\"id\":1}"

response = http.request(request)
puts response.read_body
import http.client

conn = http.client.HTTPSConnection("rpc.tomochain.com")

payload = "{\"jsonrpc\":\"2.0\",\"method\":\"eth_getStorageAt\",\"params\":[\"0x295a70b2de5e3953354a6a8344e616ed314d7251\",\"0x0\",\"latest\"],\"id\":1}"

headers = { 'content-type': "application/json" }

conn.request("POST", "/getStorageAt", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
HttpResponse response = Unirest.post("https://rpc.tomochain.com/getStorageAt")
  .header("content-type", "application/json")
  .body("{\"jsonrpc\":\"2.0\",\"method\":\"eth_getStorageAt\",\"params\":[\"0x295a70b2de5e3953354a6a8344e616ed314d7251\",\"0x0\",\"latest\"],\"id\":1}")
  .asString();

POST /getStorageAt

Returns the balance of the account of given address.

Parameters

Returns

Body parameter

{
  "jsonrpc": "2.0",
  "method": "eth_getStorageAt",
  "params": [
    "0x295a70b2de5e3953354a6a8344e616ed314d7251",
    "0x0",
    "latest"
  ],
  "id": 1
}

Parameters

Name In Type Required Description
body body getStorageAtRequest true none

Responses

Status Meaning Description Schema
200 OK Successful Operation None
500 Internal Server Error Internal Server Error None

getTransactionCount

Code samples

curl --request POST \
  --url https://rpc.tomochain.com/getTransactionCount \
  --header 'content-type: application/json' \
  --data '{"jsonrpc":"2.0","method":"eth_getTransactionCount","params":["0xbf1dcb735e512b731abd3404c15df6431bd03d42","latest"],"id":1}'
var http = require("https");

var options = {
  "method": "POST",
  "hostname": "rpc.tomochain.com",
  "port": null,
  "path": "/getTransactionCount",
  "headers": {
    "content-type": "application/json"
  }
};

var req = http.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.write(JSON.stringify({ jsonrpc: '2.0',
  method: 'eth_getTransactionCount',
  params: [ '0xbf1dcb735e512b731abd3404c15df6431bd03d42', 'latest' ],
  id: 1 }));
req.end();
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io/ioutil"
)

func main() {

	url := "https://rpc.tomochain.com/getTransactionCount"

	payload := strings.NewReader("{\"jsonrpc\":\"2.0\",\"method\":\"eth_getTransactionCount\",\"params\":[\"0xbf1dcb735e512b731abd3404c15df6431bd03d42\",\"latest\"],\"id\":1}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("content-type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
require 'uri'
require 'net/http'

url = URI("https://rpc.tomochain.com/getTransactionCount")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\"jsonrpc\":\"2.0\",\"method\":\"eth_getTransactionCount\",\"params\":[\"0xbf1dcb735e512b731abd3404c15df6431bd03d42\",\"latest\"],\"id\":1}"

response = http.request(request)
puts response.read_body
import http.client

conn = http.client.HTTPSConnection("rpc.tomochain.com")

payload = "{\"jsonrpc\":\"2.0\",\"method\":\"eth_getTransactionCount\",\"params\":[\"0xbf1dcb735e512b731abd3404c15df6431bd03d42\",\"latest\"],\"id\":1}"

headers = { 'content-type': "application/json" }

conn.request("POST", "/getTransactionCount", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
HttpResponse response = Unirest.post("https://rpc.tomochain.com/getTransactionCount")
  .header("content-type", "application/json")
  .body("{\"jsonrpc\":\"2.0\",\"method\":\"eth_getTransactionCount\",\"params\":[\"0xbf1dcb735e512b731abd3404c15df6431bd03d42\",\"latest\"],\"id\":1}")
  .asString();

POST /getTransactionCount

Returns the number of transactions sent from an address.

Parameters

Returns

Body parameter

{
  "jsonrpc": "2.0",
  "method": "eth_getTransactionCount",
  "params": [
    "0xbf1dcb735e512b731abd3404c15df6431bd03d42",
    "latest"
  ],
  "id": 1
}

Parameters

Name In Type Required Description
body body getTransactionCountRequest true none

Responses

Status Meaning Description Schema
200 OK Successful Operation None
500 Internal Server Error Internal Server Error None

getBlockTransactionCountByHash

Code samples

curl --request POST \
  --url https://rpc.tomochain.com/getBlockTransactionCountByHash \
  --header 'content-type: application/json' \
  --data '{"jsonrpc":"2.0","method":"eth_getBlockTransactionCountByHash","params":["0xc8b967161c671ce952a3d50987a78d64157fb5a8e1724804b87d3e9b11e3aa34"],"id":1}'
var http = require("https");

var options = {
  "method": "POST",
  "hostname": "rpc.tomochain.com",
  "port": null,
  "path": "/getBlockTransactionCountByHash",
  "headers": {
    "content-type": "application/json"
  }
};

var req = http.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.write(JSON.stringify({ jsonrpc: '2.0',
  method: 'eth_getBlockTransactionCountByHash',
  params: 
   [ '0xc8b967161c671ce952a3d50987a78d64157fb5a8e1724804b87d3e9b11e3aa34' ],
  id: 1 }));
req.end();
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io/ioutil"
)

func main() {

	url := "https://rpc.tomochain.com/getBlockTransactionCountByHash"

	payload := strings.NewReader("{\"jsonrpc\":\"2.0\",\"method\":\"eth_getBlockTransactionCountByHash\",\"params\":[\"0xc8b967161c671ce952a3d50987a78d64157fb5a8e1724804b87d3e9b11e3aa34\"],\"id\":1}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("content-type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
require 'uri'
require 'net/http'

url = URI("https://rpc.tomochain.com/getBlockTransactionCountByHash")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\"jsonrpc\":\"2.0\",\"method\":\"eth_getBlockTransactionCountByHash\",\"params\":[\"0xc8b967161c671ce952a3d50987a78d64157fb5a8e1724804b87d3e9b11e3aa34\"],\"id\":1}"

response = http.request(request)
puts response.read_body
import http.client

conn = http.client.HTTPSConnection("rpc.tomochain.com")

payload = "{\"jsonrpc\":\"2.0\",\"method\":\"eth_getBlockTransactionCountByHash\",\"params\":[\"0xc8b967161c671ce952a3d50987a78d64157fb5a8e1724804b87d3e9b11e3aa34\"],\"id\":1}"

headers = { 'content-type': "application/json" }

conn.request("POST", "/getBlockTransactionCountByHash", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
HttpResponse response = Unirest.post("https://rpc.tomochain.com/getBlockTransactionCountByHash")
  .header("content-type", "application/json")
  .body("{\"jsonrpc\":\"2.0\",\"method\":\"eth_getBlockTransactionCountByHash\",\"params\":[\"0xc8b967161c671ce952a3d50987a78d64157fb5a8e1724804b87d3e9b11e3aa34\"],\"id\":1}")
  .asString();

POST /getBlockTransactionCountByHash

Returns the number of transactions in a block from a block matching the given block hash.

Parameters

Returns

Body parameter

{
  "jsonrpc": "2.0",
  "method": "eth_getBlockTransactionCountByHash",
  "params": [
    "0xc8b967161c671ce952a3d50987a78d64157fb5a8e1724804b87d3e9b11e3aa34"
  ],
  "id": 1
}

Parameters

Name In Type Required Description
body body getBlockTransactionCountByHashRequest true none

Responses

Status Meaning Description Schema
200 OK Successful Operation None
500 Internal Server Error Internal Server Error None

getBlockTransactionCountByNumber

Code samples

curl --request POST \
  --url https://rpc.tomochain.com/getBlockTransactionCountByNumber \
  --header 'content-type: application/json' \
  --data '{"jsonrpc":"2.0","method":"eth_getBlockTransactionCountByNumber","params":["0x52A8CA"],"id":1}'
var http = require("https");

var options = {
  "method": "POST",
  "hostname": "rpc.tomochain.com",
  "port": null,
  "path": "/getBlockTransactionCountByNumber",
  "headers": {
    "content-type": "application/json"
  }
};

var req = http.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.write(JSON.stringify({ jsonrpc: '2.0',
  method: 'eth_getBlockTransactionCountByNumber',
  params: [ '0x52A8CA' ],
  id: 1 }));
req.end();
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io/ioutil"
)

func main() {

	url := "https://rpc.tomochain.com/getBlockTransactionCountByNumber"

	payload := strings.NewReader("{\"jsonrpc\":\"2.0\",\"method\":\"eth_getBlockTransactionCountByNumber\",\"params\":[\"0x52A8CA\"],\"id\":1}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("content-type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
require 'uri'
require 'net/http'

url = URI("https://rpc.tomochain.com/getBlockTransactionCountByNumber")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\"jsonrpc\":\"2.0\",\"method\":\"eth_getBlockTransactionCountByNumber\",\"params\":[\"0x52A8CA\"],\"id\":1}"

response = http.request(request)
puts response.read_body
import http.client

conn = http.client.HTTPSConnection("rpc.tomochain.com")

payload = "{\"jsonrpc\":\"2.0\",\"method\":\"eth_getBlockTransactionCountByNumber\",\"params\":[\"0x52A8CA\"],\"id\":1}"

headers = { 'content-type': "application/json" }

conn.request("POST", "/getBlockTransactionCountByNumber", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
HttpResponse response = Unirest.post("https://rpc.tomochain.com/getBlockTransactionCountByNumber")
  .header("content-type", "application/json")
  .body("{\"jsonrpc\":\"2.0\",\"method\":\"eth_getBlockTransactionCountByNumber\",\"params\":[\"0x52A8CA\"],\"id\":1}")
  .asString();

POST /getBlockTransactionCountByNumber

Returns the number of transactions in a block matching the given block number.

Parameters

Returns

Body parameter

{
  "jsonrpc": "2.0",
  "method": "eth_getBlockTransactionCountByNumber",
  "params": [
    "0x52A8CA"
  ],
  "id": 1
}

Parameters

Name In Type Required Description
body body getBlockTransactionCountByNumberRequest true none

Responses

Status Meaning Description Schema
200 OK Successful Operation None
500 Internal Server Error Internal Server Error None

getCode

Code samples

curl --request POST \
  --url https://rpc.tomochain.com/getCode \
  --header 'content-type: application/json' \
  --data '{"jsonrpc":"2.0","method":"eth_getCode","params":["0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b","0x2"],"id":1}'
var http = require("https");

var options = {
  "method": "POST",
  "hostname": "rpc.tomochain.com",
  "port": null,
  "path": "/getCode",
  "headers": {
    "content-type": "application/json"
  }
};

var req = http.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.write(JSON.stringify({ jsonrpc: '2.0',
  method: 'eth_getCode',
  params: [ '0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b', '0x2' ],
  id: 1 }));
req.end();
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io/ioutil"
)

func main() {

	url := "https://rpc.tomochain.com/getCode"

	payload := strings.NewReader("{\"jsonrpc\":\"2.0\",\"method\":\"eth_getCode\",\"params\":[\"0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b\",\"0x2\"],\"id\":1}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("content-type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
require 'uri'
require 'net/http'

url = URI("https://rpc.tomochain.com/getCode")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\"jsonrpc\":\"2.0\",\"method\":\"eth_getCode\",\"params\":[\"0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b\",\"0x2\"],\"id\":1}"

response = http.request(request)
puts response.read_body
import http.client

conn = http.client.HTTPSConnection("rpc.tomochain.com")

payload = "{\"jsonrpc\":\"2.0\",\"method\":\"eth_getCode\",\"params\":[\"0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b\",\"0x2\"],\"id\":1}"

headers = { 'content-type': "application/json" }

conn.request("POST", "/getCode", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
HttpResponse response = Unirest.post("https://rpc.tomochain.com/getCode")
  .header("content-type", "application/json")
  .body("{\"jsonrpc\":\"2.0\",\"method\":\"eth_getCode\",\"params\":[\"0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b\",\"0x2\"],\"id\":1}")
  .asString();

POST /getCode

Returns code at a given address.

Parameters

Returns

Body parameter

{
  "jsonrpc": "2.0",
  "method": "eth_getCode",
  "params": [
    "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b",
    "0x2"
  ],
  "id": 1
}

Parameters

Name In Type Required Description
body body getCodeRequest true none

Responses

Status Meaning Description Schema
200 OK Successful operation None
500 Internal Server Error Internal Server Error None

sign

Code samples

curl --request POST \
  --url https://rpc.tomochain.com/sign \
  --header 'content-type: application/json' \
  --data '{"jsonrpc":"2.0","method":"eth_sign","params":["0x9b2055d370f73ec7d8a03e965129118dc8f5bf83","0xdeadbeaf"],"id":1}'
var http = require("https");

var options = {
  "method": "POST",
  "hostname": "rpc.tomochain.com",
  "port": null,
  "path": "/sign",
  "headers": {
    "content-type": "application/json"
  }
};

var req = http.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.write(JSON.stringify({ jsonrpc: '2.0',
  method: 'eth_sign',
  params: [ '0x9b2055d370f73ec7d8a03e965129118dc8f5bf83', '0xdeadbeaf' ],
  id: 1 }));
req.end();
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io/ioutil"
)

func main() {

	url := "https://rpc.tomochain.com/sign"

	payload := strings.NewReader("{\"jsonrpc\":\"2.0\",\"method\":\"eth_sign\",\"params\":[\"0x9b2055d370f73ec7d8a03e965129118dc8f5bf83\",\"0xdeadbeaf\"],\"id\":1}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("content-type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
require 'uri'
require 'net/http'

url = URI("https://rpc.tomochain.com/sign")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\"jsonrpc\":\"2.0\",\"method\":\"eth_sign\",\"params\":[\"0x9b2055d370f73ec7d8a03e965129118dc8f5bf83\",\"0xdeadbeaf\"],\"id\":1}"

response = http.request(request)
puts response.read_body
import http.client

conn = http.client.HTTPSConnection("rpc.tomochain.com")

payload = "{\"jsonrpc\":\"2.0\",\"method\":\"eth_sign\",\"params\":[\"0x9b2055d370f73ec7d8a03e965129118dc8f5bf83\",\"0xdeadbeaf\"],\"id\":1}"

headers = { 'content-type': "application/json" }

conn.request("POST", "/sign", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
HttpResponse response = Unirest.post("https://rpc.tomochain.com/sign")
  .header("content-type", "application/json")
  .body("{\"jsonrpc\":\"2.0\",\"method\":\"eth_sign\",\"params\":[\"0x9b2055d370f73ec7d8a03e965129118dc8f5bf83\",\"0xdeadbeaf\"],\"id\":1}")
  .asString();

POST /sign

The sign method calculates an Ethereum specific signature with: sign(keccak256("\x19Ethereum Signed Message:\n" + len(message) + message))).

By adding a prefix to the message makes the calculated signature recognisable as an Ethereum specific signature. This prevents misuse where a malicious DApp can sign arbitrary data (e.g. transaction) and use the signature to impersonate the victim.

Note: the address to sign with must be unlocked.

Parameters

Returns

Body parameter

{
  "jsonrpc": "2.0",
  "method": "eth_sign",
  "params": [
    "0x9b2055d370f73ec7d8a03e965129118dc8f5bf83",
    "0xdeadbeaf"
  ],
  "id": 1
}

Parameters

Name In Type Required Description
body body signrequest true none

Responses

Status Meaning Description Schema
200 OK Successful Operation None
500 Internal Server Error Internal Server Error None

sendTransaction

Code samples

curl --request POST \
  --url https://rpc.tomochain.com/sendTransaction \
  --header 'content-type: application/json' \
  --data '{"jsonrpc":"2.0","method":"eth_sendTransaction","params":[{"from":"0xb60e8dd61c5d32be8058bb8eb970870f07233155","to":"0xd46e8dd67c5d32be8058bb8eb970870f07244567","gas":"0x76c0","gasPrice":"0x9184e72a000","value":"0x9184e72a","data":"0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675"}],"id":1}'
var http = require("https");

var options = {
  "method": "POST",
  "hostname": "rpc.tomochain.com",
  "port": null,
  "path": "/sendTransaction",
  "headers": {
    "content-type": "application/json"
  }
};

var req = http.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.write(JSON.stringify({ jsonrpc: '2.0',
  method: 'eth_sendTransaction',
  params: 
   [ { from: '0xb60e8dd61c5d32be8058bb8eb970870f07233155',
       to: '0xd46e8dd67c5d32be8058bb8eb970870f07244567',
       gas: '0x76c0',
       gasPrice: '0x9184e72a000',
       value: '0x9184e72a',
       data: '0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675' } ],
  id: 1 }));
req.end();
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io/ioutil"
)

func main() {

	url := "https://rpc.tomochain.com/sendTransaction"

	payload := strings.NewReader("{\"jsonrpc\":\"2.0\",\"method\":\"eth_sendTransaction\",\"params\":[{\"from\":\"0xb60e8dd61c5d32be8058bb8eb970870f07233155\",\"to\":\"0xd46e8dd67c5d32be8058bb8eb970870f07244567\",\"gas\":\"0x76c0\",\"gasPrice\":\"0x9184e72a000\",\"value\":\"0x9184e72a\",\"data\":\"0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675\"}],\"id\":1}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("content-type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
require 'uri'
require 'net/http'

url = URI("https://rpc.tomochain.com/sendTransaction")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\"jsonrpc\":\"2.0\",\"method\":\"eth_sendTransaction\",\"params\":[{\"from\":\"0xb60e8dd61c5d32be8058bb8eb970870f07233155\",\"to\":\"0xd46e8dd67c5d32be8058bb8eb970870f07244567\",\"gas\":\"0x76c0\",\"gasPrice\":\"0x9184e72a000\",\"value\":\"0x9184e72a\",\"data\":\"0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675\"}],\"id\":1}"

response = http.request(request)
puts response.read_body
import http.client

conn = http.client.HTTPSConnection("rpc.tomochain.com")

payload = "{\"jsonrpc\":\"2.0\",\"method\":\"eth_sendTransaction\",\"params\":[{\"from\":\"0xb60e8dd61c5d32be8058bb8eb970870f07233155\",\"to\":\"0xd46e8dd67c5d32be8058bb8eb970870f07244567\",\"gas\":\"0x76c0\",\"gasPrice\":\"0x9184e72a000\",\"value\":\"0x9184e72a\",\"data\":\"0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675\"}],\"id\":1}"

headers = { 'content-type': "application/json" }

conn.request("POST", "/sendTransaction", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
HttpResponse response = Unirest.post("https://rpc.tomochain.com/sendTransaction")
  .header("content-type", "application/json")
  .body("{\"jsonrpc\":\"2.0\",\"method\":\"eth_sendTransaction\",\"params\":[{\"from\":\"0xb60e8dd61c5d32be8058bb8eb970870f07233155\",\"to\":\"0xd46e8dd67c5d32be8058bb8eb970870f07244567\",\"gas\":\"0x76c0\",\"gasPrice\":\"0x9184e72a000\",\"value\":\"0x9184e72a\",\"data\":\"0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675\"}],\"id\":1}")
  .asString();

POST /sendTransaction

Creates new message call transaction or a contract creation, if the data field contains code.

Parameters

Object - The transaction object

Returns

Use eth_getTransactionReceipt to get the contract address, after the transaction was mined, when you created a contract.

Body parameter

{
  "jsonrpc": "2.0",
  "method": "eth_sendTransaction",
  "params": [
    {
      "from": "0xb60e8dd61c5d32be8058bb8eb970870f07233155",
      "to": "0xd46e8dd67c5d32be8058bb8eb970870f07244567",
      "gas": "0x76c0",
      "gasPrice": "0x9184e72a000",
      "value": "0x9184e72a",
      "data": "0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675"
    }
  ],
  "id": 1
}

Parameters

Name In Type Required Description
body body sendTransactionRequest true none

Responses

Status Meaning Description Schema
200 OK Successful Operation None
500 Internal Server Error Internal Server Error None

sendRawTransaction

Code samples

curl --request POST \
  --url https://rpc.tomochain.com/sendRawTransaction \
  --header 'content-type: application/json' \
  --data '{"jsonrpc":"2.0","method":"eth_sendRawTransaction","params":["0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675"],"id":1}'
var http = require("https");

var options = {
  "method": "POST",
  "hostname": "rpc.tomochain.com",
  "port": null,
  "path": "/sendRawTransaction",
  "headers": {
    "content-type": "application/json"
  }
};

var req = http.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.write(JSON.stringify({ jsonrpc: '2.0',
  method: 'eth_sendRawTransaction',
  params: 
   [ '0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675' ],
  id: 1 }));
req.end();
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io/ioutil"
)

func main() {

	url := "https://rpc.tomochain.com/sendRawTransaction"

	payload := strings.NewReader("{\"jsonrpc\":\"2.0\",\"method\":\"eth_sendRawTransaction\",\"params\":[\"0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675\"],\"id\":1}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("content-type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
require 'uri'
require 'net/http'

url = URI("https://rpc.tomochain.com/sendRawTransaction")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\"jsonrpc\":\"2.0\",\"method\":\"eth_sendRawTransaction\",\"params\":[\"0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675\"],\"id\":1}"

response = http.request(request)
puts response.read_body
import http.client

conn = http.client.HTTPSConnection("rpc.tomochain.com")

payload = "{\"jsonrpc\":\"2.0\",\"method\":\"eth_sendRawTransaction\",\"params\":[\"0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675\"],\"id\":1}"

headers = { 'content-type': "application/json" }

conn.request("POST", "/sendRawTransaction", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
HttpResponse response = Unirest.post("https://rpc.tomochain.com/sendRawTransaction")
  .header("content-type", "application/json")
  .body("{\"jsonrpc\":\"2.0\",\"method\":\"eth_sendRawTransaction\",\"params\":[\"0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675\"],\"id\":1}")
  .asString();

POST /sendRawTransaction

Creates new message call transaction or a contract creation for signed transactions.

Parameters

Returns

Use eth_getTransactionReceipt to get the contract address, after the transaction was mined, when you created a contract.

Body parameter

{
  "jsonrpc": "2.0",
  "method": "eth_sendRawTransaction",
  "params": [
    "0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675"
  ],
  "id": 1
}

Parameters

Name In Type Required Description
body body sendRawTransactionRequest true none

Responses

Status Meaning Description Schema
200 OK Successful Operation None
500 Internal Server Error Internal Server Error None

call

Code samples

curl --request POST \
  --url https://rpc.tomochain.com/call \
  --header 'content-type: application/json' \
  --data '{"jsonrpc":"2.0","method":"eth_call","params":[{"from":"0xb60e8dd61c5d32be8058bb8eb970870f07233155","to":"0xd46e8dd67c5d32be8058bb8eb970870f07244567","gas":"0x76c0","gasPrice":"0x9184e72a000","value":"0x9184e72a","data":"0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675"},"latest"],"id":1}'
var http = require("https");

var options = {
  "method": "POST",
  "hostname": "rpc.tomochain.com",
  "port": null,
  "path": "/call",
  "headers": {
    "content-type": "application/json"
  }
};

var req = http.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.write(JSON.stringify({ jsonrpc: '2.0',
  method: 'eth_call',
  params: 
   [ { from: '0xb60e8dd61c5d32be8058bb8eb970870f07233155',
       to: '0xd46e8dd67c5d32be8058bb8eb970870f07244567',
       gas: '0x76c0',
       gasPrice: '0x9184e72a000',
       value: '0x9184e72a',
       data: '0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675' },
     'latest' ],
  id: 1 }));
req.end();
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io/ioutil"
)

func main() {

	url := "https://rpc.tomochain.com/call"

	payload := strings.NewReader("{\"jsonrpc\":\"2.0\",\"method\":\"eth_call\",\"params\":[{\"from\":\"0xb60e8dd61c5d32be8058bb8eb970870f07233155\",\"to\":\"0xd46e8dd67c5d32be8058bb8eb970870f07244567\",\"gas\":\"0x76c0\",\"gasPrice\":\"0x9184e72a000\",\"value\":\"0x9184e72a\",\"data\":\"0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675\"},\"latest\"],\"id\":1}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("content-type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
require 'uri'
require 'net/http'

url = URI("https://rpc.tomochain.com/call")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\"jsonrpc\":\"2.0\",\"method\":\"eth_call\",\"params\":[{\"from\":\"0xb60e8dd61c5d32be8058bb8eb970870f07233155\",\"to\":\"0xd46e8dd67c5d32be8058bb8eb970870f07244567\",\"gas\":\"0x76c0\",\"gasPrice\":\"0x9184e72a000\",\"value\":\"0x9184e72a\",\"data\":\"0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675\"},\"latest\"],\"id\":1}"

response = http.request(request)
puts response.read_body
import http.client

conn = http.client.HTTPSConnection("rpc.tomochain.com")

payload = "{\"jsonrpc\":\"2.0\",\"method\":\"eth_call\",\"params\":[{\"from\":\"0xb60e8dd61c5d32be8058bb8eb970870f07233155\",\"to\":\"0xd46e8dd67c5d32be8058bb8eb970870f07244567\",\"gas\":\"0x76c0\",\"gasPrice\":\"0x9184e72a000\",\"value\":\"0x9184e72a\",\"data\":\"0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675\"},\"latest\"],\"id\":1}"

headers = { 'content-type': "application/json" }

conn.request("POST", "/call", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
HttpResponse response = Unirest.post("https://rpc.tomochain.com/call")
  .header("content-type", "application/json")
  .body("{\"jsonrpc\":\"2.0\",\"method\":\"eth_call\",\"params\":[{\"from\":\"0xb60e8dd61c5d32be8058bb8eb970870f07233155\",\"to\":\"0xd46e8dd67c5d32be8058bb8eb970870f07244567\",\"gas\":\"0x76c0\",\"gasPrice\":\"0x9184e72a000\",\"value\":\"0x9184e72a\",\"data\":\"0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675\"},\"latest\"],\"id\":1}")
  .asString();

POST /call

Executes a new message call immediately without creating a transaction on the block chain.

Parameters

Object [required]- The transaction call object

Returns

Body parameter

{
  "jsonrpc": "2.0",
  "method": "eth_call",
  "params": [
    {
      "from": "0xb60e8dd61c5d32be8058bb8eb970870f07233155",
      "to": "0xd46e8dd67c5d32be8058bb8eb970870f07244567",
      "gas": "0x76c0",
      "gasPrice": "0x9184e72a000",
      "value": "0x9184e72a",
      "data": "0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675"
    },
    "latest"
  ],
  "id": 1
}

Parameters

Name In Type Required Description
body body callrequest true none

Responses

Status Meaning Description Schema
200 OK Successful Operation None
500 Internal Server Error Internal Server Error None

estimateGas

Code samples

curl --request POST \
  --url https://rpc.tomochain.com/estimateGas \
  --header 'content-type: application/json' \
  --data '{"jsonrpc":"2.0","method":"eth_estimateGas","params":[{"from":"0xb60e8dd61c5d32be8058bb8eb970870f07233155","to":"0xd46e8dd67c5d32be8058bb8eb970870f07244567","gas":"0x76c0","gasPrice":"0x9184e72a000","value":"0x9184e72a","data":"0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675"}],"id":1}'
var http = require("https");

var options = {
  "method": "POST",
  "hostname": "rpc.tomochain.com",
  "port": null,
  "path": "/estimateGas",
  "headers": {
    "content-type": "application/json"
  }
};

var req = http.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.write(JSON.stringify({ jsonrpc: '2.0',
  method: 'eth_estimateGas',
  params: 
   [ { from: '0xb60e8dd61c5d32be8058bb8eb970870f07233155',
       to: '0xd46e8dd67c5d32be8058bb8eb970870f07244567',
       gas: '0x76c0',
       gasPrice: '0x9184e72a000',
       value: '0x9184e72a',
       data: '0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675' } ],
  id: 1 }));
req.end();
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io/ioutil"
)

func main() {

	url := "https://rpc.tomochain.com/estimateGas"

	payload := strings.NewReader("{\"jsonrpc\":\"2.0\",\"method\":\"eth_estimateGas\",\"params\":[{\"from\":\"0xb60e8dd61c5d32be8058bb8eb970870f07233155\",\"to\":\"0xd46e8dd67c5d32be8058bb8eb970870f07244567\",\"gas\":\"0x76c0\",\"gasPrice\":\"0x9184e72a000\",\"value\":\"0x9184e72a\",\"data\":\"0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675\"}],\"id\":1}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("content-type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
require 'uri'
require 'net/http'

url = URI("https://rpc.tomochain.com/estimateGas")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\"jsonrpc\":\"2.0\",\"method\":\"eth_estimateGas\",\"params\":[{\"from\":\"0xb60e8dd61c5d32be8058bb8eb970870f07233155\",\"to\":\"0xd46e8dd67c5d32be8058bb8eb970870f07244567\",\"gas\":\"0x76c0\",\"gasPrice\":\"0x9184e72a000\",\"value\":\"0x9184e72a\",\"data\":\"0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675\"}],\"id\":1}"

response = http.request(request)
puts response.read_body
import http.client

conn = http.client.HTTPSConnection("rpc.tomochain.com")

payload = "{\"jsonrpc\":\"2.0\",\"method\":\"eth_estimateGas\",\"params\":[{\"from\":\"0xb60e8dd61c5d32be8058bb8eb970870f07233155\",\"to\":\"0xd46e8dd67c5d32be8058bb8eb970870f07244567\",\"gas\":\"0x76c0\",\"gasPrice\":\"0x9184e72a000\",\"value\":\"0x9184e72a\",\"data\":\"0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675\"}],\"id\":1}"

headers = { 'content-type': "application/json" }

conn.request("POST", "/estimateGas", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
HttpResponse response = Unirest.post("https://rpc.tomochain.com/estimateGas")
  .header("content-type", "application/json")
  .body("{\"jsonrpc\":\"2.0\",\"method\":\"eth_estimateGas\",\"params\":[{\"from\":\"0xb60e8dd61c5d32be8058bb8eb970870f07233155\",\"to\":\"0xd46e8dd67c5d32be8058bb8eb970870f07244567\",\"gas\":\"0x76c0\",\"gasPrice\":\"0x9184e72a000\",\"value\":\"0x9184e72a\",\"data\":\"0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675\"}],\"id\":1}")
  .asString();

POST /estimateGas

Generates and returns an estimate of how much gas is necessary to allow the transaction to complete. The transaction will not be added to the blockchain. Note that the estimate may be significantly more than the amount of gas actually used by the transaction, for a variety of reasons including EVM mechanics and node performance.

Parameters

See eth_call parameters, expect that all properties are optional. If no gas limit is specified geth uses the block gas limit from the pending block as an upper bound. As a result the returned estimate might not be enough to executed the call/transaction when the amount of gas is higher than the pending block gas limit.

Returns

Body parameter

{
  "jsonrpc": "2.0",
  "method": "eth_estimateGas",
  "params": [
    {
      "from": "0xb60e8dd61c5d32be8058bb8eb970870f07233155",
      "to": "0xd46e8dd67c5d32be8058bb8eb970870f07244567",
      "gas": "0x76c0",
      "gasPrice": "0x9184e72a000",
      "value": "0x9184e72a",
      "data": "0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675"
    }
  ],
  "id": 1
}

Parameters

Name In Type Required Description
body body estimateGasRequest true none

Responses

Status Meaning Description Schema
200 OK Successful Operation None
500 Internal Server Error Internal Server Error None

getBlockByHash

Code samples

curl --request POST \
  --url https://rpc.tomochain.com/getBlockByHash \
  --header 'content-type: application/json' \
  --data '{"jsonrpc":"2.0","method":"eth_getBlockByHash","params":["0x9326145f8a2c8c00bbe13afc7d7f3d9c868b5ef39d89f2f4e9390e9720298624",true],"id":1}'
var http = require("https");

var options = {
  "method": "POST",
  "hostname": "rpc.tomochain.com",
  "port": null,
  "path": "/getBlockByHash",
  "headers": {
    "content-type": "application/json"
  }
};

var req = http.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.write(JSON.stringify({ jsonrpc: '2.0',
  method: 'eth_getBlockByHash',
  params: 
   [ '0x9326145f8a2c8c00bbe13afc7d7f3d9c868b5ef39d89f2f4e9390e9720298624',
     true ],
  id: 1 }));
req.end();
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io/ioutil"
)

func main() {

	url := "https://rpc.tomochain.com/getBlockByHash"

	payload := strings.NewReader("{\"jsonrpc\":\"2.0\",\"method\":\"eth_getBlockByHash\",\"params\":[\"0x9326145f8a2c8c00bbe13afc7d7f3d9c868b5ef39d89f2f4e9390e9720298624\",true],\"id\":1}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("content-type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
require 'uri'
require 'net/http'

url = URI("https://rpc.tomochain.com/getBlockByHash")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\"jsonrpc\":\"2.0\",\"method\":\"eth_getBlockByHash\",\"params\":[\"0x9326145f8a2c8c00bbe13afc7d7f3d9c868b5ef39d89f2f4e9390e9720298624\",true],\"id\":1}"

response = http.request(request)
puts response.read_body
import http.client

conn = http.client.HTTPSConnection("rpc.tomochain.com")

payload = "{\"jsonrpc\":\"2.0\",\"method\":\"eth_getBlockByHash\",\"params\":[\"0x9326145f8a2c8c00bbe13afc7d7f3d9c868b5ef39d89f2f4e9390e9720298624\",true],\"id\":1}"

headers = { 'content-type': "application/json" }

conn.request("POST", "/getBlockByHash", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
HttpResponse response = Unirest.post("https://rpc.tomochain.com/getBlockByHash")
  .header("content-type", "application/json")
  .body("{\"jsonrpc\":\"2.0\",\"method\":\"eth_getBlockByHash\",\"params\":[\"0x9326145f8a2c8c00bbe13afc7d7f3d9c868b5ef39d89f2f4e9390e9720298624\",true],\"id\":1}")
  .asString();

POST /getBlockByHash

Returns information about a block by hash.

Parameters

Returns Object - A block object, or null when no block was found:

Body parameter

{
  "jsonrpc": "2.0",
  "method": "eth_getBlockByHash",
  "params": [
    "0x9326145f8a2c8c00bbe13afc7d7f3d9c868b5ef39d89f2f4e9390e9720298624",
    true
  ],
  "id": 1
}

Parameters

Name In Type Required Description
body body getBlockByHashRequest true none

Responses

Status Meaning Description Schema
200 OK Successful Operation None
500 Internal Server Error Internal Server Error None

getBlockByNumber

Code samples

curl --request POST \
  --url https://rpc.tomochain.com/getBlockByNumber \
  --header 'content-type: application/json' \
  --data '{"jsonrpc":"2.0","method":"eth_getBlockByNumber","params":["0x0",true],"id":1}'
var http = require("https");

var options = {
  "method": "POST",
  "hostname": "rpc.tomochain.com",
  "port": null,
  "path": "/getBlockByNumber",
  "headers": {
    "content-type": "application/json"
  }
};

var req = http.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.write(JSON.stringify({ jsonrpc: '2.0',
  method: 'eth_getBlockByNumber',
  params: [ '0x0', true ],
  id: 1 }));
req.end();
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io/ioutil"
)

func main() {

	url := "https://rpc.tomochain.com/getBlockByNumber"

	payload := strings.NewReader("{\"jsonrpc\":\"2.0\",\"method\":\"eth_getBlockByNumber\",\"params\":[\"0x0\",true],\"id\":1}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("content-type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
require 'uri'
require 'net/http'

url = URI("https://rpc.tomochain.com/getBlockByNumber")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\"jsonrpc\":\"2.0\",\"method\":\"eth_getBlockByNumber\",\"params\":[\"0x0\",true],\"id\":1}"

response = http.request(request)
puts response.read_body
import http.client

conn = http.client.HTTPSConnection("rpc.tomochain.com")

payload = "{\"jsonrpc\":\"2.0\",\"method\":\"eth_getBlockByNumber\",\"params\":[\"0x0\",true],\"id\":1}"

headers = { 'content-type': "application/json" }

conn.request("POST", "/getBlockByNumber", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
HttpResponse response = Unirest.post("https://rpc.tomochain.com/getBlockByNumber")
  .header("content-type", "application/json")
  .body("{\"jsonrpc\":\"2.0\",\"method\":\"eth_getBlockByNumber\",\"params\":[\"0x0\",true],\"id\":1}")
  .asString();

POST /getBlockByNumber

Returns information about a block by block number.

Parameters

BLOCKNUMBER [required] - a hex code of an integer representing the BLOCKNUMBER or one of the following special params:

FULLTX [required] - a boolean value specified whether you want to get transactions list or not

params: [
  '0x0',
  true
]

Returns

See eth_getBlockByHash

Body parameter

{
  "jsonrpc": "2.0",
  "method": "eth_getBlockByNumber",
  "params": [
    "0x0",
    true
  ],
  "id": 1
}

Parameters

Name In Type Required Description
body body getBlockByNumberRequest true none

Responses

Status Meaning Description Schema
200 OK Successful Operation None
500 Internal Server Error Internal Server Error None

getBlockSignersByNumber

Code samples

curl --request POST \
  --url https://rpc.tomochain.com/getBlockSignersByNumber \
  --header 'content-type: application/json' \
  --data '{"jsonrpc":"2.0","method":"eth_getBlockSignersByNumber","params":["0xA61F98"],"id":1}'
var http = require("https");

var options = {
  "method": "POST",
  "hostname": "rpc.tomochain.com",
  "port": null,
  "path": "/getBlockSignersByNumber",
  "headers": {
    "content-type": "application/json"
  }
};

var req = http.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.write(JSON.stringify({ jsonrpc: '2.0',
  method: 'eth_getBlockSignersByNumber',
  params: [ '0xA61F98' ],
  id: 1 }));
req.end();
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io/ioutil"
)

func main() {

	url := "https://rpc.tomochain.com/getBlockSignersByNumber"

	payload := strings.NewReader("{\"jsonrpc\":\"2.0\",\"method\":\"eth_getBlockSignersByNumber\",\"params\":[\"0xA61F98\"],\"id\":1}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("content-type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
require 'uri'
require 'net/http'

url = URI("https://rpc.tomochain.com/getBlockSignersByNumber")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\"jsonrpc\":\"2.0\",\"method\":\"eth_getBlockSignersByNumber\",\"params\":[\"0xA61F98\"],\"id\":1}"

response = http.request(request)
puts response.read_body
import http.client

conn = http.client.HTTPSConnection("rpc.tomochain.com")

payload = "{\"jsonrpc\":\"2.0\",\"method\":\"eth_getBlockSignersByNumber\",\"params\":[\"0xA61F98\"],\"id\":1}"

headers = { 'content-type': "application/json" }

conn.request("POST", "/getBlockSignersByNumber", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
HttpResponse response = Unirest.post("https://rpc.tomochain.com/getBlockSignersByNumber")
  .header("content-type", "application/json")
  .body("{\"jsonrpc\":\"2.0\",\"method\":\"eth_getBlockSignersByNumber\",\"params\":[\"0xA61F98\"],\"id\":1}")
  .asString();

POST /getBlockSignersByNumber

Returns the signers set of the block of given BLOCKNUMBER.

Parameters

BLOCKNUMBER [required] - a hex code of an integer representing the BLOCKNUMBER or one of the following special params:

Returns

Body parameter

{
  "jsonrpc": "2.0",
  "method": "eth_getBlockSignersByNumber",
  "params": [
    "0xA61F98"
  ],
  "id": 1
}

Parameters

Name In Type Required Description
body body getBlockSignersByNumberRequest true none

Responses

Status Meaning Description Schema
200 OK Successful Operation None
500 Internal Server Error Internal Server Error None

getBlockSignersByHash

Code samples

curl --request POST \
  --url https://rpc.tomochain.com/getBlockSignersByHash \
  --header 'content-type: application/json' \
  --data '{"jsonrpc":"2.0","method":"eth_getBlockSignersByHash","params":["0x605777ee60ef3ccf21e079fa1b091b0196cf1a2c1dd7c088dd5b1ab03f680b6f"],"id":1}'
var http = require("https");

var options = {
  "method": "POST",
  "hostname": "rpc.tomochain.com",
  "port": null,
  "path": "/getBlockSignersByHash",
  "headers": {
    "content-type": "application/json"
  }
};

var req = http.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.write(JSON.stringify({ jsonrpc: '2.0',
  method: 'eth_getBlockSignersByHash',
  params: 
   [ '0x605777ee60ef3ccf21e079fa1b091b0196cf1a2c1dd7c088dd5b1ab03f680b6f' ],
  id: 1 }));
req.end();
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io/ioutil"
)

func main() {

	url := "https://rpc.tomochain.com/getBlockSignersByHash"

	payload := strings.NewReader("{\"jsonrpc\":\"2.0\",\"method\":\"eth_getBlockSignersByHash\",\"params\":[\"0x605777ee60ef3ccf21e079fa1b091b0196cf1a2c1dd7c088dd5b1ab03f680b6f\"],\"id\":1}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("content-type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
require 'uri'
require 'net/http'

url = URI("https://rpc.tomochain.com/getBlockSignersByHash")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\"jsonrpc\":\"2.0\",\"method\":\"eth_getBlockSignersByHash\",\"params\":[\"0x605777ee60ef3ccf21e079fa1b091b0196cf1a2c1dd7c088dd5b1ab03f680b6f\"],\"id\":1}"

response = http.request(request)
puts response.read_body
import http.client

conn = http.client.HTTPSConnection("rpc.tomochain.com")

payload = "{\"jsonrpc\":\"2.0\",\"method\":\"eth_getBlockSignersByHash\",\"params\":[\"0x605777ee60ef3ccf21e079fa1b091b0196cf1a2c1dd7c088dd5b1ab03f680b6f\"],\"id\":1}"

headers = { 'content-type': "application/json" }

conn.request("POST", "/getBlockSignersByHash", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
HttpResponse response = Unirest.post("https://rpc.tomochain.com/getBlockSignersByHash")
  .header("content-type", "application/json")
  .body("{\"jsonrpc\":\"2.0\",\"method\":\"eth_getBlockSignersByHash\",\"params\":[\"0x605777ee60ef3ccf21e079fa1b091b0196cf1a2c1dd7c088dd5b1ab03f680b6f\"],\"id\":1}")
  .asString();

POST /getBlockSignersByHash

Returns the signers set of the block of given BLOCKHASH.

Parameters

Returns

Body parameter

{
  "jsonrpc": "2.0",
  "method": "eth_getBlockSignersByHash",
  "params": [
    "0x605777ee60ef3ccf21e079fa1b091b0196cf1a2c1dd7c088dd5b1ab03f680b6f"
  ],
  "id": 1
}

Parameters

Name In Type Required Description
body body getBlockSignersByHashRequest true none

Responses

Status Meaning Description Schema
200 OK Successful Operation None
500 Internal Server Error Internal Server Error None

getBlockFinalityByNumber

Code samples

curl --request POST \
  --url https://rpc.tomochain.com/getBlockFinalityByNumber \
  --header 'content-type: application/json' \
  --data '{"jsonrpc":"2.0","method":"eth_getBlockFinalityByNumber","params":["0xA61F98"],"id":1}'
var http = require("https");

var options = {
  "method": "POST",
  "hostname": "rpc.tomochain.com",
  "port": null,
  "path": "/getBlockFinalityByNumber",
  "headers": {
    "content-type": "application/json"
  }
};

var req = http.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.write(JSON.stringify({ jsonrpc: '2.0',
  method: 'eth_getBlockFinalityByNumber',
  params: [ '0xA61F98' ],
  id: 1 }));
req.end();
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io/ioutil"
)

func main() {

	url := "https://rpc.tomochain.com/getBlockFinalityByNumber"

	payload := strings.NewReader("{\"jsonrpc\":\"2.0\",\"method\":\"eth_getBlockFinalityByNumber\",\"params\":[\"0xA61F98\"],\"id\":1}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("content-type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
require 'uri'
require 'net/http'

url = URI("https://rpc.tomochain.com/getBlockFinalityByNumber")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\"jsonrpc\":\"2.0\",\"method\":\"eth_getBlockFinalityByNumber\",\"params\":[\"0xA61F98\"],\"id\":1}"

response = http.request(request)
puts response.read_body
import http.client

conn = http.client.HTTPSConnection("rpc.tomochain.com")

payload = "{\"jsonrpc\":\"2.0\",\"method\":\"eth_getBlockFinalityByNumber\",\"params\":[\"0xA61F98\"],\"id\":1}"

headers = { 'content-type': "application/json" }

conn.request("POST", "/getBlockFinalityByNumber", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
HttpResponse response = Unirest.post("https://rpc.tomochain.com/getBlockFinalityByNumber")
  .header("content-type", "application/json")
  .body("{\"jsonrpc\":\"2.0\",\"method\":\"eth_getBlockFinalityByNumber\",\"params\":[\"0xA61F98\"],\"id\":1}")
  .asString();

POST /getBlockFinalityByNumber

Returns the the finality of the block of given BLOCKNUMBER.

Parameters

Returns

Body parameter

{
  "jsonrpc": "2.0",
  "method": "eth_getBlockFinalityByNumber",
  "params": [
    "0xA61F98"
  ],
  "id": 1
}

Parameters

Name In Type Required Description
body body getBlockFinalityByNumberRequest true none

Responses

Status Meaning Description Schema
200 OK Successful Operation None
500 Internal Server Error Internal Server Error None

getBlockFinalityByHash

Code samples

curl --request POST \
  --url https://rpc.tomochain.com/getBlockFinalityByHash \
  --header 'content-type: application/json' \
  --data '{"jsonrpc":"2.0","method":"eth_getBlockFinalityByHash","params":["0x605777ee60ef3ccf21e079fa1b091b0196cf1a2c1dd7c088dd5b1ab03f680b6f"],"id":1}'
var http = require("https");

var options = {
  "method": "POST",
  "hostname": "rpc.tomochain.com",
  "port": null,
  "path": "/getBlockFinalityByHash",
  "headers": {
    "content-type": "application/json"
  }
};

var req = http.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.write(JSON.stringify({ jsonrpc: '2.0',
  method: 'eth_getBlockFinalityByHash',
  params: 
   [ '0x605777ee60ef3ccf21e079fa1b091b0196cf1a2c1dd7c088dd5b1ab03f680b6f' ],
  id: 1 }));
req.end();
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io/ioutil"
)

func main() {

	url := "https://rpc.tomochain.com/getBlockFinalityByHash"

	payload := strings.NewReader("{\"jsonrpc\":\"2.0\",\"method\":\"eth_getBlockFinalityByHash\",\"params\":[\"0x605777ee60ef3ccf21e079fa1b091b0196cf1a2c1dd7c088dd5b1ab03f680b6f\"],\"id\":1}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("content-type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
require 'uri'
require 'net/http'

url = URI("https://rpc.tomochain.com/getBlockFinalityByHash")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\"jsonrpc\":\"2.0\",\"method\":\"eth_getBlockFinalityByHash\",\"params\":[\"0x605777ee60ef3ccf21e079fa1b091b0196cf1a2c1dd7c088dd5b1ab03f680b6f\"],\"id\":1}"

response = http.request(request)
puts response.read_body
import http.client

conn = http.client.HTTPSConnection("rpc.tomochain.com")

payload = "{\"jsonrpc\":\"2.0\",\"method\":\"eth_getBlockFinalityByHash\",\"params\":[\"0x605777ee60ef3ccf21e079fa1b091b0196cf1a2c1dd7c088dd5b1ab03f680b6f\"],\"id\":1}"

headers = { 'content-type': "application/json" }

conn.request("POST", "/getBlockFinalityByHash", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
HttpResponse response = Unirest.post("https://rpc.tomochain.com/getBlockFinalityByHash")
  .header("content-type", "application/json")
  .body("{\"jsonrpc\":\"2.0\",\"method\":\"eth_getBlockFinalityByHash\",\"params\":[\"0x605777ee60ef3ccf21e079fa1b091b0196cf1a2c1dd7c088dd5b1ab03f680b6f\"],\"id\":1}")
  .asString();

POST /getBlockFinalityByHash

Returns the the finality of the block of given BLOCKHASH.

Parameters

BLOCKHASH [required] - a string representing a BLOCKHASH

params: [
  '0x605777ee60ef3ccf21e079fa1b091b0196cf1a2c1dd7c088dd5b1ab03f680b6f'
]

Returns

Body parameter

{
  "jsonrpc": "2.0",
  "method": "eth_getBlockFinalityByHash",
  "params": [
    "0x605777ee60ef3ccf21e079fa1b091b0196cf1a2c1dd7c088dd5b1ab03f680b6f"
  ],
  "id": 1
}

Parameters

Name In Type Required Description
body body getBlockFinalityByHashRequest true none

Responses

Status Meaning Description Schema
200 OK Successful Operation None
500 Internal Server Error Internal Server Error None

getCandidates

Code samples

curl --request POST \
  --url https://rpc.tomochain.com/getCandidates \
  --header 'content-type: application/json' \
  --data '{"jsonrpc":"2.0","method":"eth_getCandidates","params":["latest"],"id":1}'
var http = require("https");

var options = {
  "method": "POST",
  "hostname": "rpc.tomochain.com",
  "port": null,
  "path": "/getCandidates",
  "headers": {
    "content-type": "application/json"
  }
};

var req = http.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.write(JSON.stringify({ jsonrpc: '2.0',
  method: 'eth_getCandidates',
  params: [ 'latest' ],
  id: 1 }));
req.end();
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io/ioutil"
)

func main() {

	url := "https://rpc.tomochain.com/getCandidates"

	payload := strings.NewReader("{\"jsonrpc\":\"2.0\",\"method\":\"eth_getCandidates\",\"params\":[\"latest\"],\"id\":1}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("content-type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
require 'uri'
require 'net/http'

url = URI("https://rpc.tomochain.com/getCandidates")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\"jsonrpc\":\"2.0\",\"method\":\"eth_getCandidates\",\"params\":[\"latest\"],\"id\":1}"

response = http.request(request)
puts response.read_body
import http.client

conn = http.client.HTTPSConnection("rpc.tomochain.com")

payload = "{\"jsonrpc\":\"2.0\",\"method\":\"eth_getCandidates\",\"params\":[\"latest\"],\"id\":1}"

headers = { 'content-type': "application/json" }

conn.request("POST", "/getCandidates", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
HttpResponse response = Unirest.post("https://rpc.tomochain.com/getCandidates")
  .header("content-type", "application/json")
  .body("{\"jsonrpc\":\"2.0\",\"method\":\"eth_getCandidates\",\"params\":[\"latest\"],\"id\":1}")
  .asString();

POST /getCandidates

Returns the statuses of all candidates at a specific epoch

Parameters

Returns

Body parameter

{
  "jsonrpc": "2.0",
  "method": "eth_getCandidates",
  "params": [
    "latest"
  ],
  "id": 1
}

Parameters

Name In Type Required Description
body body getCandidatesRequest true none

Responses

Status Meaning Description Schema
200 OK Successful Operation None
500 Internal Server Error Internal Server Error None

getCandidateStatus

Code samples

curl --request POST \
  --url https://rpc.tomochain.com/getCandidateStatus \
  --header 'content-type: application/json' \
  --data '{"jsonrpc":"2.0","method":"eth_getCandidateStatus","params":["0x1d50df657b6dce50bac634bf18e2d986d807e940","latest"],"id":1}'
var http = require("https");

var options = {
  "method": "POST",
  "hostname": "rpc.tomochain.com",
  "port": null,
  "path": "/getCandidateStatus",
  "headers": {
    "content-type": "application/json"
  }
};

var req = http.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.write(JSON.stringify({ jsonrpc: '2.0',
  method: 'eth_getCandidateStatus',
  params: [ '0x1d50df657b6dce50bac634bf18e2d986d807e940', 'latest' ],
  id: 1 }));
req.end();
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io/ioutil"
)

func main() {

	url := "https://rpc.tomochain.com/getCandidateStatus"

	payload := strings.NewReader("{\"jsonrpc\":\"2.0\",\"method\":\"eth_getCandidateStatus\",\"params\":[\"0x1d50df657b6dce50bac634bf18e2d986d807e940\",\"latest\"],\"id\":1}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("content-type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
require 'uri'
require 'net/http'

url = URI("https://rpc.tomochain.com/getCandidateStatus")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\"jsonrpc\":\"2.0\",\"method\":\"eth_getCandidateStatus\",\"params\":[\"0x1d50df657b6dce50bac634bf18e2d986d807e940\",\"latest\"],\"id\":1}"

response = http.request(request)
puts response.read_body
import http.client

conn = http.client.HTTPSConnection("rpc.tomochain.com")

payload = "{\"jsonrpc\":\"2.0\",\"method\":\"eth_getCandidateStatus\",\"params\":[\"0x1d50df657b6dce50bac634bf18e2d986d807e940\",\"latest\"],\"id\":1}"

headers = { 'content-type': "application/json" }

conn.request("POST", "/getCandidateStatus", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
HttpResponse response = Unirest.post("https://rpc.tomochain.com/getCandidateStatus")
  .header("content-type", "application/json")
  .body("{\"jsonrpc\":\"2.0\",\"method\":\"eth_getCandidateStatus\",\"params\":[\"0x1d50df657b6dce50bac634bf18e2d986d807e940\",\"latest\"],\"id\":1}")
  .asString();

POST /getCandidateStatus

Returns the status of the candidate of given COINBASE_ADDRESS at a specific epoch

Parameters

Returns

Body parameter

{
  "jsonrpc": "2.0",
  "method": "eth_getCandidateStatus",
  "params": [
    "0x1d50df657b6dce50bac634bf18e2d986d807e940",
    "latest"
  ],
  "id": 1
}

Parameters

Name In Type Required Description
body body getCandidateStatusRequest true none

Responses

Status Meaning Description Schema
200 OK Successful Operation None
500 Internal Server Error Internal Server Error None

getTransactionByHash

Code samples

curl --request POST \
  --url https://rpc.tomochain.com/getTransactionByHash \
  --header 'content-type: application/json' \
  --data '{"jsonrpc":"2.0","method":"eth_getTransactionByHash","params":["0xd83b26e101dd6480764bade90fc283407919f60b7e65ff83fbf6cdc92f1138a1"],"id":1}'
var http = require("https");

var options = {
  "method": "POST",
  "hostname": "rpc.tomochain.com",
  "port": null,
  "path": "/getTransactionByHash",
  "headers": {
    "content-type": "application/json"
  }
};

var req = http.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.write(JSON.stringify({ jsonrpc: '2.0',
  method: 'eth_getTransactionByHash',
  params: 
   [ '0xd83b26e101dd6480764bade90fc283407919f60b7e65ff83fbf6cdc92f1138a1' ],
  id: 1 }));
req.end();
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io/ioutil"
)

func main() {

	url := "https://rpc.tomochain.com/getTransactionByHash"

	payload := strings.NewReader("{\"jsonrpc\":\"2.0\",\"method\":\"eth_getTransactionByHash\",\"params\":[\"0xd83b26e101dd6480764bade90fc283407919f60b7e65ff83fbf6cdc92f1138a1\"],\"id\":1}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("content-type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
require 'uri'
require 'net/http'

url = URI("https://rpc.tomochain.com/getTransactionByHash")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\"jsonrpc\":\"2.0\",\"method\":\"eth_getTransactionByHash\",\"params\":[\"0xd83b26e101dd6480764bade90fc283407919f60b7e65ff83fbf6cdc92f1138a1\"],\"id\":1}"

response = http.request(request)
puts response.read_body
import http.client

conn = http.client.HTTPSConnection("rpc.tomochain.com")

payload = "{\"jsonrpc\":\"2.0\",\"method\":\"eth_getTransactionByHash\",\"params\":[\"0xd83b26e101dd6480764bade90fc283407919f60b7e65ff83fbf6cdc92f1138a1\"],\"id\":1}"

headers = { 'content-type': "application/json" }

conn.request("POST", "/getTransactionByHash", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
HttpResponse response = Unirest.post("https://rpc.tomochain.com/getTransactionByHash")
  .header("content-type", "application/json")
  .body("{\"jsonrpc\":\"2.0\",\"method\":\"eth_getTransactionByHash\",\"params\":[\"0xd83b26e101dd6480764bade90fc283407919f60b7e65ff83fbf6cdc92f1138a1\"],\"id\":1}")
  .asString();

POST /getTransactionByHash

Returns the information about a transaction requested by transaction hash.

Parameters

Returns

Object - A transaction object, or null when no transaction was found:

Body parameter

{
  "jsonrpc": "2.0",
  "method": "eth_getTransactionByHash",
  "params": [
    "0xd83b26e101dd6480764bade90fc283407919f60b7e65ff83fbf6cdc92f1138a1"
  ],
  "id": 1
}

Parameters

Name In Type Required Description
body body getTransactionByHashRequest true none

Responses

Status Meaning Description Schema
200 OK Successful Operation None
500 Internal Server Error Internal Server Error None

getTransactionByBlockHashAndIndex

Code samples

curl --request POST \
  --url https://rpc.tomochain.com/getTransactionByBlockHashAndIndex \
  --header 'content-type: application/json' \
  --data '{"jsonrpc":"2.0","method":"eth_getTransactionByBlockHashAndIndex","params":["0x3c82bc62179602b67318c013c10f99011037c49cba84e31ffe6e465a21c521a7","0x0"],"id":1}'
var http = require("https");

var options = {
  "method": "POST",
  "hostname": "rpc.tomochain.com",
  "port": null,
  "path": "/getTransactionByBlockHashAndIndex",
  "headers": {
    "content-type": "application/json"
  }
};

var req = http.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.write(JSON.stringify({ jsonrpc: '2.0',
  method: 'eth_getTransactionByBlockHashAndIndex',
  params: 
   [ '0x3c82bc62179602b67318c013c10f99011037c49cba84e31ffe6e465a21c521a7',
     '0x0' ],
  id: 1 }));
req.end();
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io/ioutil"
)

func main() {

	url := "https://rpc.tomochain.com/getTransactionByBlockHashAndIndex"

	payload := strings.NewReader("{\"jsonrpc\":\"2.0\",\"method\":\"eth_getTransactionByBlockHashAndIndex\",\"params\":[\"0x3c82bc62179602b67318c013c10f99011037c49cba84e31ffe6e465a21c521a7\",\"0x0\"],\"id\":1}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("content-type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
require 'uri'
require 'net/http'

url = URI("https://rpc.tomochain.com/getTransactionByBlockHashAndIndex")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\"jsonrpc\":\"2.0\",\"method\":\"eth_getTransactionByBlockHashAndIndex\",\"params\":[\"0x3c82bc62179602b67318c013c10f99011037c49cba84e31ffe6e465a21c521a7\",\"0x0\"],\"id\":1}"

response = http.request(request)
puts response.read_body
import http.client

conn = http.client.HTTPSConnection("rpc.tomochain.com")

payload = "{\"jsonrpc\":\"2.0\",\"method\":\"eth_getTransactionByBlockHashAndIndex\",\"params\":[\"0x3c82bc62179602b67318c013c10f99011037c49cba84e31ffe6e465a21c521a7\",\"0x0\"],\"id\":1}"

headers = { 'content-type': "application/json" }

conn.request("POST", "/getTransactionByBlockHashAndIndex", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
HttpResponse response = Unirest.post("https://rpc.tomochain.com/getTransactionByBlockHashAndIndex")
  .header("content-type", "application/json")
  .body("{\"jsonrpc\":\"2.0\",\"method\":\"eth_getTransactionByBlockHashAndIndex\",\"params\":[\"0x3c82bc62179602b67318c013c10f99011037c49cba84e31ffe6e465a21c521a7\",\"0x0\"],\"id\":1}")
  .asString();

POST /getTransactionByBlockHashAndIndex

Returns information about a transaction by block hash and transaction index position. Parameters

Returns See eth_getTransactionByHash

Body parameter

{
  "jsonrpc": "2.0",
  "method": "eth_getTransactionByBlockHashAndIndex",
  "params": [
    "0x3c82bc62179602b67318c013c10f99011037c49cba84e31ffe6e465a21c521a7",
    "0x0"
  ],
  "id": 1
}

Parameters

Name In Type Required Description
body body getTransactionByBlockHashAndIndexRequest true none

Responses

Status Meaning Description Schema
200 OK Successful Operation None
500 Internal Server Error Internal Server Error None

getTransactionByBlockNumberAndIndex

Code samples

curl --request POST \
  --url https://rpc.tomochain.com/getTransactionByBlockNumberAndIndex \
  --header 'content-type: application/json' \
  --data '{"jsonrpc":"2.0","method":"eth_getTransactionByBlockNumberAndIndex","params":["0x52A96E","0x1"],"id":1}'
var http = require("https");

var options = {
  "method": "POST",
  "hostname": "rpc.tomochain.com",
  "port": null,
  "path": "/getTransactionByBlockNumberAndIndex",
  "headers": {
    "content-type": "application/json"
  }
};

var req = http.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.write(JSON.stringify({ jsonrpc: '2.0',
  method: 'eth_getTransactionByBlockNumberAndIndex',
  params: [ '0x52A96E', '0x1' ],
  id: 1 }));
req.end();
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io/ioutil"
)

func main() {

	url := "https://rpc.tomochain.com/getTransactionByBlockNumberAndIndex"

	payload := strings.NewReader("{\"jsonrpc\":\"2.0\",\"method\":\"eth_getTransactionByBlockNumberAndIndex\",\"params\":[\"0x52A96E\",\"0x1\"],\"id\":1}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("content-type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
require 'uri'
require 'net/http'

url = URI("https://rpc.tomochain.com/getTransactionByBlockNumberAndIndex")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\"jsonrpc\":\"2.0\",\"method\":\"eth_getTransactionByBlockNumberAndIndex\",\"params\":[\"0x52A96E\",\"0x1\"],\"id\":1}"

response = http.request(request)
puts response.read_body
import http.client

conn = http.client.HTTPSConnection("rpc.tomochain.com")

payload = "{\"jsonrpc\":\"2.0\",\"method\":\"eth_getTransactionByBlockNumberAndIndex\",\"params\":[\"0x52A96E\",\"0x1\"],\"id\":1}"

headers = { 'content-type': "application/json" }

conn.request("POST", "/getTransactionByBlockNumberAndIndex", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
HttpResponse response = Unirest.post("https://rpc.tomochain.com/getTransactionByBlockNumberAndIndex")
  .header("content-type", "application/json")
  .body("{\"jsonrpc\":\"2.0\",\"method\":\"eth_getTransactionByBlockNumberAndIndex\",\"params\":[\"0x52A96E\",\"0x1\"],\"id\":1}")
  .asString();

POST /getTransactionByBlockNumberAndIndex

Returns information about a transaction by block number and transaction index position.

Parameters

Returns

See eth_getTransactionByHash

Body parameter

{
  "jsonrpc": "2.0",
  "method": "eth_getTransactionByBlockNumberAndIndex",
  "params": [
    "0x52A96E",
    "0x1"
  ],
  "id": 1
}

Parameters

Name In Type Required Description
body body getTransactionByBlockNumberAndIndexRequest true none

Responses

Status Meaning Description Schema
200 OK Successful Operation None
500 Internal Server Error Internal Server Error None

getTransactionReceipt

Code samples

curl --request POST \
  --url https://rpc.tomochain.com/getTransactionReceipt \
  --header 'content-type: application/json' \
  --data '{"jsonrpc":"2.0","method":"eth_getTransactionReceipt","params":["0xa3ece39ae137617669c6933b7578b94e705e765683f260fcfe30eaa41932610f"],"id":1}'
var http = require("https");

var options = {
  "method": "POST",
  "hostname": "rpc.tomochain.com",
  "port": null,
  "path": "/getTransactionReceipt",
  "headers": {
    "content-type": "application/json"
  }
};

var req = http.request(options, function (res) {
  var chunks = [];

  res.on("data", function (chunk) {
    chunks.push(chunk);
  });

  res.on("end", function () {
    var body = Buffer.concat(chunks);
    console.log(body.toString());
  });
});

req.write(JSON.stringify({ jsonrpc: '2.0',
  method: 'eth_getTransactionReceipt',
  params: 
   [ '0xa3ece39ae137617669c6933b7578b94e705e765683f260fcfe30eaa41932610f' ],
  id: 1 }));
req.end();
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io/ioutil"
)

func main() {

	url := "https://rpc.tomochain.com/getTransactionReceipt"

	payload := strings.NewReader("{\"jsonrpc\":\"2.0\",\"method\":\"eth_getTransactionReceipt\",\"params\":[\"0xa3ece39ae137617669c6933b7578b94e705e765683f260fcfe30eaa41932610f\"],\"id\":1}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("content-type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := ioutil.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
require 'uri'
require 'net/http'

url = URI("https://rpc.tomochain.com/getTransactionReceipt")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE

request = Net::HTTP::Post.new(url)
request["content-type"] = 'application/json'
request.body = "{\"jsonrpc\":\"2.0\",\"method\":\"eth_getTransactionReceipt\",\"params\":[\"0xa3ece39ae137617669c6933b7578b94e705e765683f260fcfe30eaa41932610f\"],\"id\":1}"

response = http.request(request)
puts response.read_body
import http.client

conn = http.client.HTTPSConnection("rpc.tomochain.com")

payload = "{\"jsonrpc\":\"2.0\",\"method\":\"eth_getTransactionReceipt\",\"params\":[\"0xa3ece39ae137617669c6933b7578b94e705e765683f260fcfe30eaa41932610f\"],\"id\":1}"

headers = { 'content-type': "application/json" }

conn.request("POST", "/getTransactionReceipt", payload, headers)

res = conn.getresponse()
data = res.read()

print(data.decode("utf-8"))
HttpResponse response = Unirest.post("https://rpc.tomochain.com/getTransactionReceipt")
  .header("content-type", "application/json")
  .body("{\"jsonrpc\":\"2.0\",\"method\":\"eth_getTransactionReceipt\",\"params\":[\"0xa3ece39ae137617669c6933b7578b94e705e765683f260fcfe30eaa41932610f\"],\"id\":1}")
  .asString();

POST /getTransactionReceipt

Returns the receipt of a transaction by transaction hash.

Note: That the receipt is not available for pending transactions.

Parameters

Returns

Object - A transaction receipt object, or null when no receipt was found:

It also returns either :

Body parameter

{
  "jsonrpc": "2.0",
  "method": "eth_getTransactionReceipt",
  "params": [
    "0xa3ece39ae137617669c6933b7578b94e705e765683f260fcfe30eaa41932610f"
  ],
  "id": 1
}

Parameters

Name In Type Required Description
body body getTransactionReceiptRequest true none

Responses

Status Meaning Description Schema
200 OK Successful Operation None
500 Internal Server Error Internal Server Error None

Schemas

clientVersionRequest

{
  "jsonrpc": "2.0",
  "method": "web3_clientVersion",
  "params": [],
  "id": 1
}

clientVersionRequest

Properties

Name Type Required Restrictions Description
jsonrpc string true none none
method string true none none
params [string] true none none
id integer(int32) true none none

sha3request

{
  "jsonrpc": "2.0",
  "method": "web3_sha3",
  "params": [
    "0x68656c6c6f20776f726c64"
  ],
  "id": 64
}

sha3request

Properties

Name Type Required Restrictions Description
jsonrpc string true none none
method string true none none
params [string] true none none
id integer(int32) true none none

versionrequest

{
  "jsonrpc": "2.0",
  "method": "net_version",
  "params": [],
  "id": 67
}

versionrequest

Properties

Name Type Required Restrictions Description
jsonrpc string true none none
method string true none none
params [string] true none none
id integer(int32) true none none

listeningrequest

{
  "jsonrpc": "2.0",
  "method": "net_listening",
  "params": [],
  "id": 67
}

listeningrequest

Properties

Name Type Required Restrictions Description
jsonrpc string true none none
method string true none none
params [string] true none none
id integer(int32) true none none

peerCountRequest

{
  "jsonrpc": "2.0",
  "method": "net_peerCount",
  "params": [],
  "id": 74
}

peerCountRequest

Properties

Name Type Required Restrictions Description
jsonrpc string true none none
method string true none none
params [string] true none none
id integer(int32) true none none

protocolVersionRequest

{
  "jsonrpc": "2.0",
  "method": "eth_protocolVersion",
  "params": [],
  "id": 67
}

protocolVersionRequest

Properties

Name Type Required Restrictions Description
jsonrpc string true none none
method string true none none
params [string] true none none
id integer(int32) true none none

syncingrequest

{
  "jsonrpc": "2.0",
  "method": "eth_syncing",
  "params": [],
  "id": 1
}

syncingrequest

Properties

Name Type Required Restrictions Description
jsonrpc string true none none
method string true none none
params [string] true none none
id integer(int32) true none none

coinbaserequest

{
  "jsonrpc": "2.0",
  "method": "eth_coinbase",
  "params": [],
  "id": 64
}

coinbaserequest

Properties

Name Type Required Restrictions Description
jsonrpc string true none none
method string true none none
params [string] true none none
id integer(int32) true none none

gasPriceRequest

{
  "jsonrpc": "2.0",
  "method": "eth_gasPrice",
  "params": [],
  "id": 73
}

gasPriceRequest

Properties

Name Type Required Restrictions Description
jsonrpc string true none none
method string true none none
params [string] true none none
id integer(int32) true none none

accountsrequest

{
  "jsonrpc": "2.0",
  "method": "eth_accounts",
  "params": [],
  "id": 1
}

accountsrequest

Properties

Name Type Required Restrictions Description
jsonrpc string true none none
method string true none none
params [string] true none none
id integer(int32) true none none

blockNumberRequest

{
  "jsonrpc": "2.0",
  "method": "eth_blockNumber",
  "params": [],
  "id": 83
}

blockNumberRequest

Properties

Name Type Required Restrictions Description
jsonrpc string true none none
method string true none none
params [string] true none none
id integer(int32) true none none

getBalanceRequest

{
  "jsonrpc": "2.0",
  "method": "eth_getBalance",
  "params": [
    "0x2b5634c42055806a59e9107ed44d43c426e58258",
    "latest"
  ],
  "id": 1
}

getBalanceRequest

Properties

Name Type Required Restrictions Description
jsonrpc string true none none
method string true none none
params [string] true none none
id integer(int32) true none none

getStorageAtRequest

{
  "jsonrpc": "2.0",
  "method": "eth_getStorageAt",
  "params": [
    "0x295a70b2de5e3953354a6a8344e616ed314d7251",
    "0x0",
    "latest"
  ],
  "id": 1
}

getStorageAtRequest

Properties

Name Type Required Restrictions Description
jsonrpc string true none none
method string true none none
params [string] true none none
id integer(int32) true none none

getTransactionCountRequest

{
  "jsonrpc": "2.0",
  "method": "eth_getTransactionCount",
  "params": [
    "0xbf1dcb735e512b731abd3404c15df6431bd03d42",
    "latest"
  ],
  "id": 1
}

getTransactionCountRequest

Properties

Name Type Required Restrictions Description
jsonrpc string true none none
method string true none none
params [string] true none none
id integer(int32) true none none

getBlockTransactionCountByHashRequest

{
  "jsonrpc": "2.0",
  "method": "eth_getBlockTransactionCountByHash",
  "params": [
    "0xc8b967161c671ce952a3d50987a78d64157fb5a8e1724804b87d3e9b11e3aa34"
  ],
  "id": 1
}

getBlockTransactionCountByHashRequest

Properties

Name Type Required Restrictions Description
jsonrpc string true none none
method string true none none
params [string] true none none
id integer(int32) true none none

getBlockTransactionCountByNumberRequest

{
  "jsonrpc": "2.0",
  "method": "eth_getBlockTransactionCountByNumber",
  "params": [
    "0x52A8CA"
  ],
  "id": 1
}

getBlockTransactionCountByNumberRequest

Properties

Name Type Required Restrictions Description
jsonrpc string true none none
method string true none none
params [string] true none none
id integer(int32) true none none

getCodeRequest

{
  "jsonrpc": "2.0",
  "method": "eth_getCode",
  "params": [
    "0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b",
    "0x2"
  ],
  "id": 1
}

getCodeRequest

Properties

Name Type Required Restrictions Description
jsonrpc string true none none
method string true none none
params [string] true none none
id integer(int32) true none none

signrequest

{
  "jsonrpc": "2.0",
  "method": "eth_sign",
  "params": [
    "0x9b2055d370f73ec7d8a03e965129118dc8f5bf83",
    "0xdeadbeaf"
  ],
  "id": 1
}

signrequest

Properties

Name Type Required Restrictions Description
jsonrpc string true none none
method string true none none
params [string] true none none
id integer(int32) true none none

sendTransactionRequest

{
  "jsonrpc": "2.0",
  "method": "eth_sendTransaction",
  "params": [
    {
      "from": "0xb60e8dd61c5d32be8058bb8eb970870f07233155",
      "to": "0xd46e8dd67c5d32be8058bb8eb970870f07244567",
      "gas": "0x76c0",
      "gasPrice": "0x9184e72a000",
      "value": "0x9184e72a",
      "data": "0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675"
    }
  ],
  "id": 1
}

sendTransactionRequest

Properties

Name Type Required Restrictions Description
jsonrpc string true none none
method string true none none
params [Param] true none none
id integer(int32) true none none

Param

{
  "from": 1.0393608864131634e+48,
  "to": 1.2127714812045434e+48,
  "gas": 30400,
  "gasPrice": 10000000000000,
  "value": 2441406250,
  "data": 4.537516814050981e+98
}

Param

Properties

Name Type Required Restrictions Description
from string true none none
to string true none none
gas string true none none
gasPrice string true none none
value string true none none
data string true none none

sendRawTransactionRequest

{
  "jsonrpc": "2.0",
  "method": "eth_sendRawTransaction",
  "params": [
    "0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675"
  ],
  "id": 1
}

sendRawTransactionRequest

Properties

Name Type Required Restrictions Description
jsonrpc string true none none
method string true none none
params [string] true none none
id integer(int32) true none none

callrequest

{
  "jsonrpc": "2.0",
  "method": "eth_call",
  "params": [
    {
      "from": "0xb60e8dd61c5d32be8058bb8eb970870f07233155",
      "to": "0xd46e8dd67c5d32be8058bb8eb970870f07244567",
      "gas": "0x76c0",
      "gasPrice": "0x9184e72a000",
      "value": "0x9184e72a",
      "data": "0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675"
    },
    "latest"
  ],
  "id": 1
}

callrequest

Properties

Name Type Required Restrictions Description
jsonrpc string true none none
method string true none none
params [Param1] true none none
id integer(int32) true none none

Param1

{
  "from": "",
  "to": "",
  "gas": "",
  "gasPrice": "",
  "value": "",
  "data": ""
}

Param1

Properties

Name Type Required Restrictions Description
from string false none none
to string false none none
gas string false none none
gasPrice string false none none
value string false none none
data string false none none

estimateGasRequest

{
  "jsonrpc": "2.0",
  "method": "eth_estimateGas",
  "params": [
    {
      "from": "0xb60e8dd61c5d32be8058bb8eb970870f07233155",
      "to": "0xd46e8dd67c5d32be8058bb8eb970870f07244567",
      "gas": "0x76c0",
      "gasPrice": "0x9184e72a000",
      "value": "0x9184e72a",
      "data": "0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675"
    }
  ],
  "id": 1
}

estimateGasRequest

Properties

Name Type Required Restrictions Description
jsonrpc string true none none
method string true none none
params [string] true none none
id integer(int32) true none none

getBlockByHashRequest

{
  "jsonrpc": "2.0",
  "method": "eth_getBlockByHash",
  "params": [
    "0x9326145f8a2c8c00bbe13afc7d7f3d9c868b5ef39d89f2f4e9390e9720298624",
    true
  ],
  "id": 1
}

getBlockByHashRequest

Properties

Name Type Required Restrictions Description
jsonrpc string true none none
method string true none none
params [string] true none none
id integer(int32) true none none

getBlockByNumberRequest

{
  "jsonrpc": "2.0",
  "method": "eth_getBlockByNumber",
  "params": [
    "0x0",
    true
  ],
  "id": 1
}

getBlockByNumberRequest

Properties

Name Type Required Restrictions Description
jsonrpc string true none none
method string true none none
params [string] true none none
id integer(int32) true none none

getBlockSignersByNumberRequest

{
  "jsonrpc": "2.0",
  "method": "eth_getBlockSignersByNumber",
  "params": [
    "0xA61F98"
  ],
  "id": 1
}

getBlockSignersByNumberRequest

Properties

Name Type Required Restrictions Description
jsonrpc string true none none
method string true none none
params [string] true none none
id integer(int32) true none none

getBlockSignersByHashRequest

{
  "jsonrpc": "2.0",
  "method": "eth_getBlockSignersByHash",
  "params": [
    "0x605777ee60ef3ccf21e079fa1b091b0196cf1a2c1dd7c088dd5b1ab03f680b6f"
  ],
  "id": 1
}

getBlockSignersByHashRequest

Properties

Name Type Required Restrictions Description
jsonrpc string true none none
method string true none none
params [string] true none none
id integer(int32) true none none

getBlockFinalityByNumberRequest

{
  "jsonrpc": "2.0",
  "method": "eth_getBlockFinalityByNumber",
  "params": [
    "0xA61F98"
  ],
  "id": 1
}

getBlockFinalityByNumberRequest

Properties

Name Type Required Restrictions Description
jsonrpc string true none none
method string true none none
params [string] true none none
id integer(int32) true none none

getBlockFinalityByHashRequest

{
  "jsonrpc": "2.0",
  "method": "eth_getBlockFinalityByHash",
  "params": [
    "0x605777ee60ef3ccf21e079fa1b091b0196cf1a2c1dd7c088dd5b1ab03f680b6f"
  ],
  "id": 1
}

getBlockFinalityByHashRequest

Properties

Name Type Required Restrictions Description
jsonrpc string true none none
method string true none none
params [string] true none none
id integer(int32) true none none

getTransactionByHashRequest

{
  "jsonrpc": "2.0",
  "method": "eth_getTransactionByHash",
  "params": [
    "0xd83b26e101dd6480764bade90fc283407919f60b7e65ff83fbf6cdc92f1138a1"
  ],
  "id": 1
}

getTransactionByHashRequest

Properties

Name Type Required Restrictions Description
jsonrpc string true none none
method string true none none
params [string] true none none
id integer(int32) true none none

getTransactionByBlockHashAndIndexRequest

{
  "jsonrpc": "2.0",
  "method": "eth_getTransactionByBlockHashAndIndex",
  "params": [
    "0x3c82bc62179602b67318c013c10f99011037c49cba84e31ffe6e465a21c521a7",
    "0x0"
  ],
  "id": 1
}

getTransactionByBlockHashAndIndexRequest

Properties

Name Type Required Restrictions Description
jsonrpc string true none none
method string true none none
params [string] true none none
id integer(int32) true none none

getTransactionByBlockNumberAndIndexRequest

{
  "jsonrpc": "2.0",
  "method": "eth_getTransactionByBlockNumberAndIndex",
  "params": [
    "0x52A96E",
    "0x1"
  ],
  "id": 1
}

getTransactionByBlockNumberAndIndexRequest

Properties

Name Type Required Restrictions Description
jsonrpc string true none none
method string true none none
params [string] true none none
id integer(int32) true none none

getTransactionReceiptRequest

{
  "jsonrpc": "2.0",
  "method": "eth_getTransactionReceipt",
  "params": [
    "0xa3ece39ae137617669c6933b7578b94e705e765683f260fcfe30eaa41932610f"
  ],
  "id": 1
}

getTransactionReceiptRequest

Properties

Name Type Required Restrictions Description
jsonrpc string true none none
method string true none none
params [string] true none none
id integer(int32) true none none

getCandidatesRequest

{
  "jsonrpc": "2.0",
  "method": "eth_getCandidates",
  "params": [
    "latest"
  ],
  "id": 1
}

getCandidateStatusRequest

Properties

Name Type Required Restrictions Description
jsonrpc string true none none
method string true none none
params [string] true none none
id integer(int32) true none none

getCandidateStatusRequest

{
  "jsonrpc": "2.0",
  "method": "eth_getCandidateStatus",
  "params": [
    "0x1d50df657b6dce50bac634bf18e2d986d807e940",
    "latest"
  ],
  "id": 1
}

getCandidateStatusRequest

Properties

Name Type Required Restrictions Description
jsonrpc string true none none
method string true none none
params [string] true none none
id integer(int32) true none none

TomoDex APIs v1.0.0

Scroll down for code samples, example requests and responses. Select a language for code samples from the tabs above or the mobile navigation menu.

TomoDex API Document

Base Url: https://dex.testnet.tomochain.com/api (testnet)

accounts

Account endpoints

Find account by user address

Code samples

# You can also use wget
curl -X GET /account/{userAddress} \
  -H 'Accept: application/json'

const fetch = require('node-fetch');

const headers = {
  'Accept':'application/json'

};

fetch('/account/{userAddress}',
{
  method: 'GET',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Accept": []string{"application/json"},
        
    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("GET", "/account/{userAddress}", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json'
}

result = RestClient.get '/account/{userAddress}',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Accept': 'application/json'
}

r = requests.get('/account/{userAddress}', params={

}, headers = headers)

print r.json()

URL obj = new URL("/account/{userAddress}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

GET /account/{userAddress}

Returns a single account

Parameters

Name In Type Required Description
userAddress path string true Address of user to return

Example responses

200 Response

{
  "address": "0xF7349C253FF7747Df661296E0859c44e974fb52E"
}

Responses

Status Meaning Description Schema
200 OK successful operation Account
400 Bad Request Invalid Address None
404 Not Found Account not found None

[Deprecated] Find account's token balance by user address and token address

Code samples

# You can also use wget
curl -X GET /account/{userAddress}/{tokenAddress} \
  -H 'Accept: application/json'

const fetch = require('node-fetch');

const headers = {
  'Accept':'application/json'

};

fetch('/account/{userAddress}/{tokenAddress}',
{
  method: 'GET',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Accept": []string{"application/json"},
        
    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("GET", "/account/{userAddress}/{tokenAddress}", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json'
}

result = RestClient.get '/account/{userAddress}/{tokenAddress}',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Accept': 'application/json'
}

r = requests.get('/account/{userAddress}/{tokenAddress}', params={

}, headers = headers)

print r.json()

URL obj = new URL("/account/{userAddress}/{tokenAddress}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

GET /account/{userAddress}/{tokenAddress}

Returns an object contains token balance of user

Parameters

Name In Type Required Description
userAddress path string true Address of user to find token balance
tokenAddress path string true Address of token

Example responses

200 Response

{
  "address": "string",
  "symbol": "string",
  "balance": "string",
  "availableBalance": "string",
  "inOrderBalance": "string"
}

Responses

Status Meaning Description Schema
200 OK successful operation TokenBalance
400 Bad Request Invalid Address None
404 Not Found Account not found None

Add a new account by user address

Code samples

# You can also use wget
curl -X POST /account/create \
  -H 'Accept: application/json'

const fetch = require('node-fetch');

const headers = {
  'Accept':'application/json'

};

fetch('/account/create',
{
  method: 'POST',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Accept": []string{"application/json"},
        
    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("POST", "/account/create", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json'
}

result = RestClient.post '/account/create',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Accept': 'application/json'
}

r = requests.post('/account/create', params={

}, headers = headers)

print r.json()

URL obj = new URL("/account/create");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

POST /account/create

Returns newly created account

Parameters

Name In Type Required Description
newAddress path string true Address of user

Example responses

201 Response

{
  "address": "0xF7349C253FF7747Df661296E0859c44e974fb52E"
}

Responses

Status Meaning Description Schema
200 OK Account already exists None
201 Created Account created Account
404 Not Found Invalid Address None
500 Internal Server Error Internal Server Error None

tokens

Token endpoints

Finds all tokens

Code samples

# You can also use wget
curl -X GET /tokens \
  -H 'Accept: application/json'

const fetch = require('node-fetch');

const headers = {
  'Accept':'application/json'

};

fetch('/tokens',
{
  method: 'GET',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Accept": []string{"application/json"},
        
    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("GET", "/tokens", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json'
}

result = RestClient.get '/tokens',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Accept': 'application/json'
}

r = requests.get('/tokens', params={

}, headers = headers)

print r.json()

URL obj = new URL("/tokens");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

GET /tokens

Return all tokens in an array

Example responses

200 Response

[
  {
    "id": "string",
    "name": "string",
    "symbol": "string",
    "address": "string",
    "image": {
      "url": "string",
      "meta": {}
    },
    "contractAddress": "string",
    "decimals": 0,
    "active": true,
    "listed": true,
    "quote": true,
    "makeFee": "string",
    "takeFee": "string",
    "usd": "string",
    "createdAt": "2019-11-03T16:33:00Z",
    "updatedAt": "2019-11-03T16:33:00Z"
  }
]

Responses

Status Meaning Description Schema
200 OK successful operation Inline
500 Internal Server Error Internal Server Error None

Response Schema

Status Code 200

Name Type Required Restrictions Description
anonymous [Token] false none none
» id string false read-only none
» name string false none none
» symbol string false none none
» address string false none none
» image Image false none none
»» url string false none none
»» meta object false none none
» contractAddress string false none none
» decimals integer(int32) false read-only none
» active boolean false none none
» listed boolean false read-only none
» quote boolean false none none
» makeFee string false none none
» takeFee string false none none
» usd string false read-only none
» createdAt string(date-time) false read-only none
» updatedAt string(date-time) false read-only none

Create new token

Code samples

# You can also use wget
curl -X POST /tokens \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json'

const fetch = require('node-fetch');
const inputBody = '{
  "name": "string",
  "symbol": "string",
  "address": "string",
  "image": {
    "url": "string",
    "meta": {}
  },
  "contractAddress": "string",
  "active": true,
  "quote": true,
  "makeFee": "string",
  "takeFee": "string"
}';
const headers = {
  'Content-Type':'application/json',
  'Accept':'application/json'

};

fetch('/tokens',
{
  method: 'POST',
  body: inputBody,
  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Content-Type": []string{"application/json"},
        "Accept": []string{"application/json"},
        
    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("POST", "/tokens", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

require 'rest-client'
require 'json'

headers = {
  'Content-Type' => 'application/json',
  'Accept' => 'application/json'
}

result = RestClient.post '/tokens',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}

r = requests.post('/tokens', params={

}, headers = headers)

print r.json()

URL obj = new URL("/tokens");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

POST /tokens

Returns newly created token

Body parameter

{
  "name": "string",
  "symbol": "string",
  "address": "string",
  "image": {
    "url": "string",
    "meta": {}
  },
  "contractAddress": "string",
  "active": true,
  "quote": true,
  "makeFee": "string",
  "takeFee": "string"
}

Parameters

Name In Type Required Description
body body Token true Token object that needs to be added
» id body string false none
» name body string false none
» symbol body string false none
» address body string false none
» image body Image false none
»» url body string false none
»» meta body object false none
» contractAddress body string false none
» decimals body integer(int32) false none
» active body boolean false none
» listed body boolean false none
» quote body boolean false none
» makeFee body string false none
» takeFee body string false none
» usd body string false none
» createdAt body string(date-time) false none
» updatedAt body string(date-time) false none

Example responses

200 Response

{
  "id": "string",
  "name": "string",
  "symbol": "string",
  "address": "string",
  "image": {
    "url": "string",
    "meta": {}
  },
  "contractAddress": "string",
  "decimals": 0,
  "active": true,
  "listed": true,
  "quote": true,
  "makeFee": "string",
  "takeFee": "string",
  "usd": "string",
  "createdAt": "2019-11-03T16:33:00Z",
  "updatedAt": "2019-11-03T16:33:00Z"
}

Responses

Status Meaning Description Schema
200 OK successful operation Token
400 Bad Request Invalid payload None
500 Internal Server Error Internal Server Error None

Finds all base tokens

Code samples

# You can also use wget
curl -X GET /tokens/base \
  -H 'Accept: application/json'

const fetch = require('node-fetch');

const headers = {
  'Accept':'application/json'

};

fetch('/tokens/base',
{
  method: 'GET',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Accept": []string{"application/json"},
        
    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("GET", "/tokens/base", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json'
}

result = RestClient.get '/tokens/base',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Accept': 'application/json'
}

r = requests.get('/tokens/base', params={

}, headers = headers)

print r.json()

URL obj = new URL("/tokens/base");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

GET /tokens/base

Return all base tokens in an array

Example responses

200 Response

[
  {
    "id": "string",
    "name": "string",
    "symbol": "string",
    "address": "string",
    "image": {
      "url": "string",
      "meta": {}
    },
    "contractAddress": "string",
    "decimals": 0,
    "active": true,
    "listed": true,
    "quote": true,
    "makeFee": "string",
    "takeFee": "string",
    "usd": "string",
    "createdAt": "2019-11-03T16:33:00Z",
    "updatedAt": "2019-11-03T16:33:00Z"
  }
]

Responses

Status Meaning Description Schema
200 OK successful operation Inline
500 Internal Server Error Internal Server Error None

Response Schema

Status Code 200

Name Type Required Restrictions Description
anonymous [Token] false none none
» id string false read-only none
» name string false none none
» symbol string false none none
» address string false none none
» image Image false none none
»» url string false none none
»» meta object false none none
» contractAddress string false none none
» decimals integer(int32) false read-only none
» active boolean false none none
» listed boolean false read-only none
» quote boolean false none none
» makeFee string false none none
» takeFee string false none none
» usd string false read-only none
» createdAt string(date-time) false read-only none
» updatedAt string(date-time) false read-only none

Finds all quote tokens

Code samples

# You can also use wget
curl -X GET /tokens/quote \
  -H 'Accept: application/json'

const fetch = require('node-fetch');

const headers = {
  'Accept':'application/json'

};

fetch('/tokens/quote',
{
  method: 'GET',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Accept": []string{"application/json"},
        
    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("GET", "/tokens/quote", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json'
}

result = RestClient.get '/tokens/quote',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Accept': 'application/json'
}

r = requests.get('/tokens/quote', params={

}, headers = headers)

print r.json()

URL obj = new URL("/tokens/quote");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

GET /tokens/quote

Return all quote tokens in an array

Example responses

200 Response

[
  {
    "id": "string",
    "name": "string",
    "symbol": "string",
    "address": "string",
    "image": {
      "url": "string",
      "meta": {}
    },
    "contractAddress": "string",
    "decimals": 0,
    "active": true,
    "listed": true,
    "quote": true,
    "makeFee": "string",
    "takeFee": "string",
    "usd": "string",
    "createdAt": "2019-11-03T16:33:00Z",
    "updatedAt": "2019-11-03T16:33:00Z"
  }
]

Responses

Status Meaning Description Schema
200 OK successful operation Inline
500 Internal Server Error Internal Server Error None

Response Schema

Status Code 200

Name Type Required Restrictions Description
anonymous [Token] false none none
» id string false read-only none
» name string false none none
» symbol string false none none
» address string false none none
» image Image false none none
»» url string false none none
»» meta object false none none
» contractAddress string false none none
» decimals integer(int32) false read-only none
» active boolean false none none
» listed boolean false read-only none
» quote boolean false none none
» makeFee string false none none
» takeFee string false none none
» usd string false read-only none
» createdAt string(date-time) false read-only none
» updatedAt string(date-time) false read-only none

Retrieve the token information corresponding to an address

Code samples

# You can also use wget
curl -X GET /tokens/{address} \
  -H 'Accept: application/json'

const fetch = require('node-fetch');

const headers = {
  'Accept':'application/json'

};

fetch('/tokens/{address}',
{
  method: 'GET',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Accept": []string{"application/json"},
        
    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("GET", "/tokens/{address}", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json'
}

result = RestClient.get '/tokens/{address}',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Accept': 'application/json'
}

r = requests.get('/tokens/{address}', params={

}, headers = headers)

print r.json()

URL obj = new URL("/tokens/{address}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

GET /tokens/{address}

Return token object

Parameters

Name In Type Required Description
address path string true Token address

Example responses

200 Response

{
  "id": "string",
  "name": "string",
  "symbol": "string",
  "address": "string",
  "image": {
    "url": "string",
    "meta": {}
  },
  "contractAddress": "string",
  "decimals": 0,
  "active": true,
  "listed": true,
  "quote": true,
  "makeFee": "string",
  "takeFee": "string",
  "usd": "string",
  "createdAt": "2019-11-03T16:33:00Z",
  "updatedAt": "2019-11-03T16:33:00Z"
}

Responses

Status Meaning Description Schema
200 OK successful operation Token
400 Bad Request Invalid Address None
500 Internal Server Error Internal Server Error None

pairs

Pair endpoints

Finds all pairs

Code samples

# You can also use wget
curl -X GET /pairs?baseToken=string"eToken=string \
  -H 'Accept: application/json'

const fetch = require('node-fetch');

const headers = {
  'Accept':'application/json'

};

fetch('/pairs?baseToken=string"eToken=string',
{
  method: 'GET',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Accept": []string{"application/json"},
        
    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("GET", "/pairs", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json'
}

result = RestClient.get '/pairs',
  params: {
  'baseToken' => 'string',
'quoteToken' => 'string'
}, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Accept': 'application/json'
}

r = requests.get('/pairs', params={
  'baseToken': 'string',  'quoteToken': 'string'
}, headers = headers)

print r.json()

URL obj = new URL("/pairs?baseToken=string"eToken=string");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

GET /pairs

Return all pairs in an array

Parameters

Name In Type Required Description
baseToken query string true Base token address
quoteToken query string true Quote token address

Example responses

200 Response

[
  {
    "id": "string",
    "baseTokenSymbol": "string",
    "baseTokenAddress": "string",
    "baseTokenDecimals": 0,
    "quoteTokenSymbol": "string",
    "quoteTokenAddress": "string",
    "quoteTokenDecimals": 0,
    "listed": true,
    "active": true,
    "rank": 0,
    "makeFee": "string",
    "takeFee": "string",
    "createdAt": "2019-11-03T16:33:00Z",
    "updatedAt": "2019-11-03T16:33:00Z"
  }
]

Responses

Status Meaning Description Schema
200 OK successful operation Inline
500 Internal Server Error Internal Server Error None

Response Schema

Status Code 200

Name Type Required Restrictions Description
anonymous [Pair] false none none
» id string false read-only none
» baseTokenSymbol string false none none
» baseTokenAddress string false none none
» baseTokenDecimals integer(int32) false read-only none
» quoteTokenSymbol string false none none
» quoteTokenAddress string false none none
» quoteTokenDecimals integer(int32) false read-only none
» listed boolean false read-only none
» active boolean false none none
» rank integer(int32) false read-only none
» makeFee string false read-only none
» takeFee string false read-only none
» createdAt string(date-time) false read-only none
» updatedAt string(date-time) false read-only none

Create new pair

Code samples

# You can also use wget
curl -X POST /pairs \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json'

const fetch = require('node-fetch');
const inputBody = '{
  "baseTokenSymbol": "string",
  "baseTokenAddress": "string",
  "quoteTokenSymbol": "string",
  "quoteTokenAddress": "string",
  "active": true
}';
const headers = {
  'Content-Type':'application/json',
  'Accept':'application/json'

};

fetch('/pairs',
{
  method: 'POST',
  body: inputBody,
  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Content-Type": []string{"application/json"},
        "Accept": []string{"application/json"},
        
    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("POST", "/pairs", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

require 'rest-client'
require 'json'

headers = {
  'Content-Type' => 'application/json',
  'Accept' => 'application/json'
}

result = RestClient.post '/pairs',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}

r = requests.post('/pairs', params={

}, headers = headers)

print r.json()

URL obj = new URL("/pairs");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

POST /pairs

Returns newly created pair

Body parameter

{
  "baseTokenSymbol": "string",
  "baseTokenAddress": "string",
  "quoteTokenSymbol": "string",
  "quoteTokenAddress": "string",
  "active": true
}

Parameters

Name In Type Required Description
body body Pair true Pair object that needs to be added
» id body string false none
» baseTokenSymbol body string false none
» baseTokenAddress body string false none
» baseTokenDecimals body integer(int32) false none
» quoteTokenSymbol body string false none
» quoteTokenAddress body string false none
» quoteTokenDecimals body integer(int32) false none
» listed body boolean false none
» active body boolean false none
» rank body integer(int32) false none
» makeFee body string false none
» takeFee body string false none
» createdAt body string(date-time) false none
» updatedAt body string(date-time) false none

Example responses

200 Response

{
  "id": "string",
  "baseTokenSymbol": "string",
  "baseTokenAddress": "string",
  "baseTokenDecimals": 0,
  "quoteTokenSymbol": "string",
  "quoteTokenAddress": "string",
  "quoteTokenDecimals": 0,
  "listed": true,
  "active": true,
  "rank": 0,
  "makeFee": "string",
  "takeFee": "string",
  "createdAt": "2019-11-03T16:33:00Z",
  "updatedAt": "2019-11-03T16:33:00Z"
}

Responses

Status Meaning Description Schema
200 OK successful operation Pair
400 Bad Request *** Parameter missing None
500 Internal Server Error Internal Server Error None

Retrieve the pair information corresponding to a baseToken and a quoteToken

Code samples

# You can also use wget
curl -X GET /pair?baseToken=string"eToken=string \
  -H 'Accept: application/json'

const fetch = require('node-fetch');

const headers = {
  'Accept':'application/json'

};

fetch('/pair?baseToken=string"eToken=string',
{
  method: 'GET',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Accept": []string{"application/json"},
        
    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("GET", "/pair", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json'
}

result = RestClient.get '/pair',
  params: {
  'baseToken' => 'string',
'quoteToken' => 'string'
}, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Accept': 'application/json'
}

r = requests.get('/pair', params={
  'baseToken': 'string',  'quoteToken': 'string'
}, headers = headers)

print r.json()

URL obj = new URL("/pair?baseToken=string"eToken=string");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

GET /pair

Multiple status values can be provided with comma separated strings

Parameters

Name In Type Required Description
baseToken query string true Base token address
quoteToken query string true Quote token address

Example responses

200 Response

{
  "id": "string",
  "baseTokenSymbol": "string",
  "baseTokenAddress": "string",
  "baseTokenDecimals": 0,
  "quoteTokenSymbol": "string",
  "quoteTokenAddress": "string",
  "quoteTokenDecimals": 0,
  "listed": true,
  "active": true,
  "rank": 0,
  "makeFee": "string",
  "takeFee": "string",
  "createdAt": "2019-11-03T16:33:00Z",
  "updatedAt": "2019-11-03T16:33:00Z"
}

Responses

Status Meaning Description Schema
200 OK successful operation Pair
400 Bad Request baseToken Parameter missing None
500 Internal Server Error Internal Server Error None

Retrieve pair data corresponding to a baseToken and quoteToken

Code samples

# You can also use wget
curl -X GET /pair/data?baseToken=string"eToken=string \
  -H 'Accept: application/json'

const fetch = require('node-fetch');

const headers = {
  'Accept':'application/json'

};

fetch('/pair/data?baseToken=string"eToken=string',
{
  method: 'GET',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Accept": []string{"application/json"},
        
    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("GET", "/pair/data", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json'
}

result = RestClient.get '/pair/data',
  params: {
  'baseToken' => 'string',
'quoteToken' => 'string'
}, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Accept': 'application/json'
}

r = requests.get('/pair/data', params={
  'baseToken': 'string',  'quoteToken': 'string'
}, headers = headers)

print r.json()

URL obj = new URL("/pair/data?baseToken=string"eToken=string");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

GET /pair/data

Multiple status values can be provided with comma separated strings

Parameters

Name In Type Required Description
baseToken query string true Base token address
quoteToken query string true Quote token address

Example responses

200 Response

{
  "pair": {
    "pairName": "string",
    "baseToken": "string",
    "quoteToken": "string"
  },
  "open": "string",
  "high": "string",
  "low": 0,
  "close": "string",
  "volume": "string",
  "count": "string",
  "timestamp": "string",
  "orderVolume": "string",
  "orderCount": "string",
  "averageOrderAmount": "string",
  "averageTradeAmount": "string",
  "askPrice": "string",
  "bidPrice": "string",
  "price": "string",
  "rank": 0
}

Responses

Status Meaning Description Schema
200 OK successful operation PairData
400 Bad Request baseToken Parameter missing None
500 Internal Server Error Internal Server Error None

Retrieve all pair data

Code samples

# You can also use wget
curl -X GET /pairs/data \
  -H 'Accept: application/json'

const fetch = require('node-fetch');

const headers = {
  'Accept':'application/json'

};

fetch('/pairs/data',
{
  method: 'GET',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Accept": []string{"application/json"},
        
    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("GET", "/pairs/data", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json'
}

result = RestClient.get '/pairs/data',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Accept': 'application/json'
}

r = requests.get('/pairs/data', params={

}, headers = headers)

print r.json()

URL obj = new URL("/pairs/data");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

GET /pairs/data

Multiple status values can be provided with comma separated strings

Example responses

200 Response

{
  "pair": {
    "pairName": "string",
    "baseToken": "string",
    "quoteToken": "string"
  },
  "open": "string",
  "high": "string",
  "low": 0,
  "close": "string",
  "volume": "string",
  "count": "string",
  "timestamp": "string",
  "orderVolume": "string",
  "orderCount": "string",
  "averageOrderAmount": "string",
  "averageTradeAmount": "string",
  "askPrice": "string",
  "bidPrice": "string",
  "price": "string",
  "rank": 0
}

Responses

Status Meaning Description Schema
200 OK successful operation PairData
400 Bad Request baseToken Parameter missing None
500 Internal Server Error Internal Server Error None

orders

Order endpoints

Retrieve the sorted list of orders for an Ethereum address

Code samples

# You can also use wget
curl -X GET /orders \
  -H 'Accept: application/json'

const fetch = require('node-fetch');

const headers = {
  'Accept':'application/json'

};

fetch('/orders',
{
  method: 'GET',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Accept": []string{"application/json"},
        
    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("GET", "/orders", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json'
}

result = RestClient.get '/orders',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Accept': 'application/json'
}

r = requests.get('/orders', params={

}, headers = headers)

print r.json()

URL obj = new URL("/orders");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

GET /orders

Return all orders in an array

Parameters

Name In Type Required Description
address query string false User address
pageOffset query string false Page offset
pageSize query string false Number of items per a page
sortBy query string false Sort for query (time, orderStatus, orderType, orderSide)
sortType query string false asc/dec
orderStatus query string false OPEN/CANCELLED/FILLED/PARTIAL_FILLED
orderSide query string false SELL/BUY
orderType query string false LO/MO
baseToken query string false Base token address
quoteToken query string false Quote token address
from query string false the beginning timestamp (number of seconds from 1970/01/01) from which order data has to be queried
to query string false the ending timestamp ((number of seconds from 1970/01/01)) until which order data has to be queried

Example responses

200 Response

{
  "total": 0,
  "orders": [
    {
      "id": "string",
      "userAddress": "string",
      "exchangeAddress": "string",
      "baseToken": "string",
      "quoteToken": "string",
      "status": "string",
      "side": "string",
      "type": "string",
      "hash": "string",
      "signature": {
        "V": "string",
        "R": "string",
        "S": "string"
      },
      "pricepoint": "string",
      "amount": "string",
      "filledAmount": "string",
      "nonce": "string",
      "makeFee": "string",
      "takeFee": "string",
      "pairName": "string",
      "createdAt": "2019-11-03T16:33:00Z",
      "updatedAt": "2019-11-03T16:33:00Z"
    }
  ]
}

Responses

Status Meaning Description Schema
200 OK successful operation Inline
400 Bad Request address Parameter missing None
500 Internal Server Error Internal Server Error None

Response Schema

Status Code 200

Name Type Required Restrictions Description
» total integer false none none
» orders [Order] false none none
»» id string false read-only none
»» userAddress string false none none
»» exchangeAddress string false none none
»» baseToken string false none none
»» quoteToken string false none none
»» status string false none none
»» side string false none none
»» type string false none none
»» hash string false none none
»» signature Signature false none none
»»» V string false none none
»»» R string false none none
»»» S string false none none
»» pricepoint string false none none
»» amount string false none none
»» filledAmount string false none none
»» nonce string false none none
»» makeFee string false none none
»» takeFee string false none none
»» pairName string false none none
»» createdAt string(date-time) false read-only none
»» updatedAt string(date-time) false read-only none

Create new order

Code samples

# You can also use wget
curl -X POST /orders \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json'

const fetch = require('node-fetch');
const inputBody = '{
  "userAddress": "0x15e08dE16f534c890828F2a0D935433aF5B3CE0C",
  "exchangeAddress": "0x0D3ab14BBaD3D99F4203bd7a11aCB94882050E7e",
  "baseToken": "0x4d7eA2cE949216D6b120f3AA10164173615A2b6C",
  "quoteToken": "0x0000000000000000000000000000000000000001",
  "side": "SELL/BUY",
  "type": "LO/MO",
  "status": "NEW/CANCELLED",
  "hash": "string",
  "signature": {
    "V": "string",
    "R": "string",
    "S": "string"
  },
  "pricepoint": "21207020000000000000000",
  "amount": "4693386710283129",
  "nonce": "1",
  "makeFee": "1",
  "takeFee": "1"
}';
const headers = {
  'Content-Type':'application/json',
  'Accept':'application/json'

};

fetch('/orders',
{
  method: 'POST',
  body: inputBody,
  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Content-Type": []string{"application/json"},
        "Accept": []string{"application/json"},
        
    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("POST", "/orders", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

require 'rest-client'
require 'json'

headers = {
  'Content-Type' => 'application/json',
  'Accept' => 'application/json'
}

result = RestClient.post '/orders',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}

r = requests.post('/orders', params={

}, headers = headers)

print r.json()

URL obj = new URL("/orders");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

POST /orders

Returns newly created order

Body parameter

{
  "userAddress": "0x15e08dE16f534c890828F2a0D935433aF5B3CE0C",
  "exchangeAddress": "0x0D3ab14BBaD3D99F4203bd7a11aCB94882050E7e",
  "baseToken": "0x4d7eA2cE949216D6b120f3AA10164173615A2b6C",
  "quoteToken": "0x0000000000000000000000000000000000000001",
  "side": "SELL/BUY",
  "type": "LO/MO",
  "status": "NEW/CANCELLED",
  "hash": "string",
  "signature": {
    "V": "string",
    "R": "string",
    "S": "string"
  },
  "pricepoint": "21207020000000000000000",
  "amount": "4693386710283129",
  "nonce": "1",
  "makeFee": "1",
  "takeFee": "1"
}

Parameters

Name In Type Required Description
body body OrderCreate true Order object that needs to be added

Example responses

201 Response

{
  "id": "string",
  "userAddress": "string",
  "exchangeAddress": "string",
  "baseToken": "string",
  "quoteToken": "string",
  "status": "string",
  "side": "string",
  "type": "string",
  "hash": "string",
  "signature": {
    "V": "string",
    "R": "string",
    "S": "string"
  },
  "pricepoint": "string",
  "amount": "string",
  "filledAmount": "string",
  "nonce": "string",
  "makeFee": "string",
  "takeFee": "string",
  "pairName": "string",
  "createdAt": "2019-11-03T16:33:00Z",
  "updatedAt": "2019-11-03T16:33:00Z"
}

Responses

Status Meaning Description Schema
201 Created successful operation Order
400 Bad Request Invalid payload None
403 Forbidden Account is blocked None
500 Internal Server Error Internal Server Error None

[Deprecated] Retrieve the list of positions for an Ethereum address. Positions are order that have been sent to the matching engine and that are waiting to be matched

Code samples

# You can also use wget
curl -X GET /orders/positions?address=string&limit=string \
  -H 'Accept: application/json'

const fetch = require('node-fetch');

const headers = {
  'Accept':'application/json'

};

fetch('/orders/positions?address=string&limit=string',
{
  method: 'GET',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Accept": []string{"application/json"},
        
    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("GET", "/orders/positions", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json'
}

result = RestClient.get '/orders/positions',
  params: {
  'address' => 'string',
'limit' => 'string'
}, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Accept': 'application/json'
}

r = requests.get('/orders/positions', params={
  'address': 'string',  'limit': 'string'
}, headers = headers)

print r.json()

URL obj = new URL("/orders/positions?address=string&limit=string");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

GET /orders/positions

Return all orders in an array

Parameters

Name In Type Required Description
address query string true User address
limit query string true Number of orders returned in query

Example responses

200 Response

[
  {
    "id": "string",
    "userAddress": "string",
    "exchangeAddress": "string",
    "baseToken": "string",
    "quoteToken": "string",
    "status": "string",
    "side": "string",
    "type": "string",
    "hash": "string",
    "signature": {
      "V": "string",
      "R": "string",
      "S": "string"
    },
    "pricepoint": "string",
    "amount": "string",
    "filledAmount": "string",
    "nonce": "string",
    "makeFee": "string",
    "takeFee": "string",
    "pairName": "string",
    "createdAt": "2019-11-03T16:33:00Z",
    "updatedAt": "2019-11-03T16:33:00Z"
  }
]

Responses

Status Meaning Description Schema
200 OK successful operation Inline
400 Bad Request address Parameter missing None
500 Internal Server Error Internal Server Error None

Response Schema

Status Code 200

Name Type Required Restrictions Description
anonymous [Order] false none none
» id string false read-only none
» userAddress string false none none
» exchangeAddress string false none none
» baseToken string false none none
» quoteToken string false none none
» status string false none none
» side string false none none
» type string false none none
» hash string false none none
» signature Signature false none none
»» V string false none none
»» R string false none none
»» S string false none none
» pricepoint string false none none
» amount string false none none
» filledAmount string false none none
» nonce string false none none
» makeFee string false none none
» takeFee string false none none
» pairName string false none none
» createdAt string(date-time) false read-only none
» updatedAt string(date-time) false read-only none

Retrieve the list of filled order for an Ethereum address

Code samples

# You can also use wget
curl -X GET /orders/history?address=string \
  -H 'Accept: application/json'

const fetch = require('node-fetch');

const headers = {
  'Accept':'application/json'

};

fetch('/orders/history?address=string',
{
  method: 'GET',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Accept": []string{"application/json"},
        
    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("GET", "/orders/history", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json'
}

result = RestClient.get '/orders/history',
  params: {
  'address' => 'string'
}, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Accept': 'application/json'
}

r = requests.get('/orders/history', params={
  'address': 'string'
}, headers = headers)

print r.json()

URL obj = new URL("/orders/history?address=string");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

GET /orders/history

Return all orders in an array

Parameters

Name In Type Required Description
address query string true User address
pageOffset query string false Page offset, default 0
pageSize query string false Number of items per a page, defaul 50
sortBy query string false Sort for query (time(default), orderStatus, orderType, orderSide)
sortType query string false asc/dec, default asc
orderStatus query string false OPEN/CANCELLED/FILLED/PARTIAL_FILLED
orderSide query string false SELL/BUY
orderType query string false LO/MO
baseToken query string false Base token address
quoteToken query string false Quote token address
from query string false the beginning timestamp (number of seconds from 1970/01/01) from which order data has to be queried
to query string false the ending timestamp ((number of seconds from 1970/01/01)) until which order data has to be queried

Example responses

200 Response

{
  "total": 0,
  "orders": [
    {
      "id": "string",
      "userAddress": "string",
      "exchangeAddress": "string",
      "baseToken": "string",
      "quoteToken": "string",
      "status": "string",
      "side": "string",
      "type": "string",
      "hash": "string",
      "signature": {
        "V": "string",
        "R": "string",
        "S": "string"
      },
      "pricepoint": "string",
      "amount": "string",
      "filledAmount": "string",
      "nonce": "string",
      "makeFee": "string",
      "takeFee": "string",
      "pairName": "string",
      "createdAt": "2019-11-03T16:33:00Z",
      "updatedAt": "2019-11-03T16:33:00Z"
    }
  ]
}

Responses

Status Meaning Description Schema
200 OK successful operation Inline
400 Bad Request address Parameter missing None
500 Internal Server Error Internal Server Error None

Response Schema

Status Code 200

Name Type Required Restrictions Description
» total integer false none none
» orders [Order] false none none
»» id string false read-only none
»» userAddress string false none none
»» exchangeAddress string false none none
»» baseToken string false none none
»» quoteToken string false none none
»» status string false none none
»» side string false none none
»» type string false none none
»» hash string false none none
»» signature Signature false none none
»»» V string false none none
»»» R string false none none
»»» S string false none none
»» pricepoint string false none none
»» amount string false none none
»» filledAmount string false none none
»» nonce string false none none
»» makeFee string false none none
»» takeFee string false none none
»» pairName string false none none
»» createdAt string(date-time) false read-only none
»» updatedAt string(date-time) false read-only none

Retrieve the total number of orders for an Ethereum address

Code samples

# You can also use wget
curl -X GET /orders/count?address=string \
  -H 'Accept: application/json'

const fetch = require('node-fetch');

const headers = {
  'Accept':'application/json'

};

fetch('/orders/count?address=string',
{
  method: 'GET',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Accept": []string{"application/json"},
        
    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("GET", "/orders/count", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json'
}

result = RestClient.get '/orders/count',
  params: {
  'address' => 'string'
}, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Accept': 'application/json'
}

r = requests.get('/orders/count', params={
  'address': 'string'
}, headers = headers)

print r.json()

URL obj = new URL("/orders/count?address=string");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

GET /orders/count

Return a positive integer

Parameters

Name In Type Required Description
address query string true User address

Example responses

200 Response

0

Responses

Status Meaning Description Schema
200 OK successful operation integer
400 Bad Request address Parameter missing None
500 Internal Server Error Internal Server Error None

Retrieve order nonce for an Ethereum address

Code samples

# You can also use wget
curl -X GET /orders/nonce?address=string \
  -H 'Accept: application/json'

const fetch = require('node-fetch');

const headers = {
  'Accept':'application/json'

};

fetch('/orders/nonce?address=string',
{
  method: 'GET',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Accept": []string{"application/json"},
        
    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("GET", "/orders/nonce", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json'
}

result = RestClient.get '/orders/nonce',
  params: {
  'address' => 'string'
}, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Accept': 'application/json'
}

r = requests.get('/orders/nonce', params={
  'address': 'string'
}, headers = headers)

print r.json()

URL obj = new URL("/orders/nonce?address=string");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

GET /orders/nonce

Return a positive integer

Parameters

Name In Type Required Description
address query string true User address

Example responses

200 Response

0

Responses

Status Meaning Description Schema
200 OK successful operation integer
400 Bad Request address Parameter missing None
500 Internal Server Error Internal Server Error None

Cancel order

Code samples

# You can also use wget
curl -X POST /orders/cancel \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json'

const fetch = require('node-fetch');
const inputBody = '{
  "orderHash": "string",
  "nonce": "string",
  "hash": "string",
  "signature": {
    "V": "string",
    "R": "string",
    "S": "string"
  }
}';
const headers = {
  'Content-Type':'application/json',
  'Accept':'application/json'

};

fetch('/orders/cancel',
{
  method: 'POST',
  body: inputBody,
  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Content-Type": []string{"application/json"},
        "Accept": []string{"application/json"},
        
    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("POST", "/orders/cancel", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

require 'rest-client'
require 'json'

headers = {
  'Content-Type' => 'application/json',
  'Accept' => 'application/json'
}

result = RestClient.post '/orders/cancel',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}

r = requests.post('/orders/cancel', params={

}, headers = headers)

print r.json()

URL obj = new URL("/orders/cancel");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

POST /orders/cancel

Returns the hash of cancelled order

Body parameter

{
  "orderHash": "string",
  "nonce": "string",
  "hash": "string",
  "signature": {
    "V": "string",
    "R": "string",
    "S": "string"
  }
}

Parameters

Name In Type Required Description
body body OrderCancel true Cancel order object
» orderHash body string false none
» nonce body string false none
» hash body string false none
» signature body Signature false none
»» V body string false none
»» R body string false none
»» S body string false none

Example responses

200 Response

"string"

Responses

Status Meaning Description Schema
200 OK successful operation string
400 Bad Request Invalid payload None
500 Internal Server Error Internal Server Error None

[Deprecated] Cancel all orders

Code samples

# You can also use wget
curl -X POST /orders/cancelAll?address=string \
  -H 'Accept: application/json'

const fetch = require('node-fetch');

const headers = {
  'Accept':'application/json'

};

fetch('/orders/cancelAll?address=string',
{
  method: 'POST',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Accept": []string{"application/json"},
        
    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("POST", "/orders/cancelAll", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json'
}

result = RestClient.post '/orders/cancelAll',
  params: {
  'address' => 'string'
}, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Accept': 'application/json'
}

r = requests.post('/orders/cancelAll', params={
  'address': 'string'
}, headers = headers)

print r.json()

URL obj = new URL("/orders/cancelAll?address=string");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("POST");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

POST /orders/cancelAll

This endpoint should implements signature authentication

Parameters

Name In Type Required Description
address query string true User address

Example responses

200 Response

"string"

Responses

Status Meaning Description Schema
200 OK successful operation string
400 Bad Request Invalid payload None
500 Internal Server Error Internal Server Error None

orderbook

Order book endpoints

Retrieve the orderbook (amount and pricepoint) corresponding to a a baseToken and a quoteToken

Code samples

# You can also use wget
curl -X GET /orderbook?baseToken=string"eToken=string \
  -H 'Accept: application/json'

const fetch = require('node-fetch');

const headers = {
  'Accept':'application/json'

};

fetch('/orderbook?baseToken=string"eToken=string',
{
  method: 'GET',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Accept": []string{"application/json"},
        
    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("GET", "/orderbook", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json'
}

result = RestClient.get '/orderbook',
  params: {
  'baseToken' => 'string',
'quoteToken' => 'string'
}, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Accept': 'application/json'
}

r = requests.get('/orderbook', params={
  'baseToken': 'string',  'quoteToken': 'string'
}, headers = headers)

print r.json()

URL obj = new URL("/orderbook?baseToken=string"eToken=string");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

GET /orderbook

Multiple status values can be provided with comma separated strings

Parameters

Name In Type Required Description
baseToken query string true Base token address
quoteToken query string true Quote token address

Example responses

200 Response

{
  "pairName": "string",
  "asks": [
    {
      "amount": "string",
      "pricepoint": "string"
    }
  ],
  "bids": [
    {
      "amount": "string",
      "pricepoint": "string"
    }
  ]
}

Responses

Status Meaning Description Schema
200 OK successful operation OrderBook
400 Bad Request *** Parameter missing None
500 Internal Server Error Internal Server Error None

Retrieve the orderbook (full raw orders, including fields such as hashes, maker, taker addresses, signatures, etc.)

corresponding to a baseToken and a quoteToken

Code samples

# You can also use wget
curl -X GET /orderbook/raw?baseToken=string"eToken=string \
  -H 'Accept: application/json'

const fetch = require('node-fetch');

const headers = {
  'Accept':'application/json'

};

fetch('/orderbook/raw?baseToken=string"eToken=string',
{
  method: 'GET',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Accept": []string{"application/json"},
        
    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("GET", "/orderbook/raw", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json'
}

result = RestClient.get '/orderbook/raw',
  params: {
  'baseToken' => 'string',
'quoteToken' => 'string'
}, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Accept': 'application/json'
}

r = requests.get('/orderbook/raw', params={
  'baseToken': 'string',  'quoteToken': 'string'
}, headers = headers)

print r.json()

URL obj = new URL("/orderbook/raw?baseToken=string"eToken=string");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

GET /orderbook/raw

Multiple status values can be provided with comma separated strings

Parameters

Name In Type Required Description
baseToken query string true Base token address
quoteToken query string true Quote token address

Example responses

200 Response

{
  "pairName": "string",
  "orders": [
    {
      "id": "string",
      "userAddress": "string",
      "exchangeAddress": "string",
      "baseToken": "string",
      "quoteToken": "string",
      "status": "string",
      "side": "string",
      "type": "string",
      "hash": "string",
      "signature": {
        "V": "string",
        "R": "string",
        "S": "string"
      },
      "pricepoint": "string",
      "amount": "string",
      "filledAmount": "string",
      "nonce": "string",
      "makeFee": "string",
      "takeFee": "string",
      "pairName": "string",
      "createdAt": "2019-11-03T16:33:00Z",
      "updatedAt": "2019-11-03T16:33:00Z"
    }
  ]
}

Responses

Status Meaning Description Schema
200 OK successful operation RawOrderBook
400 Bad Request *** Parameter missing None
500 Internal Server Error Internal Server Error None

trades

Trade endpoints

Retrieve all trades corresponding to a baseToken or/and a quoteToken

Code samples

# You can also use wget
curl -X GET /trades \
  -H 'Accept: application/json'

const fetch = require('node-fetch');

const headers = {
  'Accept':'application/json'

};

fetch('/trades',
{
  method: 'GET',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Accept": []string{"application/json"},
        
    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("GET", "/trades", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json'
}

result = RestClient.get '/trades',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Accept': 'application/json'
}

r = requests.get('/trades', params={

}, headers = headers)

print r.json()

URL obj = new URL("/trades");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

GET /trades

Return all trades in an array with total match

Parameters

Name In Type Required Description
baseToken query string false Base token address
quoteToken query string false Quote token address
pageOffset query string false none
pageSize query string false number of trade item per page, default 50
sortBy query string false Sort for query (suported sort by time)
sortType query string false asc/dec
from query string false the beginning timestamp (number of seconds from 1970/01/01) from which order data has to be queried
to query string false the ending timestamp ((number of seconds from 1970/01/01)) until which order data has to be queried

Example responses

200 Response

{
  "total": 0,
  "trades": [
    {
      "id": "string",
      "taker": "string",
      "maker": "string",
      "baseToken": "string",
      "quoteToken": "string",
      "makerOrderHash": "string",
      "takerOrderHash": "string",
      "hash": "string",
      "txHash": "string",
      "pairName": "string",
      "pricepoint": "string",
      "amount": "string",
      "status": "string",
      "createdAt": "2019-11-03T16:33:00Z",
      "updatedAt": "2019-11-03T16:33:00Z"
    }
  ]
}

Responses

Status Meaning Description Schema
200 OK successful operation Inline
400 Bad Request *** Parameter missing None
500 Internal Server Error Internal Server Error None

Response Schema

Status Code 200

Name Type Required Restrictions Description
» total integer false none none
» trades [Trade] false none none
»» id string false read-only none
»» taker string false none none
»» maker string false none none
»» baseToken string false none none
»» quoteToken string false none none
»» makerOrderHash string false none none
»» takerOrderHash string false none none
»» hash string false none none
»» txHash string false none none
»» pairName string false none none
»» pricepoint string false none none
»» amount string false none none
»» status string false none none
»» createdAt string(date-time) false read-only none
»» updatedAt string(date-time) false read-only none

Retrieve the sorted list of trades for an Ethereum address in which the given address is either maker or taker

Code samples

# You can also use wget
curl -X GET /trades/history?address=string \
  -H 'Accept: application/json'

const fetch = require('node-fetch');

const headers = {
  'Accept':'application/json'

};

fetch('/trades/history?address=string',
{
  method: 'GET',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Accept": []string{"application/json"},
        
    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("GET", "/trades/history", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json'
}

result = RestClient.get '/trades/history',
  params: {
  'address' => 'string'
}, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Accept': 'application/json'
}

r = requests.get('/trades/history', params={
  'address': 'string'
}, headers = headers)

print r.json()

URL obj = new URL("/trades/history?address=string");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

GET /trades/history

Return trades array

Parameters

Name In Type Required Description
address query string true User address
pageOffset query string false none
pageSize query string false number of trade item per page, default 50
sortBy query string false Sort for query (suported sort by time)
sortType query string false asc/dec
baseToken query string false Base token address
quoteToken query string false Quote token address
from query string false the beginning timestamp (number of seconds from 1970/01/01) from which order data has to be queried
to query string false the ending timestamp ((number of seconds from 1970/01/01)) until which order data has to be queried

Example responses

200 Response

{
  "total": 0,
  "trades": [
    {
      "id": "string",
      "taker": "string",
      "maker": "string",
      "baseToken": "string",
      "quoteToken": "string",
      "makerOrderHash": "string",
      "takerOrderHash": "string",
      "hash": "string",
      "txHash": "string",
      "pairName": "string",
      "pricepoint": "string",
      "amount": "string",
      "status": "string",
      "createdAt": "2019-11-03T16:33:00Z",
      "updatedAt": "2019-11-03T16:33:00Z"
    }
  ]
}

Responses

Status Meaning Description Schema
200 OK successful operation Inline
400 Bad Request address Parameter missing None
500 Internal Server Error Internal Server Error None

Response Schema

Status Code 200

Name Type Required Restrictions Description
» total integer false none none
» trades [Trade] false none none
»» id string false read-only none
»» taker string false none none
»» maker string false none none
»» baseToken string false none none
»» quoteToken string false none none
»» makerOrderHash string false none none
»» takerOrderHash string false none none
»» hash string false none none
»» txHash string false none none
»» pairName string false none none
»» pricepoint string false none none
»» amount string false none none
»» status string false none none
»» createdAt string(date-time) false read-only none
»» updatedAt string(date-time) false read-only none

ohlcv

OHLCV endpoints

Retrieve OHLCV data corresponding to a baseToken and a quoteToken

Code samples

# You can also use wget
curl -X GET /ohlcv?baseToken=string"eToken=string&timeInterval=string&from=string&to=string \
  -H 'Accept: application/json'

const fetch = require('node-fetch');

const headers = {
  'Accept':'application/json'

};

fetch('/ohlcv?baseToken=string"eToken=string&timeInterval=string&from=string&to=string',
{
  method: 'GET',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Accept": []string{"application/json"},
        
    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("GET", "/ohlcv", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json'
}

result = RestClient.get '/ohlcv',
  params: {
  'baseToken' => 'string',
'quoteToken' => 'string',
'timeInterval' => 'string',
'from' => 'string',
'to' => 'string'
}, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Accept': 'application/json'
}

r = requests.get('/ohlcv', params={
  'baseToken': 'string',  'quoteToken': 'string',  'timeInterval': 'string',  'from': 'string',  'to': 'string'
}, headers = headers)

print r.json()

URL obj = new URL("/ohlcv?baseToken=string"eToken=string&timeInterval=string&from=string&to=string");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

GET /ohlcv

Return all ticks in an array

Parameters

Name In Type Required Description
baseToken query string true Base token address
quoteToken query string true Quote token address
timeInterval query string true Time interval, candle size. Valid values: 1m, 3m, 5m, 15m, 30m, 1h, 2h, 4h, 6h, 8h, 12h, 1d, 1w, 1mo (1 month)
from query string true the beginning timestamp (number of seconds from 1970/01/01) from which ohlcv data has to be queried
to query string true the ending timestamp ((number of seconds from 1970/01/01)) until which ohlcv data has to be queried

Example responses

200 Response

[
  {
    "pair": {
      "pairName": "string",
      "baseToken": "string",
      "quoteToken": "string"
    },
    "open": "string",
    "high": "string",
    "low": 0,
    "close": "string",
    "volume": "string",
    "count": "string",
    "timestamp": "string"
  }
]

Responses

Status Meaning Description Schema
200 OK successful operation Inline
400 Bad Request *** Parameter missing None
500 Internal Server Error Internal Server Error None

Response Schema

Status Code 200

Name Type Required Restrictions Description
anonymous [Tick] false none none
» pair PairID false none none
»» pairName string false none none
»» baseToken string false none none
»» quoteToken string false none none
» open string false none none
» high string false none none
» low integer(int32) false none none
» close string false none none
» volume string false none none
» count string false none none
» timestamp string false none none

notifications

Notification endpoints

Retrieve the list of notifications for an address with pagination

Code samples

# You can also use wget
curl -X GET /notifications?userAddress=string&page=string&perPage=string \
  -H 'Accept: application/json'

const fetch = require('node-fetch');

const headers = {
  'Accept':'application/json'

};

fetch('/notifications?userAddress=string&page=string&perPage=string',
{
  method: 'GET',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Accept": []string{"application/json"},
        
    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("GET", "/notifications", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json'
}

result = RestClient.get '/notifications',
  params: {
  'userAddress' => 'string',
'page' => 'string',
'perPage' => 'string'
}, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Accept': 'application/json'
}

r = requests.get('/notifications', params={
  'userAddress': 'string',  'page': 'string',  'perPage': 'string'
}, headers = headers)

print r.json()

URL obj = new URL("/notifications?userAddress=string&page=string&perPage=string");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

GET /notifications

Return notifications in an array

Parameters

Name In Type Required Description
userAddress query string true User address
page query string true Page number
perPage query string true the number of records returned per page. Valid values are 10, 20, 30, 40, 50

Example responses

200 Response

[
  {
    "id": "string",
    "recipient": "string",
    "message": "string",
    "type": "string",
    "status": "string",
    "createdAt": "2019-11-03T16:33:00Z",
    "updatedAt": "2019-11-03T16:33:00Z"
  }
]

Responses

Status Meaning Description Schema
200 OK successful operation Inline
400 Bad Request Invalid user address None
500 Internal Server Error Internal Server Error None

Response Schema

Status Code 200

Name Type Required Restrictions Description
anonymous [Notification] false none none
» id string false read-only none
» recipient string false none none
» message string false none none
» type string false none none
» status string false none none
» createdAt string(date-time) false read-only none
» updatedAt string(date-time) false read-only none

Update status of a notification from UNREAD to READ

Code samples

# You can also use wget
curl -X PUT /notifications/{id} \
  -H 'Content-Type: application/json' \
  -H 'Accept: application/json'

const fetch = require('node-fetch');
const inputBody = '{
  "recipient": "string",
  "message": "string",
  "type": "string",
  "status": "string"
}';
const headers = {
  'Content-Type':'application/json',
  'Accept':'application/json'

};

fetch('/notifications/{id}',
{
  method: 'PUT',
  body: inputBody,
  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Content-Type": []string{"application/json"},
        "Accept": []string{"application/json"},
        
    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("PUT", "/notifications/{id}", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

require 'rest-client'
require 'json'

headers = {
  'Content-Type' => 'application/json',
  'Accept' => 'application/json'
}

result = RestClient.put '/notifications/{id}',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Content-Type': 'application/json',
  'Accept': 'application/json'
}

r = requests.put('/notifications/{id}', params={

}, headers = headers)

print r.json()

URL obj = new URL("/notifications/{id}");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("PUT");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

PUT /notifications/{id}

Returns newly updated notification

Body parameter

{
  "recipient": "string",
  "message": "string",
  "type": "string",
  "status": "string"
}

Parameters

Name In Type Required Description
body body Notification true Notification object that needs to be updated
» id body string false none
» recipient body string false none
» message body string false none
» type body string false none
» status body string false none
» createdAt body string(date-time) false none
» updatedAt body string(date-time) false none

Example responses

200 Response

{
  "id": "string",
  "recipient": "string",
  "message": "string",
  "type": "string",
  "status": "string",
  "createdAt": "2019-11-03T16:33:00Z",
  "updatedAt": "2019-11-03T16:33:00Z"
}

Responses

Status Meaning Description Schema
200 OK successful operation Notification
400 Bad Request Invalid payload None
500 Internal Server Error Internal Server Error None

info

Info endpoints

get__info

Code samples

# You can also use wget
curl -X GET /info \
  -H 'Accept: */*'

const fetch = require('node-fetch');

const headers = {
  'Accept':'*/*'

};

fetch('/info',
{
  method: 'GET',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Accept": []string{"*/*"},
        
    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("GET", "/info", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

require 'rest-client'
require 'json'

headers = {
  'Accept' => '*/*'
}

result = RestClient.get '/info',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Accept': '*/*'
}

r = requests.get('/info', params={

}, headers = headers)

print r.json()

URL obj = new URL("/info");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

GET /info

Example responses

200 Response

Responses

Status Meaning Description Schema
200 OK successful operation Inline
500 Internal Server Error Internal server error None

Response Schema

Status Code 200

Name Type Required Restrictions Description
» exchangeAddress string false none none
» fee string false none none

get__info_exchange

Code samples

# You can also use wget
curl -X GET /info/exchange \
  -H 'Accept: */*'

const fetch = require('node-fetch');

const headers = {
  'Accept':'*/*'

};

fetch('/info/exchange',
{
  method: 'GET',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Accept": []string{"*/*"},
        
    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("GET", "/info/exchange", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

require 'rest-client'
require 'json'

headers = {
  'Accept' => '*/*'
}

result = RestClient.get '/info/exchange',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Accept': '*/*'
}

r = requests.get('/info/exchange', params={

}, headers = headers)

print r.json()

URL obj = new URL("/info/exchange");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

GET /info/exchange

Example responses

200 Response

Responses

Status Meaning Description Schema
200 OK successful operation Inline

Response Schema

Status Code 200

Name Type Required Restrictions Description
» exchangeAddress string false none none

get__info_fees

Code samples

# You can also use wget
curl -X GET /info/fees \
  -H 'Accept: */*'

const fetch = require('node-fetch');

const headers = {
  'Accept':'*/*'

};

fetch('/info/fees',
{
  method: 'GET',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Accept": []string{"*/*"},
        
    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("GET", "/info/fees", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

require 'rest-client'
require 'json'

headers = {
  'Accept' => '*/*'
}

result = RestClient.get '/info/fees',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Accept': '*/*'
}

r = requests.get('/info/fees', params={

}, headers = headers)

print r.json()

URL obj = new URL("/info/fees");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

GET /info/fees

Example responses

200 Response

Responses

Status Meaning Description Schema
200 OK successful operation Inline

Response Schema

Status Code 200

Name Type Required Restrictions Description
» fee string false none none

market

Retrieve market stats 24h corresponding to a baseToken and a quoteToken

Code samples

# You can also use wget
curl -X GET /market/stats?baseToken=string"eToken=string \
  -H 'Accept: application/json'

const fetch = require('node-fetch');

const headers = {
  'Accept':'application/json'

};

fetch('/market/stats?baseToken=string"eToken=string',
{
  method: 'GET',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Accept": []string{"application/json"},
        
    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("GET", "/market/stats", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json'
}

result = RestClient.get '/market/stats',
  params: {
  'baseToken' => 'string',
'quoteToken' => 'string'
}, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Accept': 'application/json'
}

r = requests.get('/market/stats', params={
  'baseToken': 'string',  'quoteToken': 'string'
}, headers = headers)

print r.json()

URL obj = new URL("/market/stats?baseToken=string"eToken=string");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

GET /market/stats

Multiple status values can be provided with comma separated strings

Parameters

Name In Type Required Description
baseToken query string true Base token address
quoteToken query string true Quote token address

Example responses

200 Response

{
  "id": "string",
  "baseTokenSymbol": "string",
  "baseTokenAddress": "string",
  "baseTokenDecimals": 0,
  "quoteTokenSymbol": "string",
  "quoteTokenAddress": "string",
  "quoteTokenDecimals": 0,
  "listed": true,
  "active": true,
  "rank": 0,
  "makeFee": "string",
  "takeFee": "string",
  "createdAt": "2019-11-03T16:33:00Z",
  "updatedAt": "2019-11-03T16:33:00Z"
}

Responses

Status Meaning Description Schema
200 OK successful operation Pair
400 Bad Request baseToken Parameter missing None
500 Internal Server Error Internal Server Error None

Retrieve all market stats 2

Code samples

# You can also use wget
curl -X GET /market/stats/all \
  -H 'Accept: application/json'

const fetch = require('node-fetch');

const headers = {
  'Accept':'application/json'

};

fetch('/market/stats/all',
{
  method: 'GET',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Accept": []string{"application/json"},
        
    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("GET", "/market/stats/all", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json'
}

result = RestClient.get '/market/stats/all',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Accept': 'application/json'
}

r = requests.get('/market/stats/all', params={

}, headers = headers)

print r.json()

URL obj = new URL("/market/stats/all");
HttpURLConnection con = (HttpURLConnection) obj.openConnection();
con.setRequestMethod("GET");
int responseCode = con.getResponseCode();
BufferedReader in = new BufferedReader(
    new InputStreamReader(con.getInputStream()));
String inputLine;
StringBuffer response = new StringBuffer();
while ((inputLine = in.readLine()) != null) {
    response.append(inputLine);
}
in.close();
System.out.println(response.toString());

GET /market/stats/all

Multiple status values can be provided with comma separated strings

Example responses

200 Response

{
  "pair": {
    "pairName": "string",
    "baseToken": "string",
    "quoteToken": "string"
  },
  "open": "string",
  "high": "string",
  "low": 0,
  "close": "string",
  "volume": "string",
  "count": "string",
  "timestamp": "string",
  "orderVolume": "string",
  "orderCount": "string",
  "averageOrderAmount": "string",
  "averageTradeAmount": "string",
  "askPrice": "string",
  "bidPrice": "string",
  "price": "string",
  "rank": 0
}

Responses

Status Meaning Description Schema
200 OK successful operation PairData
400 Bad Request baseToken Parameter missing None
500 Internal Server Error Internal Server Error None

Schemas

Account

{
  "address": "0xF7349C253FF7747Df661296E0859c44e974fb52E"
}

Properties

Name Type Required Restrictions Description
id string false read-only none
address string false none none
tokenBalances object false none none
» address string false none none
» symbol string false none none
» balance string false none none
» availableBalance string false none none
» inOrderBalance string false none none
isBlocked boolean false none none
createdAt string(date-time) false read-only none
updatedAt string(date-time) false read-only none

TokenBalance

{
  "address": "string",
  "symbol": "string",
  "balance": "string",
  "availableBalance": "string",
  "inOrderBalance": "string"
}

Properties

Name Type Required Restrictions Description
address string false none none
symbol string false none none
balance string false none none
availableBalance string false none none
inOrderBalance string false none none

Token

{
  "id": "string",
  "name": "string",
  "symbol": "string",
  "address": "string",
  "image": {
    "url": "string",
    "meta": {}
  },
  "contractAddress": "string",
  "decimals": 0,
  "active": true,
  "listed": true,
  "quote": true,
  "makeFee": "string",
  "takeFee": "string",
  "usd": "string",
  "createdAt": "2019-11-03T16:33:00Z",
  "updatedAt": "2019-11-03T16:33:00Z"
}

Properties

Name Type Required Restrictions Description
id string false read-only none
name string false none none
symbol string false none none
address string false none none
image Image false none none
contractAddress string false none none
decimals integer(int32) false read-only none
active boolean false none none
listed boolean false read-only none
quote boolean false none none
makeFee string false none none
takeFee string false none none
usd string false read-only none
createdAt string(date-time) false read-only none
updatedAt string(date-time) false read-only none

Pair

{
  "id": "string",
  "baseTokenSymbol": "string",
  "baseTokenAddress": "string",
  "baseTokenDecimals": 0,
  "quoteTokenSymbol": "string",
  "quoteTokenAddress": "string",
  "quoteTokenDecimals": 0,
  "listed": true,
  "active": true,
  "rank": 0,
  "makeFee": "string",
  "takeFee": "string",
  "createdAt": "2019-11-03T16:33:00Z",
  "updatedAt": "2019-11-03T16:33:00Z"
}

Properties

Name Type Required Restrictions Description
id string false read-only none
baseTokenSymbol string false none none
baseTokenAddress string false none none
baseTokenDecimals integer(int32) false read-only none
quoteTokenSymbol string false none none
quoteTokenAddress string false none none
quoteTokenDecimals integer(int32) false read-only none
listed boolean false read-only none
active boolean false none none
rank integer(int32) false read-only none
makeFee string false read-only none
takeFee string false read-only none
createdAt string(date-time) false read-only none
updatedAt string(date-time) false read-only none

PairID

{
  "pairName": "string",
  "baseToken": "string",
  "quoteToken": "string"
}

Properties

Name Type Required Restrictions Description
pairName string false none none
baseToken string false none none
quoteToken string false none none

PairData

{
  "pair": {
    "pairName": "string",
    "baseToken": "string",
    "quoteToken": "string"
  },
  "open": "string",
  "high": "string",
  "low": 0,
  "close": "string",
  "volume": "string",
  "count": "string",
  "timestamp": "string",
  "orderVolume": "string",
  "orderCount": "string",
  "averageOrderAmount": "string",
  "averageTradeAmount": "string",
  "askPrice": "string",
  "bidPrice": "string",
  "price": "string",
  "rank": 0
}

Properties

Name Type Required Restrictions Description
pair PairID false none none
open string false none none
high string false none none
low integer(int32) false none none
close string false none none
volume string false none none
count string false none none
timestamp string false none none
orderVolume string false none none
orderCount string false none none
averageOrderAmount string false none none
averageTradeAmount string false none none
askPrice string false none none
bidPrice string false none none
price string false none none
rank integer(int32) false none none

Image

{
  "url": "string",
  "meta": {}
}

Properties

Name Type Required Restrictions Description
url string false none none
meta object false none none

Order

{
  "id": "string",
  "userAddress": "string",
  "exchangeAddress": "string",
  "baseToken": "string",
  "quoteToken": "string",
  "status": "string",
  "side": "string",
  "type": "string",
  "hash": "string",
  "signature": {
    "V": "string",
    "R": "string",
    "S": "string"
  },
  "pricepoint": "string",
  "amount": "string",
  "filledAmount": "string",
  "nonce": "string",
  "makeFee": "string",
  "takeFee": "string",
  "pairName": "string",
  "createdAt": "2019-11-03T16:33:00Z",
  "updatedAt": "2019-11-03T16:33:00Z"
}

Properties

Name Type Required Restrictions Description
id string false read-only none
userAddress string false none none
exchangeAddress string false none none
baseToken string false none none
quoteToken string false none none
status string false none none
side string false none none
type string false none none
hash string false none none
signature Signature false none none
pricepoint string false none none
amount string false none none
filledAmount string false none none
nonce string false none none
makeFee string false none none
takeFee string false none none
pairName string false none none
createdAt string(date-time) false read-only none
updatedAt string(date-time) false read-only none

OrderCreate

{
  "userAddress": "0x15e08dE16f534c890828F2a0D935433aF5B3CE0C",
  "exchangeAddress": "0x0D3ab14BBaD3D99F4203bd7a11aCB94882050E7e",
  "baseToken": "0x4d7eA2cE949216D6b120f3AA10164173615A2b6C",
  "quoteToken": "0x0000000000000000000000000000000000000001",
  "side": "SELL/BUY",
  "type": "LO/MO",
  "status": "NEW/CANCELLED",
  "hash": "string",
  "signature": {
    "V": "string",
    "R": "string",
    "S": "string"
  },
  "pricepoint": "21207020000000000000000",
  "amount": "4693386710283129",
  "nonce": "1",
  "makeFee": "1",
  "takeFee": "1"
}

Properties

Name Type Required Restrictions Description
userAddress string false none none
exchangeAddress string false none none
baseToken string false none none
quoteToken string false none none
side string false none none
type string false none none
status string false none none
hash string false none none
signature Signature false none none
pricepoint string false none none
amount string false none none
nonce string false none none
makeFee string false none none
takeFee string false none none

OrderCancel

{
  "orderHash": "string",
  "nonce": "string",
  "hash": "string",
  "signature": {
    "V": "string",
    "R": "string",
    "S": "string"
  }
}

Properties

Name Type Required Restrictions Description
orderHash string false none none
nonce string false none none
hash string false none none
signature Signature false none none

Signature

{
  "V": "string",
  "R": "string",
  "S": "string"
}

Properties

Name Type Required Restrictions Description
V string false none none
R string false none none
S string false none none

OrderBook

{
  "pairName": "string",
  "asks": [
    {
      "amount": "string",
      "pricepoint": "string"
    }
  ],
  "bids": [
    {
      "amount": "string",
      "pricepoint": "string"
    }
  ]
}

Properties

Name Type Required Restrictions Description
pairName string false none none
asks [object] false none none
» amount string false none none
» pricepoint string false none none
bids [object] false none none
» amount string false none none
» pricepoint string false none none

RawOrderBook

{
  "pairName": "string",
  "orders": [
    {
      "id": "string",
      "userAddress": "string",
      "exchangeAddress": "string",
      "baseToken": "string",
      "quoteToken": "string",
      "status": "string",
      "side": "string",
      "type": "string",
      "hash": "string",
      "signature": {
        "V": "string",
        "R": "string",
        "S": "string"
      },
      "pricepoint": "string",
      "amount": "string",
      "filledAmount": "string",
      "nonce": "string",
      "makeFee": "string",
      "takeFee": "string",
      "pairName": "string",
      "createdAt": "2019-11-03T16:33:00Z",
      "updatedAt": "2019-11-03T16:33:00Z"
    }
  ]
}

Properties

Name Type Required Restrictions Description
pairName string false none none
orders [Order] false none none

Trade

{
  "id": "string",
  "taker": "string",
  "maker": "string",
  "baseToken": "string",
  "quoteToken": "string",
  "makerOrderHash": "string",
  "takerOrderHash": "string",
  "hash": "string",
  "txHash": "string",
  "pairName": "string",
  "pricepoint": "string",
  "amount": "string",
  "status": "string",
  "createdAt": "2019-11-03T16:33:00Z",
  "updatedAt": "2019-11-03T16:33:00Z"
}

Properties

Name Type Required Restrictions Description
id string false read-only none
taker string false none none
maker string false none none
baseToken string false none none
quoteToken string false none none
makerOrderHash string false none none
takerOrderHash string false none none
hash string false none none
txHash string false none none
pairName string false none none
pricepoint string false none none
amount string false none none
status string false none none
createdAt string(date-time) false read-only none
updatedAt string(date-time) false read-only none

Tick

{
  "pair": {
    "pairName": "string",
    "baseToken": "string",
    "quoteToken": "string"
  },
  "open": "string",
  "high": "string",
  "low": 0,
  "close": "string",
  "volume": "string",
  "count": "string",
  "timestamp": "string"
}

Properties

Name Type Required Restrictions Description
pair PairID false none none
open string false none none
high string false none none
low integer(int32) false none none
close string false none none
volume string false none none
count string false none none
timestamp string false none none

Notification

{
  "id": "string",
  "recipient": "string",
  "message": "string",
  "type": "string",
  "status": "string",
  "createdAt": "2019-11-03T16:33:00Z",
  "updatedAt": "2019-11-03T16:33:00Z"
}

Properties

Name Type Required Restrictions Description
id string false read-only none
recipient string false none none
message string false none none
type string false none none
status string false none none
createdAt string(date-time) false read-only none
updatedAt string(date-time) false read-only none

ApiResponse

{
  "code": 0,
  "type": "string",
  "message": "string"
}

Properties

Name Type Required Restrictions Description
code integer(int32) false none none
type string false none none
message string false none none

TomoScan APIs v1.0.0

Scroll down for code samples, example requests and responses. Select a language for code samples from the tabs above or the mobile navigation menu.

TomoScan APIs

License: Github

Base URL: https://scan.tomochain.com

Swagger API Document: https://scan.tomochain.com/docs/

Accounts

Accounts API

Get list accounts

Code samples

# You can also use wget
curl -X GET /api/accounts

const fetch = require('node-fetch');

fetch('/api/accounts',
{
  method: 'GET'

})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

package main

import (
       "bytes"
       "net/http"
)

func main() {

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("GET", "/api/accounts", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

require 'rest-client'
require 'json'

result = RestClient.get '/api/accounts',
  params: {
  }

p JSON.parse(result)

import requests

r = requests.get('/api/accounts', params={

)

print r.json()

GET /api/accounts

Parameters

Name In Type Required Description
page query number false default = 1
limit query number false default 20, maximum = 50

Responses

Status Meaning Description Schema
200 OK OK None
400 Bad Request Bad Request None
500 Internal Server Error Server Internal Error None

Get account detail

Code samples

# You can also use wget
curl -X GET /api/accounts/{hash}

const fetch = require('node-fetch');

fetch('/api/accounts/{hash}',
{
  method: 'GET'

})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

package main

import (
       "bytes"
       "net/http"
)

func main() {

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("GET", "/api/accounts/{hash}", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

require 'rest-client'
require 'json'

result = RestClient.get '/api/accounts/{hash}',
  params: {
  }

p JSON.parse(result)

import requests

r = requests.get('/api/accounts/{hash}', params={

)

print r.json()

GET /api/accounts/{hash}

Parameters

Name In Type Required Description
hash path string true account address

Responses

Status Meaning Description Schema
200 OK OK None
400 Bad Request Bad Request None
404 Not Found Not Found None
500 Internal Server Error Server Internal Error None

Get list block create

Code samples

# You can also use wget
curl -X GET /api/accounts/{hash}/mined

const fetch = require('node-fetch');

fetch('/api/accounts/{hash}/mined',
{
  method: 'GET'

})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

package main

import (
       "bytes"
       "net/http"
)

func main() {

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("GET", "/api/accounts/{hash}/mined", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

require 'rest-client'
require 'json'

result = RestClient.get '/api/accounts/{hash}/mined',
  params: {
  }

p JSON.parse(result)

import requests

r = requests.get('/api/accounts/{hash}/mined', params={

)

print r.json()

GET /api/accounts/{hash}/mined

Parameters

Name In Type Required Description
hash path string true account address
page query number false default = 1
limit query number false default 20, maximum = 50

Responses

Status Meaning Description Schema
200 OK OK None
400 Bad Request Bad Request None
500 Internal Server Error Server Internal Error None

Get list token transactions. Require 1 of 2 conditions - address | token

Code samples

# You can also use wget
curl -X GET /api/token-txs

const fetch = require('node-fetch');

fetch('/api/token-txs',
{
  method: 'GET'

})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

package main

import (
       "bytes"
       "net/http"
)

func main() {

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("GET", "/api/token-txs", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

require 'rest-client'
require 'json'

result = RestClient.get '/api/token-txs',
  params: {
  }

p JSON.parse(result)

import requests

r = requests.get('/api/token-txs', params={

)

print r.json()

GET /api/token-txs

Parameters

Name In Type Required Description
address query string false account address
token path string true token address
page query number false default = 1
limit query number false default 20, maximum = 50

Responses

Status Meaning Description Schema
200 OK OK None
400 Bad Request Bad Request None
500 Internal Server Error Server Internal Error None

Get list token holder. Require 1 of 2 conditions - address | hassh

Code samples

# You can also use wget
curl -X GET /api/token-holders

const fetch = require('node-fetch');

fetch('/api/token-holders',
{
  method: 'GET'

})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

package main

import (
       "bytes"
       "net/http"
)

func main() {

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("GET", "/api/token-holders", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

require 'rest-client'
require 'json'

result = RestClient.get '/api/token-holders',
  params: {
  }

p JSON.parse(result)

import requests

r = requests.get('/api/token-holders', params={

)

print r.json()

GET /api/token-holders

Parameters

Name In Type Required Description
address query string false token address
hash path string true account address
page query number false default = 1
limit query number false default 20, maximum = 50

Responses

Status Meaning Description Schema
200 OK OK None
400 Bad Request Bad Request None
500 Internal Server Error Server Internal Error None

Blocks

Blocks API

Get list blocks

Code samples

# You can also use wget
curl -X GET /api/blocks

const fetch = require('node-fetch');

fetch('/api/blocks',
{
  method: 'GET'

})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

package main

import (
       "bytes"
       "net/http"
)

func main() {

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("GET", "/api/blocks", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

require 'rest-client'
require 'json'

result = RestClient.get '/api/blocks',
  params: {
  }

p JSON.parse(result)

import requests

r = requests.get('/api/blocks', params={

)

print r.json()

GET /api/blocks

Parameters

Name In Type Required Description
page query number false default = 1
limit query number false default 20, maximum = 50

Responses

Status Meaning Description Schema
200 OK OK None
400 Bad Request Bad Request None
500 Internal Server Error Server Internal Error None

Get block detail

Code samples

# You can also use wget
curl -X GET /api/blocks/{hash}

const fetch = require('node-fetch');

fetch('/api/blocks/{hash}',
{
  method: 'GET'

})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

package main

import (
       "bytes"
       "net/http"
)

func main() {

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("GET", "/api/blocks/{hash}", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

require 'rest-client'
require 'json'

result = RestClient.get '/api/blocks/{hash}',
  params: {
  }

p JSON.parse(result)

import requests

r = requests.get('/api/blocks/{hash}', params={

)

print r.json()

GET /api/blocks/{hash}

Parameters

Name In Type Required Description
hash path string true block number or block hash

Responses

Status Meaning Description Schema
200 OK OK None
400 Bad Request Bad Request None
404 Not Found Not Found None
500 Internal Server Error Server Internal Error None

Get list signers of a block

Code samples

# You can also use wget
curl -X GET /api/blocks/signers/{blockNumber}

const fetch = require('node-fetch');

fetch('/api/blocks/signers/{blockNumber}',
{
  method: 'GET'

})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

package main

import (
       "bytes"
       "net/http"
)

func main() {

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("GET", "/api/blocks/signers/{blockNumber}", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

require 'rest-client'
require 'json'

result = RestClient.get '/api/blocks/signers/{blockNumber}',
  params: {
  }

p JSON.parse(result)

import requests

r = requests.get('/api/blocks/signers/{blockNumber}', params={

)

print r.json()

GET /api/blocks/signers/{blockNumber}

Parameters

Name In Type Required Description
blockNumber path number true account address

Responses

Status Meaning Description Schema
200 OK OK None
400 Bad Request Bad Request None
500 Internal Server Error Server Internal Error None

Transactions

Transactions API

Get list blocks. Params limit & page & ((address & tx_account) | block | type)

Code samples

# You can also use wget
curl -X GET /api/txs

const fetch = require('node-fetch');

fetch('/api/txs',
{
  method: 'GET'

})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

package main

import (
       "bytes"
       "net/http"
)

func main() {

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("GET", "/api/txs", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

require 'rest-client'
require 'json'

result = RestClient.get '/api/txs',
  params: {
  }

p JSON.parse(result)

import requests

r = requests.get('/api/txs', params={

)

print r.json()

GET /api/txs

Parameters

Name In Type Required Description
page query number false default = 1
limit query number false default 20, maximum = 50
address query string false list tx of address, group with tx_account
tx_account query string false in
block query number false list tx of a block
type query string false signTxs

Responses

Status Meaning Description Schema
200 OK OK None
400 Bad Request Bad Request None
500 Internal Server Error Server Internal Error None

Get transaction detail

Code samples

# You can also use wget
curl -X GET /api/txs/{hash}

const fetch = require('node-fetch');

fetch('/api/txs/{hash}',
{
  method: 'GET'

})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

package main

import (
       "bytes"
       "net/http"
)

func main() {

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("GET", "/api/txs/{hash}", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

require 'rest-client'
require 'json'

result = RestClient.get '/api/txs/{hash}',
  params: {
  }

p JSON.parse(result)

import requests

r = requests.get('/api/txs/{hash}', params={

)

print r.json()

GET /api/txs/{hash}

Parameters

Name In Type Required Description
hash path string true transaction hash

Responses

Status Meaning Description Schema
200 OK OK None
404 Not Found Not Found None
500 Internal Server Error Server Internal Error None

Tokens

Tokens API

Get token detail

Code samples

# You can also use wget
curl -X GET /api/tokens/{hash}

const fetch = require('node-fetch');

fetch('/api/tokens/{hash}',
{
  method: 'GET'

})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

package main

import (
       "bytes"
       "net/http"
)

func main() {

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("GET", "/api/tokens/{hash}", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

require 'rest-client'
require 'json'

result = RestClient.get '/api/tokens/{hash}',
  params: {
  }

p JSON.parse(result)

import requests

r = requests.get('/api/tokens/{hash}', params={

)

print r.json()

GET /api/tokens/{hash}

Parameters

Name In Type Required Description
hash path string true token address

Responses

Status Meaning Description Schema
200 OK OK None
400 Bad Request Bad Request None
404 Not Found Not Found None
500 Internal Server Error Server Internal Error None

Token

Get list tokens

Code samples

# You can also use wget
curl -X GET /api/tokens

const fetch = require('node-fetch');

fetch('/api/tokens',
{
  method: 'GET'

})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

package main

import (
       "bytes"
       "net/http"
)

func main() {

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("GET", "/api/tokens", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

require 'rest-client'
require 'json'

result = RestClient.get '/api/tokens',
  params: {
  }

p JSON.parse(result)

import requests

r = requests.get('/api/tokens', params={

)

print r.json()

GET /api/tokens

Parameters

Name In Type Required Description
page query number false default = 1
limit query number false default 20, maximum = 50

Responses

Status Meaning Description Schema
200 OK OK None
400 Bad Request Bad Request None
500 Internal Server Error Server Internal Error None

Rewards

Get list rewards of a voter

Code samples

# You can also use wget
curl -X GET /api/rewards/{voter}

const fetch = require('node-fetch');

fetch('/api/rewards/{voter}',
{
  method: 'GET'

})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

package main

import (
       "bytes"
       "net/http"
)

func main() {

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("GET", "/api/rewards/{voter}", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

require 'rest-client'
require 'json'

result = RestClient.get '/api/rewards/{voter}',
  params: {
  }

p JSON.parse(result)

import requests

r = requests.get('/api/rewards/{voter}', params={

)

print r.json()

GET /api/rewards/{voter}

Parameters

Name In Type Required Description
voter path number true account address
page query number false default = 1
limit query number false default 20, maximum = 50

Responses

Status Meaning Description Schema
200 OK OK None
400 Bad Request Bad Request None
500 Internal Server Error Server Internal Error None

Get list reward of an epoch

Code samples

# You can also use wget
curl -X GET /api/rewards/epoch/{epochNumber}

const fetch = require('node-fetch');

fetch('/api/rewards/epoch/{epochNumber}',
{
  method: 'GET'

})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

package main

import (
       "bytes"
       "net/http"
)

func main() {

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("GET", "/api/rewards/epoch/{epochNumber}", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

require 'rest-client'
require 'json'

result = RestClient.get '/api/rewards/epoch/{epochNumber}',
  params: {
  }

p JSON.parse(result)

import requests

r = requests.get('/api/rewards/epoch/{epochNumber}', params={

)

print r.json()

GET /api/rewards/epoch/{epochNumber}

Parameters

Name In Type Required Description
epochNumber path number true epoch number
hash path string true account address

Responses

Status Meaning Description Schema
200 OK OK None
400 Bad Request Bad Request None
404 Not Found Not Found None
500 Internal Server Error Server Internal Error None

TomoMaster APIs v1.0.0

Scroll down for code samples, example requests and responses. Select a language for code samples from the tabs above or the mobile navigation menu.

Happy to code TomoMaster APIs

License: Github

Base URL: https://master.tomochain.com

Swagger API Document: https://master.tomochain.com/api-docs/

Config

Get TomoMaster Application Configuration

Get TomoMaster Application Configuration

Code samples

# You can also use wget
curl -X GET /api/config \
  -H 'Accept: application/json'

const fetch = require('node-fetch');

const headers = {
  'Accept':'application/json'

};

fetch('/api/config',
{
  method: 'GET',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Accept": []string{"application/json"},
        
    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("GET", "/api/config", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json'
}

result = RestClient.get '/api/config',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Accept': 'application/json'
}

r = requests.get('/api/config', params={

}, headers = headers)

print r.json()

GET /api/config

Example responses

200 Response

{
  "blockchain": {
    "rpc": "string",
    "ws": "string",
    "epoch": 900,
    "blockTime": 0
  },
  "explorerUrl": "string",
  "GA": "string"
}

Responses

Status Meaning Description Schema
200 OK OK config
400 Bad Request Bad Request None
401 Unauthorized Unauthorized None
406 Not Acceptable Not Acceptable None
500 Internal Server Error Server Internal Error None

Candidates

Get Candidates information

Get candidates information

Code samples

# You can also use wget
curl -X GET /api/candidates \
  -H 'Accept: application/json'

const fetch = require('node-fetch');

const headers = {
  'Accept':'application/json'

};

fetch('/api/candidates',
{
  method: 'GET',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Accept": []string{"application/json"},
        
    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("GET", "/api/candidates", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json'
}

result = RestClient.get '/api/candidates',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Accept': 'application/json'
}

r = requests.get('/api/candidates', params={

}, headers = headers)

print r.json()

GET /api/candidates

Parameters

Name In Type Required Description
limit query number false Number of record in a query
page query number false Page number

Example responses

200 Response

{
  "items": [
    {
      "_id": "123",
      "candidate": "0x11621900588eca4410c00097a9f59237f34064cd",
      "smartContractAddress": "0x0000000000000000000000000000000000000088",
      "__v": 0,
      "capacity": "91540333800000001000000",
      "createdAt": "2018-10-31T03:42:39.375Z",
      "owner": "0x11621900588eca4410c00097a9f59237f34064cd",
      "status": "RESIGNED",
      "updatedAt": "2019-01-11T09:21:55.028Z",
      "latestSignedBlock": 2917487,
      "capacityNumber": 91540.33380000001,
      "isMasternode": false,
      "isPenalty": false
    }
  ],
  "total": 100,
  "activeCandidates": 10
}

Responses

Status Meaning Description Schema
200 OK OK candidate
406 Not Acceptable Not Acceptable None

Get candidate's information

Code samples

# You can also use wget
curl -X GET /api/candidates/{candidate} \
  -H 'Accept: application/json'

const fetch = require('node-fetch');

const headers = {
  'Accept':'application/json'

};

fetch('/api/candidates/{candidate}',
{
  method: 'GET',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Accept": []string{"application/json"},
        
    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("GET", "/api/candidates/{candidate}", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json'
}

result = RestClient.get '/api/candidates/{candidate}',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Accept': 'application/json'
}

r = requests.get('/api/candidates/{candidate}', params={

}, headers = headers)

print r.json()

GET /api/candidates/{candidate}

Parameters

Name In Type Required Description
candidate path string true candidate's address

Example responses

200 Response

{
  "_id": "123",
  "candidate": "0x11621900588eca4410c00097a9f59237f34064cd",
  "smartContractAddress": "0x0000000000000000000000000000000000000088",
  "__v": 0,
  "capacity": "91540333800000001000000",
  "createdAt": "2018-10-31T03:42:39.375Z",
  "owner": "0x11621900588eca4410c00097a9f59237f34064cd",
  "status": "RESIGNED",
  "updatedAt": "2019-01-11T09:17:59.535Z",
  "latestSignedBlock": "2917487",
  "capacityNumber": 91540.33380000001,
  "isMasternode": false,
  "isPenalty": false
}

Responses

Status Meaning Description Schema
200 OK OK candidateDetail
406 Not Acceptable Not Acceptable None

Get voters who voted for the candidate

Code samples

# You can also use wget
curl -X GET /api/candidates/{candidate}/voters \
  -H 'Accept: application/json'

const fetch = require('node-fetch');

const headers = {
  'Accept':'application/json'

};

fetch('/api/candidates/{candidate}/voters',
{
  method: 'GET',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Accept": []string{"application/json"},
        
    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("GET", "/api/candidates/{candidate}/voters", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json'
}

result = RestClient.get '/api/candidates/{candidate}/voters',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Accept': 'application/json'
}

r = requests.get('/api/candidates/{candidate}/voters', params={

}, headers = headers)

print r.json()

GET /api/candidates/{candidate}/voters

Parameters

Name In Type Required Description
candidate path string true candidate's address
limit query number false Number of record in a query
page query number false Page number

Example responses

200 Response

{
  "items": [
    {
      "_id": "5bd924a9aa41b819395d9207",
      "candidate": "0x11621900588eca4410c00097a9f59237f34064cd",
      "smartContractAddress": "0x0000000000000000000000000000000000000088",
      "voter": "0xf2cce442c7ab5baf194838081b5f9396330ecfb8",
      "__v": 0,
      "capacity": "105000000000000000000",
      "createdAt": "2018-10-31T03:42:33.922Z",
      "updatedAt": "2019-01-05T02:11:31.489Z",
      "capacityNumber": 105
    }
  ],
  "total": 100
}

Responses

Status Meaning Description Schema
200 OK OK candidateVoter
406 Not Acceptable Not Acceptable None

Masternode checking

Code samples

# You can also use wget
curl -X GET /api/candidates/{candidate}/isMasternode \
  -H 'Accept: application/json'

const fetch = require('node-fetch');

const headers = {
  'Accept':'application/json'

};

fetch('/api/candidates/{candidate}/isMasternode',
{
  method: 'GET',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Accept": []string{"application/json"},
        
    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("GET", "/api/candidates/{candidate}/isMasternode", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json'
}

result = RestClient.get '/api/candidates/{candidate}/isMasternode',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Accept': 'application/json'
}

r = requests.get('/api/candidates/{candidate}/isMasternode', params={

}, headers = headers)

print r.json()

GET /api/candidates/{candidate}/isMasternode

Parameters

Name In Type Required Description
candidate path string true candidate's address

Example responses

200 Response

"1"

Responses

Status Meaning Description Schema
200 OK OK isMasternode
406 Not Acceptable Not Acceptable None

Candidate checking

Code samples

# You can also use wget
curl -X GET /api/candidates/{candidate}/isCandidate \
  -H 'Accept: application/json'

const fetch = require('node-fetch');

const headers = {
  'Accept':'application/json'

};

fetch('/api/candidates/{candidate}/isCandidate',
{
  method: 'GET',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Accept": []string{"application/json"},
        
    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("GET", "/api/candidates/{candidate}/isCandidate", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json'
}

result = RestClient.get '/api/candidates/{candidate}/isCandidate',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Accept': 'application/json'
}

r = requests.get('/api/candidates/{candidate}/isCandidate', params={

}, headers = headers)

print r.json()

GET /api/candidates/{candidate}/isCandidate

Parameters

Name In Type Required Description
candidate path string true candidate's address

Example responses

200 Response

"1"

Responses

Status Meaning Description Schema
200 OK OK isCandidate
406 Not Acceptable Not Acceptable None

Get reward of candidate

Code samples

# You can also use wget
curl -X GET /api/candidates/{candidate}/{owner}/getRewards \
  -H 'Accept: application/json'

const fetch = require('node-fetch');

const headers = {
  'Accept':'application/json'

};

fetch('/api/candidates/{candidate}/{owner}/getRewards',
{
  method: 'GET',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Accept": []string{"application/json"},
        
    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("GET", "/api/candidates/{candidate}/{owner}/getRewards", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json'
}

result = RestClient.get '/api/candidates/{candidate}/{owner}/getRewards',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Accept': 'application/json'
}

r = requests.get('/api/candidates/{candidate}/{owner}/getRewards', params={

}, headers = headers)

print r.json()

GET /api/candidates/{candidate}/{owner}/getRewards

Parameters

Name In Type Required Description
candidate path string true candidate's address
owner path string true owner's address
limit query number false number of records
page query number false page number

Example responses

200 Response

{
  "items": [
    {
      "_id": "5c19847f0e77307940be9216",
      "epoch": 3193,
      "startBlock": 2872801,
      "endBlock": 2873700,
      "address": "0x11621900588eca4410c00097a9f59237f34064cd",
      "validator": "0x11621900588eca4410c00097a9f59237f34064cd",
      "reason": "Voter",
      "lockBalance": "1000",
      "reward": "8.03540381764608993247",
      "rewardTime": "2018-12-18T23:36:18.000Z",
      "signNumber": 843,
      "__v": 0,
      "createdAt": "2018-12-18T23:36:31.435Z",
      "updatedAt": "2018-12-18T23:36:31.435Z"
    }
  ],
  "total": 100
}

Responses

Status Meaning Description Schema
200 OK OK candidateRewards
406 Not Acceptable Not Acceptable None

Voters

Get Voter information

Get voted candidates

Code samples

# You can also use wget
curl -X GET /api/voters/{voter}/candidates \
  -H 'Accept: application/json'

const fetch = require('node-fetch');

const headers = {
  'Accept':'application/json'

};

fetch('/api/voters/{voter}/candidates',
{
  method: 'GET',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Accept": []string{"application/json"},
        
    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("GET", "/api/voters/{voter}/candidates", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json'
}

result = RestClient.get '/api/voters/{voter}/candidates',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Accept': 'application/json'
}

r = requests.get('/api/voters/{voter}/candidates', params={

}, headers = headers)

print r.json()

GET /api/voters/{voter}/candidates

Parameters

Name In Type Required Description
voter path string true voter's address
limit query number false Number of record in a query
page query number false Page number

Example responses

200 Response

{
  "items": [
    {
      "candidate": "0xfc5571921c6d3672e13b58ea23dea534f2b35fa0",
      "capacity": "10000000000000000000",
      "capacityNumber": 10,
      "candidateName": "Earth"
    }
  ],
  "total": 100
}

Responses

Status Meaning Description Schema
200 OK OK voterCandidates
406 Not Acceptable Not Acceptable None

Get reward of voter

Code samples

# You can also use wget
curl -X GET /api/voters/{voter}/rewards \
  -H 'Accept: application/json'

const fetch = require('node-fetch');

const headers = {
  'Accept':'application/json'

};

fetch('/api/voters/{voter}/rewards',
{
  method: 'GET',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Accept": []string{"application/json"},
        
    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("GET", "/api/voters/{voter}/rewards", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json'
}

result = RestClient.get '/api/voters/{voter}/rewards',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Accept': 'application/json'
}

r = requests.get('/api/voters/{voter}/rewards', params={

}, headers = headers)

print r.json()

GET /api/voters/{voter}/rewards

Parameters

Name In Type Required Description
voter path string true candidate's address
limit query number false number of records
page query number false page number

Example responses

200 Response

{
  "items": [
    {
      "_id": "5c19847f0e77307940be922a",
      "epoch": 3193,
      "startBlock": 2872801,
      "endBlock": 2873700,
      "address": "0x11621900588eca4410c00097a9f59237f34064cd",
      "validator": "0x11621900588eca4410c00097a9f59237f34064cd",
      "reason": "MasterNode",
      "lockBalance": "1000",
      "reward": "25.97042513863216266174",
      "rewardTime": "2018-12-18T23:36:18.000Z",
      "signNumber": 843,
      "__v": 0,
      "createdAt": "2018-12-18T23:36:31.580Z",
      "updatedAt": "2018-12-18T23:36:31.580Z",
      "candidateName": "0x11621900588eca4410c00097a9f59237f34064cd"
    }
  ],
  "total": 100
}

Responses

Status Meaning Description Schema
200 OK OK voterRewards
406 Not Acceptable Not Acceptable None

Transaction

Get transactions of candidate and voter

Get transactions of a candidate

Code samples

# You can also use wget
curl -X GET /api/transactions/candidate/{candidate} \
  -H 'Accept: application/json'

const fetch = require('node-fetch');

const headers = {
  'Accept':'application/json'

};

fetch('/api/transactions/candidate/{candidate}',
{
  method: 'GET',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Accept": []string{"application/json"},
        
    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("GET", "/api/transactions/candidate/{candidate}", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json'
}

result = RestClient.get '/api/transactions/candidate/{candidate}',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Accept': 'application/json'
}

r = requests.get('/api/transactions/candidate/{candidate}', params={

}, headers = headers)

print r.json()

GET /api/transactions/candidate/{candidate}

Parameters

Name In Type Required Description
candidate path string true candidate's address
limit query number false number of records
page query number false page number

Example responses

200 Response

{
  "items": [
    {
      "_id": "5c247c545e769d2f2c10ab38",
      "smartContractAddress": "0x0000000000000000000000000000000000000088",
      "tx": "0x0f96e419c89dcf1397a6206959334a4485c5a158a0320cb8a8e98db3b7888141",
      "event": "Vote",
      "voter": "0xe91dc9746eed1b5971aabd6e1681da1a4d06be8d",
      "owner": "",
      "candidate": "0x11621900588eca4410c00097a9f59237f34064cd",
      "capacity": "11000000000000000000",
      "blockNumber": 2897395,
      "createdAt": "2018-12-27T07:16:36.000Z",
      "__v": 0
    }
  ],
  "total": 100
}

Responses

Status Meaning Description Schema
200 OK OK txCandidate

Get transactions of a voter

Code samples

# You can also use wget
curl -X GET /api/transactions/voter/{voter} \
  -H 'Accept: application/json'

const fetch = require('node-fetch');

const headers = {
  'Accept':'application/json'

};

fetch('/api/transactions/voter/{voter}',
{
  method: 'GET',

  headers: headers
})
.then(function(res) {
    return res.json();
}).then(function(body) {
    console.log(body);
});

package main

import (
       "bytes"
       "net/http"
)

func main() {

    headers := map[string][]string{
        "Accept": []string{"application/json"},
        
    }

    data := bytes.NewBuffer([]byte{jsonReq})
    req, err := http.NewRequest("GET", "/api/transactions/voter/{voter}", data)
    req.Header = headers

    client := &http.Client{}
    resp, err := client.Do(req)
    // ...
}

require 'rest-client'
require 'json'

headers = {
  'Accept' => 'application/json'
}

result = RestClient.get '/api/transactions/voter/{voter}',
  params: {
  }, headers: headers

p JSON.parse(result)

import requests
headers = {
  'Accept': 'application/json'
}

r = requests.get('/api/transactions/voter/{voter}', params={

}, headers = headers)

print r.json()

GET /api/transactions/voter/{voter}

Parameters

Name In Type Required Description
voter path string true voter's address
limit query number false number of records
page query number false page number

Example responses

200 Response

{
  "items": [
    {
      "_id": "5c24a189ff305840a2498bf0",
      "smartContractAddress": "0x0000000000000000000000000000000000000088",
      "tx": "0xf8f2d402c6b1cb5f891b687d69ddcd920e58d9e9fe002857cac0e7ce47998884",
      "event": "Unvote",
      "voter": "0x487d62d33467c4842c5e54eb370837e4e88bba0f",
      "owner": "",
      "candidate": "0xfc5571921c6d3672e13b58ea23dea534f2b35fa0",
      "capacity": "10000999000000000000000",
      "blockNumber": 763397,
      "createdAt": "2018-12-27T09:55:21.000Z",
      "__v": 0
    }
  ],
  "total": 100
}

Responses

Status Meaning Description Schema
200 OK OK txVoter

Schemas

config

{
  "blockchain": {
    "rpc": "string",
    "ws": "string",
    "epoch": 900,
    "blockTime": 0
  },
  "explorerUrl": "string",
  "GA": "string"
}

Properties

Name Type Required Restrictions Description
blockchain object false none Tomochain's configurations
» rpc string false none rpc
» ws string false none websocket
» epoch number false none Number of blocks for 1 epoch
» blockTime number false none Block time
explorerUrl string false none Tomoscan's API
GA string false none Google Analytic code

candidate

{
  "items": [
    {
      "_id": "123",
      "candidate": "0x11621900588eca4410c00097a9f59237f34064cd",
      "smartContractAddress": "0x0000000000000000000000000000000000000088",
      "__v": 0,
      "capacity": "91540333800000001000000",
      "createdAt": "2018-10-31T03:42:39.375Z",
      "owner": "0x11621900588eca4410c00097a9f59237f34064cd",
      "status": "RESIGNED",
      "updatedAt": "2019-01-11T09:21:55.028Z",
      "latestSignedBlock": 2917487,
      "capacityNumber": 91540.33380000001,
      "isMasternode": false,
      "isPenalty": false
    }
  ],
  "total": 100,
  "activeCandidates": 10
}

Properties

Name Type Required Restrictions Description
items [object] false none Candidate's data
total number false none Total number of candidate
activeCandidates number false none Number of active candidate

candidateDetail

{
  "_id": "123",
  "candidate": "0x11621900588eca4410c00097a9f59237f34064cd",
  "smartContractAddress": "0x0000000000000000000000000000000000000088",
  "__v": 0,
  "capacity": "91540333800000001000000",
  "createdAt": "2018-10-31T03:42:39.375Z",
  "owner": "0x11621900588eca4410c00097a9f59237f34064cd",
  "status": "RESIGNED",
  "updatedAt": "2019-01-11T09:17:59.535Z",
  "latestSignedBlock": "2917487",
  "capacityNumber": 91540.33380000001,
  "isMasternode": false,
  "isPenalty": false
}

Properties

Name Type Required Restrictions Description
_id string false none id
candidate string false none candidate's address
smartContractAddress string false none smart contract's address
__v number false none __v
capacity string false none capacity in wei
createdAt string false none creation date of candidate
owner string false none owner's address
status string false none candidate's status
updatedAt string false none update time
latestSignedBlock string false none latest signed block
capacityNumber number false none capacity number
isMasternode boolean false none is masternode
isPenalty boolean false none is penalty

candidateRewards

{
  "items": [
    {
      "_id": "5c19847f0e77307940be9216",
      "epoch": 3193,
      "startBlock": 2872801,
      "endBlock": 2873700,
      "address": "0x11621900588eca4410c00097a9f59237f34064cd",
      "validator": "0x11621900588eca4410c00097a9f59237f34064cd",
      "reason": "Voter",
      "lockBalance": "1000",
      "reward": "8.03540381764608993247",
      "rewardTime": "2018-12-18T23:36:18.000Z",
      "signNumber": 843,
      "__v": 0,
      "createdAt": "2018-12-18T23:36:31.435Z",
      "updatedAt": "2018-12-18T23:36:31.435Z"
    }
  ],
  "total": 100
}

Properties

Name Type Required Restrictions Description
items [object] false none Candidate's data
total number false none Number of candidate

candidateVoter

{
  "items": [
    {
      "_id": "5bd924a9aa41b819395d9207",
      "candidate": "0x11621900588eca4410c00097a9f59237f34064cd",
      "smartContractAddress": "0x0000000000000000000000000000000000000088",
      "voter": "0xf2cce442c7ab5baf194838081b5f9396330ecfb8",
      "__v": 0,
      "capacity": "105000000000000000000",
      "createdAt": "2018-10-31T03:42:33.922Z",
      "updatedAt": "2019-01-05T02:11:31.489Z",
      "capacityNumber": 105
    }
  ],
  "total": 100
}

Properties

Name Type Required Restrictions Description
items [object] false none Candidate's data
total number false none Total number of voters

voterCandidates

{
  "items": [
    {
      "candidate": "0xfc5571921c6d3672e13b58ea23dea534f2b35fa0",
      "capacity": "10000000000000000000",
      "capacityNumber": 10,
      "candidateName": "Earth"
    }
  ],
  "total": 100
}

Properties

Name Type Required Restrictions Description
items [object] false none Candidate's data
total number false none Total number of rewards

voterRewards

{
  "items": [
    {
      "_id": "5c19847f0e77307940be922a",
      "epoch": 3193,
      "startBlock": 2872801,
      "endBlock": 2873700,
      "address": "0x11621900588eca4410c00097a9f59237f34064cd",
      "validator": "0x11621900588eca4410c00097a9f59237f34064cd",
      "reason": "MasterNode",
      "lockBalance": "1000",
      "reward": "25.97042513863216266174",
      "rewardTime": "2018-12-18T23:36:18.000Z",
      "signNumber": 843,
      "__v": 0,
      "createdAt": "2018-12-18T23:36:31.580Z",
      "updatedAt": "2018-12-18T23:36:31.580Z",
      "candidateName": "0x11621900588eca4410c00097a9f59237f34064cd"
    }
  ],
  "total": 100
}

Properties

Name Type Required Restrictions Description
items [object] false none Voter's reward array
total number false none Number of candidate

isMasternode

"1"

Properties

Name Type Required Restrictions Description
anonymous number false none none

Enumerated Values

Property Value
anonymous 1
anonymous 0

isCandidate

"1"

Properties

Name Type Required Restrictions Description
anonymous number false none none

Enumerated Values

Property Value
anonymous 1
anonymous 0

txCandidate

{
  "items": [
    {
      "_id": "5c247c545e769d2f2c10ab38",
      "smartContractAddress": "0x0000000000000000000000000000000000000088",
      "tx": "0x0f96e419c89dcf1397a6206959334a4485c5a158a0320cb8a8e98db3b7888141",
      "event": "Vote",
      "voter": "0xe91dc9746eed1b5971aabd6e1681da1a4d06be8d",
      "owner": "",
      "candidate": "0x11621900588eca4410c00097a9f59237f34064cd",
      "capacity": "11000000000000000000",
      "blockNumber": 2897395,
      "createdAt": "2018-12-27T07:16:36.000Z",
      "__v": 0
    }
  ],
  "total": 100
}

Properties

Name Type Required Restrictions Description
items [object] false none Candidate's transactions array
total number false none Number of candidate

txVoter

{
  "items": [
    {
      "_id": "5c24a189ff305840a2498bf0",
      "smartContractAddress": "0x0000000000000000000000000000000000000088",
      "tx": "0xf8f2d402c6b1cb5f891b687d69ddcd920e58d9e9fe002857cac0e7ce47998884",
      "event": "Unvote",
      "voter": "0x487d62d33467c4842c5e54eb370837e4e88bba0f",
      "owner": "",
      "candidate": "0xfc5571921c6d3672e13b58ea23dea534f2b35fa0",
      "capacity": "10000999000000000000000",
      "blockNumber": 763397,
      "createdAt": "2018-12-27T09:55:21.000Z",
      "__v": 0
    }
  ],
  "total": 100
}

Properties

Name Type Required Restrictions Description
items [object] false none Candidate's transactions array
total number false none Number of candidate