LearnBitcoin

Glossary

BIP 143 (SegWit Transaction Signature Verification)

Defines the signature hash and verification format for SegWit version 0 transactions. Where the public key gets revealed in the witness.

BIP-143 specifies how signatures are computed and verified for SegWit version 0 outputs - the P2WPKH and P2WSH script types introduced by SegWit (BIP-141). Activated as part of the SegWit soft fork at block 481,824 on August 24, 2017.

Three changes from legacy ECDSA signature verification, each of which mattered (the first is BIP-141's structural change; BIP-143 defines the other two):

  • Signature data moves into the witness. In legacy P2PKH spends, the signature and pubkey live in the scriptSig. In SegWit v0, they live in a separate witness field that is structurally outside the transaction body. This is the change that fixes transaction malleability at scale: third parties can no longer tweak the signature encoding to change the transaction id (txid) before confirmation.
  • The signed message includes the input amount. Legacy ECDSA verification did not commit to how many satoshis the spent output held. A hardware wallet signing a transaction had to trust the host software's claim about the input amount, opening a fee-overpayment attack where a malicious host could trick a signer into spending more than expected. BIP-143 fixes this by including the input amount in the sighash.
  • A different sighash computation pattern. The new pattern avoids the quadratic-time hashing problem that affected very large legacy transactions, where total hashing work grew with the square of the transaction size (BIP-143 cites a 1 MB transaction with 5,569 signature checks that took about 25 seconds to verify).

A consequence worth knowing: the SegWit v0 witness for a P2WPKH spend contains the spender's signature and the spender's public key. Until the first spend, the address is a 160-bit hash of the pubkey; after the first spend, the pubkey is on chain in the witness of that spending transaction. This is the mechanism behind the "reuse-exposed" class of addresses: once spent, the pubkey is permanently visible to anyone reading the chain.

Authored by Johnson Lau and Pieter Wuille. Activated alongside BIP-141 (the SegWit umbrella), BIP-144 (the peer-to-peer relay format for witness data), and BIP-147 (NULLDUMMY soft fork rule).

Spec: BIP-143.

Key takeaways

  • Specifies sighash + verification for P2WPKH and P2WSH (SegWit v0 outputs)
  • Includes the input amount in the signed message - closes the fee-overpayment attack class
  • The witness data structure that carries the public key on spend

On the mailing list

BIP 143 came up in 21 threads on bitcoin-dev between April 2016 and May 2024. Read them in the archive.

Topic timelines: Segregated witness (186 threads) and Script and opcodes (192 threads).

Sources (6)

External references (2)

Related terms (9)

Published . Revised . No corrections logged for this page.

Edit this page on GitHub