DEV Community

μ΄κ΄€ν˜Έ(Gwanho LEE)
μ΄κ΄€ν˜Έ(Gwanho LEE)

Posted on

πŸ”‘ Multisig vs Normal Bitcoin Transactions β€” What’s the Difference?

πŸš€ TL;DR

  • Normal: 1 input β†’ 1 signature.
  • Multisig: 1 input β†’ M signatures (from N possible cosigners).
  • SegWit moves signatures out of the txid calculation β†’ cheaper & no txid malleability.
  • We collect partial signatures, sort them, and build the final script or witness per input.

1️⃣ Normal Transactions (Single-Sig)

  • Keys: One private key β†’ one public key.
  • Addresses:
    • Legacy (P2PKH): starts with 1...
    • SegWit (P2WPKH): starts with bc1q...
  • Signing:
    1. Create a sighash for each input.
    2. Sign it once.
    3. Attach the signature and public key.
  • Example (Legacy):
  [Signature, PubKey]
Enter fullscreen mode Exit fullscreen mode
  • Example (SegWit):
    • scriptSig empty, witness carries [Signature, PubKey].

2️⃣ Multisig Transactions (M-of-N)

  • Keys: N people, each with their own private key.
  • Addresses:
    • Legacy P2SH: starts with 3...
    • SegWit P2WSH: starts with bc1q...
  • Rule: Any M of these N signatures can spend the coins.
  • Signing:

    1. Each cosigner signs separately.
    2. Collect M valid signatures for each input.
    3. Build the final unlocking data:
      • Legacy P2SH:
       OP_0 + Sig1 + Sig2 + ... + RedeemScript
    
    • SegWit P2WSH: Witness stack:
       OP_0 (empty) + Sig1 + Sig2 + ... + WitnessScript
    

πŸ’» Example: Our Wallet’s Finalization (P2SH & P2WSH)

// Group signatures by input index
for sig in partial_sigs {
    signatures[input_index].push(sig);
}

// Sort by pubkey (BIP67)
sorted_sigs.sort_by(pubkey_order);

// Build final unlocking data
if is_p2sh {
    // Legacy P2SH scriptSig
    OP_0 + all_sigs + redeem_script
} else {
    // SegWit P2WSH witness stack
    [OP_0] + all_sigs + witness_script
}
Enter fullscreen mode Exit fullscreen mode

SegWit version is cheaper in fees and immune to txid malleability.


βš– Side-by-Side: Normal vs Multisig (With SegWit)

Feature Normal Multisig (Legacy) Multisig (SegWit)
Keys 1 keypair N keypairs N keypairs
Signatures/input 1 M M
Unlocking data [sig, pubkey] OP_0 + sigs + redeem script Witness stack: OP_0 + sigs + witness script
Fee efficiency Medium High cost Lower cost
Txid malleable? Yes (legacy) Yes (legacy) No (SegWit)

🌍 Why SegWit Multisig Rocks

  • Lower fees: Witness data gets a weight discount.
  • No txid malleability: Safer for complex protocols like Lightning.
  • Future-ready: Works with Taproot for even more privacy.
  • Same multisig benefits: More security, shared control, auditability.

πŸ›  When to Use

  • Single-sig SegWit: Everyday wallet, low fees.
  • Multisig SegWit: Treasury, cold storage, shared accounts β€” but with cost savings and malleability protection.

πŸ’‘ Key takeaway:

SegWit doesn’t change the rules of multisig β€” it just makes them cheaper, faster, and safer.

If you’re setting up a new multisig today, use SegWit (P2WSH) unless you need legacy compatibility.

Top comments (0)