[Python] Calculating TRX gas fee for a transaction/account

Discussão em 'Python' iniciado por Stack, Maio 5, 2025.

  1. Stack

    Stack Membro Participativo

    Hi i was sending a transaction on python with tronpy library, but anytime i try to send it. using the library it throws out an error saying out of balance which makes sense because i send the full amount. so

    txn = client.trx.transfer('from wallet', 'to wallet', int(balance * 1000_000)).build().sign(priv_key).inspect().broadcast()


    multiplying here with 1 million because of the decimal points in TRX money is 6 zeros. so also when i query 'wallet/getaccountnet' i think the calculation is being made from there im using testnet also mainnet but depending on the table it shows here: \n

    api\n It does not return the full details that being showed in the table so im confused where can i get the transaction fee for given trx address

    this is how i calculate the bandwidth from tron api 'wallet/getaccountnet':

    (bandwidth['freeNetLimit'] - bandwidth['freeNetUsed']) + (bandwidth['NetLimit'] - bandwidth['NetUsed'])


    Api i've provided does not return the full details that being showed in the table so im confused where can i get the transaction fee for given trx address

    Continue reading...

Compartilhe esta Página