Chaingateway public API (2.0.0-beta)

Download OpenAPI specification:Download

Blockchain API to build the bridge between Blockchain and the real world

Introduction

This API allows you to interact with Ethereum, Binance smartchain and Tron blockchain. If you ever looked for a possibility to automate token or payments this is the right place. You still have no idea for real use cases? Let me give you some examples: Accept your own token as payment method for your shop, distribute airdrop tokens of your ICO, convert your site currency to a token that can be traded on exchanges and many more. There are a lot of use cases which are not only limited to sending tokens but also receiving them. You could even create a secure wallet for your token which only the wallet owner has access to.

Endpoints

At the moment we only have an production endpoint. Its reachable at

api.chaingateway.io

Postman

Postman is a great software to test APIs, it helped us a lot when developing this API. If you haven't installed it yet, you can download it here. We have created a Postman collection that allows to import all functions and their settings, including descriptions in Postman. This way you can test all functions with the click of a button (just change the parameters before). You can import the collection by clicking the button below:

Run in Postman

Authorization

You can get your personal API Key from your account dashboard. It is used by us to determine who is accessing the API and to count the requests by that account. Add it in the HTTP header

Authorization: q9PdaWuD4j6DK6vsUgehhL8pgarSrS9m

Please do not share your api key! If you did so by mistake, immediately delete it in your account panel and create a new one!

Ethereum

Ethereum > Info Requests

getLastBlockNumber

Get the latest block number

Authorizations:
apikeyAuth
header Parameters
Accept
string
Example: application/json
Authorization
string
Example: {{api_key}}

Responses

Request samples

const request = require('request');

const options = {
  method: 'GET',
  url: 'https://api.chaingateway.io/v2/ethereum/blocks/number',
  headers: {Accept: 'SOME_STRING_VALUE', Authorization: 'SOME_STRING_VALUE'}
};

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});

Response samples

Content type
application/json
{
  • "ok": true,
  • "status": 200,
  • "message": "Successfully parsed",
  • "data": {
    }
}

getERC20

Get information about an ERC20 token

Authorizations:
apikeyAuth
path Parameters
erc20_token
required
string
Example: 0xa1f36016221d48ce7f15cde7b826a4fbe09bacce

An ERC20 token address

Responses

Request samples

const request = require('request');

const options = {
  method: 'GET',
  url: 'https://api.chaingateway.io/v2/ethereum/erc20/0xa1f36016221d48ce7f15cde7b826a4fbe09bacce'
};

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});

Response samples

Content type
application/json
{
  • "ok": true,
  • "status": 200,
  • "message": "Success! ERC20 Token has been successfully parsed.",
  • "data": {
    }
}

getGasPrice

Get gas price

Authorizations:
apikeyAuth
header Parameters
Accept
string
Example: application/json
Authorization
string
Example: APIKEY

Responses

Request samples

const request = require('request');

const options = {
  method: 'GET',
  url: 'https://api.chaingateway.io/v2/ethereum/gasprice',
  headers: {Accept: 'SOME_STRING_VALUE', Authorization: 'SOME_STRING_VALUE'}
};

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});

Response samples

Content type
application/json
{
  • "ok": true,
  • "status": 200,
  • "message": "Successfully parsed",
  • "data": {
    }
}

getEthereumBalance

Get the balance of an address

Authorizations:
apikeyAuth
path Parameters
address
required
string
Example: 0xa1f36016221d48ce7f15cde7b826a4fbe09bacce

Ethereum address

header Parameters
Accept
string
Example: application/json

Responses

Request samples

const request = require('request');

const options = {
  method: 'GET',
  url: 'https://api.chaingateway.io/v2/ethereum/balances/0xa1f36016221d48ce7f15cde7b826a4fbe09bacce',
  headers: {Accept: 'SOME_STRING_VALUE'}
};

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});

Response samples

Content type
application/json
{
  • "ok": true,
  • "status": 200,
  • "message": "Ethereum address balance successfully parsed.",
  • "data": {
    }
}

getAllERC20Balance

Get the balance of an ERC20 address

Authorizations:
apikeyAuth
path Parameters
address
required
string
Example: 0xa1f36016221d48ce7f15cde7b826a4fbe09bacce
erc20_token
required
string
Example: 0xa1f36016221d48ce7f15cde7b826a4fbe09bacce
header Parameters
Accept
string
Example: application/json

Responses

Request samples

const request = require('request');

