6

I'm playing around with regtest and wanted to generate a bech32 address. My Bitcoin Core version is 0.18.0.

I ran getnewaddress "" bech32 and got an address that began with bcrt, like this one : bcrt1qs758ursh4q9z627kt3pp5yysm78ddny6txaqgw.

I'm a bit surprised, because I was thinking that testnet bech32 addresses were different, and indeed I checked this page that says it should begin with tb1...

I tried to send some tbtc to this address with Electrum and a faucet, none worked, they indeed both say address is invalid.

So what am I missing here?

Sosthène
  • 613
  • 3
  • 13

1 Answers1

7

Regtest and testnet are different networks. They are not compatible with each other.

Regtest is a private local network which is used solely for testing. It is primarily used for the regression tests, hence the name regtest.

Testnet is the public testing network which is very similar to mainnet, the main network. It has a different genesis block and has actual miners, DNS seeds, and nodes that you can connect to.

Andrew Chow
  • 67,209
  • 5
  • 76
  • 149
  • Thanks got it, but if I'm not mistaken both testnet and regtest use the same addresses' prefix? At least it is the case for legacy and P2SH addresses, and since I don't find any specific format for bech32 on the page I linked to I was also expecting Bitcoin Core will generate addresses beginning with `tb1` on regtest. – Sosthène Oct 23 '19 at 20:13
  • They use different prefixes for bech32 addresses. – Andrew Chow Oct 23 '19 at 20:20
  • 1
    Ok, but then it means this page need to be updated https://en.bitcoin.it/wiki/List_of_address_prefixes I created an account on Bitcoin Wiki and see how to do it myself, thanks for your help – Sosthène Oct 24 '19 at 13:17
  • 2
    I'd like to second that. At very least, please add that prefix to the wiki. – dpc.pw Jan 30 '20 at 19:02
  • 5
    Another thing is that IMO giving regtest different addresses is unhelpful. It's not a big deal, but if I have a system built around communication with a bitcoin node, I'd expect not to have modify it, just to run some test scenarios in a controlled regtest setup. From the perspective of a user either something is a "real-address" (mainnet), or not-a real one. And if it is not "real", then regtest vs testnet vs whatever else doesn't really matter. It is only making job of sw eng. integrating bitcoin a bit more complicated. – dpc.pw Jan 30 '20 at 19:10