Author

Topic: Get address without pubkey (Read 975 times)

staff
Activity: 3458
Merit: 6793
Just writing some code
February 10, 2016, 09:33:55 PM
#4
Additionally, the input address isn't actually gotten from any public key in the input. Rather that address is retrieved by checking the specified output since there are special p2sh addresses that exist that don't even use public keys anywhere in them.
It is possible to determine the addresses based on the pubkeys or redeem scripts when those appear in input scripts, without having to check the transaction that is being spent.
Maybe I'm using the wrong terminology here, but I can show you an example if you want.
I know that, but when properly validating a transaction, in some cases such as this one, there is no need to have the input scripts have the necessary data to derive the address. Properly validating a transaction means that the node will still need to fetch the necessary output script in order to determine that the input script properly spends the output. Modern transactions use the hash160, and in order to get the hash160 properly, the public key (the digest)is required so that it can be used to check the signature (since the hash160 can't provide the public key to do that) and then checked against the hash160 to ensure that it is the proper public key. However, in this case, the pubkey is already supplied by the output script, so it is not necessary to include the public key in the input script since the input script will validate directly against the public key provided by the output.
sr. member
Activity: 345
Merit: 500
February 10, 2016, 09:14:09 PM
#3
Additionally, the input address isn't actually gotten from any public key in the input. Rather that address is retrieved by checking the specified output since there are special p2sh addresses that exist that don't even use public keys anywhere in them.
It is possible to determine the addresses based on the pubkeys or redeem scripts when those appear in input scripts, without having to check the transaction that is being spent.
Maybe I'm using the wrong terminology here, but I can show you an example if you want.
staff
Activity: 3458
Merit: 6793
Just writing some code
February 10, 2016, 09:03:40 PM
#2
This transaction spends from a transaction that used the old format for spending. The old format was pay-to-pubkey so the public key was already stated in the output the input references. Since the input references an output and that output has the necessary information to determine an address, it is not necessary to have the public key anywhere, all you need to do is look at the referenced output to get the input address. Additionally, the input address isn't actually gotten from any public key in the input. Rather that address is retrieved by checking the specified output since there are special p2sh addresses that exist that don't even use public keys anywhere in them.
sr. member
Activity: 345
Merit: 500
February 10, 2016, 08:58:47 PM
#1
If you check, as example, this transaction / raw:

Code:
0100000002f60b5e96f09422354ab150b0e506c4bffedaf20216d30059cc5a3061b4c83dff000000004a493046022100e26d9ff76a07d68369e5782be3f8532d25ecc8add58ee256da6c550b52e8006b022100b4431f5a9a4dcb51cbdcaae935218c0ae4cfc8aa903fe4e5bac4c208290b7d5d01fffffffff7272ef43189f5553c2baea50f59cde99b3220fd518884d932016d055895b62d000000004a493046022100a2ab7cdc5b67aca032899ea1b262f6e8181060f5a34ee667a82dac9c7b7db4c3022100911bc945c4b435df8227466433e56899fbb65833e4853683ecaa12ee840d16bf01ffffffff0100e40b54020000001976a91412ab8dc588ca9d5787dde7eb29569da63c3a238c88ac00000000

This transaction shows 2 inputs but I can't find any pubkeys:

Code:
01000000 - version number
02 - number of inputs

f60b5e96f09422354ab150b0e506c4bffedaf20216d30059cc5a3061b4c83dff - tx hash (spending)
00000000 - tx index
4a - script length
49 - OP_CODE 49

30 - header byte
46 - sig length
02 - header byte
21 - r length
00e26d9ff76a07d68369e5782be3f8532d25ecc8add58ee256da6c550b52e8006b - r
02 - header byte
21 - s length
00b4431f5a9a4dcb51cbdcaae935218c0ae4cfc8aa903fe4e5bac4c208290b7d5d - s
01 - sighash type

ffffffff - sequence number

f7272ef43189f5553c2baea50f59cde99b3220fd518884d932016d055895b62d - tx hash (spending)
00000000 - tx index
4a - script length
49 - OP_CODE 49

30 - header byte
46 - sig length
02 - header byte
21 - r length
00a2ab7cdc5b67aca032899ea1b262f6e8181060f5a34ee667a82dac9c7b7db4c3 - r
02 - header byte
21 - s length
00911bc945c4b435df8227466433e56899fbb65833e4853683ecaa12ee840d16bf - s
01 - sighash type

ffffffff - sequence number

(...)

How can you determine what are the addresses of the inputs without a pubkey?
Jump to: