Bitcoin Forum
May 17, 2024, 12:49:55 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Getting public address from scriptSig (for an altcoin varient)  (Read 1285 times)
cryptapus (OP)
Hero Member
*****
Offline Offline

Activity: 626
Merit: 504



View Profile WWW
June 18, 2014, 12:56:46 AM
Last edit: October 15, 2017, 01:34:21 PM by cryptapus
 #1

Code:
I'm posting this in the Bitcoin Tech. Support as I'm not sure where to go with this, moderators please feel free to move this if it is more appropriate elsewhere. I understand this is for an altcoin that most bitcoin brains will not look at the source, nor care, and I fully expect not to receive a response. I am interested in this more to be educated than anything else...

308cb8732951cabed1f9596f96cf093daff7733cfd42d3cb9dacee180220652f1c73cf27fe01429b1262e86fc406f52ef73d8ad283b991b82ce12cb49b2801"
            },
            "sequence" : 429496729
        }

The "asm" line is quite short and has no break in it. Also, the "hex" line seems to show just the signature. My guess is that this particular altcoin clone is attempting to hide the sender by only supplying the signed input(?)

Any ideas?

website | PGP fingerprint: 692C 0756 E57D 2FA1 7601 3729 010B 717F 231C E7AA | BTC Address: 1CrYPTB1o7QWc8hXqBMP2LtAJh1VMtTFBh
amaclin
Legendary
*
Offline Offline

Activity: 1260
Merit: 1019


View Profile
June 18, 2014, 03:56:07 AM
 #2

There is no address-info in scriptSig
You have to take the previous transaction and look at its outputs

this is spending PAY_TO_PUBKEY output
Code:
"txid" : "d12adf1ae575830b4e8d9e1178ccbaf4f22db106b2f268705445d21d17ac815f"
"asm" : "304402205242f797308cb8732951cabed1f9596f96cf093daff7733cfd42d3cb9dacee180220652f1c73cf27fe01429b1262e86fc406f52ef73d8ad283b991b82ce12cb49b2801"

30 - magic der prefix
44 - length of der data
0220 5242f797308cb8732951cabed1f9596f96cf093daff7733cfd42d3cb9dacee18 - R
0220 652f1c73cf27fe01429b1262e86fc406f52ef73d8ad283b991b82ce12cb49b28 -S
01 - hashtype (all)

you can not get pubkey (and address) from this data.
you should take d12adf1ae575830b4e8d9e1178ccbaf4f22db106b2f268705445d21d17ac815f and look at its output #1
coinsolidation
Sr. Member
****
Offline Offline

Activity: 294
Merit: 250

Bitmark Developer


View Profile WWW
June 19, 2014, 12:10:07 PM
 #3

that is strange http://coinia.net/zimstake/blockexplorer.php?q=d12adf1ae575830b4e8d9e1178ccbaf4f22db106b2f268705445d21d17ac815f outputs total more than inputs.

edit: ahh it's not strange, it's a PoS block generation http://coinia.net/zimstake/blockexplorer.php?q=31684

Bitmark (reputation+money) : Bitmark v0.9.4 (release)
cryptapus (OP)
Hero Member
*****
Offline Offline

Activity: 626
Merit: 504



View Profile WWW
June 24, 2014, 06:35:43 PM
 #4

There is no address-info in scriptSig
You have to take the previous transaction and look at its outputs

this is spending PAY_TO_PUBKEY output
Code:
"txid" : "d12adf1ae575830b4e8d9e1178ccbaf4f22db106b2f268705445d21d17ac815f"
"asm" : "304402205242f797308cb8732951cabed1f9596f96cf093daff7733cfd42d3cb9dacee180220652f1c73cf27fe01429b1262e86fc406f52ef73d8ad283b991b82ce12cb49b2801"

30 - magic der prefix
44 - length of der data
0220 5242f797308cb8732951cabed1f9596f96cf093daff7733cfd42d3cb9dacee18 - R
0220 652f1c73cf27fe01429b1262e86fc406f52ef73d8ad283b991b82ce12cb49b28 -S
01 - hashtype (all)

you can not get pubkey (and address) from this data.
you should take d12adf1ae575830b4e8d9e1178ccbaf4f22db106b2f268705445d21d17ac815f and look at its output #1


I guess I'm not totally satisfied with that answer. I see what you are saying but then why does every bitcoin/altcoin transaction scriptSig "asm" have two parts? Under what circumstances does that not happen? My guess is that that's just the way the client is coded, and that a valid transaction need not include a two part scriptSig, but that's just a guess...

By the way, I think you have to be careful with looking at a previous output to get a sending address. If there are multiple outputs in the previous output you will need to verify which one is the correct one...

