---
id: "p2wpkhaddr"
kind: "datatype"
status: "stable"
is_pii: false
categories: ["cryptocurrency"]
langs: ["common"]
quality: 100
url: "http://registry.apicrafter.io/datatype/p2wpkhaddr"
---

# Bitcoin P2WPKH address (native SegWit, bc1q) (`p2wpkhaddr`)

Native SegWit address of the pay-to-witness-public-key-hash (P2WPKH) type: witness version 0 with a 20-byte public key hash (BIP 141), encoded with Bech32 (BIP 173). Mainnet addresses have the prefix bc1q and 42 characters. They are written in lower case, or in upper case in QR codes, but never in mixed case. Testnet addresses (tb1q) are not matched.

- Parent datatype: `crypto_address`
- 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]{38}|BC1Q[02-9AC-HJ-NP-Z]{38})$
```

Check digit algorithm: `bech32`

## Examples

- `bc1qw508d6qejxtdg4y5r3zarvary0c5xw7kv8f3t4` — P2WPKH example of BIP 173
- `BC1QW508D6QEJXTDG4Y5R3ZARVARY0C5XW7KV8F3T4` — The same address in upper case (BIP 173 test vector)
- `bc1qar0srrr7xfkvy5l643lydnw9re59gtzzwf5mdq` — Example address of the Bitcoin Wiki article on invoice addresses
- `bc1qw508d6qejxtdg4y5r3zarvary0c5xw7kv8f3t5` (invalid example) — last character changed, the checksum fails
- `bc1qW508d6qejxtdg4y5r3zarvary0c5xw7kv8f3t4` (invalid example) — mixed case is not allowed

## Mappings

- presidio: `CRYPTO`
- stdnum: `bitcoin`

## Metacrafter rules

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

- `p2wpkhaddr` (data, `common/cryptocurrency.yaml`)
- `p2wpkhaddr_by_field` (field, `common/cryptocurrency.yaml`)

## Supported by tools

- `dataprep`
- `greatexpectations`
- `metacrafter`
- `openmetadata`
- `presidio`
- `pythonstdnum`

## Translations

- ru: Адрес Bitcoin P2WPKH (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 100/100.

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