Documentation for Tron, TRC10 and TRC20

Introduction

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

Tutorials

We wrote a few step-by-step tutorials with example code in PHP that might help you to work with our solution. Currently we only have tutorials for ethereum, but we will create separate ones for Tron in the near future. You can still adapt the code to work with Tron.
Address Requests: Create addresses
Transaction Requests: Send transactions
Info Requests: Get balances
IPN/Subscription Requests: Create IPNs/Subscriptions

API Requests

All Requests to our API are made in JSON format using HTTP POST. We will also return everything in JSON format. The Europe API endpoint is located at https://eu.trx.chaingateway.io/v1/{function}. We may release endpoints for other locations if needed.

API Key

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. There are 2 possibilities to use it in your requests:

  1. Add it to the JSON body in your request, like
    "apikey": "q9PdaWuD4j6DK6vsUgehhL8pgarSrS9m". This is not recommended!
  2. Add it in the HTTP header as
    'Authorization: q9PdaWuD4j6DK6vsUgehhL8pgarSrS9m'. This is way more secure and may be the only option in future versions.
Please do not share your api key! If you did so by mistake, immediately regenerate it in your account panel!

Parameters

Tron Address

This is a Tron address, which is a string in Base58 format and 34 characters long. CAUTION: If you send TRC10 or TRC20 tokens, the receiving address must be compatible with that token. So please don't use an exchange address.

Contract Address

The contract address is the tron smart contract address of the TRC20 token you want to use. It has the same format as normal Tron addresses.

Token ID

Every TRC10 token has a unique token id. We require it in integer format.

Amount

We want amounts to be strings in decimal format. If you want to send 2.5 TRX, use "2.5". If you want to send 1 million tokens, use "1000000". We require this parameter in string format to allow up to 18 decimals without inaccuracies. We will return amounts in string format for the same reason.

Private Key

Whenever you create a new Tron address, you will get a private key which is related to the address. This key allows you to send Tron, TRC10 and TRC20 tokens from the created address. Do not share or lose it! It is recommended to generate private keys offline for security reasons.

Security

Our API is very secure. The Nodes are not hosted on the same machine as the API endpoint. Also, they are not using the standard port and have a few proxies running in front. They are protected with a few firewalls, ddos protection and breach detection, too. We also have protected our endpoint and nodes against bruteforce. But even if someone would get control over our systems, your funds would still be save. Like you can see above, every Tron address needs a private key for transactions. Without it, the funds can't be accessed. This means our system is as secure as your application. If you don't secure your system and don't store the private keys in a safe way, attackers may be able to steal funds from your addresses.

Fees

We are charging on a monthly plan basis if you use our API. You can see the exact pricing and request amounts here. There are also transaction fees, which go to the Tron network to include your transaction in a block. So please make sure there is always enough Tron (or bandwidth/energy) on the address you are sending tokens or Tron from.

newAddress

Endpoint:
https://eu.trx.chaingateway.io/v1/newAddress

HTTP Method: POST


Parameter Type Explanation Example
apikey string Your API Key q9PdaWuD4j6DK6vsUgehhL8pgarSrS9m

Example Request JSON:
{"apikey": "q9PdaWuD4j6DK6vsUgehhL8pgarSrS9m"}

Example Response JSON:
{"ok":true,"privatekey":"e03f50b1783026637bfeec27869d68a850ae664ecdbdd2e6438e18cda98a77a0","address":"TQDhtyJJnWqgbGLKB79Ns5XaNGqhhQXgBX","hexaddress":"419c4fb46e187bb60d9ea00fa74087ade960a9eaac"}

getTronBalance

Endpoint:
https://eu.trx.chaingateway.io/v1/getTronBalance

HTTP Method: POST


Parameter Type Explanation Example
tronaddress string (Base58) Tron address you want to get the balance of TWQiHuVugyFSWDnBh2ytFPaXtGskHt3iyB
apikey string Your API Key q9PdaWuD4j6DK6vsUgehhL8pgarSrS9m

