How to swap trc20 to trx with Python in one wallet address?

558 views Asked by At

I need to swap(change) part of my trc20 asset to trx in my Tron wallet. Consider i have some data like this:

public_key="AAA"
private_key="PPP"
trc20_address="TR7NHqjeKQxGTCi8q8ZY4pL8otSzgjLj6t"
current_trc20_amount=100 usdt

So for example swap 2 usdt to trx.
Is it possible? How?

I need this because i want to make transaction automatically and programmatically. And for sending trc20 we need some trx as fee.

1

There are 1 answers

1
Worthy On

Try to use the Tron API along with a library like tronpy. https://tronpy.readthedocs.io/en/stable/ https://developers.tron.network/ hope these helpful.