<p>The hash160 of the script is</p>
<pre><code>e9c3dd0c07aac76179ebc76a6c78d4d67c6c160a
</code></pre>
<p>Prepend the version byte <code>05</code></p>
<pre><code>05e9c3dd0c07aac76179ebc76a6c78d4d67c6c160a
</code></pre>
<p>Double sha-256 gives a checksum of</p>
<pre><code>1. 5dad64852fbff1510074011803d9bf50b9650a517240d298a07ea5c525cdc5e7
2. 7f297f3156a14d114af23b33c339817a1241afcb52a154d19683c67c538b7278
first 4 bytes: 7f297f31
</code></pre>
<p>Encoding</p>
<pre><code>05e9c3dd0c07aac76179ebc76a6c78d4d67c6c160a7f297f31
</code></pre>
<p>as Bitcoin's Base58 gives</p>
<pre><code>3P14159f73E4gFr7JterCCQh9QjiTjiZrG
</code></pre>
<p>By the way, that's a pretty cool address. I assume it's a vanity address, 3 P(oint) 14159 = π.</p>

CC BY-SA 4.0
2021-12-29T00:04:24.527Z
2021-12-29T07:02:32.550Z
2021-12-29T07:02:32.550Z
meshcollider
<p>I have already looked at <a href="https://bitcoin.stackexchange.com/questions/92957/how-to-parse-transaction-script-to-address-the-correct-way">link</a>.</p>
<p>I am trying to generate P2SH address from output script but no luck. I am using transaction  <code>40eee3ae1760e3a8532263678cdf64569e6ad06abc133af64f735e52562bccc8</code> for testing purpose which has one input and one output. The output goes to P2SH address that starts with 3. Output script looks like below</p>
<pre><code>OP_HASH160
e9c3dd0c07aac76179ebc76a6c78d4d67c6c160a
OP_EQUAL
</code></pre>
<p>And destination address is <code>3P14159f73E4gFr7JterCCQh9QjiTjiZrG</code> as per open source explorers. I tried</p>
<p>Base58Check(e9c3dd0c07aac76179ebc76a6c78d4d67c6c160a)</p>
<p>Followed instructions on <a href="https://en.bitcoin.it/wiki/Technical_background_of_version_1_Bitcoin_addresses" rel="nofollow noreferrer">https://en.bitcoin.it/wiki/Technical_background_of_version_1_Bitcoin_addresses</a></p>
<p>But could not land to the address. Can anyone help me decoding the output script to fetch address.</p>

CC BY-SA 4.0
2021-12-28T23:18:03.127Z
Did you use the correct version byte? P2SH is `05`.
Ava Chow
CC BY-SA 4.0
2021-12-28T23:32:51.230Z
Yes. I tried 1 and 5 both but didnt work
Ankit
CC BY-SA 4.0
2021-12-28T23:59:01.003Z
Can you post all of the steps that you did?
Ava Chow
<bitcoin-core><address><p2sh>
Parsing P2SH address from output script
Ankit
# Parsing P2SH address from output script

(Asked by: username_0 on 2021-12-28)

I have already looked at [link](https://bitcoin.stackexchange.com/questions/92957/how-to-parse-transaction-script-to-address-the-correct-way).

I am trying to generate P2SH address from output script but no luck. I am using transaction `40eee3ae1760e3a8532263678cdf64569e6ad06abc133af64f735e52562bccc8` for testing purpose which has one input and one output. The output goes to P2SH address that starts with 3. Output script looks like below

```
OP_HASH160
e9c3dd0c07aac76179ebc76a6c78d4d67c6c160a
OP_EQUAL

```

And destination address is `3P14159f73E4gFr7JterCCQh9QjiTjiZrG` as per open source explorers. I tried

Base58Check(e9c3dd0c07aac76179ebc76a6c78d4d67c6c160a)

Followed instructions on <https://en.bitcoin.it/wiki/Technical_background_of_version_1_Bitcoin_addresses>

But could not land to the address. Can anyone help me decoding the output script to fetch address.

**Tags:** bitcoin-core, address, p2sh

> **Comments:**
> **username_1**: Did you use the correct version byte? P2SH is `05`.  
> **username_0**: Yes. I tried 1 and 5 both but didnt work  
> **username_1**: Can you post all of the steps that you did?  

---

## 1 answers

### Answer by username_2 on 2021-12-29. Score: 3 | Accepted answer

The hash160 of the script is

```
e9c3dd0c07aac76179ebc76a6c78d4d67c6c160a

```

Prepend the version byte `05`

```
05e9c3dd0c07aac76179ebc76a6c78d4d67c6c160a

```

Double sha-256 gives a checksum of

```
1. 5dad64852fbff1510074011803d9bf50b9650a517240d298a07ea5c525cdc5e7
2. 7f297f3156a14d114af23b33c339817a1241afcb52a154d19683c67c538b7278
first 4 bytes: 7f297f31

```

Encoding

```
05e9c3dd0c07aac76179ebc76a6c78d4d67c6c160a7f297f31

```

as Bitcoin's Base58 gives

```
3P14159f73E4gFr7JterCCQh9QjiTjiZrG

```

By the way, that's a pretty cool address. I assume it's a vanity address, 3 P(oint) 14159 = π.


---