Example Request JSON:
{"tronaddress": "TWQiHuVugyFSWDnBh2ytFPaXtGskHt3iyB", "apikey": "q9PdaWuD4j6DK6vsUgehhL8pgarSrS9m"}

Example Response JSON:
{"ok": true, "tronaddress": "TWQiHuVugyFSWDnBh2ytFPaXtGskHt3iyB", "balance": "1.346912"}

getTRC10Balance

Endpoint:
https://eu.trx.chaingateway.io/v1/getTRC10Balance

HTTP Method: POST


Parameter Type Explanation Example
tokenid integer Token id of the TRC10 token 1003134
tronaddress string (Base58) Tron address you want to get the balance of TWQiHuVugyFSWDnBh2ytFPaXtGskHt3iyB
apikey string Your API Key q9PdaWuD4j6DK6vsUgehhL8pgarSrS9m

Example Request JSON:
{"tokenid": 1003134, "tronaddress": "TWQiHuVugyFSWDnBh2ytFPaXtGskHt3iyB", "apikey": "q9PdaWuD4j6DK6vsUgehhL8pgarSrS9m"}

Example Response JSON:
{"ok": true, "tronaddress": "TWQiHuVugyFSWDnBh2ytFPaXtGskHt3iyB", "tokenid": 1003134, "decimals": 6, "balance": "150790.630960"}

getTRC20Balance

Endpoint:
https://eu.trx.chaingateway.io/v1/getTRC20Balance

HTTP Method: POST


Parameter Type Explanation Example
contractaddress string (Base58) Contractaddress of the TRC20 token TLa2f6VPqDgRE67v1736s7bJ8Ray5wYjU7
tronaddress string (Base58) Tron address you want to get the balance of TWQiHuVugyFSWDnBh2ytFPaXtGskHt3iyB
apikey string Your API Key q9PdaWuD4j6DK6vsUgehhL8pgarSrS9m

Example Request JSON:
{"contractaddress": "TLa2f6VPqDgRE67v1736s7bJ8Ray5wYjU7", "tronaddress": "TWQiHuVugyFSWDnBh2ytFPaXtGskHt3iyB", "apikey": "q9PdaWuD4j6DK6vsUgehhL8pgarSrS9m"}

Example Response JSON:
{"ok": true, "tronaddress": "TWQiHuVugyFSWDnBh2ytFPaXtGskHt3iyB", "contractaddress": "TLa2f6VPqDgRE67v1736s7bJ8Ray5wYjU7", "decimals": 6, "balance": "1206.166463"}

getExchangeRate

Endpoint:
https://eu.trx.chaingateway.io/v1/getExchangeRate

HTTP Method: POST


Parameter Type Explanation Example
apikey string Your API Key q9PdaWuD4j6DK6vsUgehhL8pgarSrS9m
currency string eur or usd eur

Example Request JSON:
{"apikey": "q9PdaWuD4j6DK6vsUgehhL8pgarSrS9m", "currency": "eur"}

Example Response JSON:
{"ok": true, "currency": "eur", "rate": 0.02421938}

subscribeAddress

Endpoint:
https://eu.trx.chaingateway.io/v1/subscribeAddress

HTTP Method: POST


Parameter Type Explanation Example
apikey string Your API Key q9PdaWuD4j6DK6vsUgehhL8pgarSrS9m
tronaddress string (Base58) The tron address you want to watch TWQiHuVugyFSWDnBh2ytFPaXtGskHt3iyB
contractaddress string (Base58) (Optional) Contractaddress of the TRC20 token you want to watch (Will watch TRON/TRX by default) TLa2f6VPqDgRE67v1736s7bJ8Ray5wYjU7
tronid integer (Optional) Tokenid of the TRC10 token you want to watch (Will watch TRON/TRX by default). 1003134
url string The URL you want to receive notifications on. https://yoururl.com/ipnreceiver.php

Example Request JSON:
{"apikey": "q9PdaWuD4j6DK6vsUgehhL8pgarSrS9m","tronaddress": "TWQiHuVugyFSWDnBh2ytFPaXtGskHt3iyB", "contractaddress": "TLa2f6VPqDgRE67v1736s7bJ8Ray5wYjU7", "url": "https://yoururl.com/ipnreceiver.php"}

