I have a little bit confusion about addresses segwit and not segwit.

I can see P2WPKH and P2WSH from this link https://en.bitcoin.it/wiki/BIP_0173, and they are segwit and start with bc (mainnet) or tb (testnet).

But I can see even P2SH, start with 3 nested P2WPKH or P2WSH, and that address start with 3.

Then When we speak about P2WPKH and P2WSH we mean Native and start with bc, or We can have even P2WPKH start with 1 and P2WSH start with 3?

when I create

bitcoin-cli getnewaddress "segwit" "p2sh-segwit" 

which kind of script I have? P2PK?


6 types of Bitcoin addresses (in parentheses are the data they keep):


  • P2PKH 1... (a public key's hash)
  • P2SH 3... (a script's hash) (defined in BIP16)

SegWit (P2WPKH/P2WSH) nested in P2SH (defined in BIP141)

  • P2SH-P2WPKH 3... (a public key's hash)
  • P2SH-P2WSH 3... (a script's hash)

(these start with three because these addresses are meant to be compatible with existing wallets, who would see those addresses as P2SH wallets)

Native SegWit (P2WPKH/P2WSH) (defined in BIP141 + BIP173)

  • P2WPKH bc1... (a public key's hash)
  • P2WSH bc1... (a script's hash) (but longer than P2WPKH)

which kind of script I have? P2PK?

getnewaddress can't return P2PK because you can either pay directly to a script (which can be P2PK) or a script enclosed in P2SH (or its derivatives P2SH-P2WSH and P2WSH). But that's not very useful.

The documentation says:


  1. "label" (string, optional) The label name for the address to be linked to. If not provided, the default label "" is used. It can also be set to the empty string "" to represent the default label. The label does not need to exist, it will be created if there is no label by the given name.

  2. "address_type" (string, optional) The address type to use. Options are "legacy", "p2sh-segwit", and "bech32". Default is set by -addresstype.

The legacy type means P2PKH, p2sh-segwit means P2SH-P2WPKH and bech32 means P2WPKH.

  • Perfect answer thanks – monkeyUser Mar 29 '20 at 14:42
  • In P2SH-P2WPKH that I can get with getnewaddress P2WPKH has the bech32 logic inside (en.bitcoin.it/wiki/BIP_0173)? is it native bech32 but wrapped into P2SH? – monkeyUser Mar 29 '20 at 14:47
  • The goal of SegWit addresses is to move signatures to a register named "witness". Because both P2WPKH and P2SH-P2WPKH do that, both are SegWit addresses. But a native SegWit address is more space efficient than a P2SH-nested address; it saves about twenty bytes (examples). And Bech32 is the serialization method to represent native SegWit addresses. So both are SegWit addresses but Bech32 is more SegWit as it doesn't aim to be backwards-compatible (so old wallets can't send to it but it can send anywhere) – MCCCS Mar 29 '20 at 14:54
  • 1
    If it doesn't mention P2SH and it's SegWit then it's a native address, represented by Bech32. In mainnet all Bech32 addresses start with bc1 (unless they change it in the future). – MCCCS Mar 29 '20 at 15:18
  • 1
    bitcoin-cli getnewaddress "segwit" "p2sh-segwit" is P2SH-P2WPKH. bitcoin-cli getnewaddress "segwit" "bech32" is native P2WPKH. – MCCCS Mar 30 '20 at 8:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.