Transaction Size and Fees
Tidecoin fee estimation must account for post-quantum public keys and signatures. The fee rule is still Bitcoin-like: pay by virtual size. The difference is that the witness stack is much larger, especially for ML-DSA schemes.
This page is an integration guide. The canonical transaction layout is Transactions, and the canonical signature layout is Signature Encoding.
Core formula
Use the standard weight and virtual-size model:
weight = stripped_size * 4 + witness_size
vbytes = ceil(weight / 4)
fee = vbytes * feerate_per_vbyteDo not estimate Tidecoin transactions by copying Bitcoin ECDSA input sizes. Calculate from the actual script and witness stack.
Signature and public-key sizes
| Scheme | Serialized public key bytes | Script signature bytes with sighash |
|---|---|---|
| Falcon-512 | 898 | 667 padded, up to 753 maximum |
| Falcon-1024 | 1,794 | 1,281 padded, up to 1,463 maximum |
| ML-DSA-44 | 1,313 | 2,421 |
| ML-DSA-65 | 1,953 | 3,310 |
| ML-DSA-87 | 2,593 | 4,628 |
Only Falcon-512 is mainnet-active before AuxPoW. Other schemes are built but mainnet-gated by AuxPoW activation.
Approximate witness-v0 key-hash input sizes
For a witness-v0 key-hash style spend with stack:
<signature+sighash> <prefixed_pq_public_key>Approximate per-input size is:
| Scheme | Witness bytes | Weight units | Virtual bytes |
|---|---|---|---|
| Falcon-512 padded | 1,572 | 1,736 | 434 |
| Falcon-1024 padded | 3,080 | 3,244 | 811 |
| ML-DSA-44 | 3,739 | 3,903 | 976 |
| ML-DSA-65 | 5,268 | 5,432 | 1,358 |
| ML-DSA-87 | 7,228 | 7,392 | 1,848 |
These numbers assume a 41-byte stripped input component and compact-size length prefixes for the two witness stack items. They are sizing aids, not a substitute for calculating the final signed transaction.
Output sizes
| Output type | ScriptPubKey bytes | Notes |
|---|---|---|
| Key hash | 25 | Base58Check key-hash destination. |
| Script hash | 23 | Base58Check script-hash destination. |
| Witness v0 key hash | 22 | OP_0 <20-byte program>. |
| Witness v0 script hash | 34 | OP_0 <32-byte program>. |
| Witness v1 P2WSH-512 | 66 | OP_1 <64-byte program>. |
Output amounts and CompactSize prefixes add their normal serialized overhead. Final transaction size must include version, marker/flag where witness is present, input count, output count, locktime, and all scripts.
Relay policy constants
Default policy values:
| Policy | Default |
|---|---|
-minrelaytxfee | 100 atoms/kvB |
-incrementalrelayfee | 100 atoms/kvB |
-dustrelayfee | 3000 atoms/kvB |
| Maximum standard transaction weight | 800,000 |
| Maximum standard scriptSig size | 8,192 bytes |
| Maximum standard P2WSH stack items | 100 |
| Maximum standard P2WSH stack item size | 5,000 bytes |
| Maximum standard P2WSH script size | 65,536 bytes |
Operators can change some policy values locally. Integrations should
query their own node state and handle sendrawtransaction rejection
messages rather than assuming every peer has identical policy.
Dust
Dust is calculated from the cost to spend an output at the node’s
dustrelayfee. Tidecoin uses the same policy concept as Bitcoin Core,
but PQ public keys and signatures can raise spend costs for outputs that
require PQ material to spend.
Use the node or wallet to construct and test transactions when possible.
For custom systems, mirror GetDustThreshold() and IsDust() from
../tidecoin/src/policy/policy.cpp.
Recommended integration workflow
- Build the transaction with the wallet or signing stack that will actually sign it.
- Sign or simulate signatures using the intended scheme.
- Compute the final virtual size from the signed transaction.
- Query
estimatesmartfeefor the target confirmation window. - Compare against local minimum relay and mempool minimum fees.
- Run
testmempoolacceptbefore broadcast for externally built raw transactions. - Broadcast with
sendrawtransaction, settingmaxfeerateexplicitly if your transaction is intentionally large.
Worked fee example
For one Falcon-512 witness-v0 key-hash input and two witness-v0 key-hash outputs, a rough sizing model is:
base transaction overhead: about 12 vB
1 input: about 434 vB
2 outputs: about 2 * 31 vB
estimated total: about 508 vBAt 2 atoms/vB, that transaction needs about 1,016 atoms in fees. At
10 atoms/vB, it needs about 5,080 atoms. Always replace this estimate
with the final signed virtual size before broadcast.
Source of truth
| Topic | Source |
|---|---|
| PQ public-key and signature sizes | ../tidecoin/src/pq/pq_scheme.h |
| Transaction serialization and witness hashes | ../tidecoin/src/primitives/transaction.h |
| Policy constants | ../tidecoin/src/policy/policy.h |
| Dust calculation | ../tidecoin/src/policy/policy.cpp |
| Fee estimator | ../tidecoin/src/policy/fees.cpp |
| Wallet fee selection | ../tidecoin/src/wallet/fees.cpp, ../tidecoin/src/wallet/rpc/spend.cpp |
See also: Learn / Fees and Transaction Sizes, Exchange Integration, Protocol / Transactions.