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

# Bitcoin P2SH address (`p2shaddr`)

Bitcoin address of the pay-to-script-hash (P2SH) type, defined by BIP 13 and BIP 16. It is the Base58Check encoding of the version byte 5 and the 20-byte hash of a redeem script (for example a multisignature script or wrapped SegWit), so it has 34 characters and starts with 3. Older Litecoin P2SH addresses use the same version byte and cannot be told apart. Testnet P2SH addresses start with 2 and 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`):

```
^3[1-9A-HJ-NP-Za-km-z]{33}$
```

Check digit algorithm: `base58check`

## Examples

- `3J98t1WpEZ73CNmQviecrnyiWrnqRhWNLy` — Example address of the Bitcoin Wiki article on invoice addresses
- `3J98t1WpEZ73CNmQviecrnyiWrnqRhWNLz` (invalid example) — last character changed, the checksum fails
- `1PMycacnJaSqwwJqjawXBErnLsZ7RkXUAs` (invalid example) — P2PKH address (p2pkhaddr)

## Mappings

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

## Metacrafter rules

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

- `p2shaddr` (data, `common/cryptocurrency.yaml`)
- `p2shaddr_by_field` (field, `common/cryptocurrency.yaml`)

## Supported by tools

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

## Translations

- ru: Адрес Bitcoin P2SH

## Sources

- doc: <https://github.com/bitcoin/bips/blob/master/bip-0013.mediawiki>
- doc: <https://github.com/bitcoin/bips/blob/master/bip-0016.mediawiki>
- other: <https://en.bitcoin.it/wiki/Invoice_address>

## Quality

Score 93/100. Missing: second example.

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