Transactions
Tidecoin keeps Bitcoin’s UTXO transaction model and serialization shape: version, inputs, outputs, optional witness data, and locktime. The protocol differences are in the scripts, witness programs, and post-quantum signature/public-key material carried by those scripts.
This page defines transaction structure. It is not the signature scheme registry; for schemes and byte sizes, see Scheme Registry. It is not the script reference; for opcodes and witness program semantics, see Scripts.
Serialized structure
Non-witness transactions use the classic form:
nVersion
vin[]
vout[]
nLockTimeTransactions with witness data use the segwit serialization form:
nVersion
marker
flag
vin[]
vout[]
witnesses[]
nLockTimeThe txid is the transaction hash without witness data. The witness hash
or wtxid includes the witness serialization. Tidecoin preserves this
Bitcoin distinction.
Inputs
Each input spends a previous output and carries unlocking data:
previous_txid
previous_output_index
scriptSig
nSequenceFor legacy key-hash spends, scriptSig commonly carries the signature
stack data. For witness spends, scriptSig is empty or carries only the
nested redeem script, and the actual signatures/scripts are in the input
witness.
Outputs
Each output carries an amount and a locking script:
nValue
scriptPubKeyCommon Tidecoin output templates include:
| Output type | ScriptPubKey shape | Address family |
|---|---|---|
| Key hash | OP_DUP OP_HASH160 <20-byte key hash> OP_EQUALVERIFY OP_CHECKSIG | Base58Check P2PKH-style |
| Script hash | OP_HASH160 <20-byte script hash> OP_EQUAL | Base58Check P2SH-style |
| Witness v0 key hash | OP_0 <20-byte key hash> | bech32 witness v0 |
| Witness v0 script hash | OP_0 <32-byte script hash> | bech32 witness v0 |
| Witness v1 script hash 512 | OP_1 <64-byte SHA512(witness_script)> | bech32m PQ witness v1 |
Witness v1 script-hash-512 outputs are implemented but gated by the post-AuxPoW rule set on mainnet.
PQ public keys and signatures
Tidecoin identifies a PQ signature scheme through the serialized public key. The public key layout is:
scheme_prefix || raw_scheme_public_keyThe signature does not carry a separate Tidecoin scheme prefix. The verifier reads the public-key prefix, selects the scheme, and verifies the signature bytes for that scheme.
For script paths that use a standard sighash byte, the signature stack item is:
scheme_signature || sighash_typeThe sighash byte is part of script transaction-signing semantics. It is not part of the raw Falcon or ML-DSA signature passed to the scheme verifier.
Typical witness stacks
| Spend path | Witness stack shape |
|---|---|
| Witness v0 key hash | <signature+sighash> <prefixed_pq_public_key> |
| Witness v0 script hash | <satisfying stack items...> <witness_script> |
| Witness v1 script hash 512 | <satisfying stack items...> <witness_script> |
Inside witness scripts, OP_CHECKSIG and multisig-style constructions
consume PQ signatures and prefixed PQ public keys according to the active
signature verification mode.
Size drivers
PQ transactions are larger than classical ECDSA/Schnorr transactions because public keys and signatures are larger. The most important size drivers are:
| Scheme | Serialized public key bytes | Padded or fixed signature bytes | Script signature bytes with sighash |
|---|---|---|---|
| Falcon-512 | 898 | 666 | 667 |
| Falcon-1024 | 1,794 | 1,280 | 1,281 |
| ML-DSA-44 | 1,313 | 2,420 | 2,421 |
| ML-DSA-65 | 1,953 | 3,309 | 3,310 |
| ML-DSA-87 | 2,593 | 4,627 | 4,628 |
Fee estimation and integration code should calculate sizes from the actual script and witness stack, not from classical Bitcoin assumptions.
Sighash semantics
Witness v0 follows the Bitcoin-style witness sighash path. Witness v1
P2WSH-512 uses the Tidecoin witness-v1 signature version and SHA-512
hashing internally for the transaction digest components. The accepted
sighash types remain the standard transaction-signing modes such as
SIGHASH_ALL, SIGHASH_NONE, SIGHASH_SINGLE, and
SIGHASH_ANYONECANPAY.
Source of truth
| Topic | Source |
|---|---|
| Transaction serialization and witness hashes | ../tidecoin/src/primitives/transaction.h, ../tidecoin/src/core_write.cpp |
| Address and script templates | ../tidecoin/src/addresstype.cpp, ../tidecoin/src/script/solver.cpp |
| PQ key/signature sizes | ../tidecoin/src/pq/pq_scheme.h |
| Signature dispatch | ../tidecoin/src/key.cpp, ../tidecoin/src/pubkey.cpp, ../tidecoin/src/pq/pq_api.h |
| Witness v1 signature hashing | ../tidecoin/src/script/interpreter.cpp |
See also: Signatures, Signature Encoding, Scripts, Witness V1 SHA-512, Addresses.