Marker and Flag

TransactionMarker
Structure
Version
4 bytes
Segwit (Optional)
Marker
1 byte
Flag
1 byte
Structure
Input Count
variable
Input Structure
Previous TXID
32 bytes
Output Index
4 bytes
ScriptSig Size
variable
ScriptSig
variable
Sequence
4 bytes
Structure
Output Count
variable
Output Structure
Amount
8 bytes
ScriptPubKey Size
variable
ScriptPubKey
variable
Structure
Witness
variable
Structure
Locktime
4 bytes

Size

1 byte

Format

-

Description

Used to indicate a segwit transaction. Must be 00.

Example

00

Byte Visualization

00
Byte 1

The marker and flag are optional fields introduced with SegWit.

They indicate that a transaction uses the segregated witness structure defined in BIP144 (Witness data is required for inputs locked by P2WPKH, P2WSH, or P2TR).

Marker

Marker indicates that the transaction uses the SegWit transaction format (also known as the extended format).

  • Marker is 1 byte.
  • Must always be 0x00 to signal a SegWit transaction.

Flag

  • The flag is 1 byte.
  • It is currently set to 0x01 in all SegWit transactions.
  • Future upgrades may use different flags.

Note: Legacy Compatibility

If a transaction doesn’t include witness data, marker and flag are omitted.

Question

How do old nodes treat marker and flag for SegWit transactions?

-> Answer here

Suggest Edits