Bitcoin Forum

Alternate cryptocurrencies => Altcoin Discussion => Topic started by: roleg on December 21, 2013, 07:27:37 AM



Title: How receive sender Public Key from bitcoin transaction ?
Post by: roleg on December 21, 2013, 07:27:37 AM
I have this transaction:

Code:
Array
(
    [txid] => 107b485a1b19d659173e5c5de762f4ae235f4cd913bffe0386ac87c28721d3ef
    [version] => 1
    [locktime] => 0
    [vin] => Array
        (
            [0] => Array
                (
                    [txid] => ee759554cffc082d1168691df3c51bba0b16cdcd2d2e340b20d16ac734b525a5
                    [vout] => 0
                    [scriptSig] => Array
                        (
                            [asm] => 304502205be1eeb9c2bbbec97958fa52109dfb4845e15882772f28433c42089aca248322022100af23b8dc1d2b1d9bae4bf1a31027554a7c0c2dc75ead0297617e6e4a9939316501 022e2531ee7a16dbaf83e3554334bb6adea93af0fb2f221cb17b9ffbb587e6bb7f
                            [hex] => 48304502205be1eeb9c2bbbec97958fa52109dfb4845e15882772f28433c42089aca248322022100af23b8dc1d2b1d9bae4bf1a31027554a7c0c2dc75ead0297617e6e4a993931650121022e2531ee7a16dbaf83e3554334bb6adea93af0fb2f221cb17b9ffbb587e6bb7f
                        )

                    [sequence] => 4294967295
                )

        )

    [vout] => Array
        (
            [0] => Array
                (
                    [value] => 0.01
                    [n] => 0
                    [scriptPubKey] => Array
                        (
                            [asm] => OP_DUP OP_HASH160 686f68f7c47a0b11dc971857cdc2148a8dd11418 OP_EQUALVERIFY OP_CHECKSIG
                            [hex] => 76a914686f68f7c47a0b11dc971857cdc2148a8dd1141888ac
                            [reqSigs] => 1
                            [type] => pubkeyhash
                            [addresses] => Array
                                (
                                    [0] => LUkA14u3fjLCgnBfC5NcoN7DhVt5XARbd7
                                )

                        )

                )

            [1] => Array
                (
                    [value] => 0.04091674
                    [n] => 1
                    [scriptPubKey] => Array
                        (
                            [asm] => OP_DUP OP_HASH160 4567476389e2e7bb397f55da01d0b0f9c62de7e4 OP_EQUALVERIFY OP_CHECKSIG
                            [hex] => 76a9144567476389e2e7bb397f55da01d0b0f9c62de7e488ac
                            [reqSigs] => 1
                            [type] => pubkeyhash
                            [addresses] => Array
                                (
                                    [0] => LRYvcPbrT8K3WxrP8cN7ZR6L5tSzH1HgD4
                                )

                        )

                )

        )


How receive sender Public Key from this transaction?
Or where I can get sender Public Key using bitcoin RPC API?


Title: Re: How receive sender Public Key from bitcoin transaction ?
Post by: fbueller on December 21, 2013, 09:27:42 AM
The public key isn't stored in a transaction or the block chain, but it's hash is. Normally blockexplorer or something will pick out the public key from the signature when spent (you're looking for the public key for the sender, who has just signed the transaction with this part:)
Code:
                    [scriptSig] => Array
                        (
                            [asm] => 304502205be1eeb9c2bbbec97958fa52109dfb4845e15882772f28433c42089aca248322022100af23b8dc1d2b1d9bae4bf1a31027554a7c0c2dc75ead0297617e6e4a9939316501 022e2531ee7a16dbaf83e3554334bb6adea93af0fb2f221cb17b9ffbb587e6bb7f
                            [hex] => 48304502205be1eeb9c2bbbec97958fa52109dfb4845e15882772f28433c42089aca248322022100af23b8dc1d2b1d9bae4bf1a31027554a7c0c2dc75ead0297617e6e4a993931650121022e2531ee7a16dbaf83e3554334bb6adea93af0fb2f221cb17b9ffbb587e6bb7f
                        )

Can't get onto explorer.litecoin.com right now but it might help you when it gets back up..


Title: Re: How receive sender Public Key from bitcoin transaction ?
Post by: roleg on December 21, 2013, 09:40:52 AM
I want recover sender address from this transaction.


Title: Re: How receive sender Public Key from bitcoin transaction ?
Post by: andytoshi on December 21, 2013, 10:05:23 PM
I want recover sender address from this transaction.

There is no from address. It is clear what you are asking for, but not why you need it or why you believe it is the "sender's address".

You may find it worthwhile to read http://download.wpsoftware.net/bitcoin/bitcoin-faq.pdf .


Title: Re: How receive sender Public Key from bitcoin transaction ?
Post by: piotr_n on December 22, 2013, 12:55:33 AM
the public key in your example is:
Code:
022e2531ee7a16dbaf83e3554334bb6adea93af0fb2f221cb17b9ffbb587e6bb7f


Title: Re: How receive sender Public Key from bitcoin transaction ?
Post by: roleg on December 22, 2013, 06:33:29 PM
the public key in your example is:
Code:
022e2531ee7a16dbaf83e3554334bb6adea93af0fb2f221cb17b9ffbb587e6bb7f

OK!

and I try, create address from it
Code:
step1 022e2531ee7a16dbaf83e3554334bb6adea93af0fb2f221cb17b9ffbb587e6bb7f - public key
step2 0366f01948a5f5621ec9b7f78a6e7f549b4600656f5e51706b24350b37c9168b - sha256
step3 7ec68dcd19e108813204d645b0a6354999acdad2 - ripemd160
step4 007ec68dcd19e108813204d645b0a6354999acdad2 - 00 + step3
step5 4342cf3808ad504d28a366ea89a098249104921781a6d46347e70c2c43bdbb96 - sha256
step6 88774008f1d141d6efc3b55ffd8062d46d2b12137655f1d5be608d3d059938aa - sha256
step7 88774008 - checksum substr($step6,0,8)
step8 007ec68dcd19e108813204d645b0a6354999acdad288774008 - step4 + checksum
step9 1CZKzwR9tM5SLTS9bZEQyd1eHCGHewFQ87 - address in base58

but is not true  :-[


Title: Re: How receive sender Public Key from bitcoin transaction ?
Post by: piotr_n on December 22, 2013, 06:39:55 PM
but is not true  :-[
It is true - that's the address.
Why do you think that it isn't?

1CZKzwR9tM5SLTS9bZEQyd1eHCGHewFQ87 - is exactly what 022e2531ee7a16dbaf83e3554334bb6adea93af0fb2f221cb17b9ffbb587e6bb7f points to.


Title: Re: How receive sender Public Key from bitcoin transaction ?
Post by: roleg on December 22, 2013, 06:48:16 PM
becouse I send from LWnHG9iyy1KVbG8JmhDiFe5QVQdZnxtqGW
but Litecoin address to Litecoin address


Title: Re: How receive sender Public Key from bitcoin transaction ?
Post by: piotr_n on December 22, 2013, 06:51:13 PM
becouse I send from LWnHG9iyy1KVbG8JmhDiFe5QVQdZnxtqGW
but Litecoin proto
Well, then you should have told us that you meant litecoin, not bitcoin.

I don't know litecoin address specifics, but I guess that there should be at least a different "version" byte (the 00 in front, added in step4, will likely be something else).


Title: Re: How receive sender Public Key from bitcoin transaction ?
Post by: piotr_n on December 22, 2013, 06:58:32 PM
the 00 in front, added in step4, will likely be something else
It is 48 (decimal) - replace 00 with 30 and you will get LWnHG9iyy1KVbG8JmhDiFe5QVQdZnxtqGW


Title: Re: How receive sender Public Key from bitcoin transaction ?
Post by: roleg on December 22, 2013, 07:05:47 PM
the 00 in front, added in step4, will likely be something else
It is 48 (decimal) - replace 00 with 30 and you will get LWnHG9iyy1KVbG8JmhDiFe5QVQdZnxtqGW

 :D OMG !
You My HERO!!!  ;D
snks!


Title: Re: How receive sender Public Key from bitcoin transaction ?
Post by: bitpop on December 22, 2013, 09:28:58 PM
Wow


Title: Re: How receive sender Public Key from bitcoin transaction ?
Post by: marathasam on May 04, 2017, 02:30:19 PM
Hi Roleg,

I'm trying develop same function to get vin address from public key by using c++, while coding i tried pub key mentioned above in this post and generated sha256 but i'm getting different output.
(output: 36bdb67e9a379df3e208ab87941d7320aabde7204f6eb4a1b31660804f958c15). I have used openssl/sha.h for sha256. It would be great, if you could tell me how you got that sha256 value from pubkey this pubkey (022e2531ee7a16dbaf83e3554334bb6adea93af0fb2f221cb17b9ffbb587e6bb7f).




Title: Re: How receive sender Public Key from bitcoin transaction ?
Post by: Kristina303 on April 27, 2019, 02:48:08 PM
There is more easy way  to find the publickey... only from( R S Z ) in a seconds.

Plus i have a code which working just perfectly...  ;)