# How Bitcoin P2PKH Addresses Are Derived

Source: https://www.btcvanity.io/blog/how-bitcoin-addresses-are-derived

Published: 2026-11-06

Updated: 2026-11-09

![P2PKH derivation pipeline. Public key: Derived from a secp256k1 private key; HASH160: RIPEMD-160 applied to SHA-256 of the public key; Base58Check: Version, public-key hash and checksum are encoded.](https://www.btcvanity.io/images/blog/how-bitcoin-addresses-are-derived-diagram-v2.webp)

P2PKH derivation pipeline. Public key: Derived from a secp256k1 private key; HASH160: RIPEMD-160 applied to SHA-256 of the public key; Base58Check: Version, public-key hash and checksum are encoded.

[Full-size diagram (SVG)](https://www.btcvanity.io/images/blog/how-bitcoin-addresses-are-derived-diagram-v2.svg)

[Diagram download (PNG)](https://www.btcvanity.io/images/blog/how-bitcoin-addresses-are-derived-diagram-v2.png)

A Bitcoin P2PKH address is derived from a secp256k1 public key, a public-key hash, a mainnet version byte and a Base58Check encoding.

## From a secret scalar to a receiving address

The worker uses a private scalar to derive a secp256k1 public key. For its compressed P2PKH output, it hashes the serialized public key with SHA-256 and then RIPEMD-160. A mainnet version byte and a checksum are included before Base58 encoding.

Each stage has a different role: the secret enables signing, the public key is derived from it, the hash identifies the P2PKH spending condition, and the encoding makes the destination transferable as text.


## Where vanity search enters the process

The desired text is checked after address derivation. It does not allow the service to pick arbitrary address characters and solve backwards for a key. Instead, candidate keys are tried until their derived addresses meet the pattern.

This is why [adding characters increases search difficulty](https://www.btcvanity.io/blog/bitcoin-vanity-address-difficulty). The generator changes the candidate key, not the address by hand.


## What the independent check establishes

Before reporting success, the worker decodes the WIF output, derives its public key and address independently, and compares the address and requested pattern. A malformed WIF, mismatched address or nonmatching pattern is rejected.

That check establishes consistency of the returned pair. It does not audit every aspect of the random source or hosting system; see [the separate security questions](https://www.btcvanity.io/blog/bitcoin-vanity-randomness-security). Save the exact WIF because the public address alone cannot restore that secret.


## Explore the related mechanism

- [Bitcoin Vanity Address Patterns: Prefix, Suffix and Base58](https://www.btcvanity.io/blog/bitcoin-vanity-address-format) — This generator returns Bitcoin mainnet legacy P2PKH addresses beginning with 1. Patterns use Base58, which excludes 0, O, I and lowercase l.
- [Bitcoin Vanity Generators: Local Tools, Hosted Search and Keys](https://www.btcvanity.io/blog/bitcoin-vanity-randomness-security) — A memorable address is useful only if its private key is unpredictable. A successful pattern match does not establish the quality of a random-number source.
- [Open the complete workflow guide](https://www.btcvanity.io/guide) to place these checks in order.
- [Open the address generator](https://www.btcvanity.io/) when you have chosen a compatible format and pattern.

## Sources

- [Bitcoin developer transactions guide](https://developer.bitcoin.org/devguide/transactions.html)



Editorial method: https://www.btcvanity.io/about#publication-method
