NAV Navigation
cURL Node.JS GO Ruby Python Java

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 Swagger Docs

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'
require 'openssl'

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
» jsonrpc body string true none
» method body string true none
» params body [string] true none
» id body integer(int32) 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'
require 'openssl'

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
» jsonrpc body string true none
» method body string true none
» params body [string] true none
» id body integer(int32) 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'
require 'openssl'

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
» jsonrpc body string true none
» method body string true none
» params body [string] true none
» id body integer(int32) 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'
require 'openssl'

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
» jsonrpc body string true none
» method body string true none
» params body [string] true none
» id body integer(int32) 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'
require 'openssl'

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
» jsonrpc body string true none
» method body string true none
» params body [string] true none
» id body integer(int32) 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'
require 'openssl'

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
» jsonrpc body string true none
» method body string true none
» params body [string] true none
» id body integer(int32) 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'
require 'openssl'

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
» jsonrpc body string true none
» method body string true none
» params body [string] true none
» id body integer(int32) 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'
require 'openssl'

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
» jsonrpc body string true none
» method body string true none
» params body [string] true none
» id body integer(int32) 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'
require 'openssl'

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
» jsonrpc body string true none
» method body string true none
» params body [string] true none
» id body integer(int32) 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'
require 'openssl'

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
» jsonrpc body string true none
» method body string true none
» params body [string] true none
» id body integer(int32) 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'
require 'openssl'

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
» jsonrpc body string true none
» method body string true none
» params body [string] true none
» id body integer(int32) 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'
require 'openssl'

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

params: [ ' 0x2b5634c42055806a59e9107ed44d43c426e58258', 'latest' ]

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
» jsonrpc body string true none
» method body string true none
» params body [string] true none
» id body integer(int32) 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'
require 'openssl'

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

params: [ '0x2b5634c42055806a59e9107ed44d43c426e58258', 'latest' ]

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
» jsonrpc body string true none
» method body string true none
» params body [string] true none
» id body integer(int32) 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'
require 'openssl'

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