Example Response JSON:
{"ok":true, "tronaddress": "TWQiHuVugyFSWDnBh2ytFPaXtGskHt3iyB", "contractaddress": "TLa2f6VPqDgRE67v1736s7bJ8Ray5wYjU7", "url": "https://yoururl.com/ipnreceiver.php"}

unsubscribeAddress

Endpoint:
https://eu.trx.chaingateway.io/v1/unsubscribeAddress

HTTP Method: POST


Parameter Type Explanation Example
apikey string Your API Key q9PdaWuD4j6DK6vsUgehhL8pgarSrS9m
tronaddress string (Base58) The tron address you want to watch TWQiHuVugyFSWDnBh2ytFPaXtGskHt3iyB
contractaddress string (Base58) (Optional) Contractaddress of the TRC20 token you want to watch (Will watch TRON/TRX by default) TLa2f6VPqDgRE67v1736s7bJ8Ray5wYjU7
tronid integer (Optional) Tokenid of the TRC10 token you want to watch (Will watch TRON/TRX by default). 1003134
url string The URL you want to receive notifications on. https://yoururl.com/ipnreceiver.php

Example Request JSON:
{"apikey": "q9PdaWuD4j6DK6vsUgehhL8pgarSrS9m","tronaddress": "TWQiHuVugyFSWDnBh2ytFPaXtGskHt3iyB", "contractaddress": "TLa2f6VPqDgRE67v1736s7bJ8Ray5wYjU7", "url": "https://yoururl.com/ipnreceiver.php"}

Example Response JSON:
{"ok":true, "tronaddress": "TWQiHuVugyFSWDnBh2ytFPaXtGskHt3iyB", "contractaddress": "TLa2f6VPqDgRE67v1736s7bJ8Ray5wYjU7", "url": "https://yoururl.com/ipnreceiver.php", "deleted": true}

listSubscribedAddresses

Endpoint:
https://eu.trx.chaingateway.io/v1/listSubscribedAddresses

HTTP Method: POST


Parameter Type Explanation Example
apikey string Your API Key q9PdaWuD4j6DK6vsUgehhL8pgarSrS9m

Example Request JSON:
{"apikey": "q9PdaWuD4j6DK6vsUgehhL8pgarSrS9m"}

Example Response JSON:
{"ok":true,"ipns":[{"tronaddress": "TWQiHuVugyFSWDnBh2ytFPaXtGskHt3iyB", "contractaddress": "TLa2f6VPqDgRE67v1736s7bJ8Ray5wYjU7", "url": "https://yoururl.com/ipnreceiver.php"}]}

listFailedIPNs

Endpoint:
https://eu.trx.chaingateway.io/v1/listFailedIPNs

HTTP Method: POST


Parameter Type Explanation Example
apikey string Your API Key q9PdaWuD4j6DK6vsUgehhL8pgarSrS9m

Example Request JSON:
{"apikey": "q9PdaWuD4j6DK6vsUgehhL8pgarSrS9m"}

Example Response JSON:
{"ok":true,"failed_ipns":[{"id":"182659","timestamp":"2019-12-18 17:14:36","tronaddress":"TWQiHuVugyFSWDnBh2ytFPaXtGskHt3iyB", "contractaddress": "TLa2f6VPqDgRE67v1736s7bJ8Ray5wYjU7","amount":"1.567393", "url":"https:\/\/yoururl.com/ipnreceiver.php","action":"withdraw"}]}

resendFailedIPN

Endpoint:
https://eu.trx.chaingateway.io/v1/resendFailedIPN

HTTP Method: POST


Parameter Type Explanation Example
apikey string Your API Key q9PdaWuD4j6DK6vsUgehhL8pgarSrS9m
id integer ID of the IPN to send again 182659

Example Request JSON:
{"apikey": "q9PdaWuD4j6DK6vsUgehhL8pgarSrS9m", "id": 182659}

