Last active
October 14, 2024 15:31
-
-
Save sh4dowb/43ed4839acdd81a36e1418379111d8ea to your computer and use it in GitHub Desktop.
tronapi python mass USDT payment - send mass USDT payments with python
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
from tronapi import Tron | |
full_node = 'https://api.trongrid.io' | |
solidity_node = 'https://api.trongrid.io' | |
event_server = 'https://api.trongrid.io' | |
pkey = "private_key_hex" | |
payments = [ | |
["150", "T1...."], | |
["50.25", "T2..."], | |
] | |
# USDT amount, address | |
tron = Tron(full_node=full_node, | |
solidity_node=solidity_node, | |
event_server=event_server) | |
tron.private_key = pkey | |
tron.default_address = tron.address.from_private_key(pkey).base58 | |
for payment_amount,payment_address in payments: | |
trx_kwargs = dict() | |
trx_kwargs["private_key"] = pkey | |
trx_kwargs["default_address"] = tron.address.from_private_key(pkey).base58 | |
tron = Tron(**trx_kwargs) | |
kwargs = dict() | |
kwargs["contract_address"] = tron.address.to_hex("TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t") # USDT contract address | |
kwargs["function_selector"] = "transfer(address,uint256)" # function to call and types. for reference on tronscan it looks like this: transfer(address _to,uint256 _value) | |
kwargs["fee_limit"] = 5000000 # fee limit in tron (5 TRX here) | |
kwargs["call_value"] = 0 # how much tron to send to the contract (always keep this zero for transferring tokens) | |
payment_amount = int(float(payment_amount)) | |
kwargs["parameters"] = [ | |
{ | |
'type': 'address', | |
'value': tron.address.to_hex(payment_address) | |
}, | |
{ | |
'type': 'uint256', | |
'value': payment_amount * 1000000 # 1000000 = 1 USDT | |
} | |
] | |
raw_tx = tron.transaction_builder.trigger_smart_contract(**kwargs) | |
signed = tron.trx.sign(raw_tx["transaction"]) | |
print(f"\n\nSENDING {payment_amount} USDT TO {payment_address} IN 2 SEC...\n") | |
time.sleep(2) | |
result = tron.trx.broadcast(signed) | |
print("RESULT", result, "\n\n") |
?????? WhAT IS THIS???
from eth_abi import (
ImportError: cannot import name 'encode_abi' from 'eth_abi' (C:\Users\BOT\AppData\Local\Programs\Python\Python38\lib\site-packages\eth_abi_init_.py)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I am also want to send from a multi signature wallet which i have the same problem!