2

1.What is the public key of address 3P9dyU9ga3aJorHAUqKBFCX2NdyuHEVgx1 (usually placed under input.. not in this case)

2.What type of Script (P2PK, P2PKH, P2SH, P2WPKH, P2WSH) is used to make this Tx, also how you discovered?

https://blockchain.info/tx/9d710be07bed7699055ed4c27868ee50fcb91f8d738bebfdbf4145cdbaeb15a2

1

A Bitcoin address starting with 3 is always P2SH (pay to script hash).

It's not P2PK (in that case you would see a public key instead of an address) nor P2PKH (you would see an address starting with 1). It could be P2WPKH or P2WSH since these are simply implemented as special types of scripts via P2SH. The address is only the hash of the script, not the script itself, and hash functions are one-way. So we won't know what the script actually is, nor whether it happens to be a WPKH or WSH script, until after that transaction output is spent.

See https://bitcoincore.org/en/segwit_wallet_dev/ for more info about segwit. In particular note the following:

Until a P2SH-P2WPKH UTXO is spent and the redeemScript is exposed, a P2SH-P2WPKH address is indistinguishable from a non-segwit P2SH address (such as a non-segwit multi-signature address)

Like any other P2SH and P2SH-P2WPKH address, P2SH-P2WSH address has prefix 3. They are indistinguishable until the UTXO is spent

  • Nit: P2WPKH and P2WSH can also be used natively, without P2SH. – Pieter Wuille Dec 12 '17 at 18:15
  • @PieterWuille, in that case, it shall not be the segwit address (starting with 1) anymore – user380208 Dec 12 '17 at 19:03
  • @PieterWuille I think this block explorer is useful.. it returns a P2SH P2WPKH script ..however, suppose i'm a 3rd party and i want to verify that public key belongs to that (3P9...) address .... how to do that?VISIT- btc.com/… – user380208 Dec 12 '17 at 19:09
  • bitcoinvalued.com/tools.php ..... my hash160 generator returns an invalid address from public key's 03144cf9e97d15e70820556aeb4d0f99ca8b9a5876e0fe26a67c0272c21a53009d - and - 03144cf9e97d15e70820556aeb4d0f99ca8b9a5876e0fe26a67c0272c21a53009d – user380208 Dec 12 '17 at 19:12
  • @Nate Eldredge There is an output assigned to this transaction.. so there must be public keys and witness data since this is a segwit transaction or P2SH P2WPKH script ... i see some random string .. how to construct this back to scriptsig????? any ideas – user380208 Dec 15 '17 at 7:21

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.