2

getnewaddress "" bech32 generates a P2WPKH address (e.g. tb1qw508d6qejxtdg4y5r3zarvary0c5xw7kxpjzsx).

How can I generate a P2WSH address (e.g. tb1qrp33g0q5c5txsp9arysrx4k6zdkfs4nce4xj0gdcccefvpysxf3q0sl5k7)?

Murch
  • 71,155
  • 33
  • 180
  • 600
toddmo
  • 774
  • 2
  • 7
  • 23

1 Answers1

3

To generate a P2WSH address, you need to have some script. The easiest one you can use is a multisig script. You can do this with the command addmultisigaddress. If you do something like

addmultisigaddress 1 '["37Ju7oTbPfe5qNAHYiAKfdTtVvCSP3TTdL"]' "" "bech32"

you should get a P2WSH address.

Murch
  • 71,155
  • 33
  • 180
  • 600
Andrew Chow
  • 67,209
  • 5
  • 76
  • 149
  • Works great! I just used `getnewaddress "" "bech32"` to get the address to use with `addmultisigaddress 1 '["
    "]' "" "bech32"`
    – toddmo Apr 22 '18 at 23:12
  • This question can really use an updated answer for descriptor wallets (where you can actually construct meaningful multisig P2WSH wallets). – Pieter Wuille Nov 02 '21 at 21:54