---
id: "p2wshaddr"
kind: "datatype"
status: "stable"
is_pii: false
name: "Bitcoin P2WSH address (native SegWit, bc1q)"
regexp: "^(?:bc1q[02-9ac-hj-np-z]{58}|BC1Q[02-9AC-HJ-NP-Z]{58})$"
checksum: "bech32"
categories: ["cryptocurrency"]
langs: ["common"]
quality: 93
url: "https://registry.apicrafter.io/datatype/p2wshaddr"
---

# Bitcoin P2WSH address (native SegWit, bc1q) (`p2wshaddr`)

Native SegWit address of the pay-to-witness-script-hash (P2WSH) type: witness version 0 with the 32-byte SHA-256 hash of a witness script (BIP 141), encoded with Bech32 (BIP 173). Mainnet addresses have the prefix bc1q and 62 characters, which tells them apart from 42-character P2WPKH addresses. Lower or upper case, never mixed. Testnet addresses (tb1q) are not matched.

- Parent datatype: [`crypto_address`](https://registry.apicrafter.io/datatype/crypto_address.md)
- Personal data (PII): no
- Categories: Cryptocurrency (cryptocurrency)
- Countries: global
- Languages: Common to most languages (common)
- Classification: identifier

## Detection

Regular expression (Python `re`):

```
^(?:bc1q[02-9ac-hj-np-z]{58}|BC1Q[02-9AC-HJ-NP-Z]{58})$
```

Check digit algorithm: `bech32`

## Examples

- `bc1qrp33g0q5c5txsp9arysrx4k6zdkfs4nce4xj0gdcccefvpysxf3qccfmv3` — P2WSH example of BIP 173
- `bc1qrp33g0q5c5txsp9arysrx4k6zdkfs4nce4xj0gdcccefvpysxf3qccfmv4` (invalid example) — last character changed, the checksum fails
- `bc1qw508d6qejxtdg4y5r3zarvary0c5xw7kv8f3t4` (invalid example) — P2WPKH address (p2wpkhaddr)

## Mappings

- misp: `btc`
- presidio: `CRYPTO`
- stdnum: `bitcoin`

## Metacrafter rules

2 rules: 1 match the field name, 1 match values.

- `p2wshaddr` (data, `common/cryptocurrency.yaml`)
- `p2wshaddr_by_field` (field, `common/cryptocurrency.yaml`)

## Supported by tools

- [`dataprep`](https://registry.apicrafter.io/tool/dataprep.md)
- [`metacrafter`](https://registry.apicrafter.io/tool/metacrafter.md)
- [`openmetadata`](https://registry.apicrafter.io/tool/openmetadata.md)
- [`presidio`](https://registry.apicrafter.io/tool/presidio.md)
- [`pythonstdnum`](https://registry.apicrafter.io/tool/pythonstdnum.md)
- [`pywhat`](https://registry.apicrafter.io/tool/pywhat.md)
- [`validatorjs`](https://registry.apicrafter.io/tool/validatorjs.md)

## Translations

- ru: Адрес Bitcoin P2WSH (SegWit, bc1q)

## Sources

- doc: <https://github.com/bitcoin/bips/blob/master/bip-0173.mediawiki>
- doc: <https://github.com/bitcoin/bips/blob/master/bip-0141.mediawiki>

## Quality

Score 93/100. Missing: second example.

JSON: <https://registry.apicrafter.io/api/v1/datatypes/p2wshaddr.json> · Edit: <https://github.com/apicrafter/metacrafter-registry/edit/main/data/datatypes/any/cryptocurrency/p2wshaddr.yaml>