website | PGP fingerprint: 692C 0756 E57D 2FA1 7601 3729 010B 717F 231C E7AA | BTC Address: 1CrYPTB1o7QWc8hXqBMP2LtAJh1VMtTFBh
amaclin
Legendary
*
Offline Offline

Activity: 1260
Merit: 1019


View Profile
June 24, 2014, 07:33:51 PM
 #5

Quote
I guess I'm not totally satisfied with that answer. I see what you are saying but then why does every bitcoin/altcoin transaction scriptSig "asm" have two parts?
Valid scriptSig must correspond the previous output.
If output is PAY_TO_PUBKEY_HASH (the most popular one) I should provide signature and my public key.
So there are two pushes in scriptSig.

For output type PAY_TO_PUBKEY you already provide my public key in your output. So, I should put only the signature in scriptSig

There are other script types.

Quote
By the way, I think you have to be careful with looking at a previous output to get a sending address. If there are multiple outputs in the previous output you will need to verify which one is the correct one...
No-no-no! Stop here and read manuals again

The transaction may have more than one output.
Each output is a pair of value and script.

When I receive transaction from the network i do the following:
1) Is it correct? If yes - continue.
2) Are the output scripts known by my client? If yes - continue
3) Can I redeem(resend,forward) this outputs later? If yes - wow! Somebody sent me money!

Read carefuly https://en.bitcoin.it/wiki/Script#Scripts please
cryptapus (OP)
Hero Member
*****
Offline Offline

Activity: 626
Merit: 504



View Profile WWW
June 24, 2014, 10:43:48 PM
 #6

Quote
I guess I'm not totally satisfied with that answer. I see what you are saying but then why does every bitcoin/altcoin transaction scriptSig "asm" have two parts?
Valid scriptSig must correspond the previous output.
If output is PAY_TO_PUBKEY_HASH (the most popular one) I should provide signature and my public key.
So there are two pushes in scriptSig.

For output type PAY_TO_PUBKEY you already provide my public key in your output. So, I should put only the signature in scriptSig

There are other script types.


Ah.. This is what I was looking for. Thanks for this.

Quote

Quote
By the way, I think you have to be careful with looking at a previous output to get a sending address. If there are multiple outputs in the previous output you will need to verify which one is the correct one...
No-no-no! Stop here and read manuals again

The transaction may have more than one output.
Each output is a pair of value and script.

When I receive transaction from the network i do the following:
1) Is it correct? If yes - continue.
2) Are the output scripts known by my client? If yes - continue
3) Can I redeem(resend,forward) this outputs later? If yes - wow! Somebody sent me money!

Read carefuly https://en.bitcoin.it/wiki/Script#Scripts please

My point was that I'm not sure you can assume that "output #1" was the pair that you were interested in, it might be the 2nd, etc.

Thanks for the insight!

website | PGP fingerprint: 692C 0756 E57D 2FA1 7601 3729 010B 717F 231C E7AA | BTC Address: 1CrYPTB1o7QWc8hXqBMP2LtAJh1VMtTFBh
DeathAndTaxes
Donator
Legendary
*
Offline Offline

Activity: 1218
Merit: 1079


Gerald Davis


View Profile
June 24, 2014, 11:51:57 PM
 #7

My point was that I'm not sure you can assume that "output #1" was the pair that you were interested in, it might be the 2nd, etc.

What?

You don't assume anything.   Every input refers to a specific exact output.
Quote
"txid" : "d12adf1ae575830b4e8d9e1178ccbaf4f22db106b2f268705445d21d17ac815f",
            "vout" : 1,

Note the bolded portion.   vout refers the to output index and it is a zero based index so "1" = 2nd output.  If it was "0" it would be the 1st output and if it was "128" it would be the 129th output of that tx.  There is no assumptions involved.
cryptapus (OP)
Hero Member
*****
Offline Offline

Activity: 626
Merit: 504



View Profile WWW
June 25, 2014, 01:00:23 PM
 #8

My point was that I'm not sure you can assume that "output #1" was the pair that you were interested in, it might be the 2nd, etc.

What?

You don't assume anything.   Every input refers to a specific exact output.
Quote
"txid" : "d12adf1ae575830b4e8d9e1178ccbaf4f22db106b2f268705445d21d17ac815f",
            "vout" : 1,

Note the bolded portion.   vout refers the to output index and it is a zero based index so "1" = 2nd output.  If it was "0" it would be the 1st output and if it was "128" it would be the 129th output of that tx.  There is no assumptions involved.


OK, thanks for the clarification.

Thank you all for your insight.

website | PGP fingerprint: 692C 0756 E57D 2FA1 7601 3729 010B 717F 231C E7AA | BTC Address: 1CrYPTB1o7QWc8hXqBMP2LtAJh1VMtTFBh
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!