Bitcoin Forum
July 17, 2018, 05:42:45 PM *
News: Latest stable version of Bitcoin Core: 0.16.1  [Torrent]. (New!)
 
   Home   Help Search Donate Login Register  
Pages: [1]
  Print  
Author Topic: When can you figure out an address from inside a transaction?  (Read 889 times)
tobasco
Jr. Member
*
Offline Offline

Activity: 52
Merit: 2


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?

Bitcoin Video Tutorials: https://bitcointalk.org/index.php?topic=3093713.msg31934254

http://learnmeabitcoin.com
1531849365
Hero Member
*
Offline Offline

Posts: 1531849365

View Profile Personal Message (Offline)

Ignore
1531849365
Reply with quote  #2

1531849365
Report to moderator
1531849365
Hero Member
*
Offline Offline

Posts: 1531849365

View Profile Personal Message (Offline)

Ignore
1531849365
Reply with quote  #2

1531849365
Report to moderator
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
1531849365
Hero Member
*
Offline Offline

Posts: 1531849365

View Profile Personal Message (Offline)

Ignore
1531849365
Reply with quote  #2

1531849365
Report to moderator
1531849365
Hero Member
*
Offline Offline

Posts: 1531849365

View Profile Personal Message (Offline)

Ignore
1531849365
Reply with quote  #2

1531849365
Report to moderator
1531849365
Hero Member
*
Offline Offline

Posts: 1531849365

View Profile Personal Message (Offline)

Ignore
1531849365
Reply with quote  #2

1531849365
Report to moderator
achow101
Moderator
Legendary
*
expert
Offline Offline

Activity: 1456
Merit: 1443


3F1Y9yquzvY6RWvKbw2n2zeo9V5mvBhADU


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: 2198
Merit: 1370



View Profile
November 03, 2016, 10:28:27 PM
 #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
Jr. Member
*
Offline Offline

Activity: 52
Merit: 2


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

Bitcoin Video Tutorials: https://bitcointalk.org/index.php?topic=3093713.msg31934254

http://learnmeabitcoin.com
achow101
Moderator
Legendary
*
expert
Offline Offline

Activity: 1456
Merit: 1443


3F1Y9yquzvY6RWvKbw2n2zeo9V5mvBhADU


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: 2198
Merit: 1370



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
Jr. Member
*
Offline Offline

Activity: 52
Merit: 2


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

Bitcoin Video Tutorials: https://bitcointalk.org/index.php?topic=3093713.msg31934254

http://learnmeabitcoin.com
achow101
Moderator
Legendary
*
expert
Offline Offline

Activity: 1456
Merit: 1443


3F1Y9yquzvY6RWvKbw2n2zeo9V5mvBhADU


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
Jr. Member
*
Offline Offline

Activity: 52
Merit: 2


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?

Bitcoin Video Tutorials: https://bitcointalk.org/index.php?topic=3093713.msg31934254

http://learnmeabitcoin.com
Pages: [1]
  Print  
 
Jump to:  

Sponsored by , a Bitcoin-accepting VPN.
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!