Comments (4)
You can calculate a unsigned transaction but the result is not the ultimate result. Only the signed transaction will be stored in the blockchain.
from tronweb.
In Java-tron, the consumed bandwidth of a transaction depends on its byte size after being serialized by protobuf
.
In frontend, you can use the following function to calculate the bandwidth with a signedTransaction roughly:
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;
}
from tronweb.
In Java-tron, the consumed bandwidth of a transaction depends on its byte size after being serialized by
protobuf
. In frontend, you can use the following function to calculate the bandwidth with a signedTransaction roughly: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?
from tronweb.
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
from tronweb.
Related Issues (20)
- TRON
- getEventResult filter onlyConfirmed/onlyUnconfirmed not working HOT 2
- SDK
- Check your verification status - Google Business Profile Help - Verification my Address User`Account_,¥,aguinaldok4"/,kris9773180017‽,activity_,datalogs^Accnt,u• HOT 2
- CEX.IO Status - Poor liquidity for pairs: AKRO:USD, AKRO:USDT, AKRO:EUR, BEL:USD, BEL:EUR, CAKE:USD, CAKE:EUR, DNT:USD, EUROC:USD, EUROC:EUR, FUN:USD, HOT:USD, LEVER:USD, LQTY:USD, TRB:USD, TWT:USD, TWT:USDT, VET:USD, XVS:USD
- TRON.WEB#
- callback is not defined HOT 6
- `options` object is ignored in TransactionBuilder HOT 4
- @noble/secp256k1 package removed from package.json but still required in node build HOT 4
- transactionBuilder.js对address[][]参数编码有问题 HOT 2
- How to activate an account with this module? HOT 2
- Open DApp by Deeplink not work HOT 1
- feature request: deserialize `raw_data_hex` into transaction HOT 4
- contract.send() option `pollTimes` not working in TronLink HOT 2
- check address by method isAddress return false HOT 7
- updateAccountPermissions fail Failed to sign transaction: Invalid transaction provided HOT 2
- Error: crypto.getRandomValues must be defined HOT 1
- Depends on vulnerable version of axios HOT 8
- `Assertion failed` during sign HOT 14
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tronweb.