const options = {
  method: 'GET',
  url: 'https://api.chaingateway.io/v2/ethereum/balances/0xa1f36016221d48ce7f15cde7b826a4fbe09bacce/erc20/0xa1f36016221d48ce7f15cde7b826a4fbe09bacce',
  headers: {Accept: 'SOME_STRING_VALUE'}
};

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});

Response samples

Content type
application/json
{
  • "ok": true,
  • "status": 200,
  • "message": "Token Balance has been successfully parsed.",
  • "data": {
    }
}

getBlock

Get information of a specific block

Authorizations:
apikeyAuth
path Parameters
block
required
string
Example: 0xd9186b67ae0d3ee0777a607eeb195c5a9fb0affcd78ddcd7481efae4b258c9f5

Block number or hash

header Parameters
Accept
string
Example: application/json

Responses

Request samples

const request = require('request');

const options = {
  method: 'GET',
  url: 'https://api.chaingateway.io/v2/ethereum/blocks/0xd9186b67ae0d3ee0777a607eeb195c5a9fb0affcd78ddcd7481efae4b258c9f5',
  headers: {Accept: 'SOME_STRING_VALUE'}
};

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});

Response samples

Content type
application/json
{
  • "ok": true,
  • "status": 200,
  • "message": "Successfully parsed the block.",
  • "data": [
    ]
}

getNFTUri

Get the URI of an NFT

Authorizations:
apikeyAuth
path Parameters
contract
required
string
Example: 0x9db475371b5cc2913d3219f72e16a3f101339a05

NFT contract address

token_id
required
integer
Example: 374

Id of the NFT

header Parameters
Accept
string
Example: application/json

Responses

Request samples

const request = require('request');

const options = {
  method: 'GET',
  url: 'https://api.chaingateway.io/v2/ethereum/nfts/0x9db475371b5cc2913d3219f72e16a3f101339a05/uri/374',
  headers: {Accept: 'SOME_STRING_VALUE'}
};

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});

Response samples

Content type
application/json
{}

getNFTOwner

Get the Owner of an NFT

Authorizations:
apikeyAuth
path Parameters
contract
required
string
Example: 0x9db475371b5cc2913d3219f72e16a3f101339a05

NFT contract address

token_id
required
integer
Example: 374

Id of the NFT

header Parameters
Accept
string
Example: application/json

Responses

Request samples

const request = require('request');

const options = {
  method: 'GET',
  url: 'https://api.chaingateway.io/v2/ethereum/nfts/0x9db475371b5cc2913d3219f72e16a3f101339a05/owner/374',
  headers: {Accept: 'SOME_STRING_VALUE'}
};

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});

Response samples

Content type
application/json
{
  • "ok": true,
  • "status": 200,
  • "message": "NFT Owner has been successfully parsed.",
  • "data": {
    }
}

getTransaction

Get info about a transaction

You can choose if you want to get the Transaction encoded or decoded by add /decoded to your request. See examlpes for details

Authorizations:
apikeyAuth
path Parameters
transaction
required
string
Example: 0x0b361c13214a0d498b69d6ea86039fdf8e578f4b6e3b28db52a422f8ed3ea037

Transaction hash

header Parameters
Accept
string
Example: application/json

Responses

Request samples

const request = require('request');

const options = {
  method: 'GET',
  url: 'https://api.chaingateway.io/v2/ethereum/transactions/0x0b361c13214a0d498b69d6ea86039fdf8e578f4b6e3b28db52a422f8ed3ea037/decoded',
  headers: {Accept: 'SOME_STRING_VALUE'}
};

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});

Response samples

Content type
application/json
Example
{
  • "ok": true,
  • "status": 200,
  • "message": "Successfully parsed transactionReceipt",
  • "data": [
    ]
}

getTransactionReceipt

Get info about a transaction receipt

You can choose if you want to get the Transaction encoded or decoded by add /decoded to your request. See examlpes for details

Authorizations:
apikeyAuth
path Parameters
transaction
required
string
Example: 0x0b361c13214a0d498b69d6ea86039fdf8e578f4b6e3b28db52a422f8ed3ea037

Transaction hash

header Parameters
Accept
string
Example: application/json

Responses

Request samples

const request = require('request');

const options = {
  method: 'GET',
  url: 'https://api.chaingateway.io/v2/ethereum/transactions/0x0b361c13214a0d498b69d6ea86039fdf8e578f4b6e3b28db52a422f8ed3ea037/receipt/decoded',
  headers: {Accept: 'SOME_STRING_VALUE'}
};

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});

Response samples

Content type
application/json
Example
{
  • "ok": true,
  • "status": 200,
  • "message": "Successfully parsed transactionReceipt",
  • "data": [
    ]
}