Example Response JSON:
{"ok":true, "id": 182659}

sendTron

Endpoint:
https://eu.trx.chaingateway.io/v1/sendTron

HTTP Method: POST


Parameter Type Explanation Example
to string (Base58) Tron address you want to send to TWQiHuVugyFSWDnBh2ytFPaXtGskHt3iyB
privatekey string (Hex) Privatekey of the sender address e03f50b1783026637bfeec27869d68a850ae664ecdbdd2e6438e18cda98a77a0
amount string Amount of Tron/TRX you want to send 1.572945
apikey string Your API Key q9PdaWuD4j6DK6vsUgehhL8pgarSrS9m

Example Request JSON:
{"to": "TWQiHuVugyFSWDnBh2ytFPaXtGskHt3iyB", "privatekey": "e03f50b1783026637bfeec27869d68a850ae664ecdbdd2e6438e18cda98a77a0", "amount": "1.572945", "apikey": "q9PdaWuD4j6DK6vsUgehhL8pgarSrS9m"}

Example Response JSON:
{"txid": "f4935c8af33fd68ddcf6190d1ee8858159541c54e3b3e931c3a1f1fc4c02b0be", "to": "TWQiHuVugyFSWDnBh2ytFPaXtGskHt3iyB", "from": "TWQiHuVugyFSWDnBh2ytFPaXtGskHt3iyB", "amount": "1.572945"}

sendTRC10

Endpoint:
https://eu.trx.chaingateway.io/v1/sendTRC10

HTTP Method: POST


Parameter Type Explanation Example
tokenid integer Token id of the TRC10 token 1003134
to string (Base58) Tron address you want to send to TWQiHuVugyFSWDnBh2ytFPaXtGskHt3iyB
privatekey string (Hex) Privatekey of the sender address e03f50b1783026637bfeec27869d68a850ae664ecdbdd2e6438e18cda98a77a0
amount string Amount of TRC10 tokens you want to send 1.572945
apikey string Your API Key q9PdaWuD4j6DK6vsUgehhL8pgarSrS9m

Example Request JSON:
{"tokenid": 1003134, "to": "TWQiHuVugyFSWDnBh2ytFPaXtGskHt3iyB", "privatekey": "e03f50b1783026637bfeec27869d68a850ae664ecdbdd2e6438e18cda98a77a0", "amount": "1.572945", "apikey": "q9PdaWuD4j6DK6vsUgehhL8pgarSrS9m"}

Example Response JSON:
{"txid": "f4935c8af33fd68ddcf6190d1ee8858159541c54e3b3e931c3a1f1fc4c02b0be", "tokenid": 1003134, "decimals": 6, "to": "TWQiHuVugyFSWDnBh2ytFPaXtGskHt3iyB", "from": "TWQiHuVugyFSWDnBh2ytFPaXtGskHt3iyB", "amount": "1.572945"}

sendTRC20

Endpoint:
https://eu.trx.chaingateway.io/v1/sendTRC20

HTTP Method: POST


Parameter Type Explanation Example
contractaddress string (Base58) Contract address of the TRC20 token TLa2f6VPqDgRE67v1736s7bJ8Ray5wYjU7
from string (Base58) Tron address you want to send from TWQiHuVugyFSWDnBh2ytFPaXtGskHt3iyB
to string (Base58) Tron address you want to send to TWQiHuVugyFSWDnBh2ytFPaXtGskHt3iyB
privatekey string (Hex) Privatekey of the sender address e03f50b1783026637bfeec27869d68a850ae664ecdbdd2e6438e18cda98a77a0
amount string Amount of TRC20 tokens you want to send 1.572945
apikey string Your API Key q9PdaWuD4j6DK6vsUgehhL8pgarSrS9m

