Sending TRX with tronpy

918 Views Asked by At

I'm using tronpy library to send trx, here is my code:

from tronpy import Tron
from tronpy.keys import PrivateKey

# integers representing half & one Tron
HALF_TRON = 500000
ONE_TRON = 1000000 #equals 1 TRX

# your wallet information
WALLET_ADDRESS = "TTJSsmQWypFyH6LzjJ83G8JHedKKhrnWXK" #MY WALLET
PRIVATE_KEY = "private key here"
priv_key = PrivateKey(bytes.fromhex("0ec032178bdfb76c6a4a4f9a1fea661d1ef74322a102bd4f3180e6d7ed4a3f43"))
client = Tron()

def send_tron(amount, wallet):
    try:
        
        # create transaction and broadcast it
        txn = (
            client.trx.transfer(WALLET_ADDRESS, str(wallet), int(amount))
            .memo("Transaction Description")
            .build()
            .inspect()
            .sign(priv_key)
            .broadcast()
        )
        
        return txn.wait()

    # return the exception
    except Exception as ex:
        return ex

send_tron(1000000, 'THLFjoyxxrBnKd7UtfGzruhMZfJb2xY87С')

When I'm running this code, nothing happens. I've checked both wallets, private key and my balance, everyting is fine.I've tried: client = Tron(network='nile')

0

There are 0 best solutions below