params: [ '0x407d73d8a49eeb85d32cf465507dd71d507100c1', 'latest' // state at the latest block ]

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
» jsonrpc body string true none
» method body string true none
» params body [string] true none
» id body integer(int32) 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'
require 'openssl'

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

params: [ '0xc8b967161c671ce952a3d50987a78d64157fb5a8e1724804b87d3e9b11e3aa34' ]

Returns

Body parameter

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

Parameters

Name In Type Required Description
body body getBlockTransactionCountByHashRequest true none
» jsonrpc body string true none
» method body string true none
» params body [string] true none
» id body integer(int32) 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'
require 'openssl'

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

params: [ '0x85', // 232 ]

Returns

Body parameter

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

Parameters

Name In Type Required Description
body body getBlockTransactionCountByNumberRequest true none
» jsonrpc body string true none
» method body string true none
» params body [string] true none
» id body integer(int32) 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'
require 'openssl'

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

params: [ '0xa94f5374fce5edbc8e2a8697c15331677e6ebf0b', '0x2' // 2 ]

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
» jsonrpc body string true none
» method body string true none
» params body [string] true none
» id body integer(int32) 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'
require 'openssl'

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
» jsonrpc body string true none
» method body string true none
» params body [string] true none
» id body integer(int32) 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'
require 'openssl'

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

params: [{ "from": " 0xb60e8dd61c5d32be8058bb8eb970870f07233155", "to": " 0xd46e8dd67c5d32be8058bb8eb970870f07244567", "gas": "0x76c0", // 30400 "gasPrice": "0x9184e72a000", // 10000000000000 "value": "0x9184e72a", // 2441406250 "data": "0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675" }] 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
» jsonrpc body string true none
» method body string true none
» params body [Param] true none
»» Param body Param false none
»»» from body string true none
»»» to body string true none
»»» gas body string true none
»»» gasPrice body string true none
»»» value body string true none
»»» data body string true none
» id body integer(int32) 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'
require 'openssl'

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

params: ["0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675"] 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
» jsonrpc body string true none
» method body string true none
» params body [string] true none
» id body integer(int32) 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'
require 'openssl'

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
» jsonrpc body string true none
» method body string true none
» params body [Param1] true none
»» Param1 body Param1 false none
»»» from body string false none
»»» to body string false none
»»» gas body string false none
»»» gasPrice body string false none
»»» value body string false none
»»» data body string false none
» id body integer(int32) 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'
require 'openssl'

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
» jsonrpc body string true none
» method body string true none
» params body [string] true none
» id body integer(int32) 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'
require 'openssl'

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
» jsonrpc body string true none
» method body string true none
» params body [string] true none
» id body integer(int32) 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'
require 'openssl'

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
» jsonrpc body string true none
» method body string true none
» params body [string] true none
» id body integer(int32) 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'
require 'openssl'

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:

params: [ '0xA61F98' ]

Returns

Body parameter

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

Parameters

Name In Type Required Description
body body getBlockSignersByNumberRequest true none
» jsonrpc body string true none
» method body string true none
» params body [string] true none
» id body integer(int32) 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'
require 'openssl'

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

params: [ '0x605777ee60ef3ccf21e079fa1b091b0196cf1a2c1dd7c088dd5b1ab03f680b6f' ]

Returns

Body parameter

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

Parameters

Name In Type Required Description
body body getBlockSignersByHashRequest true none
» jsonrpc body string true none
» method body string true none
» params body [string] true none
» id body integer(int32) 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'
require 'openssl'

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

params: [ '0xA61F98' ]

Returns

Body parameter

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

Parameters

Name In Type Required Description
body body getBlockFinalityByNumberRequest true none
» jsonrpc body string true none
» method body string true none
» params body [string] true none
» id body integer(int32) 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'
require 'openssl'

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
» jsonrpc body string true none
» method body string true none
» params body [string] true none
» id body integer(int32) 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'
require 'openssl'

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

params: [ 'latest' ]

Returns

Body parameter

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

Parameters

Name In Type Required Description
body body getCandidatesRequest true none
» jsonrpc body string true none
» method body string true none
» params body [string] true none
» id body integer(int32) 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'
require 'openssl'

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

Example

params: [ '0x1d50df657b6dce50bac634bf18e2d986d807e940', 'latest' ]

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
» jsonrpc body string true none
» method body string true none
» params body [string] true none
» id body integer(int32) 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'
require 'openssl'

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

Example params: [ "0xd83b26e101dd6480764bade90fc283407919f60b7e65ff83fbf6cdc92f1138a1" ] 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
» jsonrpc body string true none
» method body string true none
» params body [string] true none
» id body integer(int32) 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'
require 'openssl'

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

Body parameter

{
  "jsonrpc": "2.0",
  "method": "eth_getTransactionByBlockHashAndIndex",
  "params": [
    "0x3c82bc62179602b67318c013c10f99011037c49cba84e31ffe6e465a21c521a7",
    "0x0"
  ],
  "id": 1
}

Parameters

Name In Type Required Description
body body getTransactionByBlockHashAndIndexRequest true none
» jsonrpc body string true none
» method body string true none
» params body [string] true none
» id body integer(int32) 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'
require 'openssl'

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

Example params: [ '0x29c', // 668 '0x0' // 0 ]

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
» jsonrpc body string true none
» method body string true none
» params body [string] true none
» id body integer(int32) 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'
require 'openssl'

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

Example

params: [ '0xb903239f8543d04b5dc1ba6579132b143087c68db1b2168786408fcbce568238' ]

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
» jsonrpc body string true none
» method body string true none
» params body [string] true none
» id body integer(int32) true none

Responses

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

tomox

API for tomox request

getAskTree

Code samples

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

var options = {
  "method": "POST",
  "hostname": "rpc.tomochain.com",
  "port": null,
  "path": "//getAskTree",
  "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: 'tomox_getAskTree',
  params: [
    '0xf992cf45394dAc5f50A26446de17803a79B940da',
    '0x0000000000000000000000000000000000000001'
  ],
  id: 1
}));
req.end();
package main

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

func main() {

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

	payload := strings.NewReader("{\"jsonrpc\":\"2.0\",\"method\":\"tomox_getAskTree\",\"params\":[\"0xf992cf45394dAc5f50A26446de17803a79B940da\",\"0x0000000000000000000000000000000000000001\"],\"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'
require 'openssl'

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

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\":\"tomox_getAskTree\",\"params\":[\"0xf992cf45394dAc5f50A26446de17803a79B940da\",\"0x0000000000000000000000000000000000000001\"],\"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\":\"tomox_getAskTree\",\"params\":[\"0xf992cf45394dAc5f50A26446de17803a79B940da\",\"0x0000000000000000000000000000000000000001\"],\"id\":1}"

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

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

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

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

POST /getAskTree

Returns the ask tree (price, orders, amount)

Parameters

Example

params: [ '0xf992cf45394dAc5f50A26446de17803a79B940da', '0x0000000000000000000000000000000000000001' ]

Returns

Object - A ask tree (price, orders, amount)

Body parameter

{
  "jsonrpc": "2.0",
  "method": "tomox_getAskTree",
  "params": [
    "0xf992cf45394dAc5f50A26446de17803a79B940da",
    "0x0000000000000000000000000000000000000001"
  ],
  "id": 1
}

Parameters

Name In Type Required Description
body body getAskTree true none
» jsonrpc body string true none
» method body string true none
» params body [string] true none
» id body integer(int32) true none

Responses

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

getAsks

Code samples

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

var options = {
  "method": "POST",
  "hostname": "rpc.tomochain.com",
  "port": null,
  "path": "//getAsks",
  "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: 'tomox_getAsks',
  params: [
    '0xf992cf45394dAc5f50A26446de17803a79B940da',
    '0x0000000000000000000000000000000000000001'
  ],
  id: 1
}));
req.end();
package main

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

func main() {

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

	payload := strings.NewReader("{\"jsonrpc\":\"2.0\",\"method\":\"tomox_getAsks\",\"params\":[\"0xf992cf45394dAc5f50A26446de17803a79B940da\",\"0x0000000000000000000000000000000000000001\"],\"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'
require 'openssl'

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

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\":\"tomox_getAsks\",\"params\":[\"0xf992cf45394dAc5f50A26446de17803a79B940da\",\"0x0000000000000000000000000000000000000001\"],\"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\":\"tomox_getAsks\",\"params\":[\"0xf992cf45394dAc5f50A26446de17803a79B940da\",\"0x0000000000000000000000000000000000000001\"],\"id\":1}"

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

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

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

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

POST /getAsks

Returns the asks (price, amount)

Parameters

Returns

Object - A asks (price, amount)

Body parameter

{
  "jsonrpc": "2.0",
  "method": "tomox_getAsks",
  "params": [
    "0xf992cf45394dAc5f50A26446de17803a79B940da",
    "0x0000000000000000000000000000000000000001"
  ],
  "id": 1
}

Parameters

Name In Type Required Description
body body getAsks true none
» jsonrpc body string true none
» method body string true none
» params body [string] true none
» id body integer(int32) true none

Responses

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

getBestAsk

Code samples

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

var options = {
  "method": "POST",
  "hostname": "rpc.tomochain.com",
  "port": null,
  "path": "//getBestAsk",
  "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: 'tomox_getBestAsk',
  params: [
    '0xf992cf45394dAc5f50A26446de17803a79B940da',
    '0x0000000000000000000000000000000000000001'
  ],
  id: 1
}));
req.end();
package main

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

func main() {

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

	payload := strings.NewReader("{\"jsonrpc\":\"2.0\",\"method\":\"tomox_getBestAsk\",\"params\":[\"0xf992cf45394dAc5f50A26446de17803a79B940da\",\"0x0000000000000000000000000000000000000001\"],\"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'
require 'openssl'

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

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\":\"tomox_getBestAsk\",\"params\":[\"0xf992cf45394dAc5f50A26446de17803a79B940da\",\"0x0000000000000000000000000000000000000001\"],\"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\":\"tomox_getBestAsk\",\"params\":[\"0xf992cf45394dAc5f50A26446de17803a79B940da\",\"0x0000000000000000000000000000000000000001\"],\"id\":1}"

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

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

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

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

POST /getBestAsk

Returns the best ask

Parameters

Returns

Object - the best ask (price, volume)

Body parameter

{
  "jsonrpc": "2.0",
  "method": "tomox_getBestAsk",
  "params": [
    "0xf992cf45394dAc5f50A26446de17803a79B940da",
    "0x0000000000000000000000000000000000000001"
  ],
  "id": 1
}

Parameters

Name In Type Required Description
body body getBestAsk true none
» jsonrpc body string true none
» method body string true none
» params body [string] true none
» id body integer(int32) true none

Responses

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

getBidTree

Code samples

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

var options = {
  "method": "POST",
  "hostname": "rpc.tomochain.com",
  "port": null,
  "path": "//getBidTree",
  "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: 'tomox_getBidTree',
  params: [
    '0xf992cf45394dAc5f50A26446de17803a79B940da',
    '0x0000000000000000000000000000000000000001'
  ],
  id: 1
}));
req.end();
package main

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

func main() {

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

	payload := strings.NewReader("{\"jsonrpc\":\"2.0\",\"method\":\"tomox_getBidTree\",\"params\":[\"0xf992cf45394dAc5f50A26446de17803a79B940da\",\"0x0000000000000000000000000000000000000001\"],\"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'
require 'openssl'

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

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\":\"tomox_getBidTree\",\"params\":[\"0xf992cf45394dAc5f50A26446de17803a79B940da\",\"0x0000000000000000000000000000000000000001\"],\"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\":\"tomox_getBidTree\",\"params\":[\"0xf992cf45394dAc5f50A26446de17803a79B940da\",\"0x0000000000000000000000000000000000000001\"],\"id\":1}"

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

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

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

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

POST /getBidTree

Returns the bid tree (price, orders, amount)

Parameters

Example

params: [ '0xf992cf45394dAc5f50A26446de17803a79B940da', '0x0000000000000000000000000000000000000001' ]

Returns

Object - A bid tree (price, orders, amount)

Body parameter

{
  "jsonrpc": "2.0",
  "method": "tomox_getBidTree",
  "params": [
    "0xf992cf45394dAc5f50A26446de17803a79B940da",
    "0x0000000000000000000000000000000000000001"
  ],
  "id": 1
}

Parameters

Name In Type Required Description
body body getBidTree true none
» jsonrpc body string true none
» method body string true none
» params body [string] true none
» id body integer(int32) true none

Responses

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

getBids

Code samples

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

var options = {
  "method": "POST",
  "hostname": "rpc.tomochain.com",
  "port": null,
  "path": "//getBids",
  "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: 'tomox_getBids',
  params: [
    '0xf992cf45394dAc5f50A26446de17803a79B940da',
    '0x0000000000000000000000000000000000000001'
  ],
  id: 1
}));
req.end();
package main

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

func main() {

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

	payload := strings.NewReader("{\"jsonrpc\":\"2.0\",\"method\":\"tomox_getBids\",\"params\":[\"0xf992cf45394dAc5f50A26446de17803a79B940da\",\"0x0000000000000000000000000000000000000001\"],\"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'
require 'openssl'

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

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\":\"tomox_getBids\",\"params\":[\"0xf992cf45394dAc5f50A26446de17803a79B940da\",\"0x0000000000000000000000000000000000000001\"],\"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\":\"tomox_getBids\",\"params\":[\"0xf992cf45394dAc5f50A26446de17803a79B940da\",\"0x0000000000000000000000000000000000000001\"],\"id\":1}"

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

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

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

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

POST /getBids

Returns the bids (price, amount)

Parameters

Returns

Object - A bids (price, amount)

Body parameter

{
  "jsonrpc": "2.0",
  "method": "tomox_getBids",
  "params": [
    "0xf992cf45394dAc5f50A26446de17803a79B940da",
    "0x0000000000000000000000000000000000000001"
  ],
  "id": 1
}

Parameters

Name In Type Required Description
body body getBids true none
» jsonrpc body string true none
» method body string true none
» params body [string] true none
» id body integer(int32) true none

Responses

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

getBestBid

Code samples

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

var options = {
  "method": "POST",
  "hostname": "rpc.tomochain.com",
  "port": null,
  "path": "//getBestBid",
  "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: 'tomox_getBestBid',
  params: [
    '0xf992cf45394dAc5f50A26446de17803a79B940da',
    '0x0000000000000000000000000000000000000001'
  ],
  id: 1
}));
req.end();
package main

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

func main() {

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

	payload := strings.NewReader("{\"jsonrpc\":\"2.0\",\"method\":\"tomox_getBestBid\",\"params\":[\"0xf992cf45394dAc5f50A26446de17803a79B940da\",\"0x0000000000000000000000000000000000000001\"],\"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'
require 'openssl'

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

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\":\"tomox_getBestBid\",\"params\":[\"0xf992cf45394dAc5f50A26446de17803a79B940da\",\"0x0000000000000000000000000000000000000001\"],\"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\":\"tomox_getBestBid\",\"params\":[\"0xf992cf45394dAc5f50A26446de17803a79B940da\",\"0x0000000000000000000000000000000000000001\"],\"id\":1}"

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

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

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

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

POST /getBestBid

Returns the best ask

Parameters

Returns

Object - the best ask (price, volume)

Body parameter

{
  "jsonrpc": "2.0",
  "method": "tomox_getBestBid",
  "params": [
    "0xf992cf45394dAc5f50A26446de17803a79B940da",
    "0x0000000000000000000000000000000000000001"
  ],
  "id": 1
}

Parameters

Name In Type Required Description
body body getBestBid true none
» jsonrpc body string true none
» method body string true none
» params body [string] true none
» id body integer(int32) true none

Responses

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

getBorrows

Code samples

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

var options = {
  "method": "POST",
  "hostname": "rpc.tomochain.com",
  "port": null,
  "path": "//getBorrows",
  "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: 'tomox_getBorrows',
  params: ['0xf992cf45394dAc5f50A26446de17803a79B940da', 86400],
  id: 1
}));
req.end();
package main

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

func main() {

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

	payload := strings.NewReader("{\"jsonrpc\":\"2.0\",\"method\":\"tomox_getBorrows\",\"params\":[\"0xf992cf45394dAc5f50A26446de17803a79B940da\",86400],\"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'
require 'openssl'

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

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\":\"tomox_getBorrows\",\"params\":[\"0xf992cf45394dAc5f50A26446de17803a79B940da\",86400],\"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\":\"tomox_getBorrows\",\"params\":[\"0xf992cf45394dAc5f50A26446de17803a79B940da\",86400],\"id\":1}"

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

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

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

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

POST /getBorrows

Returns the borrows (interest, amount)

Parameters

Returns

Object - list borrows (interest, amount)

Body parameter

{
  "jsonrpc": "2.0",
  "method": "tomox_getBorrows",
  "params": [
    "0xf992cf45394dAc5f50A26446de17803a79B940da",
    86400
  ],
  "id": 1
}

Parameters

Name In Type Required Description
body body getBorrows true none
» jsonrpc body string true none
» method body string true none
» params body [string] true none
» id body integer(int32) true none

Responses

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

getInvests

Code samples

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

var options = {
  "method": "POST",
  "hostname": "rpc.tomochain.com",
  "port": null,
  "path": "//getInvest",
  "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: 'tomox_getInvests',
  params: ['0xf992cf45394dAc5f50A26446de17803a79B940da', 86400],
  id: 1
}));
req.end();
package main

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

func main() {

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

	payload := strings.NewReader("{\"jsonrpc\":\"2.0\",\"method\":\"tomox_getInvests\",\"params\":[\"0xf992cf45394dAc5f50A26446de17803a79B940da\",86400],\"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'
require 'openssl'

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

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\":\"tomox_getInvests\",\"params\":[\"0xf992cf45394dAc5f50A26446de17803a79B940da\",86400],\"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\":\"tomox_getInvests\",\"params\":[\"0xf992cf45394dAc5f50A26446de17803a79B940da\",86400],\"id\":1}"

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

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

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

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

POST /getInvest

Returns the invests (interest, amount)

Parameters

Returns

Object - list invests (interest, amount)

Body parameter

{
  "jsonrpc": "2.0",
  "method": "tomox_getInvests",
  "params": [
    "0xf992cf45394dAc5f50A26446de17803a79B940da",
    86400
  ],
  "id": 1
}

Parameters

Name In Type Required Description
body body getInvests true none
» jsonrpc body string true none
» method body string true none
» params body [string] true none
» id body integer(int32) true none

Responses

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

posv

API for posv request

getNetworkInformation

Code samples

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

var options = {
  "method": "POST",
  "hostname": "rpc.tomochain.com",
  "port": null,
  "path": "//getNetworkInformation",
  "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: 'posv_getNetworkInformation', params: [], id: 1}));
req.end();
package main

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

func main() {

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

	payload := strings.NewReader("{\"jsonrpc\":\"2.0\",\"method\":\"posv_getNetworkInformation\",\"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'
require 'openssl'

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

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\":\"posv_getNetworkInformation\",\"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\":\"posv_getNetworkInformation\",\"params\":[],\"id\":1}"

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

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

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

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

POST /getNetworkInformation

Returns the network information (chainId, special contracts)

Returns

Object - network information

Body parameter

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

Parameters

Name In Type Required Description
body body getNetworkInformation true none
» jsonrpc body string true none
» method body string true none
» params body [string] true none
» id body integer(int32) 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

getAskTree

{
  "jsonrpc": "2.0",
  "method": "tomox_getAskTree",
  "params": [
    "0xf992cf45394dAc5f50A26446de17803a79B940da",
    "0x0000000000000000000000000000000000000001"
  ],
  "id": 1
}

getAskTree

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

getAsks

{
  "jsonrpc": "2.0",
  "method": "tomox_getAsks",
  "params": [
    "0xf992cf45394dAc5f50A26446de17803a79B940da",
    "0x0000000000000000000000000000000000000001"
  ],
  "id": 1
}

getAsks

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

getBestAsk

{
  "jsonrpc": "2.0",
  "method": "tomox_getBestAsk",
  "params": [
    "0xf992cf45394dAc5f50A26446de17803a79B940da",
    "0x0000000000000000000000000000000000000001"
  ],
  "id": 1
}

getBestAsk

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

getBidTree

{
  "jsonrpc": "2.0",
  "method": "tomox_getBidTree",
  "params": [
    "0xf992cf45394dAc5f50A26446de17803a79B940da",
    "0x0000000000000000000000000000000000000001"
  ],
  "id": 1
}

getBidTree

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

getBids

{
  "jsonrpc": "2.0",
  "method": "tomox_getBids",
  "params": [
    "0xf992cf45394dAc5f50A26446de17803a79B940da",
    "0x0000000000000000000000000000000000000001"
  ],
  "id": 1
}

getBids

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

getBestBid

{
  "jsonrpc": "2.0",
  "method": "tomox_getBestBid",
  "params": [
    "0xf992cf45394dAc5f50A26446de17803a79B940da",
    "0x0000000000000000000000000000000000000001"
  ],
  "id": 1
}

getBestBid

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

getBorrows

{
  "jsonrpc": "2.0",
  "method": "tomox_getBorrows",
  "params": [
    "0xf992cf45394dAc5f50A26446de17803a79B940da",
    86400
  ],
  "id": 1
}

getBorrows

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

getInvests

{
  "jsonrpc": "2.0",
  "method": "tomox_getInvests",
  "params": [
    "0xf992cf45394dAc5f50A26446de17803a79B940da",
    86400
  ],
  "id": 1
}

getInvest

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

getNetworkInformation

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

getNetworkInformation

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 URLs:

accounts

Account endpoints

Find account by user address

Code samples

curl --request GET \
  --url https://dex.tomochain.com/api/account/string \
  --header 'accept: application/json'
var http = require("https");

var options = {
  "method": "GET",
  "hostname": "dex.tomochain.com",
  "port": null,
  "path": "/api/account/string",
  "headers": {
    "accept": "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.end();
package main

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

func main() {

	url := "https://dex.tomochain.com/api/account/string"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("accept", "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'
require 'openssl'

url = URI("https://dex.tomochain.com/api/account/string")

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

request = Net::HTTP::Get.new(url)
request["accept"] = 'application/json'

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

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

headers = { 'accept': "application/json" }

conn.request("GET", "/api/account/string", headers=headers)

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

print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://dex.tomochain.com/api/account/string")
  .header("accept", "application/json")
  .asString();

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

curl --request GET \
  --url https://dex.tomochain.com/api/account/string/string \
  --header 'accept: application/json'
var http = require("https");

var options = {
  "method": "GET",
  "hostname": "dex.tomochain.com",
  "port": null,
  "path": "/api/account/string/string",
  "headers": {
    "accept": "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.end();
package main

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

func main() {

	url := "https://dex.tomochain.com/api/account/string/string"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("accept", "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'
require 'openssl'

url = URI("https://dex.tomochain.com/api/account/string/string")

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

request = Net::HTTP::Get.new(url)
request["accept"] = 'application/json'

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

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

headers = { 'accept': "application/json" }

conn.request("GET", "/api/account/string/string", headers=headers)

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

print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://dex.tomochain.com/api/account/string/string")
  .header("accept", "application/json")
  .asString();

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

tokens

Token endpoints

Finds all tokens

Code samples

curl --request GET \
  --url https://dex.tomochain.com/api/tokens \
  --header 'accept: application/json'
var http = require("https");

var options = {
  "method": "GET",
  "hostname": "dex.tomochain.com",
  "port": null,
  "path": "/api/tokens",
  "headers": {
    "accept": "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.end();
package main

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

func main() {

	url := "https://dex.tomochain.com/api/tokens"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("accept", "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'
require 'openssl'

url = URI("https://dex.tomochain.com/api/tokens")

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

request = Net::HTTP::Get.new(url)
request["accept"] = 'application/json'

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

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

headers = { 'accept': "application/json" }

conn.request("GET", "/api/tokens", headers=headers)

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

print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://dex.tomochain.com/api/tokens")
  .header("accept", "application/json")
  .asString();

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": "2020-06-22T09:54:03Z",
    "updatedAt": "2020-06-22T09:54:03Z"
  }
]

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

curl --request POST \
  --url https://dex.tomochain.com/api/tokens \
  --header 'accept: application/json' \
  --header 'content-type: application/json' \
  --data '{"name":"string","symbol":"string","address":"string","image":{"url":"string","meta":{}},"contractAddress":"string","active":true,"quote":true,"makeFee":"string","takeFee":"string"}'
var http = require("https");

var options = {
  "method": "POST",
  "hostname": "dex.tomochain.com",
  "port": null,
  "path": "/api/tokens",
  "headers": {
    "content-type": "application/json",
    "accept": "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({
  name: 'string',
  symbol: 'string',
  address: 'string',
  image: {url: 'string', meta: {}},
  contractAddress: 'string',
  active: true,
  quote: true,
  makeFee: 'string',
  takeFee: 'string'
}));
req.end();
package main

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

func main() {

	url := "https://dex.tomochain.com/api/tokens"

	payload := strings.NewReader("{\"name\":\"string\",\"symbol\":\"string\",\"address\":\"string\",\"image\":{\"url\":\"string\",\"meta\":{}},\"contractAddress\":\"string\",\"active\":true,\"quote\":true,\"makeFee\":\"string\",\"takeFee\":\"string\"}")

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

	req.Header.Add("content-type", "application/json")
	req.Header.Add("accept", "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'
require 'openssl'

url = URI("https://dex.tomochain.com/api/tokens")

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["accept"] = 'application/json'
request.body = "{\"name\":\"string\",\"symbol\":\"string\",\"address\":\"string\",\"image\":{\"url\":\"string\",\"meta\":{}},\"contractAddress\":\"string\",\"active\":true,\"quote\":true,\"makeFee\":\"string\",\"takeFee\":\"string\"}"

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

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

payload = "{\"name\":\"string\",\"symbol\":\"string\",\"address\":\"string\",\"image\":{\"url\":\"string\",\"meta\":{}},\"contractAddress\":\"string\",\"active\":true,\"quote\":true,\"makeFee\":\"string\",\"takeFee\":\"string\"}"

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

conn.request("POST", "/api/tokens", payload, headers)

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

print(data.decode("utf-8"))
HttpResponse response = Unirest.post("https://dex.tomochain.com/api/tokens")
  .header("content-type", "application/json")
  .header("accept", "application/json")
  .body("{\"name\":\"string\",\"symbol\":\"string\",\"address\":\"string\",\"image\":{\"url\":\"string\",\"meta\":{}},\"contractAddress\":\"string\",\"active\":true,\"quote\":true,\"makeFee\":\"string\",\"takeFee\":\"string\"}")
  .asString();

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": "2020-06-22T09:54:03Z",
  "updatedAt": "2020-06-22T09:54:03Z"
}

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

curl --request GET \
  --url https://dex.tomochain.com/api/tokens/base \
  --header 'accept: application/json'
var http = require("https");

var options = {
  "method": "GET",
  "hostname": "dex.tomochain.com",
  "port": null,
  "path": "/api/tokens/base",
  "headers": {
    "accept": "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.end();
package main

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

func main() {

	url := "https://dex.tomochain.com/api/tokens/base"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("accept", "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'
require 'openssl'

url = URI("https://dex.tomochain.com/api/tokens/base")

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

request = Net::HTTP::Get.new(url)
request["accept"] = 'application/json'

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

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

headers = { 'accept': "application/json" }

conn.request("GET", "/api/tokens/base", headers=headers)

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

print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://dex.tomochain.com/api/tokens/base")
  .header("accept", "application/json")
  .asString();

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": "2020-06-22T09:54:03Z",
    "updatedAt": "2020-06-22T09:54:03Z"
  }
]

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

curl --request GET \
  --url https://dex.tomochain.com/api/tokens/quote \
  --header 'accept: application/json'
var http = require("https");

var options = {
  "method": "GET",
  "hostname": "dex.tomochain.com",
  "port": null,
  "path": "/api/tokens/quote",
  "headers": {
    "accept": "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.end();
package main

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

func main() {

	url := "https://dex.tomochain.com/api/tokens/quote"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("accept", "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'
require 'openssl'

url = URI("https://dex.tomochain.com/api/tokens/quote")

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

request = Net::HTTP::Get.new(url)
request["accept"] = 'application/json'

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

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

headers = { 'accept': "application/json" }

conn.request("GET", "/api/tokens/quote", headers=headers)

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

print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://dex.tomochain.com/api/tokens/quote")
  .header("accept", "application/json")
  .asString();

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": "2020-06-22T09:54:03Z",
    "updatedAt": "2020-06-22T09:54:03Z"
  }
]

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

curl --request GET \
  --url https://dex.tomochain.com/api/tokens/string \
  --header 'accept: application/json'
var http = require("https");

var options = {
  "method": "GET",
  "hostname": "dex.tomochain.com",
  "port": null,
  "path": "/api/tokens/string",
  "headers": {
    "accept": "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.end();
package main

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

func main() {

	url := "https://dex.tomochain.com/api/tokens/string"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("accept", "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'
require 'openssl'

url = URI("https://dex.tomochain.com/api/tokens/string")

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

request = Net::HTTP::Get.new(url)
request["accept"] = 'application/json'

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

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

headers = { 'accept': "application/json" }

conn.request("GET", "/api/tokens/string", headers=headers)

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

print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://dex.tomochain.com/api/tokens/string")
  .header("accept", "application/json")
  .asString();

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": "2020-06-22T09:54:03Z",
  "updatedAt": "2020-06-22T09:54:03Z"
}

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

curl --request GET \
  --url https://dex.tomochain.com/api/pairs \
  --header 'accept: application/json'
var http = require("https");

var options = {
  "method": "GET",
  "hostname": "dex.tomochain.com",
  "port": null,
  "path": "/api/pairs",
  "headers": {
    "accept": "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.end();
package main

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

func main() {

	url := "https://dex.tomochain.com/api/pairs"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("accept", "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'
require 'openssl'

url = URI("https://dex.tomochain.com/api/pairs")

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

request = Net::HTTP::Get.new(url)
request["accept"] = 'application/json'

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

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

headers = { 'accept': "application/json" }

conn.request("GET", "/api/pairs", headers=headers)

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

print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://dex.tomochain.com/api/pairs")
  .header("accept", "application/json")
  .asString();

GET /pairs

Return all pairs in an array

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": "2020-06-22T09:54:03Z",
    "updatedAt": "2020-06-22T09:54:03Z"
  }
]

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

curl --request POST \
  --url https://dex.tomochain.com/api/pairs \
  --header 'accept: application/json' \
  --header 'content-type: application/json' \
  --data '{"baseTokenSymbol":"string","baseTokenAddress":"string","quoteTokenSymbol":"string","quoteTokenAddress":"string","active":true}'
var http = require("https");

var options = {
  "method": "POST",
  "hostname": "dex.tomochain.com",
  "port": null,
  "path": "/api/pairs",
  "headers": {
    "content-type": "application/json",
    "accept": "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({
  baseTokenSymbol: 'string',
  baseTokenAddress: 'string',
  quoteTokenSymbol: 'string',
  quoteTokenAddress: 'string',
  active: true
}));
req.end();
package main

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

func main() {

	url := "https://dex.tomochain.com/api/pairs"

	payload := strings.NewReader("{\"baseTokenSymbol\":\"string\",\"baseTokenAddress\":\"string\",\"quoteTokenSymbol\":\"string\",\"quoteTokenAddress\":\"string\",\"active\":true}")

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

	req.Header.Add("content-type", "application/json")
	req.Header.Add("accept", "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'
require 'openssl'

url = URI("https://dex.tomochain.com/api/pairs")

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["accept"] = 'application/json'
request.body = "{\"baseTokenSymbol\":\"string\",\"baseTokenAddress\":\"string\",\"quoteTokenSymbol\":\"string\",\"quoteTokenAddress\":\"string\",\"active\":true}"

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

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

payload = "{\"baseTokenSymbol\":\"string\",\"baseTokenAddress\":\"string\",\"quoteTokenSymbol\":\"string\",\"quoteTokenAddress\":\"string\",\"active\":true}"

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

conn.request("POST", "/api/pairs", payload, headers)

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

print(data.decode("utf-8"))
HttpResponse response = Unirest.post("https://dex.tomochain.com/api/pairs")
  .header("content-type", "application/json")
  .header("accept", "application/json")
  .body("{\"baseTokenSymbol\":\"string\",\"baseTokenAddress\":\"string\",\"quoteTokenSymbol\":\"string\",\"quoteTokenAddress\":\"string\",\"active\":true}")
  .asString();

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": "2020-06-22T09:54:03Z",
  "updatedAt": "2020-06-22T09:54:03Z"
}

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

curl --request GET \
  --url 'https://dex.tomochain.com/api/pair?baseToken=string"eToken=string' \
  --header 'accept: application/json'
var http = require("https");

var options = {
  "method": "GET",
  "hostname": "dex.tomochain.com",
  "port": null,
  "path": "/api/pair?baseToken=string"eToken=string",
  "headers": {
    "accept": "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.end();
package main

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

func main() {

	url := "https://dex.tomochain.com/api/pair?baseToken=string"eToken=string"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("accept", "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'
require 'openssl'

url = URI("https://dex.tomochain.com/api/pair?baseToken=string"eToken=string")

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

request = Net::HTTP::Get.new(url)
request["accept"] = 'application/json'

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

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

headers = { 'accept': "application/json" }

conn.request("GET", "/api/pair?baseToken=string"eToken=string", headers=headers)

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

print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://dex.tomochain.com/api/pair?baseToken=string"eToken=string")
  .header("accept", "application/json")
  .asString();

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": "2020-06-22T09:54:03Z",
  "updatedAt": "2020-06-22T09:54:03Z"
}

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

curl --request GET \
  --url 'https://dex.tomochain.com/api/pair/data?baseToken=string"eToken=string' \
  --header 'accept: application/json'
var http = require("https");

var options = {
  "method": "GET",
  "hostname": "dex.tomochain.com",
  "port": null,
  "path": "/api/pair/data?baseToken=string"eToken=string",
  "headers": {
    "accept": "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.end();
package main

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

func main() {

	url := "https://dex.tomochain.com/api/pair/data?baseToken=string"eToken=string"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("accept", "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'
require 'openssl'

url = URI("https://dex.tomochain.com/api/pair/data?baseToken=string"eToken=string")

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

request = Net::HTTP::Get.new(url)
request["accept"] = 'application/json'

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

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

headers = { 'accept': "application/json" }

conn.request("GET", "/api/pair/data?baseToken=string"eToken=string", headers=headers)

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

print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://dex.tomochain.com/api/pair/data?baseToken=string"eToken=string")
  .header("accept", "application/json")
  .asString();

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",
  "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

curl --request GET \
  --url https://dex.tomochain.com/api/pairs/data \
  --header 'accept: application/json'
var http = require("https");

var options = {
  "method": "GET",
  "hostname": "dex.tomochain.com",
  "port": null,
  "path": "/api/pairs/data",
  "headers": {
    "accept": "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.end();
package main

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

func main() {

	url := "https://dex.tomochain.com/api/pairs/data"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("accept", "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'
require 'openssl'

url = URI("https://dex.tomochain.com/api/pairs/data")

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

request = Net::HTTP::Get.new(url)
request["accept"] = 'application/json'

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

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

headers = { 'accept': "application/json" }

conn.request("GET", "/api/pairs/data", headers=headers)

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

print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://dex.tomochain.com/api/pairs/data")
  .header("accept", "application/json")
  .asString();

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",
  "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

curl --request GET \
  --url https://dex.tomochain.com/api/orders \
  --header 'accept: application/json'
var http = require("https");

var options = {
  "method": "GET",
  "hostname": "dex.tomochain.com",
  "port": null,
  "path": "/api/orders",
  "headers": {
    "accept": "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.end();
package main

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

func main() {

	url := "https://dex.tomochain.com/api/orders"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("accept", "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'
require 'openssl'

url = URI("https://dex.tomochain.com/api/orders")

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

request = Net::HTTP::Get.new(url)
request["accept"] = 'application/json'

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

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

headers = { 'accept': "application/json" }

conn.request("GET", "/api/orders", headers=headers)

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

print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://dex.tomochain.com/api/orders")
  .header("accept", "application/json")
  .asString();

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
hash query string false hash of order
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": "2020-06-22T09:54:03Z",
      "updatedAt": "2020-06-22T09:54:03Z",
      "orderID": "string"
    }
  ]
}

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
»» orderID string false none none

Create new order

Code samples

curl --request POST \
  --url https://dex.tomochain.com/api/orders \
  --header 'accept: application/json' \
  --header 'content-type: application/json' \
  --data '{"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"}'
var http = require("https");

var options = {
  "method": "POST",
  "hostname": "dex.tomochain.com",
  "port": null,
  "path": "/api/orders",
  "headers": {
    "content-type": "application/json",
    "accept": "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({
  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'
}));
req.end();
package main

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

func main() {

	url := "https://dex.tomochain.com/api/orders"

	payload := strings.NewReader("{\"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\"}")

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

	req.Header.Add("content-type", "application/json")
	req.Header.Add("accept", "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'
require 'openssl'

url = URI("https://dex.tomochain.com/api/orders")

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["accept"] = 'application/json'
request.body = "{\"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\"}"

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

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

payload = "{\"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\"}"

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

conn.request("POST", "/api/orders", payload, headers)

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

print(data.decode("utf-8"))
HttpResponse response = Unirest.post("https://dex.tomochain.com/api/orders")
  .header("content-type", "application/json")
  .header("accept", "application/json")
  .body("{\"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\"}")
  .asString();

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": "2020-06-22T09:54:03Z",
  "updatedAt": "2020-06-22T09:54:03Z",
  "orderID": "string"
}

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

curl --request GET \
  --url 'https://dex.tomochain.com/api/orders/positions?address=string&limit=string' \
  --header 'accept: application/json'
var http = require("https");

var options = {
  "method": "GET",
  "hostname": "dex.tomochain.com",
  "port": null,
  "path": "/api/orders/positions?address=string&limit=string",
  "headers": {
    "accept": "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.end();
package main

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

func main() {

	url := "https://dex.tomochain.com/api/orders/positions?address=string&limit=string"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("accept", "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'
require 'openssl'

url = URI("https://dex.tomochain.com/api/orders/positions?address=string&limit=string")

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

request = Net::HTTP::Get.new(url)
request["accept"] = 'application/json'

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

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

headers = { 'accept': "application/json" }

conn.request("GET", "/api/orders/positions?address=string&limit=string", headers=headers)

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

print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://dex.tomochain.com/api/orders/positions?address=string&limit=string")
  .header("accept", "application/json")
  .asString();

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": "2020-06-22T09:54:03Z",
    "updatedAt": "2020-06-22T09:54:03Z",
    "orderID": "string"
  }
]

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
» orderID string false none none

Retrieve the list of filled order for an Ethereum address

Code samples

curl --request GET \
  --url 'https://dex.tomochain.com/api/orders/history?address=string' \
  --header 'accept: application/json'
var http = require("https");

var options = {
  "method": "GET",
  "hostname": "dex.tomochain.com",
  "port": null,
  "path": "/api/orders/history?address=string",
  "headers": {
    "accept": "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.end();
package main

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

func main() {

	url := "https://dex.tomochain.com/api/orders/history?address=string"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("accept", "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'
require 'openssl'

url = URI("https://dex.tomochain.com/api/orders/history?address=string")

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

request = Net::HTTP::Get.new(url)
request["accept"] = 'application/json'

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

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

headers = { 'accept': "application/json" }

conn.request("GET", "/api/orders/history?address=string", headers=headers)

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

print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://dex.tomochain.com/api/orders/history?address=string")
  .header("accept", "application/json")
  .asString();

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": "2020-06-22T09:54:03Z",
      "updatedAt": "2020-06-22T09:54:03Z",
      "orderID": "string"
    }
  ]
}

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
»» orderID string false none none

Retrieve the total number of orders for an Ethereum address

Code samples

curl --request GET \
  --url 'https://dex.tomochain.com/api/orders/count?address=string' \
  --header 'accept: application/json'
var http = require("https");

var options = {
  "method": "GET",
  "hostname": "dex.tomochain.com",
  "port": null,
  "path": "/api/orders/count?address=string",
  "headers": {
    "accept": "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.end();
package main

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

func main() {

	url := "https://dex.tomochain.com/api/orders/count?address=string"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("accept", "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'
require 'openssl'

url = URI("https://dex.tomochain.com/api/orders/count?address=string")

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

request = Net::HTTP::Get.new(url)
request["accept"] = 'application/json'

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

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

headers = { 'accept': "application/json" }

conn.request("GET", "/api/orders/count?address=string", headers=headers)

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

print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://dex.tomochain.com/api/orders/count?address=string")
  .header("accept", "application/json")
  .asString();

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

curl --request GET \
  --url 'https://dex.tomochain.com/api/orders/nonce?address=string' \
  --header 'accept: application/json'
var http = require("https");

var options = {
  "method": "GET",
  "hostname": "dex.tomochain.com",
  "port": null,
  "path": "/api/orders/nonce?address=string",
  "headers": {
    "accept": "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.end();
package main

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

func main() {

	url := "https://dex.tomochain.com/api/orders/nonce?address=string"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("accept", "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'
require 'openssl'

url = URI("https://dex.tomochain.com/api/orders/nonce?address=string")

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

request = Net::HTTP::Get.new(url)
request["accept"] = 'application/json'

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

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

headers = { 'accept': "application/json" }

conn.request("GET", "/api/orders/nonce?address=string", headers=headers)

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

print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://dex.tomochain.com/api/orders/nonce?address=string")
  .header("accept", "application/json")
  .asString();

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

curl --request POST \
  --url https://dex.tomochain.com/api/orders/cancel \
  --header 'accept: application/json' \
  --header 'content-type: application/json' \
  --data '{"orderHash":"string","nonce":"string","hash":"string","signature":{"V":"string","R":"string","S":"string"}}'
var http = require("https");

var options = {
  "method": "POST",
  "hostname": "dex.tomochain.com",
  "port": null,
  "path": "/api/orders/cancel",
  "headers": {
    "content-type": "application/json",
    "accept": "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({
  orderHash: 'string',
  nonce: 'string',
  hash: 'string',
  signature: {V: 'string', R: 'string', S: 'string'}
}));
req.end();
package main

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

func main() {

	url := "https://dex.tomochain.com/api/orders/cancel"

	payload := strings.NewReader("{\"orderHash\":\"string\",\"nonce\":\"string\",\"hash\":\"string\",\"signature\":{\"V\":\"string\",\"R\":\"string\",\"S\":\"string\"}}")

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

	req.Header.Add("content-type", "application/json")
	req.Header.Add("accept", "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'
require 'openssl'

url = URI("https://dex.tomochain.com/api/orders/cancel")

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["accept"] = 'application/json'
request.body = "{\"orderHash\":\"string\",\"nonce\":\"string\",\"hash\":\"string\",\"signature\":{\"V\":\"string\",\"R\":\"string\",\"S\":\"string\"}}"

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

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

payload = "{\"orderHash\":\"string\",\"nonce\":\"string\",\"hash\":\"string\",\"signature\":{\"V\":\"string\",\"R\":\"string\",\"S\":\"string\"}}"

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

conn.request("POST", "/api/orders/cancel", payload, headers)

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

print(data.decode("utf-8"))
HttpResponse response = Unirest.post("https://dex.tomochain.com/api/orders/cancel")
  .header("content-type", "application/json")
  .header("accept", "application/json")
  .body("{\"orderHash\":\"string\",\"nonce\":\"string\",\"hash\":\"string\",\"signature\":{\"V\":\"string\",\"R\":\"string\",\"S\":\"string\"}}")
  .asString();

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

curl --request POST \
  --url 'https://dex.tomochain.com/api/orders/cancelAll?address=string' \
  --header 'accept: application/json'
var http = require("https");

var options = {
  "method": "POST",
  "hostname": "dex.tomochain.com",
  "port": null,
  "path": "/api/orders/cancelAll?address=string",
  "headers": {
    "accept": "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.end();
package main

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

func main() {

	url := "https://dex.tomochain.com/api/orders/cancelAll?address=string"

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

	req.Header.Add("accept", "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'
require 'openssl'

url = URI("https://dex.tomochain.com/api/orders/cancelAll?address=string")

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["accept"] = 'application/json'

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

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

headers = { 'accept': "application/json" }

conn.request("POST", "/api/orders/cancelAll?address=string", headers=headers)

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

print(data.decode("utf-8"))
HttpResponse response = Unirest.post("https://dex.tomochain.com/api/orders/cancelAll?address=string")
  .header("accept", "application/json")
  .asString();

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

Retrieve the order information corresponding to an order hash

Code samples

curl --request GET \
  --url https://dex.tomochain.com/api/orders/string \
  --header 'accept: application/json'
var http = require("https");

var options = {
  "method": "GET",
  "hostname": "dex.tomochain.com",
  "port": null,
  "path": "/api/orders/string",
  "headers": {
    "accept": "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.end();
package main

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

func main() {

	url := "https://dex.tomochain.com/api/orders/string"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("accept", "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'
require 'openssl'

url = URI("https://dex.tomochain.com/api/orders/string")

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

request = Net::HTTP::Get.new(url)
request["accept"] = 'application/json'

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

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

headers = { 'accept': "application/json" }

conn.request("GET", "/api/orders/string", headers=headers)

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

print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://dex.tomochain.com/api/orders/string")
  .header("accept", "application/json")
  .asString();

GET /orders/{hash}

Return order object

Parameters

Name In Type Required Description
hash path string true order hash

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": "2020-06-22T09:54:03Z",
  "updatedAt": "2020-06-22T09:54:03Z",
  "orderID": "string"
}

Responses

Status Meaning Description Schema
200 OK successful operation Order
400 Bad Request Invalid order hash 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

curl --request GET \
  --url 'https://dex.tomochain.com/api/orderbook?baseToken=string"eToken=string' \
  --header 'accept: application/json'
var http = require("https");

var options = {
  "method": "GET",
  "hostname": "dex.tomochain.com",
  "port": null,
  "path": "/api/orderbook?baseToken=string"eToken=string",
  "headers": {
    "accept": "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.end();
package main

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

func main() {

	url := "https://dex.tomochain.com/api/orderbook?baseToken=string"eToken=string"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("accept", "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'
require 'openssl'

url = URI("https://dex.tomochain.com/api/orderbook?baseToken=string"eToken=string")

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

request = Net::HTTP::Get.new(url)
request["accept"] = 'application/json'

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

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

headers = { 'accept': "application/json" }

conn.request("GET", "/api/orderbook?baseToken=string"eToken=string", headers=headers)

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

print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://dex.tomochain.com/api/orderbook?baseToken=string"eToken=string")
  .header("accept", "application/json")
  .asString();

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

curl --request GET \
  --url 'https://dex.tomochain.com/api/orderbook/raw?baseToken=string"eToken=string' \
  --header 'accept: application/json'
var http = require("https");

var options = {
  "method": "GET",
  "hostname": "dex.tomochain.com",
  "port": null,
  "path": "/api/orderbook/raw?baseToken=string"eToken=string",
  "headers": {
    "accept": "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.end();
package main

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

func main() {

	url := "https://dex.tomochain.com/api/orderbook/raw?baseToken=string"eToken=string"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("accept", "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'
require 'openssl'

url = URI("https://dex.tomochain.com/api/orderbook/raw?baseToken=string"eToken=string")

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

request = Net::HTTP::Get.new(url)
request["accept"] = 'application/json'

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

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

headers = { 'accept': "application/json" }

conn.request("GET", "/api/orderbook/raw?baseToken=string"eToken=string", headers=headers)

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

print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://dex.tomochain.com/api/orderbook/raw?baseToken=string"eToken=string")
  .header("accept", "application/json")
  .asString();

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": "2020-06-22T09:54:03Z",
      "updatedAt": "2020-06-22T09:54:03Z",
      "orderID": "string"
    }
  ]
}

Responses

Status Meaning Description Schema
200 OK successful operation RawOrderBook
400 Bad Request *** Parameter missing None
500 Internal Server Error Internal Server Error None

Retrieve the orderbook (amount and pricepoint) corresponding to a lendingToken and a term

Code samples

curl --request GET \
  --url 'https://dex.tomochain.com/api/lending/orderbook?lendingToken=string&term=string'
var http = require("https");

var options = {
  "method": "GET",
  "hostname": "dex.tomochain.com",
  "port": null,
  "path": "/api/lending/orderbook?lendingToken=string&term=string",
  "headers": {}
};

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.end();
package main

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

func main() {

	url := "https://dex.tomochain.com/api/lending/orderbook?lendingToken=string&term=string"

	req, _ := http.NewRequest("GET", url, nil)

	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'
require 'openssl'

url = URI("https://dex.tomochain.com/api/lending/orderbook?lendingToken=string&term=string")

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

request = Net::HTTP::Get.new(url)

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

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

conn.request("GET", "/api/lending/orderbook?lendingToken=string&term=string")

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

print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://dex.tomochain.com/api/lending/orderbook?lendingToken=string&term=string")
  .asString();

GET /lending/orderbook

Retrieve the orderbook (amount and pricepoint) corresponding to a lendingToken and a term

Parameters

Name In Type Required Description
lendingToken query string true lending token address
term query string true term (e.g 86400 seconds)

Responses

Status Meaning Description Schema
200 OK successful operation None
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

curl --request GET \
  --url https://dex.tomochain.com/api/trades \
  --header 'accept: application/json'
var http = require("https");

var options = {
  "method": "GET",
  "hostname": "dex.tomochain.com",
  "port": null,
  "path": "/api/trades",
  "headers": {
    "accept": "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.end();
package main

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

func main() {

	url := "https://dex.tomochain.com/api/trades"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("accept", "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'
require 'openssl'

url = URI("https://dex.tomochain.com/api/trades")

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

request = Net::HTTP::Get.new(url)
request["accept"] = 'application/json'

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

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

headers = { 'accept': "application/json" }

conn.request("GET", "/api/trades", headers=headers)

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

print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://dex.tomochain.com/api/trades")
  .header("accept", "application/json")
  .asString();

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": "2020-06-22T09:54:03Z",
      "updatedAt": "2020-06-22T09:54:03Z"
    }
  ]
}

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

curl --request GET \
  --url 'https://dex.tomochain.com/api/trades/history?address=string' \
  --header 'accept: application/json'
var http = require("https");

var options = {
  "method": "GET",
  "hostname": "dex.tomochain.com",
  "port": null,
  "path": "/api/trades/history?address=string",
  "headers": {
    "accept": "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.end();
package main

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

func main() {

	url := "https://dex.tomochain.com/api/trades/history?address=string"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("accept", "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'
require 'openssl'

url = URI("https://dex.tomochain.com/api/trades/history?address=string")

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

request = Net::HTTP::Get.new(url)
request["accept"] = 'application/json'

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

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

headers = { 'accept': "application/json" }

conn.request("GET", "/api/trades/history?address=string", headers=headers)

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

print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://dex.tomochain.com/api/trades/history?address=string")
  .header("accept", "application/json")
  .asString();

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": "2020-06-22T09:54:03Z",
      "updatedAt": "2020-06-22T09:54:03Z"
    }
  ]
}

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

curl --request GET \
  --url 'https://dex.tomochain.com/api/ohlcv?baseToken=string"eToken=string&timeInterval=string&from=string&to=string' \
  --header 'accept: application/json'
var http = require("https");

var options = {
  "method": "GET",
  "hostname": "dex.tomochain.com",
  "port": null,
  "path": "/api/ohlcv?baseToken=string"eToken=string&timeInterval=string&from=string&to=string",
  "headers": {
    "accept": "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.end();
package main

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

func main() {

	url := "https://dex.tomochain.com/api/ohlcv?baseToken=string"eToken=string&timeInterval=string&from=string&to=string"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("accept", "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'
require 'openssl'

url = URI("https://dex.tomochain.com/api/ohlcv?baseToken=string"eToken=string&timeInterval=string&from=string&to=string")

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

request = Net::HTTP::Get.new(url)
request["accept"] = 'application/json'

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

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

headers = { 'accept': "application/json" }

conn.request("GET", "/api/ohlcv?baseToken=string"eToken=string&timeInterval=string&from=string&to=string", headers=headers)

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

print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://dex.tomochain.com/api/ohlcv?baseToken=string"eToken=string&timeInterval=string&from=string&to=string")
  .header("accept", "application/json")
  .asString();

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

curl --request GET \
  --url 'https://dex.tomochain.com/api/notifications?userAddress=string&page=string&perPage=string' \
  --header 'accept: application/json'
var http = require("https");

var options = {
  "method": "GET",
  "hostname": "dex.tomochain.com",
  "port": null,
  "path": "/api/notifications?userAddress=string&page=string&perPage=string",
  "headers": {
    "accept": "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.end();
package main

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

func main() {

	url := "https://dex.tomochain.com/api/notifications?userAddress=string&page=string&perPage=string"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("accept", "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'
require 'openssl'

url = URI("https://dex.tomochain.com/api/notifications?userAddress=string&page=string&perPage=string")

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

request = Net::HTTP::Get.new(url)
request["accept"] = 'application/json'

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

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

headers = { 'accept': "application/json" }

conn.request("GET", "/api/notifications?userAddress=string&page=string&perPage=string", headers=headers)

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

print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://dex.tomochain.com/api/notifications?userAddress=string&page=string&perPage=string")
  .header("accept", "application/json")
  .asString();

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": "2020-06-22T09:54:03Z",
    "updatedAt": "2020-06-22T09:54:03Z"
  }
]

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

curl --request PUT \
  --url https://dex.tomochain.com/api/notifications/ \
  --header 'accept: application/json' \
  --header 'content-type: application/json' \
  --data '{"recipient":"string","message":"string","type":"string","status":"string"}'
var http = require("https");

var options = {
  "method": "PUT",
  "hostname": "dex.tomochain.com",
  "port": null,
  "path": "/api/notifications/",
  "headers": {
    "content-type": "application/json",
    "accept": "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({recipient: 'string', message: 'string', type: 'string', status: 'string'}));
req.end();
package main

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

func main() {

	url := "https://dex.tomochain.com/api/notifications/"

	payload := strings.NewReader("{\"recipient\":\"string\",\"message\":\"string\",\"type\":\"string\",\"status\":\"string\"}")

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

	req.Header.Add("content-type", "application/json")
	req.Header.Add("accept", "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'
require 'openssl'

url = URI("https://dex.tomochain.com/api/notifications/")

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

request = Net::HTTP::Put.new(url)
request["content-type"] = 'application/json'
request["accept"] = 'application/json'
request.body = "{\"recipient\":\"string\",\"message\":\"string\",\"type\":\"string\",\"status\":\"string\"}"

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

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

payload = "{\"recipient\":\"string\",\"message\":\"string\",\"type\":\"string\",\"status\":\"string\"}"

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

conn.request("PUT", "/api/notifications/", payload, headers)

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

print(data.decode("utf-8"))
HttpResponse response = Unirest.put("https://dex.tomochain.com/api/notifications/")
  .header("content-type", "application/json")
  .header("accept", "application/json")
  .body("{\"recipient\":\"string\",\"message\":\"string\",\"type\":\"string\",\"status\":\"string\"}")
  .asString();

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": "2020-06-22T09:54:03Z",
  "updatedAt": "2020-06-22T09:54:03Z"
}

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

curl --request GET \
  --url https://dex.tomochain.com/api/info \
  --header 'accept: */*'
var http = require("https");

var options = {
  "method": "GET",
  "hostname": "dex.tomochain.com",
  "port": null,
  "path": "/api/info",
  "headers": {
    "accept": "*/*"
  }
};

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.end();
package main

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

func main() {

	url := "https://dex.tomochain.com/api/info"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("accept", "*/*")

	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'
require 'openssl'

url = URI("https://dex.tomochain.com/api/info")

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

request = Net::HTTP::Get.new(url)
request["accept"] = '*/*'

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

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

headers = { 'accept': "*/*" }

conn.request("GET", "/api/info", headers=headers)

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

print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://dex.tomochain.com/api/info")
  .header("accept", "*/*")
  .asString();

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

curl --request GET \
  --url https://dex.tomochain.com/api/info/exchange \
  --header 'accept: */*'
var http = require("https");

var options = {
  "method": "GET",
  "hostname": "dex.tomochain.com",
  "port": null,
  "path": "/api/info/exchange",
  "headers": {
    "accept": "*/*"
  }
};

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.end();
package main

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

func main() {

	url := "https://dex.tomochain.com/api/info/exchange"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("accept", "*/*")

	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'
require 'openssl'

url = URI("https://dex.tomochain.com/api/info/exchange")

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

request = Net::HTTP::Get.new(url)
request["accept"] = '*/*'

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

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

headers = { 'accept': "*/*" }

conn.request("GET", "/api/info/exchange", headers=headers)

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

print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://dex.tomochain.com/api/info/exchange")
  .header("accept", "*/*")
  .asString();

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

curl --request GET \
  --url https://dex.tomochain.com/api/info/fees \
  --header 'accept: */*'
var http = require("https");

var options = {
  "method": "GET",
  "hostname": "dex.tomochain.com",
  "port": null,
  "path": "/api/info/fees",
  "headers": {
    "accept": "*/*"
  }
};

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.end();
package main

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

func main() {

	url := "https://dex.tomochain.com/api/info/fees"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("accept", "*/*")

	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'
require 'openssl'

url = URI("https://dex.tomochain.com/api/info/fees")

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

request = Net::HTTP::Get.new(url)
request["accept"] = '*/*'

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

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

headers = { 'accept': "*/*" }

conn.request("GET", "/api/info/fees", headers=headers)

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

print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://dex.tomochain.com/api/info/fees")
  .header("accept", "*/*")
  .asString();

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

curl --request GET \
  --url 'https://dex.tomochain.com/api/market/stats?baseToken=string"eToken=string' \
  --header 'accept: application/json'
var http = require("https");

var options = {
  "method": "GET",
  "hostname": "dex.tomochain.com",
  "port": null,
  "path": "/api/market/stats?baseToken=string"eToken=string",
  "headers": {
    "accept": "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.end();
package main

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

func main() {

	url := "https://dex.tomochain.com/api/market/stats?baseToken=string"eToken=string"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("accept", "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'
require 'openssl'

url = URI("https://dex.tomochain.com/api/market/stats?baseToken=string"eToken=string")

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

request = Net::HTTP::Get.new(url)
request["accept"] = 'application/json'

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

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

headers = { 'accept': "application/json" }

conn.request("GET", "/api/market/stats?baseToken=string"eToken=string", headers=headers)

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

print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://dex.tomochain.com/api/market/stats?baseToken=string"eToken=string")
  .header("accept", "application/json")
  .asString();

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": "2020-06-22T09:54:03Z",
  "updatedAt": "2020-06-22T09:54:03Z"
}

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

curl --request GET \
  --url https://dex.tomochain.com/api/market/stats/all \
  --header 'accept: application/json'
var http = require("https");

var options = {
  "method": "GET",
  "hostname": "dex.tomochain.com",
  "port": null,
  "path": "/api/market/stats/all",
  "headers": {
    "accept": "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.end();
package main

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

func main() {

	url := "https://dex.tomochain.com/api/market/stats/all"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("accept", "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'
require 'openssl'

url = URI("https://dex.tomochain.com/api/market/stats/all")

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

request = Net::HTTP::Get.new(url)
request["accept"] = 'application/json'

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

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

headers = { 'accept': "application/json" }

conn.request("GET", "/api/market/stats/all", headers=headers)

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

print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://dex.tomochain.com/api/market/stats/all")
  .header("accept", "application/json")
  .asString();

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",
  "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": "2020-06-22T09:54:03Z",
  "updatedAt": "2020-06-22T09:54:03Z"
}

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": "2020-06-22T09:54:03Z",
  "updatedAt": "2020-06-22T09:54:03Z"
}

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",
  "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
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": "2020-06-22T09:54:03Z",
  "updatedAt": "2020-06-22T09:54:03Z",
  "orderID": "string"
}

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
orderID string false none 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": "2020-06-22T09:54:03Z",
      "updatedAt": "2020-06-22T09:54:03Z",
      "orderID": "string"
    }
  ]
}

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": "2020-06-22T09:54:03Z",
  "updatedAt": "2020-06-22T09:54:03Z"
}

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": "2020-06-22T09:54:03Z",
  "updatedAt": "2020-06-22T09:54:03Z"
}

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

Accounts

Accounts API

Get list accounts

Code samples

curl --request GET \
  --url https://example.com/api/accounts
var http = require("https");

var options = {
  "method": "GET",
  "hostname": "example.com",
  "port": null,
  "path": "/api/accounts",
  "headers": {}
};

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.end();
package main

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

func main() {

	url := "https://example.com/api/accounts"

	req, _ := http.NewRequest("GET", url, nil)

	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'
require 'openssl'

url = URI("https://example.com/api/accounts")

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

request = Net::HTTP::Get.new(url)

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

conn = http.client.HTTPSConnection("example.com")

conn.request("GET", "/api/accounts")

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

print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://example.com/api/accounts")
  .asString();

GET /api/accounts

Parameters

Name In Type Required Description
page query number false default = 1, maximum = 500
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

curl --request GET \
  --url https://example.com/api/accounts/string
var http = require("https");

var options = {
  "method": "GET",
  "hostname": "example.com",
  "port": null,
  "path": "/api/accounts/string",
  "headers": {}
};

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.end();
package main

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

func main() {

	url := "https://example.com/api/accounts/string"

	req, _ := http.NewRequest("GET", url, nil)

	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'
require 'openssl'

url = URI("https://example.com/api/accounts/string")

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

request = Net::HTTP::Get.new(url)

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

conn = http.client.HTTPSConnection("example.com")

conn.request("GET", "/api/accounts/string")

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

print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://example.com/api/accounts/string")
  .asString();

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

curl --request GET \
  --url https://example.com/api/accounts/string/mined
var http = require("https");

var options = {
  "method": "GET",
  "hostname": "example.com",
  "port": null,
  "path": "/api/accounts/string/mined",
  "headers": {}
};

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.end();
package main

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

func main() {

	url := "https://example.com/api/accounts/string/mined"

	req, _ := http.NewRequest("GET", url, nil)

	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'
require 'openssl'

url = URI("https://example.com/api/accounts/string/mined")

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

request = Net::HTTP::Get.new(url)

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

conn = http.client.HTTPSConnection("example.com")

conn.request("GET", "/api/accounts/string/mined")

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

print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://example.com/api/accounts/string/mined")
  .asString();

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

Blocks

Blocks API

Get list blocks

Code samples

curl --request GET \
  --url https://example.com/api/blocks
var http = require("https");

var options = {
  "method": "GET",
  "hostname": "example.com",
  "port": null,
  "path": "/api/blocks",
  "headers": {}
};

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.end();
package main

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

func main() {

	url := "https://example.com/api/blocks"

	req, _ := http.NewRequest("GET", url, nil)

	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'
require 'openssl'

url = URI("https://example.com/api/blocks")

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

request = Net::HTTP::Get.new(url)

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

conn = http.client.HTTPSConnection("example.com")

conn.request("GET", "/api/blocks")

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

print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://example.com/api/blocks")
  .asString();

GET /api/blocks

Parameters

Name In Type Required Description
page query number false default = 1, maximum = 500
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

curl --request GET \
  --url https://example.com/api/blocks/string
var http = require("https");

var options = {
  "method": "GET",
  "hostname": "example.com",
  "port": null,
  "path": "/api/blocks/string",
  "headers": {}
};

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.end();
package main

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

func main() {

	url := "https://example.com/api/blocks/string"

	req, _ := http.NewRequest("GET", url, nil)

	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'
require 'openssl'

url = URI("https://example.com/api/blocks/string")

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

request = Net::HTTP::Get.new(url)

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

conn = http.client.HTTPSConnection("example.com")

conn.request("GET", "/api/blocks/string")

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

print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://example.com/api/blocks/string")
  .asString();

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

Check exist transaction from/to address inside block

Code samples

curl --request GET \
  --url https://example.com/api/blocks/0/address/string
var http = require("https");

var options = {
  "method": "GET",
  "hostname": "example.com",
  "port": null,
  "path": "/api/blocks/0/address/string",
  "headers": {}
};

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.end();
package main

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

func main() {

	url := "https://example.com/api/blocks/0/address/string"

	req, _ := http.NewRequest("GET", url, nil)

	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'
require 'openssl'

url = URI("https://example.com/api/blocks/0/address/string")

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

request = Net::HTTP::Get.new(url)

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

conn = http.client.HTTPSConnection("example.com")

conn.request("GET", "/api/blocks/0/address/string")

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

print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://example.com/api/blocks/0/address/string")
  .asString();

GET /api/blocks/{blockNumber}/address/{address}

Parameters

Name In Type Required Description
blockNumber path number true block number
address path string true 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 signers of a block

Code samples

curl --request GET \
  --url https://example.com/api/blocks/signers/0
var http = require("https");

var options = {
  "method": "GET",
  "hostname": "example.com",
  "port": null,
  "path": "/api/blocks/signers/0",
  "headers": {}
};

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.end();
package main

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

func main() {

	url := "https://example.com/api/blocks/signers/0"

	req, _ := http.NewRequest("GET", url, nil)

	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'
require 'openssl'

url = URI("https://example.com/api/blocks/signers/0")

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

request = Net::HTTP::Get.new(url)

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

conn = http.client.HTTPSConnection("example.com")

conn.request("GET", "/api/blocks/signers/0")

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

print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://example.com/api/blocks/signers/0")
  .asString();

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

Get latest irreversible block

Code samples

curl --request GET \
  --url https://example.com/api/blocks/finality/latestIrreversibleBlock
var http = require("https");

var options = {
  "method": "GET",
  "hostname": "example.com",
  "port": null,
  "path": "/api/blocks/finality/latestIrreversibleBlock",
  "headers": {}
};

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.end();
package main

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

func main() {

	url := "https://example.com/api/blocks/finality/latestIrreversibleBlock"

	req, _ := http.NewRequest("GET", url, nil)

	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'
require 'openssl'

url = URI("https://example.com/api/blocks/finality/latestIrreversibleBlock")

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

request = Net::HTTP::Get.new(url)

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

conn = http.client.HTTPSConnection("example.com")

conn.request("GET", "/api/blocks/finality/latestIrreversibleBlock")

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

print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://example.com/api/blocks/finality/latestIrreversibleBlock")
  .asString();

GET /api/blocks/finality/latestIrreversibleBlock

Responses

Status Meaning Description Schema
200 OK OK None
400 Bad Request Bad Request None
500 Internal Server Error Server Internal Error None

Contracts

Contract API

Get list verified contract

Code samples

curl --request GET \
  --url https://example.com/api/contracts
var http = require("https");

var options = {
  "method": "GET",
  "hostname": "example.com",
  "port": null,
  "path": "/api/contracts",
  "headers": {}
};

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.end();
package main

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

func main() {

	url := "https://example.com/api/contracts"

	req, _ := http.NewRequest("GET", url, nil)

	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'
require 'openssl'

url = URI("https://example.com/api/contracts")

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

request = Net::HTTP::Get.new(url)

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

conn = http.client.HTTPSConnection("example.com")

conn.request("GET", "/api/contracts")

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

print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://example.com/api/contracts")
  .asString();

GET /api/contracts

Parameters

Name In Type Required Description
page query number false default = 1, maximum = 500
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 contract detail

Code samples

curl --request GET \
  --url https://example.com/api/contracts/string
var http = require("https");

var options = {
  "method": "GET",
  "hostname": "example.com",
  "port": null,
  "path": "/api/contracts/string",
  "headers": {}
};

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.end();
package main

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

func main() {

	url := "https://example.com/api/contracts/string"

	req, _ := http.NewRequest("GET", url, nil)

	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'
require 'openssl'

url = URI("https://example.com/api/contracts/string")

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

request = Net::HTTP::Get.new(url)

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

conn = http.client.HTTPSConnection("example.com")

conn.request("GET", "/api/contracts/string")

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

print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://example.com/api/contracts/string")
  .asString();

GET /api/contracts/{contractAddress}

Parameters

Name In Type Required Description
contractAddress path string true contract 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

Read all function on contract

Code samples

curl --request GET \
  --url https://example.com/api/contracts/string/read
var http = require("https");

var options = {
  "method": "GET",
  "hostname": "example.com",
  "port": null,
  "path": "/api/contracts/string/read",
  "headers": {}
};

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.end();
package main

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

func main() {

	url := "https://example.com/api/contracts/string/read"

	req, _ := http.NewRequest("GET", url, nil)

	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'
require 'openssl'

url = URI("https://example.com/api/contracts/string/read")

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

request = Net::HTTP::Get.new(url)

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

conn = http.client.HTTPSConnection("example.com")

conn.request("GET", "/api/contracts/string/read")

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

print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://example.com/api/contracts/string/read")
  .asString();

GET /api/contracts/{contractAddress}/read

Parameters

Name In Type Required Description
contractAddress path string true contract 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

Transactions

Transactions API

Get list transaction by type

Code samples

curl --request GET \
  --url https://example.com/api/txs/listByType/:txType
var http = require("https");

var options = {
  "method": "GET",
  "hostname": "example.com",
  "port": null,
  "path": "/api/txs/listByType/:txType",
  "headers": {}
};

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.end();
package main

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

func main() {

	url := "https://example.com/api/txs/listByType/:txType"

	req, _ := http.NewRequest("GET", url, nil)

	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'
require 'openssl'

url = URI("https://example.com/api/txs/listByType/:txType")

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

request = Net::HTTP::Get.new(url)

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

conn = http.client.HTTPSConnection("example.com")

conn.request("GET", "/api/txs/listByType/:txType")

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

print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://example.com/api/txs/listByType/:txType")
  .asString();

GET /api/txs/listByType/:txType

Parameters

Name In Type Required Description
txType path number true signTxs
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 txs by block number.

Code samples

curl --request GET \
  --url https://example.com/api/txs/listByBlock/0
var http = require("https");

var options = {
  "method": "GET",
  "hostname": "example.com",
  "port": null,
  "path": "/api/txs/listByBlock/0",
  "headers": {}
};

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.end();
package main

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

func main() {

	url := "https://example.com/api/txs/listByBlock/0"

	req, _ := http.NewRequest("GET", url, nil)

	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'
require 'openssl'

url = URI("https://example.com/api/txs/listByBlock/0")

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

request = Net::HTTP::Get.new(url)

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

conn = http.client.HTTPSConnection("example.com")

conn.request("GET", "/api/txs/listByBlock/0")

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

print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://example.com/api/txs/listByBlock/0")
  .asString();

GET /api/txs/listByBlock/{blockNumber}

Parameters

Name In Type Required Description
blockNumber path number true block number
page query number false default = 1
limit query number false default 20, maximum = 100

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 txs by account address.

Code samples

curl --request GET \
  --url https://example.com/api/txs/listByAccount/string
var http = require("https");

var options = {
  "method": "GET",
  "hostname": "example.com",
  "port": null,
  "path": "/api/txs/listByAccount/string",
  "headers": {}
};

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.end();
package main

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

func main() {

	url := "https://example.com/api/txs/listByAccount/string"

	req, _ := http.NewRequest("GET", url, nil)

	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'
require 'openssl'

url = URI("https://example.com/api/txs/listByAccount/string")

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

request = Net::HTTP::Get.new(url)

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

conn = http.client.HTTPSConnection("example.com")

conn.request("GET", "/api/txs/listByAccount/string")

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

print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://example.com/api/txs/listByAccount/string")
  .asString();

GET /api/txs/listByAccount/{address}

Parameters

Name In Type Required Description
address path string true account address
page query number false default = 1
limit query number false default 20, maximum = 100
tx_type query string false in
filterAddress query string false transaction send to/from address

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

curl --request GET \
  --url https://example.com/api/txs/string
var http = require("https");

var options = {
  "method": "GET",
  "hostname": "example.com",
  "port": null,
  "path": "/api/txs/string",
  "headers": {}
};

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.end();
package main

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

func main() {

	url := "https://example.com/api/txs/string"

	req, _ := http.NewRequest("GET", url, nil)

	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'
require 'openssl'

url = URI("https://example.com/api/txs/string")

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

request = Net::HTTP::Get.new(url)

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

conn = http.client.HTTPSConnection("example.com")

conn.request("GET", "/api/txs/string")

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

print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://example.com/api/txs/string")
  .asString();

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

Get internal transaction of an address

Code samples

curl --request GET \
  --url https://example.com/api/txs/internal/string
var http = require("https");

var options = {
  "method": "GET",
  "hostname": "example.com",
  "port": null,
  "path": "/api/txs/internal/string",
  "headers": {}
};

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.end();
package main

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

func main() {

	url := "https://example.com/api/txs/internal/string"

	req, _ := http.NewRequest("GET", url, nil)

	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'
require 'openssl'

url = URI("https://example.com/api/txs/internal/string")

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

request = Net::HTTP::Get.new(url)

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

conn = http.client.HTTPSConnection("example.com")

conn.request("GET", "/api/txs/internal/string")

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

print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://example.com/api/txs/internal/string")
  .asString();

GET /api/txs/internal/{address}

Parameters

Name In Type Required Description
address path string true account address

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

curl --request GET \
  --url https://example.com/api/tokens/string
var http = require("https");

var options = {
  "method": "GET",
  "hostname": "example.com",
  "port": null,
  "path": "/api/tokens/string",
  "headers": {}
};

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.end();
package main

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

func main() {

	url := "https://example.com/api/tokens/string"

	req, _ := http.NewRequest("GET", url, nil)

	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'
require 'openssl'

url = URI("https://example.com/api/tokens/string")

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

request = Net::HTTP::Get.new(url)

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

conn = http.client.HTTPSConnection("example.com")

conn.request("GET", "/api/tokens/string")

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

print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://example.com/api/tokens/string")
  .asString();

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

Get list token holding of a holder

Code samples

curl --request GET \
  --url https://example.com/api/tokens/holding/string/string
var http = require("https");

var options = {
  "method": "GET",
  "hostname": "example.com",
  "port": null,
  "path": "/api/tokens/holding/string/string",
  "headers": {}
};

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.end();
package main

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

func main() {

	url := "https://example.com/api/tokens/holding/string/string"

	req, _ := http.NewRequest("GET", url, nil)

	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'
require 'openssl'

url = URI("https://example.com/api/tokens/holding/string/string")

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

request = Net::HTTP::Get.new(url)

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

conn = http.client.HTTPSConnection("example.com")

conn.request("GET", "/api/tokens/holding/string/string")

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

print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://example.com/api/tokens/holding/string/string")
  .asString();

GET /api/tokens/holding/{tokenType}/{holder}

Parameters

Name In Type Required Description
tokenType path string true trc20
holder path string true holder 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

Epoch

Get list epoch

Code samples

curl --request GET \
  --url https://example.com/api/epochs
var http = require("https");

var options = {
  "method": "GET",
  "hostname": "example.com",
  "port": null,
  "path": "/api/epochs",
  "headers": {}
};

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.end();
package main

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

func main() {

	url := "https://example.com/api/epochs"

	req, _ := http.NewRequest("GET", url, nil)

	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'
require 'openssl'

url = URI("https://example.com/api/epochs")

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

request = Net::HTTP::Get.new(url)

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

conn = http.client.HTTPSConnection("example.com")

conn.request("GET", "/api/epochs")

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

print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://example.com/api/epochs")
  .asString();

GET /api/epochs

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
404 Not Found Not Found None
500 Internal Server Error Server Internal Error None

Get epoch detail

Code samples

curl --request GET \
  --url https://example.com/api/epochs/0
var http = require("https");

var options = {
  "method": "GET",
  "hostname": "example.com",
  "port": null,
  "path": "/api/epochs/0",
  "headers": {}
};

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.end();
package main

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

func main() {

	url := "https://example.com/api/epochs/0"

	req, _ := http.NewRequest("GET", url, nil)

	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'
require 'openssl'

url = URI("https://example.com/api/epochs/0")

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

request = Net::HTTP::Get.new(url)

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

conn = http.client.HTTPSConnection("example.com")

conn.request("GET", "/api/epochs/0")

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

print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://example.com/api/epochs/0")
  .asString();

GET /api/epochs/{epochNumber}

Parameters

Name In Type Required Description
epochNumber path number true epoch number

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

Rewards

Get list rewards of a voter

Code samples

curl --request GET \
  --url https://example.com/api/rewards/0
var http = require("https");

var options = {
  "method": "GET",
  "hostname": "example.com",
  "port": null,
  "path": "/api/rewards/0",
  "headers": {}
};

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.end();
package main

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

func main() {

	url := "https://example.com/api/rewards/0"

	req, _ := http.NewRequest("GET", url, nil)

	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'
require 'openssl'

url = URI("https://example.com/api/rewards/0")

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

request = Net::HTTP::Get.new(url)

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

conn = http.client.HTTPSConnection("example.com")

conn.request("GET", "/api/rewards/0")

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

print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://example.com/api/rewards/0")
  .asString();

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

curl --request GET \
  --url https://example.com/api/rewards/epoch/0
var http = require("https");

var options = {
  "method": "GET",
  "hostname": "example.com",
  "port": null,
  "path": "/api/rewards/epoch/0",
  "headers": {}
};

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.end();
package main

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

func main() {

	url := "https://example.com/api/rewards/epoch/0"

	req, _ := http.NewRequest("GET", url, nil)

	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'
require 'openssl'

url = URI("https://example.com/api/rewards/epoch/0")

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

request = Net::HTTP::Get.new(url)

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

conn = http.client.HTTPSConnection("example.com")

conn.request("GET", "/api/rewards/epoch/0")

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

print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://example.com/api/rewards/epoch/0")
  .asString();

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

Get total rewards of an address

Code samples

curl --request GET \
  --url https://example.com/api/rewards/total/string/0/0
var http = require("https");

var options = {
  "method": "GET",
  "hostname": "example.com",
  "port": null,
  "path": "/api/rewards/total/string/0/0",
  "headers": {}
};

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.end();
package main

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

func main() {

	url := "https://example.com/api/rewards/total/string/0/0"

	req, _ := http.NewRequest("GET", url, nil)

	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'
require 'openssl'

url = URI("https://example.com/api/rewards/total/string/0/0")

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

request = Net::HTTP::Get.new(url)

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

conn = http.client.HTTPSConnection("example.com")

conn.request("GET", "/api/rewards/total/string/0/0")

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

print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://example.com/api/rewards/total/string/0/0")
  .asString();

GET /api/rewards/total/{address}/{fromEpoch}/{toEpoch}

Parameters

Name In Type Required Description
address path string true account address
fromEpoch path number true from epoch
toEpoch path number true to epoch

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

curl --request GET \
  --url https://example.com/api/tokens
var http = require("https");

var options = {
  "method": "GET",
  "hostname": "example.com",
  "port": null,
  "path": "/api/tokens",
  "headers": {}
};

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.end();
package main

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

func main() {

	url := "https://example.com/api/tokens"

	req, _ := http.NewRequest("GET", url, nil)

	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'
require 'openssl'

url = URI("https://example.com/api/tokens")

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

request = Net::HTTP::Get.new(url)

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

conn = http.client.HTTPSConnection("example.com")

conn.request("GET", "/api/tokens")

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

print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://example.com/api/tokens")
  .asString();

GET /api/tokens

Parameters

Name In Type Required Description
type query string false trc20
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 trc20 token holder. Require 1 of 2 conditions - address | hash

Code samples

curl --request GET \
  --url https://example.com/api/token-holders
var http = require("https");

var options = {
  "method": "GET",
  "hostname": "example.com",
  "port": null,
  "path": "/api/token-holders",
  "headers": {}
};

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.end();
package main

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

func main() {

	url := "https://example.com/api/token-holders"

	req, _ := http.NewRequest("GET", url, nil)

	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'
require 'openssl'

url = URI("https://example.com/api/token-holders")

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

request = Net::HTTP::Get.new(url)

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

conn = http.client.HTTPSConnection("example.com")

conn.request("GET", "/api/token-holders")

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

print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://example.com/api/token-holders")
  .asString();

GET /api/token-holders

Parameters

Name In Type Required Description
address query string false token address
hash query string false 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.

Code samples

curl --request GET \
  --url https://example.com/api/token-txs/string
var http = require("https");

var options = {
  "method": "GET",
  "hostname": "example.com",
  "port": null,
  "path": "/api/token-txs/string",
  "headers": {}
};

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.end();
package main

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

func main() {

	url := "https://example.com/api/token-txs/string"

	req, _ := http.NewRequest("GET", url, nil)

	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'
require 'openssl'

url = URI("https://example.com/api/token-txs/string")

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

request = Net::HTTP::Get.new(url)

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

conn = http.client.HTTPSConnection("example.com")

conn.request("GET", "/api/token-txs/string")

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

print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://example.com/api/token-txs/string")
  .asString();

GET /api/token-txs/{tokenType}

Parameters

Name In Type Required Description
tokenType path string true trc20
holder query string false holder address
token query string false 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 transactions by transaction hash.

Code samples

curl --request GET \
  --url https://example.com/api/token-txs/string/string
var http = require("https");

var options = {
  "method": "GET",
  "hostname": "example.com",
  "port": null,
  "path": "/api/token-txs/string/string",
  "headers": {}
};

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.end();
package main

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

func main() {

	url := "https://example.com/api/token-txs/string/string"

	req, _ := http.NewRequest("GET", url, nil)

	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'
require 'openssl'

url = URI("https://example.com/api/token-txs/string/string")

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

request = Net::HTTP::Get.new(url)

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

conn = http.client.HTTPSConnection("example.com")

conn.request("GET", "/api/token-txs/string/string")

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

print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://example.com/api/token-txs/string/string")
  .asString();

GET /api/token-txs/{tokenType}/{txHash}

Parameters

Name In Type Required Description
tokenType path string true trc20
txHash path string true token address
holder query string false holder 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

Orders

Get list order

Code samples

curl --request GET \
  --url https://example.com/api/orders
var http = require("https");

var options = {
  "method": "GET",
  "hostname": "example.com",
  "port": null,
  "path": "/api/orders",
  "headers": {}
};

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.end();
package main

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

func main() {

	url := "https://example.com/api/orders"

	req, _ := http.NewRequest("GET", url, nil)

	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'
require 'openssl'

url = URI("https://example.com/api/orders")

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

request = Net::HTTP::Get.new(url)

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

conn = http.client.HTTPSConnection("example.com")

conn.request("GET", "/api/orders")

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

print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://example.com/api/orders")
  .asString();

GET /api/orders

Parameters

Name In Type Required Description
page query number false default = 1
limit query number false default 20, maximum = 50
userAddress query string false userAddress
pairName query string false pairName = btc/tomo
side query string false buy/sell

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 order of dex

Code samples

curl --request GET \
  --url https://example.com/api/orders/listByDex/string
var http = require("https");

var options = {
  "method": "GET",
  "hostname": "example.com",
  "port": null,
  "path": "/api/orders/listByDex/string",
  "headers": {}
};

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.end();
package main

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

func main() {

	url := "https://example.com/api/orders/listByDex/string"

	req, _ := http.NewRequest("GET", url, nil)

	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'
require 'openssl'

url = URI("https://example.com/api/orders/listByDex/string")

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

request = Net::HTTP::Get.new(url)

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

conn = http.client.HTTPSConnection("example.com")

conn.request("GET", "/api/orders/listByDex/string")

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

print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://example.com/api/orders/listByDex/string")
  .asString();

GET /api/orders/listByDex/{dexAddress}

Parameters

Name In Type Required Description
dexAddress path string true address of dex
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
404 Not Found Not Found None
500 Internal Server Error Server Internal Error None

Get list order of account

Code samples

curl --request GET \
  --url https://example.com/api/orders/listByAccount/string
var http = require("https");

var options = {
  "method": "GET",
  "hostname": "example.com",
  "port": null,
  "path": "/api/orders/listByAccount/string",
  "headers": {}
};

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.end();
package main

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

func main() {

	url := "https://example.com/api/orders/listByAccount/string"

	req, _ := http.NewRequest("GET", url, nil)

	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'
require 'openssl'

url = URI("https://example.com/api/orders/listByAccount/string")

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

request = Net::HTTP::Get.new(url)

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

conn = http.client.HTTPSConnection("example.com")

conn.request("GET", "/api/orders/listByAccount/string")

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

print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://example.com/api/orders/listByAccount/string")
  .asString();

GET /api/orders/listByAccount/{accountAddress}

Parameters

Name In Type Required Description
accountAddress path string true address of account
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
404 Not Found Not Found None
500 Internal Server Error Server Internal Error None

Get list order by pair

Code samples

curl --request GET \
  --url https://example.com/api/orders/listByPair/string/string
var http = require("https");

var options = {
  "method": "GET",
  "hostname": "example.com",
  "port": null,
  "path": "/api/orders/listByPair/string/string",
  "headers": {}
};

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.end();
package main

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

func main() {

	url := "https://example.com/api/orders/listByPair/string/string"

	req, _ := http.NewRequest("GET", url, nil)

	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'
require 'openssl'

url = URI("https://example.com/api/orders/listByPair/string/string")

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

request = Net::HTTP::Get.new(url)

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

conn = http.client.HTTPSConnection("example.com")

conn.request("GET", "/api/orders/listByPair/string/string")

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

print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://example.com/api/orders/listByPair/string/string")
  .asString();

GET /api/orders/listByPair/{baseToken}/{quoteToken}

Parameters

Name In Type Required Description
baseToken path string true base token
quoteToken path string true quote token
userAddress query string false filter 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
404 Not Found Not Found None
500 Internal Server Error Server Internal Error None

Trades

Get list trade

Code samples

curl --request GET \
  --url https://example.com/api/trades
var http = require("https");

var options = {
  "method": "GET",
  "hostname": "example.com",
  "port": null,
  "path": "/api/trades",
  "headers": {}
};

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.end();
package main

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

func main() {

	url := "https://example.com/api/trades"

	req, _ := http.NewRequest("GET", url, nil)

	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'
require 'openssl'

url = URI("https://example.com/api/trades")

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

request = Net::HTTP::Get.new(url)

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

conn = http.client.HTTPSConnection("example.com")

conn.request("GET", "/api/trades")

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

print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://example.com/api/trades")
  .asString();

GET /api/trades

Parameters

Name In Type Required Description
page query number false default = 1
limit query number false default 20, maximum = 50
userAddress query string false userAddress
pairName query string false pairName = btc/tomo

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 trade of dex

Code samples

curl --request GET \
  --url https://example.com/api/trades/listByDex/string
var http = require("https");

var options = {
  "method": "GET",
  "hostname": "example.com",
  "port": null,
  "path": "/api/trades/listByDex/string",
  "headers": {}
};

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.end();
package main

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

func main() {

	url := "https://example.com/api/trades/listByDex/string"

	req, _ := http.NewRequest("GET", url, nil)

	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'
require 'openssl'

url = URI("https://example.com/api/trades/listByDex/string")

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

request = Net::HTTP::Get.new(url)

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

conn = http.client.HTTPSConnection("example.com")

conn.request("GET", "/api/trades/listByDex/string")

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

print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://example.com/api/trades/listByDex/string")
  .asString();

GET /api/trades/listByDex/{dexAddress}

Parameters

Name In Type Required Description
dexAddress path string true address of dex
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
404 Not Found Not Found None
500 Internal Server Error Server Internal Error None

Get list trade of account

Code samples

curl --request GET \
  --url https://example.com/api/trades/listByAccount/string
var http = require("https");

var options = {
  "method": "GET",
  "hostname": "example.com",
  "port": null,
  "path": "/api/trades/listByAccount/string",
  "headers": {}
};

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.end();
package main

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

func main() {

	url := "https://example.com/api/trades/listByAccount/string"

	req, _ := http.NewRequest("GET", url, nil)

	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'
require 'openssl'

url = URI("https://example.com/api/trades/listByAccount/string")

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

request = Net::HTTP::Get.new(url)

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

conn = http.client.HTTPSConnection("example.com")

conn.request("GET", "/api/trades/listByAccount/string")

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

print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://example.com/api/trades/listByAccount/string")
  .asString();

GET /api/trades/listByAccount/{accountAddress}

Parameters

Name In Type Required Description
accountAddress path string true address of account
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
404 Not Found Not Found None
500 Internal Server Error Server Internal Error None

Get list order by pair

Code samples

curl --request GET \
  --url https://example.com/api/trades/listByPair/string/string
var http = require("https");

var options = {
  "method": "GET",
  "hostname": "example.com",
  "port": null,
  "path": "/api/trades/listByPair/string/string",
  "headers": {}
};

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.end();
package main

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

func main() {

	url := "https://example.com/api/trades/listByPair/string/string"

	req, _ := http.NewRequest("GET", url, nil)

	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'
require 'openssl'

url = URI("https://example.com/api/trades/listByPair/string/string")

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

request = Net::HTTP::Get.new(url)

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

conn = http.client.HTTPSConnection("example.com")

conn.request("GET", "/api/trades/listByPair/string/string")

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

print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://example.com/api/trades/listByPair/string/string")
  .asString();

GET /api/trades/listByPair/{baseToken}/{quoteToken}

Parameters

Name In Type Required Description
baseToken path string true base token
quoteToken path string true quote token
userAddress query string false filter 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
404 Not Found Not Found None
500 Internal Server Error Server Internal Error None

Get trade stats

Code samples

curl --request GET \
  --url https://example.com/api/trades/stats/string/string
var http = require("https");

var options = {
  "method": "GET",
  "hostname": "example.com",
  "port": null,
  "path": "/api/trades/stats/string/string",
  "headers": {}
};

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.end();
package main

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

func main() {

	url := "https://example.com/api/trades/stats/string/string"

	req, _ := http.NewRequest("GET", url, nil)

	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'
require 'openssl'

url = URI("https://example.com/api/trades/stats/string/string")

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

request = Net::HTTP::Get.new(url)

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

conn = http.client.HTTPSConnection("example.com")

conn.request("GET", "/api/trades/stats/string/string")

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

print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://example.com/api/trades/stats/string/string")
  .asString();

GET /api/trades/stats/{exchangeAddress}/{pairName}

Parameters

Name In Type Required Description
exchangeAddress path string true exchange address
pairName path string true pair
date query string false stats of a special day yyyy-mm-dd

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 trade daily stats

Code samples

curl --request GET \
  --url 'https://example.com/api/trades/dailyStats/string/string?fromDate=string&toDate=string'
var http = require("https");

var options = {
  "method": "GET",
  "hostname": "example.com",
  "port": null,
  "path": "/api/trades/dailyStats/string/string?fromDate=string&toDate=string",
  "headers": {}
};

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.end();
package main

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

func main() {

	url := "https://example.com/api/trades/dailyStats/string/string?fromDate=string&toDate=string"

	req, _ := http.NewRequest("GET", url, nil)

	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'
require 'openssl'

url = URI("https://example.com/api/trades/dailyStats/string/string?fromDate=string&toDate=string")

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

request = Net::HTTP::Get.new(url)

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

conn = http.client.HTTPSConnection("example.com")

conn.request("GET", "/api/trades/dailyStats/string/string?fromDate=string&toDate=string")

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

print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://example.com/api/trades/dailyStats/string/string?fromDate=string&toDate=string")
  .asString();

GET /api/trades/dailyStats/{exchangeAddress}/{pairName}

Parameters

Name In Type Required Description
exchangeAddress path string true exchange address
pairName path string true pair
fromDate query string true from day yyyy-mm-dd
toDate query string true from day yyyy-mm-dd

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 trade weekly stats

Code samples

curl --request GET \
  --url 'https://example.com/api/trades/weeklyStats/string/string?fromYear=0&fromWeek=0&toYear=0&toWeek=0'
var http = require("https");

var options = {
  "method": "GET",
  "hostname": "example.com",
  "port": null,
  "path": "/api/trades/weeklyStats/string/string?fromYear=0&fromWeek=0&toYear=0&toWeek=0",
  "headers": {}
};

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.end();
package main

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

func main() {

	url := "https://example.com/api/trades/weeklyStats/string/string?fromYear=0&fromWeek=0&toYear=0&toWeek=0"

	req, _ := http.NewRequest("GET", url, nil)

	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'
require 'openssl'

url = URI("https://example.com/api/trades/weeklyStats/string/string?fromYear=0&fromWeek=0&toYear=0&toWeek=0")

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

request = Net::HTTP::Get.new(url)

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

conn = http.client.HTTPSConnection("example.com")

conn.request("GET", "/api/trades/weeklyStats/string/string?fromYear=0&fromWeek=0&toYear=0&toWeek=0")

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

print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://example.com/api/trades/weeklyStats/string/string?fromYear=0&fromWeek=0&toYear=0&toWeek=0")
  .asString();

GET /api/trades/weeklyStats/{exchangeAddress}/{pairName}

Parameters

Name In Type Required Description
exchangeAddress path string true exchange address
pairName path string true pair
fromYear query number true from year
fromWeek query number true from week 1-53
toYear query number true to year
toWeek query number true to week 1-53

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 trade monthly stats

Code samples

curl --request GET \
  --url 'https://example.com/api/trades/monthlyStats/string/string?fromYear=0&fromMonth=0&toYear=0&toMonth=0'
var http = require("https");

var options = {
  "method": "GET",
  "hostname": "example.com",
  "port": null,
  "path": "/api/trades/monthlyStats/string/string?fromYear=0&fromMonth=0&toYear=0&toMonth=0",
  "headers": {}
};

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.end();
package main

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

func main() {

	url := "https://example.com/api/trades/monthlyStats/string/string?fromYear=0&fromMonth=0&toYear=0&toMonth=0"

	req, _ := http.NewRequest("GET", url, nil)

	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'
require 'openssl'

url = URI("https://example.com/api/trades/monthlyStats/string/string?fromYear=0&fromMonth=0&toYear=0&toMonth=0")

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

request = Net::HTTP::Get.new(url)

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

conn = http.client.HTTPSConnection("example.com")

conn.request("GET", "/api/trades/monthlyStats/string/string?fromYear=0&fromMonth=0&toYear=0&toMonth=0")

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

print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://example.com/api/trades/monthlyStats/string/string?fromYear=0&fromMonth=0&toYear=0&toMonth=0")
  .asString();

GET /api/trades/monthlyStats/{exchangeAddress}/{pairName}

Parameters

Name In Type Required Description
exchangeAddress path string true exchange address
pairName path string true pair
fromYear query number true from year
fromMonth query number true from week 1-12
toYear query number true to year
toMonth query number true to week 1-12

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.3.3

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

Base URLs:

License: Github

Config

Get TomoMaster Application Configuration

Get TomoMaster Application Configuration

Code samples

curl --request GET \
  --url https://master.tomochain.com/api/config \
  --header 'accept: application/json'
var http = require("https");

var options = {
  "method": "GET",
  "hostname": "master.tomochain.com",
  "port": null,
  "path": "/api/config",
  "headers": {
    "accept": "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.end();
package main

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

func main() {

	url := "https://master.tomochain.com/api/config"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("accept", "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'
require 'openssl'

url = URI("https://master.tomochain.com/api/config")

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

request = Net::HTTP::Get.new(url)
request["accept"] = 'application/json'

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

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

headers = { 'accept': "application/json" }

conn.request("GET", "/api/config", headers=headers)

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

print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://master.tomochain.com/api/config")
  .header("accept", "application/json")
  .asString();

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

curl --request GET \
  --url https://master.tomochain.com/api/candidates \
  --header 'accept: application/json'
var http = require("https");

var options = {
  "method": "GET",
  "hostname": "master.tomochain.com",
  "port": null,
  "path": "/api/candidates",
  "headers": {
    "accept": "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.end();
package main

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

func main() {

	url := "https://master.tomochain.com/api/candidates"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("accept", "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'
require 'openssl'

url = URI("https://master.tomochain.com/api/candidates")

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

request = Net::HTTP::Get.new(url)
request["accept"] = 'application/json'

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

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

headers = { 'accept': "application/json" }

conn.request("GET", "/api/candidates", headers=headers)

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

print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://master.tomochain.com/api/candidates")
  .header("accept", "application/json")
  .asString();

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 masternodes(exclude Proposed candidates) information

Code samples

curl --request GET \
  --url https://master.tomochain.com/api/candidates/masternodes \
  --header 'accept: application/json'
var http = require("https");

var options = {
  "method": "GET",
  "hostname": "master.tomochain.com",
  "port": null,
  "path": "/api/candidates/masternodes",
  "headers": {
    "accept": "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.end();
package main

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

func main() {

	url := "https://master.tomochain.com/api/candidates/masternodes"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("accept", "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'
require 'openssl'

url = URI("https://master.tomochain.com/api/candidates/masternodes")

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

request = Net::HTTP::Get.new(url)
request["accept"] = 'application/json'

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

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

headers = { 'accept': "application/json" }

conn.request("GET", "/api/candidates/masternodes", headers=headers)

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

print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://master.tomochain.com/api/candidates/masternodes")
  .header("accept", "application/json")
  .asString();

GET /api/candidates/masternodes

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": "5c52a0df5f0abf3496d9a38f",
      "candidate": "0x1d50df657b6dce50bac634bf18e2d986d807e940",
      "smartContractAddress": "0x0000000000000000000000000000000000000088",
      "__v": 0,
      "capacity": "574962709628904011242293",
      "capacityNumber": 574962.709628904,
      "createdAt": "2019-01-31T07:16:47.833Z",
      "nodeId": "1d50df657b6dce50bac634bf18e2d986d807e940",
      "owner": "0x300d18c65563d0c9021d7722dd1aab74b9cc447f",
      "status": "MASTERNODE",
      "updatedAt": "2019-04-11T02:56:39.928Z",
      "latestSignedBlock": 3899535,
      "name": "GNBA.GE",
      "rank": 1
    }
  ],
  "activeCandidates": 150,
  "totalSlashed": 1,
  "totalResigned": 53,
  "totalProposed": 10
}

Responses

Status Meaning Description Schema
200 OK OK masternode
406 Not Acceptable Not Acceptable None

Get slashed Masternodes

Code samples

curl --request GET \
  --url https://master.tomochain.com/api/candidates/slashedMNs \
  --header 'accept: application/json'
var http = require("https");

var options = {
  "method": "GET",
  "hostname": "master.tomochain.com",
  "port": null,
  "path": "/api/candidates/slashedMNs",
  "headers": {
    "accept": "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.end();
package main

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

func main() {

	url := "https://master.tomochain.com/api/candidates/slashedMNs"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("accept", "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'
require 'openssl'

url = URI("https://master.tomochain.com/api/candidates/slashedMNs")

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

request = Net::HTTP::Get.new(url)
request["accept"] = 'application/json'

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

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

headers = { 'accept': "application/json" }

conn.request("GET", "/api/candidates/slashedMNs", headers=headers)

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

print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://master.tomochain.com/api/candidates/slashedMNs")
  .header("accept", "application/json")
  .asString();

GET /api/candidates/slashedMNs

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": "5c4006b47ff073e7961fabd5",
      "candidate": "0x1c5a1cb41c920c2532cbb77be5845b258eca32f3",
      "smartContractAddress": "0x0000000000000000000000000000000000000088",
      "__v": 0,
      "capacity": "114213709385390179602070",
      "capacityNumber": 114213.70938539018,
      "createdAt": "2019-01-17T04:38:12.051Z",
      "nodeId": "1c5a1cb41c920c2532cbb77be5845b258eca32f3",
      "owner": "0xe60f54049759a11d764756ece4d27815e990d92f",
      "status": "SLASHED",
      "updatedAt": "2019-01-29T10:38:18.268Z",
      "latestSignedBlock": 1220265
    }
  ],
  "total": 1
}

Responses

Status Meaning Description Schema
200 OK OK slashedMN
406 Not Acceptable Not Acceptable None

Get proposed Masternodes

Code samples

curl --request GET \
  --url https://master.tomochain.com/api/candidates/proposedMNs \
  --header 'accept: application/json'
var http = require("https");

var options = {
  "method": "GET",
  "hostname": "master.tomochain.com",
  "port": null,
  "path": "/api/candidates/proposedMNs",
  "headers": {
    "accept": "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.end();
package main

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

func main() {

	url := "https://master.tomochain.com/api/candidates/proposedMNs"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("accept", "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'
require 'openssl'

url = URI("https://master.tomochain.com/api/candidates/proposedMNs")

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

request = Net::HTTP::Get.new(url)
request["accept"] = 'application/json'

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

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

headers = { 'accept': "application/json" }

conn.request("GET", "/api/candidates/proposedMNs", headers=headers)

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

print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://master.tomochain.com/api/candidates/proposedMNs")
  .header("accept", "application/json")
  .asString();

GET /api/candidates/proposedMNs

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": "5c4006b47ff073e7961fabd5",
      "candidate": "0x1c5a1cb41c920c2532cbb77be5845b258eca32f3",
      "smartContractAddress": "0x0000000000000000000000000000000000000088",
      "__v": 0,
      "capacity": "114213709385390179602070",
      "capacityNumber": 114213.70938539018,
      "createdAt": "2019-01-17T04:38:12.051Z",
      "nodeId": "1c5a1cb41c920c2532cbb77be5845b258eca32f3",
      "owner": "0xe60f54049759a11d764756ece4d27815e990d92f",
      "status": "PROPOSED",
      "updatedAt": "2019-01-29T10:38:18.268Z",
      "latestSignedBlock": 1220265
    }
  ],
  "total": 1
}

Responses

Status Meaning Description Schema
200 OK OK proposedMN
406 Not Acceptable Not Acceptable None

Get resigned Masternodes

Code samples

curl --request GET \
  --url https://master.tomochain.com/api/candidates/resignedMNs \
  --header 'accept: application/json'
var http = require("https");

var options = {
  "method": "GET",
  "hostname": "master.tomochain.com",
  "port": null,
  "path": "/api/candidates/resignedMNs",
  "headers": {
    "accept": "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.end();
package main

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

func main() {

	url := "https://master.tomochain.com/api/candidates/resignedMNs"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("accept", "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'
require 'openssl'

url = URI("https://master.tomochain.com/api/candidates/resignedMNs")

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

request = Net::HTTP::Get.new(url)
request["accept"] = 'application/json'

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

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

headers = { 'accept': "application/json" }

conn.request("GET", "/api/candidates/resignedMNs", headers=headers)

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

print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://master.tomochain.com/api/candidates/resignedMNs")
  .header("accept", "application/json")
  .asString();

GET /api/candidates/resignedMNs

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": "5c4006b37ff073e7961fab14",
      "candidate": "0x7a3b86261cd2042a3190c81dd37d0a12e0397daf",
      "smartContractAddress": "0x0000000000000000000000000000000000000088",
      "__v": 0,
      "capacity": "40508760000000000000000",
      "capacityNumber": 40508.76,
      "createdAt": "2019-01-17T04:38:11.949Z",
      "nodeId": "7a3b86261cd2042a3190c81dd37d0a12e0397daf",
      "owner": "0xbff690303287ce327c319f575c7671c3ad626de4",
      "status": "RESIGNED",
      "updatedAt": "2019-01-29T10:11:19.464Z",
      "latestSignedBlock": 957442
    }
  ],
  "total": 1
}

Responses

Status Meaning Description Schema
200 OK OK resignedMN
406 Not Acceptable Not Acceptable None

Get candidate's information

Code samples

curl --request GET \
  --url https://master.tomochain.com/api/candidates/string \
  --header 'accept: application/json'
var http = require("https");

var options = {
  "method": "GET",
  "hostname": "master.tomochain.com",
  "port": null,
  "path": "/api/candidates/string",
  "headers": {
    "accept": "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.end();
package main

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

func main() {

	url := "https://master.tomochain.com/api/candidates/string"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("accept", "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'
require 'openssl'

url = URI("https://master.tomochain.com/api/candidates/string")

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

request = Net::HTTP::Get.new(url)
request["accept"] = 'application/json'

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

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

headers = { 'accept': "application/json" }

conn.request("GET", "/api/candidates/string", headers=headers)

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

print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://master.tomochain.com/api/candidates/string")
  .header("accept", "application/json")
  .asString();

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

curl --request GET \
  --url https://master.tomochain.com/api/candidates/string/voters \
  --header 'accept: application/json'
var http = require("https");

var options = {
  "method": "GET",
  "hostname": "master.tomochain.com",
  "port": null,
  "path": "/api/candidates/string/voters",
  "headers": {
    "accept": "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.end();
package main

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

func main() {

	url := "https://master.tomochain.com/api/candidates/string/voters"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("accept", "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'
require 'openssl'

url = URI("https://master.tomochain.com/api/candidates/string/voters")

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

request = Net::HTTP::Get.new(url)
request["accept"] = 'application/json'

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

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

headers = { 'accept': "application/json" }

conn.request("GET", "/api/candidates/string/voters", headers=headers)

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

print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://master.tomochain.com/api/candidates/string/voters")
  .header("accept", "application/json")
  .asString();

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

curl --request GET \
  --url https://master.tomochain.com/api/candidates/string/isMasternode \
  --header 'accept: application/json'
var http = require("https");

var options = {
  "method": "GET",
  "hostname": "master.tomochain.com",
  "port": null,
  "path": "/api/candidates/string/isMasternode",
  "headers": {
    "accept": "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.end();
package main

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

func main() {

	url := "https://master.tomochain.com/api/candidates/string/isMasternode"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("accept", "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'
require 'openssl'

url = URI("https://master.tomochain.com/api/candidates/string/isMasternode")

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

request = Net::HTTP::Get.new(url)
request["accept"] = 'application/json'

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

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

headers = { 'accept': "application/json" }

conn.request("GET", "/api/candidates/string/isMasternode", headers=headers)

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

print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://master.tomochain.com/api/candidates/string/isMasternode")
  .header("accept", "application/json")
  .asString();

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

curl --request GET \
  --url https://master.tomochain.com/api/candidates/string/isCandidate \
  --header 'accept: application/json'
var http = require("https");

var options = {
  "method": "GET",
  "hostname": "master.tomochain.com",
  "port": null,
  "path": "/api/candidates/string/isCandidate",
  "headers": {
    "accept": "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.end();
package main

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

func main() {

	url := "https://master.tomochain.com/api/candidates/string/isCandidate"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("accept", "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'
require 'openssl'

url = URI("https://master.tomochain.com/api/candidates/string/isCandidate")

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

request = Net::HTTP::Get.new(url)
request["accept"] = 'application/json'

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

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

headers = { 'accept': "application/json" }

conn.request("GET", "/api/candidates/string/isCandidate", headers=headers)

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

print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://master.tomochain.com/api/candidates/string/isCandidate")
  .header("accept", "application/json")
  .asString();

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

Owner checking

Code samples

curl --request GET \
  --url https://master.tomochain.com/api/candidates/string/string/isOwner \
  --header 'accept: application/json'
var http = require("https");

var options = {
  "method": "GET",
  "hostname": "master.tomochain.com",
  "port": null,
  "path": "/api/candidates/string/string/isOwner",
  "headers": {
    "accept": "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.end();
package main

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

func main() {

	url := "https://master.tomochain.com/api/candidates/string/string/isOwner"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("accept", "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'
require 'openssl'

url = URI("https://master.tomochain.com/api/candidates/string/string/isOwner")

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

request = Net::HTTP::Get.new(url)
request["accept"] = 'application/json'

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

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

headers = { 'accept': "application/json" }

conn.request("GET", "/api/candidates/string/string/isOwner", headers=headers)

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

print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://master.tomochain.com/api/candidates/string/string/isOwner")
  .header("accept", "application/json")
  .asString();

GET /api/candidates/{candidate}/{owner}/isOwner

Parameters

Name In Type Required Description
candidate path string true candidate's address
owner path string true owner's address

Example responses

200 Response

"true"

Responses

Status Meaning Description Schema
200 OK OK isOwner
406 Not Acceptable Not Acceptable None

Get reward of candidate

Code samples

curl --request GET \
  --url https://master.tomochain.com/api/candidates/string/string/getRewards \
  --header 'accept: application/json'
var http = require("https");

var options = {
  "method": "GET",
  "hostname": "master.tomochain.com",
  "port": null,
  "path": "/api/candidates/string/string/getRewards",
  "headers": {
    "accept": "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.end();
package main

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

func main() {

	url := "https://master.tomochain.com/api/candidates/string/string/getRewards"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("accept", "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'
require 'openssl'

url = URI("https://master.tomochain.com/api/candidates/string/string/getRewards")

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

request = Net::HTTP::Get.new(url)
request["accept"] = 'application/json'

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

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

headers = { 'accept': "application/json" }

conn.request("GET", "/api/candidates/string/string/getRewards", headers=headers)

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

print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://master.tomochain.com/api/candidates/string/string/getRewards")
  .header("accept", "application/json")
  .asString();

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

Get list of slashed masternodes

Code samples

curl --request GET \
  --url https://master.tomochain.com/api/candidates/slashed/string \
  --header 'accept: application/json'
var http = require("https");

var options = {
  "method": "GET",
  "hostname": "master.tomochain.com",
  "port": null,
  "path": "/api/candidates/slashed/string",
  "headers": {
    "accept": "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.end();
package main

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

func main() {

	url := "https://master.tomochain.com/api/candidates/slashed/string"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("accept", "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'
require 'openssl'

url = URI("https://master.tomochain.com/api/candidates/slashed/string")

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

request = Net::HTTP::Get.new(url)
request["accept"] = 'application/json'

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

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

headers = { 'accept': "application/json" }

conn.request("GET", "/api/candidates/slashed/string", headers=headers)

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

print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://master.tomochain.com/api/candidates/slashed/string")
  .header("accept", "application/json")
  .asString();

GET /api/candidates/slashed/{epoch}

Parameters

Name In Type Required Description
epoch path string true epoch number

Example responses

200 Response

{
  "items": {},
  "blockNumber": 3899700,
  "epoch": 4334,
  "networkId": 88
}

Responses

Status Meaning Description Schema
200 OK OK slashedMasternodes
406 Not Acceptable Not Acceptable None

Voters

Get Voter information

Get voted candidates

Code samples

curl --request GET \
  --url https://master.tomochain.com/api/voters/string/candidates \
  --header 'accept: application/json'
var http = require("https");

var options = {
  "method": "GET",
  "hostname": "master.tomochain.com",
  "port": null,
  "path": "/api/voters/string/candidates",
  "headers": {
    "accept": "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.end();
package main

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

func main() {

	url := "https://master.tomochain.com/api/voters/string/candidates"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("accept", "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'
require 'openssl'

url = URI("https://master.tomochain.com/api/voters/string/candidates")

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

request = Net::HTTP::Get.new(url)
request["accept"] = 'application/json'

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

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

headers = { 'accept': "application/json" }

conn.request("GET", "/api/voters/string/candidates", headers=headers)

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

print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://master.tomochain.com/api/voters/string/candidates")
  .header("accept", "application/json")
  .asString();

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

curl --request GET \
  --url https://master.tomochain.com/api/voters/string/rewards \
  --header 'accept: application/json'
var http = require("https");

var options = {
  "method": "GET",
  "hostname": "master.tomochain.com",
  "port": null,
  "path": "/api/voters/string/rewards",
  "headers": {
    "accept": "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.end();
package main

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

func main() {

	url := "https://master.tomochain.com/api/voters/string/rewards"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("accept", "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'
require 'openssl'

url = URI("https://master.tomochain.com/api/voters/string/rewards")

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

request = Net::HTTP::Get.new(url)
request["accept"] = 'application/json'

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

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

headers = { 'accept': "application/json" }

conn.request("GET", "/api/voters/string/rewards", headers=headers)

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

print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://master.tomochain.com/api/voters/string/rewards")
  .header("accept", "application/json")
  .asString();

GET /api/voters/{voter}/rewards

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": "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

Get ROI of masternode and voter

Code samples

curl --request GET \
  --url 'https://master.tomochain.com/api/voters/annualReward?candidate=string' \
  --header 'accept: application/json'
var http = require("https");

var options = {
  "method": "GET",
  "hostname": "master.tomochain.com",
  "port": null,
  "path": "/api/voters/annualReward?candidate=string",
  "headers": {
    "accept": "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.end();
package main

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

func main() {

	url := "https://master.tomochain.com/api/voters/annualReward?candidate=string"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("accept", "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'
require 'openssl'

url = URI("https://master.tomochain.com/api/voters/annualReward?candidate=string")

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

request = Net::HTTP::Get.new(url)
request["accept"] = 'application/json'

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

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

headers = { 'accept': "application/json" }

conn.request("GET", "/api/voters/annualReward?candidate=string", headers=headers)

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

print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://master.tomochain.com/api/voters/annualReward?candidate=string")
  .header("accept", "application/json")
  .asString();

GET /api/voters/annualReward

Parameters

Name In Type Required Description
candidate query string true candidate's address

Example responses

200 Response

{
  "epochDuration": 30,
  "lastEpoch": 6945,
  "numberOfMN": 150,
  "capacity": 200000,
  "voterROI": 6,
  "mnROI": 29
}

Responses

Status Meaning Description Schema
200 OK OK annualReward
406 Not Acceptable Not Acceptable None

Transaction

Get transactions of candidate and voter

Get transactions of a candidate

Code samples

curl --request GET \
  --url https://master.tomochain.com/api/transactions/candidate/string \
  --header 'accept: application/json'
var http = require("https");

var options = {
  "method": "GET",
  "hostname": "master.tomochain.com",
  "port": null,
  "path": "/api/transactions/candidate/string",
  "headers": {
    "accept": "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.end();
package main

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

func main() {

	url := "https://master.tomochain.com/api/transactions/candidate/string"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("accept", "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'
require 'openssl'

url = URI("https://master.tomochain.com/api/transactions/candidate/string")

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

request = Net::HTTP::Get.new(url)
request["accept"] = 'application/json'

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

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

headers = { 'accept': "application/json" }

conn.request("GET", "/api/transactions/candidate/string", headers=headers)

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

print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://master.tomochain.com/api/transactions/candidate/string")
  .header("accept", "application/json")
  .asString();

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

curl --request GET \
  --url https://master.tomochain.com/api/transactions/voter/string \
  --header 'accept: application/json'
var http = require("https");

var options = {
  "method": "GET",
  "hostname": "master.tomochain.com",
  "port": null,
  "path": "/api/transactions/voter/string",
  "headers": {
    "accept": "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.end();
package main

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

func main() {

	url := "https://master.tomochain.com/api/transactions/voter/string"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("accept", "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'
require 'openssl'

url = URI("https://master.tomochain.com/api/transactions/voter/string")

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

request = Net::HTTP::Get.new(url)
request["accept"] = 'application/json'

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

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

headers = { 'accept': "application/json" }

conn.request("GET", "/api/transactions/voter/string", headers=headers)

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

print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://master.tomochain.com/api/transactions/voter/string")
  .header("accept", "application/json")
  .asString();

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

Get a transaction's detail

Code samples

curl --request GET \
  --url https://master.tomochain.com/api/transactions/string \
  --header 'accept: application/json'
var http = require("https");

var options = {
  "method": "GET",
  "hostname": "master.tomochain.com",
  "port": null,
  "path": "/api/transactions/string",
  "headers": {
    "accept": "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.end();
package main

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

func main() {

	url := "https://master.tomochain.com/api/transactions/string"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("accept", "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'
require 'openssl'

url = URI("https://master.tomochain.com/api/transactions/string")

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

request = Net::HTTP::Get.new(url)
request["accept"] = 'application/json'

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

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

headers = { 'accept': "application/json" }

conn.request("GET", "/api/transactions/string", headers=headers)

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

print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://master.tomochain.com/api/transactions/string")
  .header("accept", "application/json")
  .asString();

GET /api/transactions/{tx}

Parameters

Name In Type Required Description
tx path string true Transaction

Example responses

200 Response

{
  "_id": "5c52a4465f0abf3496da0e91",
  "tx": "0xdd03614f86982663b4c17eaaf9051b3df7a88fefc445df41921fa223c6178bf7",
  "smartContractAddress": "0x0000000000000000000000000000000000000088",
  "__v": 0,
  "capacity": "1715000000000000000000",
  "createdAt": "2018-10-31T03:42:39.375Z",
  "owner": "0x7e0d154cba89190ce1801031cba9d46ad21eb317",
  "blockNumber": 1310702,
  "updatedAt": "2019-01-11T09:17:59.535Z",
  "voter": "0x7e0d154cba89190ce1801031cba9d46ad21eb317",
  "candidate": "",
  "event": "Withdraw"
}

Responses

Status Meaning Description Schema
200 OK OK transaction

Signer

Get a list of signers

Get a list of latest signers

Code samples

curl --request GET \
  --url https://master.tomochain.com/api/signers/get/latest \
  --header 'accept: application/json'
var http = require("https");

var options = {
  "method": "GET",
  "hostname": "master.tomochain.com",
  "port": null,
  "path": "/api/signers/get/latest",
  "headers": {
    "accept": "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.end();
package main

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

func main() {

	url := "https://master.tomochain.com/api/signers/get/latest"

	req, _ := http.NewRequest("GET", url, nil)

	req.Header.Add("accept", "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'
require 'openssl'

url = URI("https://master.tomochain.com/api/signers/get/latest")

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

request = Net::HTTP::Get.new(url)
request["accept"] = 'application/json'

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

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

headers = { 'accept': "application/json" }

conn.request("GET", "/api/signers/get/latest", headers=headers)

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

print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://master.tomochain.com/api/signers/get/latest")
  .header("accept", "application/json")
  .asString();

GET /api/signers/get/latest

Example responses

200 Response

{
  "_id": "5c52a4465f0abf3496da0e91",
  "signers": [
    "0x98ffa09ae64a3ad63289ee0def385e6455b777e5",
    "0x6670fe10f076539459753b7aabc53fc218644042",
    "0x71ab3b4352084f13bedb15693cd6bb923a1b80a1"
  ],
  "__v": 0,
  "networkId": "1715000000000000000000",
  "createdAt": "2018-10-31T03:42:39.375Z",
  "blockNumber": 1310702,
  "updatedAt": "2019-01-11T09:17:59.535Z"
}

Responses

Status Meaning Description Schema
200 OK OK signers

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

slashedMN

{
  "items": [
    {
      "_id": "5c4006b47ff073e7961fabd5",
      "candidate": "0x1c5a1cb41c920c2532cbb77be5845b258eca32f3",
      "smartContractAddress": "0x0000000000000000000000000000000000000088",
      "__v": 0,
      "capacity": "114213709385390179602070",
      "capacityNumber": 114213.70938539018,
      "createdAt": "2019-01-17T04:38:12.051Z",
      "nodeId": "1c5a1cb41c920c2532cbb77be5845b258eca32f3",
      "owner": "0xe60f54049759a11d764756ece4d27815e990d92f",
      "status": "SLASHED",
      "updatedAt": "2019-01-29T10:38:18.268Z",
      "latestSignedBlock": 1220265
    }
  ],
  "total": 1
}

Properties

Name Type Required Restrictions Description
items [object] false none Candidate's data
total number false none Total number of candidate

proposedMN

{
  "items": [
    {
      "_id": "5c4006b47ff073e7961fabd5",
      "candidate": "0x1c5a1cb41c920c2532cbb77be5845b258eca32f3",
      "smartContractAddress": "0x0000000000000000000000000000000000000088",
      "__v": 0,
      "capacity": "114213709385390179602070",
      "capacityNumber": 114213.70938539018,
      "createdAt": "2019-01-17T04:38:12.051Z",
      "nodeId": "1c5a1cb41c920c2532cbb77be5845b258eca32f3",
      "owner": "0xe60f54049759a11d764756ece4d27815e990d92f",
      "status": "PROPOSED",
      "updatedAt": "2019-01-29T10:38:18.268Z",
      "latestSignedBlock": 1220265
    }
  ],
  "total": 1
}

Properties

Name Type Required Restrictions Description
items [object] false none Candidate's data
total number false none Total number of candidate

resignedMN

{
  "items": [
    {
      "_id": "5c4006b37ff073e7961fab14",
      "candidate": "0x7a3b86261cd2042a3190c81dd37d0a12e0397daf",
      "smartContractAddress": "0x0000000000000000000000000000000000000088",
      "__v": 0,
      "capacity": "40508760000000000000000",
      "capacityNumber": 40508.76,
      "createdAt": "2019-01-17T04:38:11.949Z",
      "nodeId": "7a3b86261cd2042a3190c81dd37d0a12e0397daf",
      "owner": "0xbff690303287ce327c319f575c7671c3ad626de4",
      "status": "RESIGNED",
      "updatedAt": "2019-01-29T10:11:19.464Z",
      "latestSignedBlock": 957442
    }
  ],
  "total": 1
}

Properties

Name Type Required Restrictions Description
items [object] false none Candidate's data
total number false none Total number of candidate

isOwner

"true"

Properties

Name Type Required Restrictions Description
anonymous number false none none

Enumerated Values

Property Value
anonymous true
anonymous false

transaction

{
  "_id": "5c52a4465f0abf3496da0e91",
  "tx": "0xdd03614f86982663b4c17eaaf9051b3df7a88fefc445df41921fa223c6178bf7",
  "smartContractAddress": "0x0000000000000000000000000000000000000088",
  "__v": 0,
  "capacity": "1715000000000000000000",
  "createdAt": "2018-10-31T03:42:39.375Z",
  "owner": "0x7e0d154cba89190ce1801031cba9d46ad21eb317",
  "blockNumber": 1310702,
  "updatedAt": "2019-01-11T09:17:59.535Z",
  "voter": "0x7e0d154cba89190ce1801031cba9d46ad21eb317",
  "candidate": "",
  "event": "Withdraw"
}

Properties

Name Type Required Restrictions Description
_id string false none id
tx string false none transaction hash
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
blockNumber number false none blockNumber
updatedAt string false none update time
voter string false none voter address
candidate string false none candidate address
event string false none event

Enumerated Values

Property Value
event Vote
event Unvote
event Withdraw
event Propose
event Resign

signers

{
  "_id": "5c52a4465f0abf3496da0e91",
  "signers": [
    "0x98ffa09ae64a3ad63289ee0def385e6455b777e5",
    "0x6670fe10f076539459753b7aabc53fc218644042",
    "0x71ab3b4352084f13bedb15693cd6bb923a1b80a1"
  ],
  "__v": 0,
  "networkId": "1715000000000000000000",
  "createdAt": "2018-10-31T03:42:39.375Z",
  "blockNumber": 1310702,
  "updatedAt": "2019-01-11T09:17:59.535Z"
}

Properties

Name Type Required Restrictions Description
_id string false none id
signers [string] false none List of latest signers
__v number false none __v
networkId string false none capacity in wei
createdAt string false none creation date of candidate
blockNumber number false none blockNumber
updatedAt string false none update time

masternode

{
  "items": [
    {
      "_id": "5c52a0df5f0abf3496d9a38f",
      "candidate": "0x1d50df657b6dce50bac634bf18e2d986d807e940",
      "smartContractAddress": "0x0000000000000000000000000000000000000088",
      "__v": 0,
      "capacity": "574962709628904011242293",
      "capacityNumber": 574962.709628904,
      "createdAt": "2019-01-31T07:16:47.833Z",
      "nodeId": "1d50df657b6dce50bac634bf18e2d986d807e940",
      "owner": "0x300d18c65563d0c9021d7722dd1aab74b9cc447f",
      "status": "MASTERNODE",
      "updatedAt": "2019-04-11T02:56:39.928Z",
      "latestSignedBlock": 3899535,
      "name": "GNBA.GE",
      "rank": 1
    }
  ],
  "activeCandidates": 150,
  "totalSlashed": 1,
  "totalResigned": 53,
  "totalProposed": 10
}

Properties

Name Type Required Restrictions Description
items [object] false none Masternode's data
activeCandidates number false none Total number of active masternode(status = 'MASTERNODE')
totalSlashed number false none Number of slashed masternode
totalResigned number false none Number of resigned masternode
totalProposed number false none Number of proposed masternode

slashedMasternodes

{
  "items": {},
  "blockNumber": 3899700,
  "epoch": 4334,
  "networkId": 88
}

Properties

Name Type Required Restrictions Description
items object false none Masternode's data
blockNumber number false none Blocknumber slashed
epoch number false none epoch slashed
networkId number false none Network id

annualReward

{
  "epochDuration": 30,
  "lastEpoch": 6945,
  "numberOfMN": 150,
  "capacity": 200000,
  "voterROI": 6,
  "mnROI": 29
}

Properties

Name Type Required Restrictions Description
epochDuration number false none Epoch duration in minutes
lastEpoch number false none Last epoch
numberOfMN number false none Masternode numbers
capacity string false none Masternode capacity
voterROI number false none Voter ROI
mnROI number false none Masternode ROI

TomoX Relayer 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.

Base URL https://dex.tomochain.com

Base URLs:

License: Github

CoinMarketCap

CoinMarketCap's Ideal API Endpoints

Market Summary Endpoint

Code samples

curl --request GET \
  --url https://dex.tomochain.com/api/coinmarketcap/markets
var http = require("https");

var options = {
  "method": "GET",
  "hostname": "dex.tomochain.com",
  "port": null,
  "path": "/api/coinmarketcap/markets",
  "headers": {}
};

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.end();
package main

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

func main() {

	url := "https://dex.tomochain.com/api/coinmarketcap/markets"

	req, _ := http.NewRequest("GET", url, nil)

	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'
require 'openssl'

url = URI("https://dex.tomochain.com/api/coinmarketcap/markets")

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

request = Net::HTTP::Get.new(url)

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

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

conn.request("GET", "/api/coinmarketcap/markets")

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

print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://dex.tomochain.com/api/coinmarketcap/markets")
  .asString();

GET /api/coinmarketcap/markets

The summary endpoint is to provide an overview of market data for all tickers and all market pairs on the exchange.

Returns

Responses

Status Meaning Description Schema
200 OK OK None
400 Bad Request Bad Request None
401 Unauthorized Unauthorized None
406 Not Acceptable Not Acceptable None
500 Internal Server Error Server Internal Error None

Endpoint A1

Code samples

curl --request GET \
  --url https://dex.tomochain.com/api/coinmarketcap/assets
var http = require("https");

var options = {
  "method": "GET",
  "hostname": "dex.tomochain.com",
  "port": null,
  "path": "/api/coinmarketcap/assets",
  "headers": {}
};

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.end();
package main

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

func main() {

	url := "https://dex.tomochain.com/api/coinmarketcap/assets"

	req, _ := http.NewRequest("GET", url, nil)

	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'
require 'openssl'

url = URI("https://dex.tomochain.com/api/coinmarketcap/assets")

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

request = Net::HTTP::Get.new(url)

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

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

conn.request("GET", "/api/coinmarketcap/assets")

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

print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://dex.tomochain.com/api/coinmarketcap/assets")
  .asString();

GET /api/coinmarketcap/assets

The assets endpoint is to provide a detailed summary for each currency available on the exchange.

Returns

Responses

Status Meaning Description Schema
200 OK OK None
400 Bad Request Bad Request None
401 Unauthorized Unauthorized None
406 Not Acceptable Not Acceptable None
500 Internal Server Error Server Internal Error None

Endpoint A2

Code samples

curl --request GET \
  --url https://dex.tomochain.com/api/coinmarketcap/ticker
var http = require("https");

var options = {
  "method": "GET",
  "hostname": "dex.tomochain.com",
  "port": null,
  "path": "/api/coinmarketcap/ticker",
  "headers": {}
};

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.end();
package main

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

func main() {

	url := "https://dex.tomochain.com/api/coinmarketcap/ticker"

	req, _ := http.NewRequest("GET", url, nil)

	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'
require 'openssl'

url = URI("https://dex.tomochain.com/api/coinmarketcap/ticker")

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

request = Net::HTTP::Get.new(url)

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

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

conn.request("GET", "/api/coinmarketcap/ticker")

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

print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://dex.tomochain.com/api/coinmarketcap/ticker")
  .asString();

GET /api/coinmarketcap/ticker

The ticker endpoint is to provide a 24-hour pricing and volume summary for each market pair available on the exchange.

Returns

Responses

Status Meaning Description Schema
200 OK OK None
400 Bad Request Bad Request None
401 Unauthorized Unauthorized None
406 Not Acceptable Not Acceptable None
500 Internal Server Error Server Internal Error None

Endpoint A3

Code samples

curl --request GET \
  --url https://dex.tomochain.com/api/coinmarketcap/orderbook/TOMO_USDT
var http = require("https");

var options = {
  "method": "GET",
  "hostname": "dex.tomochain.com",
  "port": null,
  "path": "/api/coinmarketcap/orderbook/TOMO_USDT",
  "headers": {}
};

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.end();
package main

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

func main() {

	url := "https://dex.tomochain.com/api/coinmarketcap/orderbook/TOMO_USDT"

	req, _ := http.NewRequest("GET", url, nil)

	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'
require 'openssl'

url = URI("https://dex.tomochain.com/api/coinmarketcap/orderbook/TOMO_USDT")

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

request = Net::HTTP::Get.new(url)

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

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

conn.request("GET", "/api/coinmarketcap/orderbook/TOMO_USDT")

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

print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://dex.tomochain.com/api/coinmarketcap/orderbook/TOMO_USDT")
  .asString();

GET /api/coinmarketcap/orderbook/{market_pair}

The order book endpoint is to provide a complete level 2 order book (arranged by best asks/bids) with full depth returned for a given market pair.

Parameters

Returns

Parameters

Name In Type Required Description
market_pair path string true A pair such as 'TOMO_USDT'
depth query number false Orders depth quantity [0,10,20,50,100,500]. Depth 100 means 50 for each bid/ask side. Default full orderbook.
level query number false Level 1 - Only the best bid and ask. Level 2 - Arranged by best bids and asks. Level 3 - Complete order book, no aggregation.

Enumerated Values

Parameter Value
level 1
level 2
level 3

Responses

Status Meaning Description Schema
200 OK OK None
400 Bad Request Bad Request None
401 Unauthorized Unauthorized None
406 Not Acceptable Not Acceptable None
500 Internal Server Error Server Internal Error None

Endpoint A4

Code samples

curl --request GET \
  --url https://dex.tomochain.com/api/coinmarketcap/trades/TOMO_USDT
var http = require("https");

var options = {
  "method": "GET",
  "hostname": "dex.tomochain.com",
  "port": null,
  "path": "/api/coinmarketcap/trades/TOMO_USDT",
  "headers": {}
};

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.end();
package main

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

func main() {

	url := "https://dex.tomochain.com/api/coinmarketcap/trades/TOMO_USDT"

	req, _ := http.NewRequest("GET", url, nil)

	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'
require 'openssl'

url = URI("https://dex.tomochain.com/api/coinmarketcap/trades/TOMO_USDT")

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

request = Net::HTTP::Get.new(url)

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

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

conn.request("GET", "/api/coinmarketcap/trades/TOMO_USDT")

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

print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://dex.tomochain.com/api/coinmarketcap/trades/TOMO_USDT")
  .asString();

GET /api/coinmarketcap/trades/{market_pair}

The trades endpoint is to return data on all recently completed trades for a given market pair.

Parameters

Returns

Parameters

Name In Type Required Description
market_pair path string true A pair such as 'TOMO_USDT'

Responses

Status Meaning Description Schema
200 OK OK None
400 Bad Request Bad Request None
401 Unauthorized Unauthorized None
406 Not Acceptable Not Acceptable None
500 Internal Server Error Server Internal Error None

CoinGecko

CoinGecko's Ideal API Endpoints

Endpoint 1 - details on cryptoassets traded on an exchange.

Code samples

curl --request GET \
  --url https://dex.tomochain.com/api/coingecko/pairs
var http = require("https");

var options = {
  "method": "GET",
  "hostname": "dex.tomochain.com",
  "port": null,
  "path": "/api/coingecko/pairs",
  "headers": {}
};

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.end();
package main

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

func main() {

	url := "https://dex.tomochain.com/api/coingecko/pairs"

	req, _ := http.NewRequest("GET", url, nil)

	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'
require 'openssl'

url = URI("https://dex.tomochain.com/api/coingecko/pairs")

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

request = Net::HTTP::Get.new(url)

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

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

conn.request("GET", "/api/coingecko/pairs")

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

print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://dex.tomochain.com/api/coingecko/pairs")
  .asString();

GET /api/coingecko/pairs

The endpoint provides a summary on cryptoasset trading pairs available on the exchange.

Returns

Responses

Status Meaning Description Schema
200 OK OK None
400 Bad Request Bad Request None
401 Unauthorized Unauthorized None
406 Not Acceptable Not Acceptable None
500 Internal Server Error Server Internal Error None

Code samples

curl --request GET \
  --url https://dex.tomochain.com/api/coingecko/tickers
var http = require("https");

var options = {
  "method": "GET",
  "hostname": "dex.tomochain.com",
  "port": null,
  "path": "/api/coingecko/tickers",
  "headers": {}
};

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.end();
package main

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

func main() {

	url := "https://dex.tomochain.com/api/coingecko/tickers"

	req, _ := http.NewRequest("GET", url, nil)

	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'
require 'openssl'

url = URI("https://dex.tomochain.com/api/coingecko/tickers")

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

request = Net::HTTP::Get.new(url)

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

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

conn.request("GET", "/api/coingecko/tickers")

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

print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://dex.tomochain.com/api/coingecko/tickers")
  .asString();

GET /api/coingecko/tickers

The endpoint provides 24-hour pricing and volume information on each market pair available on an exchange.

Returns

Status Meaning Description Schema
200 OK OK None
400 Bad Request Bad Request None
401 Unauthorized Unauthorized None
406 Not Acceptable Not Acceptable None
500 Internal Server Error Server Internal Error None

Endpoint 3 - order book depth of any given trading pair, split into two different arrays for bid and ask orders.

Code samples

curl --request GET \
  --url 'https://dex.tomochain.com/api/coingecko/orderbook?ticker_id=TOMO_USDT'
var http = require("https");

var options = {
  "method": "GET",
  "hostname": "dex.tomochain.com",
  "port": null,
  "path": "/api/coingecko/orderbook?ticker_id=TOMO_USDT",
  "headers": {}
};

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.end();
package main

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

func main() {

	url := "https://dex.tomochain.com/api/coingecko/orderbook?ticker_id=TOMO_USDT"

	req, _ := http.NewRequest("GET", url, nil)

	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'
require 'openssl'

url = URI("https://dex.tomochain.com/api/coingecko/orderbook?ticker_id=TOMO_USDT")

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

request = Net::HTTP::Get.new(url)

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

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

conn.request("GET", "/api/coingecko/orderbook?ticker_id=TOMO_USDT")

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

print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://dex.tomochain.com/api/coingecko/orderbook?ticker_id=TOMO_USDT")
  .asString();

GET /api/coingecko/orderbook

The endpoint is to provide order book information with at least depth = 100 (50 each side) returned for a given market pair/ticker.

Returns

Parameters

Name In Type Required Description
ticker_id query string true A ticker such as "BTC_ETH", with delimiter between different cryptoassets
depth query integer false Orders depth quantity: [0, 100, 200, 500...]. 0 returns full depth. Depth = 100 means 50 for each bid/ask side.

Responses

Status Meaning Description Schema
200 OK OK None
400 Bad Request Bad Request None
401 Unauthorized Unauthorized None
406 Not Acceptable Not Acceptable None
500 Internal Server Error Server Internal Error None

Endpoint 4 - historical trade data for any given trading pair.

Code samples

curl --request GET \
  --url 'https://dex.tomochain.com/api/coingecko/historical_trades?ticker_id=TOMO_USDT&type=buy'
var http = require("https");

var options = {
  "method": "GET",
  "hostname": "dex.tomochain.com",
  "port": null,
  "path": "/api/coingecko/historical_trades?ticker_id=TOMO_USDT&type=buy",
  "headers": {}
};

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.end();
package main

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

func main() {

	url := "https://dex.tomochain.com/api/coingecko/historical_trades?ticker_id=TOMO_USDT&type=buy"

	req, _ := http.NewRequest("GET", url, nil)

	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'
require 'openssl'

url = URI("https://dex.tomochain.com/api/coingecko/historical_trades?ticker_id=TOMO_USDT&type=buy")

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

request = Net::HTTP::Get.new(url)

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

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

conn.request("GET", "/api/coingecko/historical_trades?ticker_id=TOMO_USDT&type=buy")

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

print(data.decode("utf-8"))
HttpResponse response = Unirest.get("https://dex.tomochain.com/api/coingecko/historical_trades?ticker_id=TOMO_USDT&type=buy")
  .asString();

GET /api/coingecko/historical_trades

The endpoint is used to return data on historical completed trades for a given market pair.

Returns

Parameters

Name In Type Required Description
ticker_id query string true A ticker such as "BTC_ETH", with delimiter between different cryptoassets
type query string true To indicate nature of trade - buy/sell
limit query integer false Number of historical trades to retrieve from time of query. [0, 200, 500...]. 0 returns full history.

Enumerated Values

Parameter Value
type buy
type sell

Responses

Status Meaning Description Schema
200 OK OK None
400 Bad Request Bad Request None
401 Unauthorized Unauthorized None
406 Not Acceptable Not Acceptable None
500 Internal Server Error Server Internal Error None