Example Request JSON:
{"contractaddress": "TLa2f6VPqDgRE67v1736s7bJ8Ray5wYjU7", "from": "TWQiHuVugyFSWDnBh2ytFPaXtGskHt3iyB", "to": "TWQiHuVugyFSWDnBh2ytFPaXtGskHt3iyB", "privatekey": "e03f50b1783026637bfeec27869d68a850ae664ecdbdd2e6438e18cda98a77a0", "amount": "1.572945", "apikey": "q9PdaWuD4j6DK6vsUgehhL8pgarSrS9m"}

Example Response JSON:
{"txid": "f4935c8af33fd68ddcf6190d1ee8858159541c54e3b3e931c3a1f1fc4c02b0be", "contractaddress": "TLa2f6VPqDgRE67v1736s7bJ8Ray5wYjU7", "decimals": 6, "to": "TWQiHuVugyFSWDnBh2ytFPaXtGskHt3iyB", "from": "TWQiHuVugyFSWDnBh2ytFPaXtGskHt3iyB", "amount": "1.572945"}

freezeBalance

Endpoint:
https://eu.trx.chaingateway.io/v1/freezeBalance

HTTP Method: POST


Parameter Type Explanation Example
tronaddress string (Base58) Tron address to freeze balance of TWQiHuVugyFSWDnBh2ytFPaXtGskHt3iyB
amount string Amount of Tron to freeze 1.572945
duration integer Duration in days to freeze Tron (minimum 3) 3
type string Resource type to freeze Tron for. Either 'BANDWIDTH' or 'ENERGY' ENERGY
to string (Base58) (Optional) Tron address which receives the resources. Will use tronaddress if not provided. TWQiHuVugyFSWDnBh2ytFPaXtGskHt3iyB
privatekey string (Hex) Privatekey of the sender address e03f50b1783026637bfeec27869d68a850ae664ecdbdd2e6438e18cda98a77a0
apikey string Your API Key q9PdaWuD4j6DK6vsUgehhL8pgarSrS9m

Example Request JSON:
{"tronaddress": "TWQiHuVugyFSWDnBh2ytFPaXtGskHt3iyB", "amount": "1.572945", "duration": 3, "type": "ENERGY", "privatekey": "e03f50b1783026637bfeec27869d68a850ae664ecdbdd2e6438e18cda98a77a0", "apikey": "q9PdaWuD4j6DK6vsUgehhL8pgarSrS9m"}

Example Response JSON:
{"ok": true, txid": "78fc104859094c29becb884e8fba1ada974dbe5dd5014052d954a577dbb03be9", "tronaddress": "TWQiHuVugyFSWDnBh2ytFPaXtGskHt3iyB", "amount": "1.572945", "duration": 3, "type": "ENERGY", "to": NULL}

unfreezeBalance

Endpoint:
https://eu.trx.chaingateway.io/v1/unfreezeBalance

HTTP Method: POST


Parameter Type Explanation Example
tronaddress string (Base58) Tron address to unfreeze Tron of TWQiHuVugyFSWDnBh2ytFPaXtGskHt3iyB
type string Resource type to unfreeze Tron for. Either 'BANDWIDTH' or 'ENERGY' ENERGY
to string (Base58) (Optional) Tron address which will lose the resources. Will use tronaddress if not provided. TWQiHuVugyFSWDnBh2ytFPaXtGskHt3iyB
privatekey string (Hex) Privatekey of the sender address e03f50b1783026637bfeec27869d68a850ae664ecdbdd2e6438e18cda98a77a0
apikey string Your API Key q9PdaWuD4j6DK6vsUgehhL8pgarSrS9m

Example Request JSON:
{"tronaddress": "TWQiHuVugyFSWDnBh2ytFPaXtGskHt3iyB", "type": "ENERGY", "privatekey": "e03f50b1783026637bfeec27869d68a850ae664ecdbdd2e6438e18cda98a77a0", "apikey": "q9PdaWuD4j6DK6vsUgehhL8pgarSrS9m"}

Example Response JSON:
{"ok": true, txid": "78fc104859094c29becb884e8fba1ada974dbe5dd5014052d954a577dbb03be9", "tronaddress": "TWQiHuVugyFSWDnBh2ytFPaXtGskHt3iyB", "type": "ENERGY", "to": NULL}