How to generate Segwit address using bitcoind?

1

I am using bitcoind. It generates the BTC addresses(not segregated). How to get segwit addresses? Do I have to change the settings in bitcoin.conf file?

bitcoin-cli getnewaddress -- generates address that starts with '1'

merklexy

Posted 2018-03-09T09:40:54.707

Reputation: 87

Answers

2

Make sure you are using Bitcoin-core v0.16 bitcoin-cli getnetworkinfo then in your bitcoin.conf add

addresstype=bech32

As @Meshcolider comment if you want to get p2sh address you should set:

addresstype=p2sh-segwit

But I would use bech32 since bech32 produces smaller transactions than P2SH segwit transactions.


For Bitcoin-core version 0.15 send

bitcoin-cli addwitnessaddress 1BRo7qrYHMPrzdBDzfjmzteBdYAyTMXW75

to get p2sh address.

Adam

Posted 2018-03-09T09:40:54.707

Reputation: 3 215

After adding, when I use "getnewaddress" , will it give me a segwit address directly?merklexy 2018-03-09T11:55:35.447

Yeah, nothing more required. You are most welcome!Adam 2018-03-10T13:28:43.123