<p>The process of calculating a Bitcoin P2PKH address in base56check encoding format is as follows:</p>
<ol>
<li>get a public key from the private key</li>
<li>hash the public key with the SHA256 hash function</li>
<li>hash the result from the 2nd step with the RIPEMD160 hash function</li>
<li>prepend 0x00 to the result from the previous step</li>
<li>calculate checksum of the result from the 4th step as sha256(sha256(result))</li>
<li>take the first 4 bytes from the obtained result and append it to the content from the step 4</li>
<li>encode it with base58</li>
</ol>
<p>So, following these steps, the results are as follows:</p>
<ol>
<li>03486669962008e0713660b6d69117a65fcecd221d06c1e5077b4d9cd477c0cf98</li>
<li>af1a74e378749900ab079315e518dfd27196193ca139f1e8a037e5851f8a5ecb</li>
<li>cfcc2ce2d8fc82b2b0837b6c1775d5edcffc107f</li>
<li>00cfcc2ce2d8fc82b2b0837b6c1775d5edcffc107f</li>
<li>79ccb53d787d2c54087ca095504d92ee2ad2bc93a0986ef9d19a017ef8232cdd</li>
<li>00cfcc2ce2d8fc82b2b0837b6c1775d5edcffc107f79ccb53d</li>
<li><strong>1KwjU4UknzbXh1rnP1jAKz9wwjcuYwe9AC</strong></li>
</ol>
<p>Looking at the video you provided, operation <code>RIPEMD(SHA256(&lt;pubkey&gt;))</code> doesn't give a correct result to him, but it ends up getting a good address. Very strange indeed. I see that in the comments of the video there are also people who had the same problem.</p>
<p>So, the conclusion is that you are not doing anything wrong. Something is wrong (or more correctly say strange) in the video I would say.</p>

CC BY-SA 4.0
2023-10-20T19:37:26.230Z
Thanks for your quick and clear response. Inspired by your insights, I'll analyze the process myself. Will share any findings. Appreciate your help!
ifuensan
CC BY-SA 4.0
2023-10-20T21:32:53.463Z
@ifuensan You're welcome
dassd
CC BY-SA 4.0
2023-10-18T23:05:04.487Z
2023-10-18T23:05:04.487Z
dassd
<p>I'm attempting to dissect a P2PKH transaction based on guidance from Rene Pickhardt's video (<a href="https://www.youtube.com/watch?v=1n4g3eYX1UI&amp;ab_channel=Ren%C3%A9Pickhardt" rel="nofollow noreferrer">link</a>). At around the 2:54 minute mark, he calculates the Bitcoin Address from the input. I'm interested in understanding the process behind obtaining the address. Here's the transcription:</p>
<pre><code>pubkey: 03486669962008e0713660b6d69117a65fcecd221d06c1e5077b4d9cd477c0cf98

Check the bitcoin address from the input:
RIPMED160(SHA256(pubkey)): CB226B9CC60C613DDDCB188E984F631764CEF143
Extend with version: 00CB226B9CC60C613DDDCB188E984F631764CEF143

Calculate checksum:
SHA256(SHA256(extended Pubkey)): CE281C015A7230F46041D2DD640A6714725C25A0ED674D5E215318AA206A397F
Checksum = first 4 Bytes: CE281C01
Address in hex: 00CB226B9CC60C613DDDCB188E984F631764CEF143CE281C01

Encode to base58: 1KwjU4UknzbXh1rnP1jAKz9wwjcuYwe9AC
</code></pre>
<p>Using this web <a href="http://lenschulwitz.com/base58" rel="nofollow noreferrer">http://lenschulwitz.com/base58</a> I can't get the address calculated before by Rene. What I'm doing wrong?
<a href="https://i.sstatic.net/ShdGk.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/ShdGk.png" alt="Encoding address in hex to base58" /></a></p>

<address><p2pkh><base58>
Stuck dissecting a P2PKH Bitcoin transaction, what am I doing wrong?
ifuensan
# Stuck dissecting a P2PKH Bitcoin transaction, what am I doing wrong?

(Asked by: username_0 on 2023-10-18)

I'm attempting to dissect a P2PKH transaction based on guidance from Rene Pickhardt's video ([link](https://www.youtube.com/watch?v=1n4g3eYX1UI&ab_channel=Ren%C3%A9Pickhardt)). At around the 2:54 minute mark, he calculates the Bitcoin Address from the input. I'm interested in understanding the process behind obtaining the address. Here's the transcription:

```
pubkey: 03486669962008e0713660b6d69117a65fcecd221d06c1e5077b4d9cd477c0cf98

Check the bitcoin address from the input:
RIPMED160(SHA256(pubkey)): CB226B9CC60C613DDDCB188E984F631764CEF143
Extend with version: 00CB226B9CC60C613DDDCB188E984F631764CEF143

Calculate checksum:
SHA256(SHA256(extended Pubkey)): CE281C015A7230F46041D2DD640A6714725C25A0ED674D5E215318AA206A397F
Checksum = first 4 Bytes: CE281C01
Address in hex: 00CB226B9CC60C613DDDCB188E984F631764CEF143CE281C01

Encode to base58: 1KwjU4UknzbXh1rnP1jAKz9wwjcuYwe9AC

```

Using this web <http://lenschulwitz.com/base58> I can't get the address calculated before by Rene. What I'm doing wrong?
[![Encoding address in hex to base58](https://i.sstatic.net/ShdGk.png)](https://i.sstatic.net/ShdGk.png)

**Tags:** address, p2pkh, base58


---

## 1 answers

### Answer by username_1 on 2023-10-18. Score: 2 | Accepted answer

The process of calculating a Bitcoin P2PKH address in base56check encoding format is as follows:

1. get a public key from the private key
2. hash the public key with the SHA256 hash function
3. hash the result from the 2nd step with the RIPEMD160 hash function
4. prepend 0x00 to the result from the previous step
5. calculate checksum of the result from the 4th step as sha256(sha256(result))
6. take the first 4 bytes from the obtained result and append it to the content from the step 4
7. encode it with base58

So, following these steps, the results are as follows:

1. 03486669962008e0713660b6d69117a65fcecd221d06c1e5077b4d9cd477c0cf98
2. af1a74e378749900ab079315e518dfd27196193ca139f1e8a037e5851f8a5ecb
3. cfcc2ce2d8fc82b2b0837b6c1775d5edcffc107f
4. 00cfcc2ce2d8fc82b2b0837b6c1775d5edcffc107f
5. 79ccb53d787d2c54087ca095504d92ee2ad2bc93a0986ef9d19a017ef8232cdd
6. 00cfcc2ce2d8fc82b2b0837b6c1775d5edcffc107f79ccb53d
7. **1KwjU4UknzbXh1rnP1jAKz9wwjcuYwe9AC**

Looking at the video you provided, operation `RIPEMD(SHA256(<pubkey>))` doesn't give a correct result to him, but it ends up getting a good address. Very strange indeed. I see that in the comments of the video there are also people who had the same problem.

So, the conclusion is that you are not doing anything wrong. Something is wrong (or more correctly say strange) in the video I would say.

> **Comments:**
> **username_0**: Thanks for your quick and clear response. Inspired by your insights, I'll analyze the process myself. Will share any findings. Appreciate your help!  
> **username_1**: @username_0 You're welcome  

---

