-
Notifications
You must be signed in to change notification settings - Fork 273
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
how to estimate bandwidth and get same value as on tronscan #437
Comments
In Java-tron, the consumed bandwidth of a transaction depends on its byte size after being serialized by function estimateBandwidth(signedTxn) {
const DATA_HEX_PROTOBUF_EXTRA = 3;
const MAX_RESULT_SIZE_IN_TX = 64;
const A_SIGNATURE = 67;
const len = signedTxn.raw_data_hex.length /2 + DATA_HEX_PROTOBUF_EXTRA + MAX_RESULT_SIZE_IN_TX ;
const signatureListSize = signedTxn.signature.length || 0;
for(let i=0;i<signatureListSize;i++)
{
len += A_SIGNATURE;
}
return len;
} |
before signing I can't calculate this? |
You can calculate a unsigned transaction but the result is not the ultimate result. Only the signed transaction will be stored in the blockchain. |
thanks |
I have transaction where I'm triggering method of smart contract and need to understand how could I calculate bandwidth to get same value as on tronscan
I've tried different operations to calculate this value, but can't get same..
this.chain.transactionBuilder
with this I'm getting 1960 966 862 431
maybe somebody could help me with this
The text was updated successfully, but these errors were encountered: