Author

Topic: get sender address from RPC api (Read 3668 times)

hero member
Activity: 714
Merit: 662
June 14, 2014, 07:54:44 PM
#20
hi and sorry,

i try to understand this world and i try to crate a game/services.

My program in c# .net call the wallet by RPC, but how i can get sender address ?

for now i can get the transaction on specific account by listtransactions, i try getrawtransaction verbose or decoderawtransaction, but i can't get the address of sender.

Can you help me?

It was not here when you posted this message, but now, here you go
Github : https://github.com/NicolasDorier/NBitcoin
Nuget : Install-Package NBitcoin
The class that interest you is called RPCClient.
I wrote some articles on codeproject, I let you discover that.
legendary
Activity: 3472
Merit: 4801
June 03, 2014, 06:38:11 PM
#19
I wrote the ultimate guide many times.  Eventually got sick of it.

The short version is that there is no "sender", much less a "sender address".

I was hoping that the "Ultimate Guide" comment was in reference to:

Quote
With the Payment Protocol, the wallet supplies a refund address along with the payment.

An "Ultimate Guide" on how to choose which address your wallet will choose as the "refund address" when you send the payment, and how as a merchant to request a "refund address" from the customer by way of the payment protocol would be nice.
kjj
legendary
Activity: 1302
Merit: 1026
June 03, 2014, 04:44:45 PM
#18
I wrote the ultimate guide many times.  Eventually got sick of it.

The short version is that there is no "sender", much less a "sender address".
member
Activity: 93
Merit: 10
June 03, 2014, 03:31:34 PM
#17
This question pops up every now and then. I will write an "ultimate guide" on how to do this once and for all.

And I will show my gratitude with a modest donation.  (very modest)
member
Activity: 154
Merit: 10
June 03, 2014, 12:16:03 PM
#16
This question pops up every now and then. I will write an "ultimate guide" on how to do this once and for all.
member
Activity: 93
Merit: 10
June 03, 2014, 09:43:06 AM
#15
For anyone following this thread:

Quote
With the Payment Protocol, the wallet supplies a refund address along with the payment. This eliminates another potential source of error in refund situations. This approach to refunds works on the block chain, with any wallet software, and does not require the buyers to have a bitpay account.

http://blog.bitpay.com/2014/02/20/bitpay-launches-payment-protocol-support.html
legendary
Activity: 905
Merit: 1012
May 31, 2014, 11:38:38 PM
#14
RangerK the only legitimate way of retrieving the transaction sender's address is to ask for one. You might also want to take a closer look to the refund address facility introduced with the 0.9 client, however this is no production ready yet.

You are talking about the payment protocol, right? That's ready for production, and is the right tool to use here.
full member
Activity: 128
Merit: 104
May 31, 2014, 11:43:15 AM
#13
any ideas? I need it.
member
Activity: 66
Merit: 10
May 20, 2014, 11:22:38 AM
#12

As noted above:
Quote
As long as the sender uses their own client for the transaction they will always be the previous owners of all transaction's inputs so in this case you actually can get the sender's address(es), this is how SatoshiDice also retrieves the sender's address.

Is this not accurate?  Is your concern based on the fact that people might use web-wallets?

RangerK the only legitimate way of retrieving the transaction sender's address is to ask for one. You might also want to take a closer look to the refund address facility introduced with the 0.9 client, however this is no production ready yet.

BitcoinLib's GetTransactionSenderAddress() is not meant for production environment, as also stated in its comments and it will eventually return invalid data for thin clients and e-wallets. SatoshiDice follows the same routine to extract the sender's address but it also fails in exactly the same way.
legendary
Activity: 905
Merit: 1012
May 18, 2014, 04:53:59 PM
#11
No, that is not accurate. There are an unlimited ways in which this can break (and yes, it does break for SatoshiDice). If it seems relatively safe now, it is because smart contracts, joint transactions, and other on-the-horizon technologies are not being widely deployed. When they are, the assumption that you can simply return funds to a transactions input(s) will be even less valid.
member
Activity: 93
Merit: 10
May 18, 2014, 07:38:57 AM
#10
To get sender's address, you can go two ways
1.
use getrawtransaction TXID
decoderawtransaction TXID
then convert first prev_out pubkey to address
2.
parse JSON http://blockchain.info/rawtx/TXID
This is a horrible idea, as has already been explained in detail in this very thread. Please don't do this: you will have customers lose money.

maaku, Isn't this exactly the standard by which Satoshi Dice and some other Bitcoin casinos operate?  My impression was that with standard standard clients and standard transactions, it's no problem.  It will fail only with web-wallets and (Perhaps???) multi-sig transactions.

As noted above:
Quote
As long as the sender uses their own client for the transaction they will always be the previous owners of all transaction's inputs so in this case you actually can get the sender's address(es), this is how SatoshiDice also retrieves the sender's address.

Is this not accurate?  Is your concern based on the fact that people might use web-wallets?
legendary
Activity: 905
Merit: 1012
February 09, 2014, 06:25:11 AM
#9
To get sender's address, you can go two ways
1.
use getrawtransaction TXID
decoderawtransaction TXID
then convert first prev_out pubkey to address
2.
parse JSON http://blockchain.info/rawtx/TXID
This is a horrible idea, as has already been explained in detail in this very thread. Please don't do this: you will have customers lose money.
Ins
full member
Activity: 196
Merit: 100
February 09, 2014, 06:11:11 AM
#8
To get sender's address, you can go two ways
1.
use getrawtransaction TXID
decoderawtransaction TXID
then convert first prev_out pubkey to address
2.
parse JSON http://blockchain.info/rawtx/TXID
full member
Activity: 179
Merit: 151
-
February 08, 2014, 06:32:45 PM
#7
What you're asking for is implemented in this C# wrapper: https://github.com/GeorgeKimionis/BitcoinLib (IRpcExtenderService -> GetTransactionSenderAddress)


Really? Immediately above the definition of this function there is the comment

Code:
        // Note: Be careful when using GetTransactionSenderAddress(es) as it just gives you an address owned by someone who previously controlled the transaction's outputs
        // which might not actually be the sender

which tells you that this function is horribly misnamed and actually does not do what the OP asked for.

Bitcoin transactions do not contain enough information to determine a sender address. There is therefore no way to obtain this information through the RPC interface.
full member
Activity: 212
Merit: 100
January 14, 2014, 05:06:12 PM
#6
I have a MUCH better idea!

Ask your users what address they would like to use for receiving payment!

Brialliant!  Each user can tell you where they want their payments sent.  You can store this in a database, and when you need to send a payment to your users, you can send it to the address that THEY TOLD YOU THEY WANT IT SENT TO.

This way you don't have to try and guess what address they want the bitcoins sent to.  Guessing is a bad idea.  It will result in you guessing incorrectly sometimes and will cause problems for you and for your users.  Since there is a very simple solution that does not involve guessing, why would you want to take the risks that are associated with the possibility of guessing incorrectly?

it's the second that say is wrong. ok i try with signed message of wallet autentication.
legendary
Activity: 3472
Merit: 4801
January 14, 2014, 04:50:40 PM
#5
I have a MUCH better idea!

Ask your users what address they would like to use for receiving payment!

Brilliant!  Each user can tell you where they want their payments sent.  You can store this in a database, and when you need to send a payment to your users, you can send it to the address that THEY TOLD YOU THEY WANT IT SENT TO.

This way you don't have to try and guess what address they want the bitcoins sent to.  Guessing is a bad idea.  It will result in you guessing incorrectly sometimes and will cause problems for you and for your users.  Since there is a very simple solution that does not involve guessing, why would you want to take the risks that are associated with the possibility of guessing incorrectly?
full member
Activity: 212
Merit: 100
January 14, 2014, 12:48:12 PM
#4
From same code on github I understand that is possible or necessary analize all blockchain for get the sender address because is necessary analise all out address.
May be sufficient the single raw transaction?
full member
Activity: 212
Merit: 100
January 13, 2014, 02:15:39 PM
#3
This is a dangerous way to do things.  There isn't really a "sender address".  There are just previous outputs that are used as inputs. 

Additionally, people using online wallets, such as Mt.Gox, do not necessarily get credited for transactions that go back to the "sender address".

but for betting or dice game is perfect.

and for service i think is possible use signed message.

even with the difficulty of the case and imperfections, I want to create services without user db.
I want to create services where you just have a wallet
sr. member
Activity: 349
Merit: 250
BTCPak.com - Exchange your Bitcoins for MP!
January 13, 2014, 01:37:26 PM
#2
This is a dangerous way to do things.  There isn't really a "sender address".  There are just previous outputs that are used as inputs. 

Additionally, people using online wallets, such as Mt.Gox, do not necessarily get credited for transactions that go back to the "sender address".
full member
Activity: 212
Merit: 100
January 13, 2014, 01:17:41 PM
#1
hi and sorry,

i try to understand this world and i try to crate a game/services.

My program in c# .net call the wallet by RPC, but how i can get sender address ?

for now i can get the transaction on specific account by listtransactions, i try getrawtransaction verbose or decoderawtransaction, but i can't get the address of sender.

Can you help me?
Jump to: