1
I have the following testnet wallet address:
2MsQEtPJ6JJZszMYrD6udjUyTDFLczWQrv9
Which I am trying to encode as pubkeyhash to the coinbase TX in testnet. When i run decode58, I get this
C401B47E5722F808856A308FA043CCF28323F51711E8165536
I strip it off the version byte prefix and the checksum postfix, and I get:
01B47E5722F808856A308FA043CCF28323F51711
So the scriptPubKey should be
76a91401b47e5722f808856a308fa043ccf28323f5171188ac which is OP_DUP OP_HASH160 01b47e5722f808856a308fa043ccf28323f51711 OP_EQUALVERIFY OP_CHECKSIG
But as a sanity unit test, i verify it Vs. the debug console
decodescript 76a91401b47e5722f808856a308fa043ccf28323f5171188ac
But the debug console gives me this:
"asm": "OP_DUP OP_HASH160 01b47e5722f808856a308fa043ccf28323f51711 OP_EQUALVERIFY OP_CHECKSIG",
"reqSigs": 1,
"type": "pubkeyhash",
"addresses": [
"mffyC9xbwyBQUWhV8SbYWpqaiNSSWR2vpo"
],
"p2sh": "2ND12E9b9oa9hvTTckXwNaSJiRZ39eRFWSJ"
So why do I get address "mffyC9xbwyBQUWhV8SbYWpqaiNSSWR2vpo" and not "2MsQEtPJ6JJZszMYrD6udjUyTDFLczWQrv9" as I expect?
Thanks!, so if the version byte is "0xc4" then I can tell it's a P2SH address...I now I get https://en.bitcoin.it/wiki/Base58Check_encoding. What I now wish to understand is why does the opcode are different in P2SH addresses in coinbase transactions
– dodo – 2018-04-23T19:22:21.347They are not necessarily P2SH. You are probably confusing them with something else. – Andrew Chow – 2018-04-23T20:07:42.867