Ethereum > Address Requests

newAddress

Authorizations:
apikeyAuth
header Parameters
Accept
string
Example: application/json
Request Body schema: application/json
object

Responses

Request samples

Content type
application/json
{
  • "password": "test123"
}

Response samples

Content type
application/json
{
  • "ok": true,
  • "status": 200,
  • "message": "Success! Ethereum Address was successfully created.",
  • "data": {
    }
}

listAddresses

Authorizations:
apikeyAuth
header Parameters
Accept
string
Example: application/json

Responses

Request samples

const request = require('request');

const options = {
  method: 'GET',
  url: 'https://api.chaingateway.io/v2/ethereum/addresses',
  headers: {Accept: 'SOME_STRING_VALUE'}
};

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});

Response samples

Content type
application/json
{
  • "ok": true,
  • "status": 200,
  • "message": "Success! Ethereum Addresses has been successfully parsed.",
  • "data": {
    }
}

deleteAddress

Authorizations:
apikeyAuth
path Parameters
address
required
string
Example: 0xfa343ee01667869cfb409b24ae33f7ce8b110eb0

Ethereum address

header Parameters
Accept
string
Example: application/json

Responses

Request samples

const request = require('request');

const options = {
  method: 'DELETE',
  url: 'https://api.chaingateway.io/v2/ethereum/addresses/0xfa343ee01667869cfb409b24ae33f7ce8b110eb0',
  headers: {Accept: 'SOME_STRING_VALUE'}
};

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});

Response samples

Content type
application/json
{
  • "ok": true,
  • "status": 200,
  • "message": "Success! Ethereum Address has been successfully deleted.",
  • "data": {
    }
}

importAddress

Authorizations:
apikeyAuth
header Parameters
Accept
string
Example: application/json
Request Body schema: application/json
object

Responses

Request samples

Content type
application/json
{
  • "filename": "UTC--2020-09-19T10-42-26.196Z--71892889ed4d79d88ab6ea3783b571b8ece9bef4",
  • "content": {
    },
  • "password": "padN39QkRA2hJ"
}

Response samples

Content type
application/json
{
  • "ok": true,
  • "status": 200,
  • "message": "Success! Ethereum address has been successfully imported.",
  • "data": {
    }
}

exportAddress

Authorizations:
apikeyAuth
path Parameters
address
required
string
Example: 0xacc767f4042360c5f08c7b98bac8e66a5c679cef

0xe7114f0dbd5a5fa62ed2df905f7391c957ff9e36

header Parameters
Accept
string
Example: application/json
Request Body schema: application/json
object

Responses

Request samples

Content type
application/json
{
  • "password": "test123"
}

Response samples

Content type
application/json
{
  • "ok": true,
  • "status": 200,
  • "message": "Success! Ethereum address has been successfully exported.",
  • "data": {
    }
}

ListTransactionsByAddress

Our API provides an endpoint for retrieving all transactions associated with a particular blockchain address. To use this endpoint, you will need to provide the wallet address as a parameter in the request.

Each page of results returned by this endpoint contains up to 100 entries, and you can use a paginator to navigate through the pages of results.

To use the paginator, you can include parameter in your request: "page" . The "page" parameter specifies which page of results to retrieve,

For example, to retrieve the first 100 transactions associated with a particular blockchain address, you would make a request to the following URL:

/addresses//transactions/1

If there are more than 100 transactions associated with the blockchain address, you can retrieve additional pages of results by incrementing the "page" parameter in your request. For example, to retrieve the next 100 transactions, you would make a request to the following URL:

/addresses//transactions/2

By using the paginator, you can retrieve all transactions associated with a particular blockchain address, regardless of the total number of transactions in the blockchain.

each request tells you the max pages within the Request in the max_pages field

"max_pages": 515

Authorizations:
apikeyAuth
path Parameters
address
required
string
Example: 0xDAFEA492D9c6733ae3d56b7Ed1ADB60692c98Bc5

account address

page
required
integer
Example: 1

Current page, see description for more informatiosn how pagination works

Responses

Request samples

const request = require('request');

const options = {
  method: 'GET',
  url: 'https://api.chaingateway.io/v2/ethereum/addresses/0xDAFEA492D9c6733ae3d56b7Ed1ADB60692c98Bc5/transactions/1'
};

request(options, function (error, response, body) {
  if (error) throw new Error(error);

  console.log(body);
});

Response samples

Content type
application/json
{
  • "ok": true,
  • "status": 200,
  • "message": "Success! Ethereum Addresses has been successfully parsed.",
  • "data": {