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

# BIP-32 extended key (xpub, xprv) (`bip32addr`)

Extended public or private key of a hierarchical deterministic (HD) wallet in the serialization of BIP-32: 4 version bytes, depth, fingerprint of the parent key, child number, 32-byte chain code and 33-byte key data, followed by a 4-byte checksum and encoded with Base58Check into 111 characters. Mainnet keys start with xpub (public) or xprv (private), testnet keys with tpub or tprv. An xprv value is a wallet secret that controls all funds below it; an xpub value reveals every address of its branch. Keys with the prefixes of SLIP-132 (ypub, zpub and others) use the same structure but are not matched here.

- Personal data (PII): no
- Categories: Cryptocurrency (cryptocurrency), Secrets and credentials (passwords, keys, tokens) (secrets)
- Countries: global
- Languages: Common to most languages (common)
- Classification: identifier

## Detection

Regular expression (Python `re`):

```
^[xt](?:pub|prv)[1-9A-HJ-NP-Za-km-z]{107}$
```

Check digit algorithm: `base58check`

## Examples

- `xpub661MyMwAqRbcFtXgS5sYJABqqG9YLmC4Q1Rdap9gSE8NqtwybGhePY2gZ29ESFjqJoCu1Rupje8YtGqsefD265TMg7usUDFdp6W1EGMcet8` — BIP-32 test vector 1, extended public key of the master node (chain m)
- `xprv9s21ZrQH143K3QTDL4LXw2F7HEK3wJUD2nW2nRk4stbPy6cq3jPPqjiChkVvvNKmPGJxWUtg6LnF5kejMRNNU3TGtRBeJgk33yuGBxrMPHi` — BIP-32 test vector 1, extended private key of the master node (chain m)
- `xpub661MyMwAqRbcFtXgS5sYJABqqG9YLmC4Q1Rdap9gSE8NqtwybGhePY2gZ29ESFjqJoCu1Rupje8YtGqsefD265TMg7usUDFdp6W1EGMcet9` (invalid example) — test vector with the last character changed, the checksum fails

## Metacrafter rules

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

- `bip32addr_by_field` (field, `common/cryptocurrency.yaml`)
- `bip32addr_xprv` (data, `common/cryptocurrency.yaml`)
- `bip32addr_xpub` (data, `common/cryptocurrency.yaml`)

## Supported by tools

- `metacrafter`

## Translations

- ru: Расширенный ключ BIP-32 (xpub, xprv)

## Sources

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

## Quality

Score 90/100. Missing: mapping (Wikidata, Schema.org, ...).

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