0

I have already looked at link.

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.

3
  • Did you use the correct version byte? P2SH is 05.
    – Andrew Chow
    Dec 28 '21 at 23:18
  • Yes. I tried 1 and 5 both but didnt work
    – Ankit
    Dec 28 '21 at 23:32
  • Can you post all of the steps that you did?
    – Andrew Chow
    Dec 28 '21 at 23:59
3

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 = π.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.