To send or receive ERC-20 tokens, you need an address that is compatible with the Tron blockchain. Of course, most people use their wallets to send TRC20 tokens. But what if you need to make hundreds of thousands of transactions? In this case, you need a better way to send TRC20 tokens in an automated way. We have written a detailed tutorial for this purpose. Read more.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import requests
import json
############################
# Replace with your Values #
############################
apikey = "YOURAPIKEY"; # API Key in your account panel
contractaddress = "CONTRACTADDRESS"; # Smart contract address of the Token
from = "SENDERADDRESS"; # Tron address you want to send from (must have been created with Chaingateway.io)
to = "RECEIVERADDRESS"; # Receiving tron address
password = "PASSWORD"; # Password of the tron address (which you specified when you created the address)
amount = 55.89; # Amount of Tokens to send
url = "https://api.chaingateway.io/v2/tron/transactions/trc20"
payload = json.dumps({"contractaddress": contractaddress, "from": from,"to": to,"password": password, "amount": amount})
headers = {
'Accept': 'application/json',
'Authorization': apikey
}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
Replace “YOURAPIKEY” of above code with the API Key in your Chaingateway.io Account Panel. Replace “CONTRACTADDRESS” with the smart contract address of the Token. Replace “SENDERADDRESS” with the tron address you want to send from. Replace “RECEIVERADDRESS” with the receiving tron address Replace “PASSWORD” with your password of the tron address, which you specified when you created the address. Replace “55.89” with the amount of Tokens you want to send.
Congratulations! You just sent TRC20 Tokens using Chaingateway.io. Wasn’t that hard, right?