From 82e18115444a91cead51124e3b18a2e75ca211f3 Mon Sep 17 00:00:00 2001 From: Red and Green <62441426+RGGH@users.noreply.github.com> Date: Mon, 4 Nov 2024 16:10:29 +0000 Subject: [PATCH] Update readme.md --- readme.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/readme.md b/readme.md index ea89b12..e1daffc 100644 --- a/readme.md +++ b/readme.md @@ -17,3 +17,13 @@ This is a demo, it uses Legacy Bitcoin addresses, which start with a 1 for P2PKH Example: 1PMycacnJaSqwwJqjawXBErnLsZ7RkXUAs. Encoding: Base58Check encoding. Type: P2PKH (Pay-to-Public-Key-Hash). + +This code generates a legacy Bitcoin address from a given public key in hexadecimal format. It performs the following steps: + +1. **Hex to Bytes**: Converts the input hexadecimal string into a byte array. +2. **SHA-256 Hashing**: Computes the SHA-256 hash of the public key bytes. +3. **RIPEMD-160 Hashing**: Hashes the SHA-256 result using the RIPEMD-160 algorithm. +4. **Version Byte**: Prepends a version byte (0x00) to the RIPEMD-160 hash, indicating it's for the main Bitcoin network. +5. **Checksum Calculation**: Computes the SHA-256 hash of the versioned hash, then performs SHA-256 again to derive a checksum. +6. **Checksum Append**: Appends the first four bytes of the checksum to the versioned hash. +7. **Base58 Encoding**: Converts the final byte array into a Base58 string, resulting in the Bitcoin address.