The correct way to create a Bitcoin address is to use well tested, open source, peer reviewed wallet software. Manually handling keys has resulted in funds loss over and over again. Unlike other centralized systems losses in Bitcoin are usually unrecoverable.
There are currently three address formats in use:
- P2PKH - Pay 2 Public Key Hash - which begin with the number
- P2SH - Pay 2 Script Hash - type starting with the number
- Bech32 - SegWit Wallet Address - type starting with
There’s a good chance your preferred website, wallet or exchange doesn’t support at least one of these formats. Read my article on different BTC address types Mining into Bitcoin Addresses ! - Everything You Must Know About Bitcoin Addresses.
What is in the Content ?
In this article, I am going to discuss about how to create a version 1 (P2PKH) wallet address. I am hoping to create a series of articles about Bitcoin addresses in future.
Into Business !
A Bitcoin address is a 160-bit hash of the public portion of a public/private ECDSA keypair. Using public-key cryptography, you can "sign" data with your private key and anyone who knows your public key can verify that the signature is valid.
Here is a brief overview of how address generation works, for informational purposes:
0 - Having a private ECDSA key
18e14a7b6a307f426a94f8114701e7c8e774e7f9a47e2c2035db29a206321725 (The Private Key)
1 - Take the corresponding public key generated with it (33 bytes, 1 byte 0x02 (y-coord is even), and 32 bytes corresponding to X coordinate)
0250863ad64a87ae8a2fe83c1af1a8403cb53f53e486d8511dad8a04887e5b2352 (The Public Key)
2 - Perform SHA-256 hashing on the public key
3 - Perform RIPEMD-160 hashing on the result of SHA-256
4 - Add version byte in front of RIPEMD-160 hash (0x00 for Main Network)
(note that below steps are the Base58Check encoding, which has multiple library options available implementing it)
5 - Perform SHA-256 hash on the extended RIPEMD-160 result
6 - Perform SHA-256 hash on the result of the previous SHA-256 hash
7 - Take the first 4 bytes of the second SHA-256 hash. This is the address checksum
These are control digits which help the wallet determine you didn't mistype the address.
8 - Add the 4 checksum bytes from stage 7 at the end of extended RIPEMD-160 hash from stage 4. This is the 25-byte binary Bitcoin Address.
9 - Convert the result from a byte string into a base58 string using Base58Check encoding. This is the most commonly used Bitcoin Address format (P2PKH)
1PMycacnJaSqwwJqjawXBErnLsZ7RkXUAs - "This is your Bitcoin Address".
When sender gets a bitcoin address, their wallet converts it from base58check to hex, checks the checksum and removes both the Version-Byte (zero-byte) and checksum to get RIPEMD160(SHA256(pubkey)) - value in step 03. Then it proceeds with scriptPubKey verification.
That's why it is called Pay-to-public-key-hash. Bitcoin address is just a way of encoding a public key hash.
Thank You for Viewing.
Please consider following and helping with a donation.
StarClicks - Earn Some Extra Money by Clicking Ads !
Honeygain - Money for Your Excess Internet Capacity !
View Other Articles:
1) LocalCryptos - Non Custodial P2P marketplace for Cryptos !
2) Create a Bitcoin SEGWIT P2SH Address using Electrum Wallet !
3) StarClicks - Earn Some Extra Money by Clicking Ads !
4) Mining into Bitcoin Addresses ! - A Non-Base58 Character in a Bitcoin Addresses ?
5) If you are interested in some nice relaxing music, check my YouTube Channel