logo
Resources
 Bitcoin Core CLI Help  Github Repo  Report Issue  Donate

BitcoinJS Guide

    • Part One: Preparing The Work Environment
      • Introduction to Bitcoin Programming
      • Generating and Importing Wallets
      • Generating Blocks
    • Part Two: Paying A Key
      • Legacy P2PKH
        • Simple Transaction (1 input, 1 output) - Legacy P2PKH
        • Typical Transaction (1 input, 2 outputs) - Legacy P2PKH
        • UTXO Consolidation (3 inputs, 1 output) - Legacy P2PKH
        • Batching Transaction (1 input, 5 outputs) - Legacy P2PKH
        • Coinjoin Transaction (4 inputs, 4 outputs) - Legacy P2PKH
      • Native Segwit P2WPKH
        • Spend a Native Segwit P2WPKH UTXO
        • Typical Transaction (1 input, 2 outputs) - Native Segwit P2WPKH
      • Nested Segwit NP2WPKH
        • Spend a Nested Segwit NP2WPKH UTXO
    • Part Three: Paying A Script
      • Puzzles
        • Algebra Puzzle - Legacy P2SH
        • Algebra Puzzle - Native Segwit P2WSH
        • Algebra Puzzle - Nested Segwit P2SH-P2WSH
        • Computational Puzzle: SHA-1 Collision
      • Multi-signatures
        • Multi-signature Legacy 2 of 4
        • Multi-signature Native Segwit 2 of 4
        • Multi-signature Nested Segwit 2 of 4
      • Timelocks
        • Script with CHECKLOCKTIMEVERIFY - Legacy P2SH
        • Script with CHECKLOCKTIMEVERIFY - Native Segwit P2WSH
        • Script with CHECKSEQUENCEVERIFY - Legacy P2SH
        • Script with CHECKSEQUENCEVERIFY - Native Segwit P2WSH
      • Submarine Swaps
        • Submarine Swap - On-chain to Off-chain
    • Part Four: Data Anchoring
      • Data Anchoring with OP_RETURN
    • Tools
      • Base58Check Address Encoding
      • Data Length and Base Conversion
      • Number Encoding
BitcoinJS Guide BitcoinJS v4
  • BitcoinJS Guide
    • BitcoinJS v5
    • BitcoinJS v4
  • BitcoinJS Guide
  • Part Two: Paying A Key
  • Nested Segwit NP2WPKH
BitcoinJS v5 BitcoinJS v4

Nested Segwit P2SH-P2WPKH

Working with P2SH now is a bit premature as we are dedicated this topic to part three of this guide. Nevertheless, the purpose of P2SH-P2WPKH transactions is to pay to a Segwit public key hash, inside a legacy P2SH. This type of transaction is less optimal than native Segwit but useful for backward compatibility.

« Typical Transaction (1 input, 2 outputs) - Native Segwit P2WPKH Spend a Nested Segwit NP2WPKH UTXO »

Contents