Author

Topic: When can you figure out an address from inside a transaction? (Read 962 times)

member
Activity: 61
Merit: 12
I found a transaction on testnet with the following scriptPubKey

Code:
d366fb5cbf048801b1bf0742bb0d873f65afb406f41756bd4a31865870f6a928 OP_DROP OP_2   OP_CHECKMULTISIG

Is this not going to be able to be redeemed because it does not have a OP_y before the OP_CHECKMULTISIG?
staff
Activity: 3458
Merit: 6793
Just writing some code
Thanks Danny (and achow101).

Do you know what the structure of a multisig output looks like (in OP codes)?
They look like this:
Code:
OP_0  ...  OP_y OP_CHECKMULTISIG
n and y must be below 15. OP_y specifies how many of the previous pubkeys must be used to sign the transaction.
member
Activity: 61
Merit: 12
Or can you also get an address when the P2SH is:
Code:
... OP_CHECKMULTISIG

As achow101 has implied...

OP_CHECKMULTISIG is not a P2SH output.

It's a multisig output.

I suppose, if you want to, you could potentially convert each of the public keys from the multisig output into a separate address.

Thanks Danny (and achow101).

Do you know what the structure of a multisig output looks like (in OP codes)?
legendary
Activity: 3472
Merit: 4801
Or can you also get an address when the P2SH is:
Code:
... OP_CHECKMULTISIG

As achow101 has implied...

OP_CHECKMULTISIG is not a P2SH output.

It's a multisig output.

I suppose, if you want to, you could potentially convert each of the public keys from the multisig output into a separate address.
staff
Activity: 3458
Merit: 6793
Just writing some code
There are only two versions of address, '1' and '3' addresses. '1' is for P2PK and P2PKH outputs, and '3' for P2SH outputs. These three output types are the only standard output types for now.

You can represent anything you want as an address.  You just have to create your own algorithm for generating the representation.

Really, it's only the P2PKH and the P2SH outputs that have a standard bitcoin address.  Anything else (including P2PK) is non-standard and is up to the person doing the conversion to decide how they want to represent it.

It is common to represent a P2PK output as a version 1 address, but if you gave someone that version 1 address there are no wallets that would build such an output, and when the output was created it was NOT done with that address.

Thank you.

With regards to P2SH, is it only possible to get an address from the pattern:
Code:
OP_HASH160  OP_EQUAL

Or can you also get an address when the P2SH is:
Code:
... OP_CHECKMULTISIG
P2SH addresses only are for output scripts of the form
Code:
OP_HASH160  OP_EQUAl
because that specific script is a P2SH script.
member
Activity: 61
Merit: 12
There are only two versions of address, '1' and '3' addresses. '1' is for P2PK and P2PKH outputs, and '3' for P2SH outputs. These three output types are the only standard output types for now.

You can represent anything you want as an address.  You just have to create your own algorithm for generating the representation.

Really, it's only the P2PKH and the P2SH outputs that have a standard bitcoin address.  Anything else (including P2PK) is non-standard and is up to the person doing the conversion to decide how they want to represent it.

It is common to represent a P2PK output as a version 1 address, but if you gave someone that version 1 address there are no wallets that would build such an output, and when the output was created it was NOT done with that address.

Thank you.

With regards to P2SH, is it only possible to get an address from the pattern:
Code:
OP_HASH160  OP_EQUAL

Or can you also get an address when the P2SH is:
Code:
... OP_CHECKMULTISIG
legendary
Activity: 3472
Merit: 4801
There are only two versions of address, '1' and '3' addresses. '1' is for P2PK and P2PKH outputs, and '3' for P2SH outputs. These three output types are the only standard output types for now.

You can represent anything you want as an address.  You just have to create your own algorithm for generating the representation.

Really, it's only the P2PKH and the P2SH outputs that have a standard bitcoin address.  Anything else (including P2PK) is non-standard and is up to the person doing the conversion to decide how they want to represent it.

It is common to represent a P2PK output as a version 1 address, but if you gave someone that version 1 address there are no wallets that would build such an output, and when the output was created it was NOT done with that address.
staff
Activity: 3458
Merit: 6793
Just writing some code
There are only two versions of address, '1' and '3' addresses. '1' is for P2PK and P2PKH outputs, and '3' for P2SH outputs. These three output types are the only standard output types for now.
member
Activity: 61
Merit: 12
I'm running through the blockchain (blk*.dat files), and I'm trying to get the addresses from inside each transaction.

So far I've made this diagram to show when I can get an address from a pattern of OP codes:



What other patterns of OP codes allow you to work out addresses?
Jump to: