ePrivacy and GPDR Cookie Consent by Cookie Consent

Binance Smart Chain Documentation

Introduction

This API allows you to interact with the Binance Smart Chain including Binance COIn and BEP-20 tokens. If you ever looked for a possibility to automate token or BNB payments this is the right place.
You still have no idea for real use cases? Let me give you some examples: Accept your own BEP-20 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 and BNB but also receiving them. You could even create a secure wallet for your token which only the wallet owner has access to.

Postman

Postman collection and documentation will follow soon...

Tutorials

We wrote a few step-by-step tutorials with example code in PHP that might help you to work with our solution. Currently there is one tutorial for every request type.
Address Requests: Create BSC addresses
Transaction Requests: Send BEP-20 token transactions
Info Requests: Get BEP-20 token balances
IPN/Subscription Requests: Subscribe to BEP-20 token deposits

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.bsc.chaingateway.io/v1/{function}.

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

Parameters

Binancecoin Address

This is an Binancecoin address, which has 0x in front and 40 hexadecimal characters after it. CAUTION: If you send tokens, the receiving address must be BEP-20 compatible. So please don't use an exchange address.

Contract Address

The contract address is the binance smart chain contract address of the BEP-20 token you want to use. It has the same format as normal Binancecoin addresses.

Amount

We want amounts to be in normal decimal format and as string. If you want to send 2.5 BNB, use "2.5". If you want to send 1 million tokens, use "1000000". If you are not sure how many decimals a token has, you can use the getToken function. We decided to use amounts in string format to support up to 18 decimals with perfect precision.

Password

Whenever you create a new Binancecoin address, you need to specify a password for it. This password is used for all transactions you are doing with this address. We don't save this password on our end, so please don't lose it.

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. Sensitive data, especially keystores are being saved only with really strong and military proof encryption. But even if someone would get control over our systems, your funds would still be save. Like you can see above, every Binancecoin address needs a password 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 passwords in a safe way, attackers may be able to steal funds from your addresses. (They would still need your API Key however)

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 miners to include your transaction in a block. So please make sure there are always enough Binance coins on the address you are sending tokens or BNB from. The exact fee which is used is determined by the average gas fee at that time (If not specified otherwise).

Receiving Subscriptions/IPNs

Once we detect a balance update in one of your subscriptions, we will delay a JSON formatted call to the URL you provided. You will need to return {"ok": true} in JSON format after receiving so our system knows you received the call successfully. If you don't return ok, we will try to send the call again 10 times within 10 minutes.

Here is an explanation of the parameters we send you:

Parameter Type Explanation Example
id integer The unique ID of the IPN 141854
action string Either "withdraw" or "deposit" deposit
type string Either "ETH" or "BEP-20" ETH
binancecoinaddress string The BSC address you subscribed to 0xa1f36016221d48ce7f15cde7b826a4fbe09bacce
contractaddress string Token smart contract address (BEP-20). 0x5b86a33f0c232fe909eb4602a9d039072869d915
amount string Amount received/sent 0.0464537
timestamp string Date and time of the IPN 2021-08-30 15:15:39

An example of a call would look like this:

{"id": 141854, "action": "deposit", "type": "BEP-20", "binancecoinaddress": "0xa1f36016221d48ce7f15cde7b826a4fbe09bacce", "contractaddress": "0x5b86a33f0c232fe909eb4602a9d039072869d915", "amount": "0.0464537", "timestamp": "2021-08-30 15:15:39"}

getToken

Endpoint:
https://eu.bsc.chaingateway.io/v1/getToken

HTTP Method: POST


Parameter Explanation Example
contractaddress B