tronprotocol / tronweb

Javascript API Library for interacting with the TRON Network
MIT License
423 stars 271 forks source link

how calculate bandwidth for sending TRX #401

Closed Melekhin closed 1 year ago

Melekhin commented 1 year ago

Hello!

Is there any way to calculate the bandwidth of a TRX transaction before it is sent?

In order to be able to calculate what the fee will be based on this value.

There is no separate method for calculating this value(bandwidth) or estimating the required amount of badwidth for sending TRX tokens..

start940315 commented 1 year ago

The bandwidth is calculated based on the transaction raw data length, you can get the length of transaction raw_data to get the estimated bandwidth.