Bitcoin Forum
April 19, 2024, 06:31:49 PM *
News: Latest Bitcoin Core release: 26.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: When can you figure out an address from inside a transaction?  (Read 962 times)
tobasco (OP)
Member
**
Offline Offline

Activity: 61
Merit: 12


View Profile WWW
November 03, 2016, 09:32:21 PM
 #1

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?

The forum strives to allow free discussion of any ideas. All policies are built around this principle. This doesn't mean you can post garbage, though: posts should actually contain ideas, and these ideas should be argued reasonably.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
achow101
Moderator
Legendary
*
expert
Offline Offline

Activity: 3374
Merit: 6511


Just writing some code


View Profile WWW
November 03, 2016, 09:55:28 PM
 #2

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.

DannyHamilton
Legendary
*
Offline Offline

Activity: 3360
Merit: 4570



View Profile
November 03, 2016, 10:28:27 PM
Merited by ABCbits (2)
 #3

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.
tobasco (OP)
Member
**
Offline Offline

Activity: 61
Merit: 12


View Profile WWW
November 04, 2016, 01:02:08 AM
 #4

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 <hash160> OP_EQUAL

Or can you also get an address when the P2SH is:
Code:
... OP_CHECKMULTISIG

achow101
Moderator
Legendary
*
expert
Offline Offline

Activity: 3374
Merit: 6511


Just writing some code


View Profile WWW
November 04, 2016, 01:38:54 AM
 #5

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 <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 <hash> OP_EQUAl
because that specific script is a P2SH script.

DannyHamilton
Legendary
*
Offline Offline

Activity: 3360
Merit: 4570



View Profile
November 04, 2016, 01:55:50 AM
 #6

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.
tobasco (OP)
Member
**
Offline Offline

Activity: 61
Merit: 12


View Profile WWW
November 04, 2016, 10:25:38 AM
 #7

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)?

achow101
Moderator
Legendary
*
expert
Offline Offline

Activity: 3374
Merit: 6511


Just writing some code


View Profile WWW
November 04, 2016, 12:39:31 PM
 #8

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 <pubkey1> ... <pubkey n> 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.

tobasco (OP)
Member
**
Offline Offline

Activity: 61
Merit: 12


View Profile WWW
November 11, 2016, 12:01:39 PM
 #9

I found a transaction on testnet with the following scriptPubKey

Code:
d366fb5cbf048801b1bf0742bb0d873f65afb406f41756bd4a31865870f6a928 OP_DROP OP_2 <pubkey> <pubkey> OP_CHECKMULTISIG

Is this not going to be able to be redeemed because it does not have a OP_y before the OP_CHECKMULTISIG?

Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!