You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We are planning to charge per byte of signed transaction size: iov-one/weave#1091
In order to calculate the fee, we need to know the final transaction size including aignatures before the the transaction is signed.
Do no this, we can do bnsCodec.bytesToPost(withDummySignatures), where withDummySignatures is the unsigned transaction plus the expected number of signatures. A dummy signature can be constructed as
constdummy: FullSignature={nonce: 66asNonce,pubkey: {algo: Algorithm.Ed25519,// ed25519 pubkey has 32 bytes https://blog.mozilla.org/warner/2011/11/29/ed25519-keys/data: newUint8Array(32)asPubkeyBytes,},// ed25519 signature has 64 bytes https://blog.mozilla.org/warner/2011/11/29/ed25519-keys/signature: newUint8Array(64)asSignatureBytes,};
The fee calculation constants FREE_CONTINGENT and MULTIPLIER can be fixed in the first step but should be queried from the chain later on.
Add helper functions for estimating tx size as above
Add function for getting tx fee parameters from chain
Update BnsConnection.getFeeQuote to use these functions
The text was updated successfully, but these errors were encountered:
willclarktech
changed the title
Add helpers to calculate BNS transaction size
Calculate fee based on tx size and on-chain tx fee parameters
Jan 8, 2020
We are planning to charge per byte of signed transaction size: iov-one/weave#1091
In order to calculate the fee, we need to know the final transaction size including aignatures before the the transaction is signed.
Do no this, we can do
bnsCodec.bytesToPost(withDummySignatures)
, wherewithDummySignatures
is the unsigned transaction plus the expected number of signatures. A dummy signature can be constructed asThe fee calculation constants
FREE_CONTINGENT
andMULTIPLIER
can be fixed in the first step but should be queried from the chain later on.BnsConnection.getFeeQuote
to use these functionsThe text was updated successfully, but these errors were encountered: