<p>The quote below is taken from my answer to <a href="https://bitcoin.stackexchange.com/a/14073/16">How to implement a game like SatoshiDice?</a>  What you are looking for is addressed in this portion of my answer below.</p>

<blockquote>
  <p><strong>Get the customer amount and payment address</strong>  </p>
  
  <ol>
  <li><p>Call <code>bitcoind getrawtransaction [The incoming transaction ID] 1</code>.  The 1 at the end will return the data in "verbose mode", which
  essentially the raw data in JSON format.</p></li>
  <li><p>From the raw transaction details, take the <code>txid</code> and <code>vout</code> from the <code>vin</code> object.  With this transaction, again call <code>bitcoind
  getrawtransaction</code> on the <code>txid</code>.</p></li>
  <li><p>From these raw transaction details find the <code>vout</code> object, referenced by the <code>vout</code> index from step #2.  Within this <code>vout</code>
  object, there should be a list of payment recipient addresses.  Take
  and store the first address.</p></li>
  </ol>
</blockquote>

<p>It is worth mentioning that a received payment can be a summation of numerous, former transactions to multiple recipient addresses.  Getting an originators address isn't always straight-forward because the original payment could consist of multiple payments, from multiple sending addresses.</p>

<p>This is why that in my response to the SatoshiDice question I mention taking the first address from the second <code>vout</code> result.  </p>

<p>You can safely assume that if someone sends you a payment originating from multiple accounts, they control all accounts. Ergo, picking the first in the list will give you correct address.</p>

CC BY-SA 3.0
2015-10-13T13:02:21.700Z
2015-10-13T13:08:26.497Z
2017-04-13T12:47:33.583Z
RLH
<p>I'm trying to get the senders address using the Bitcoin JSON RPC in C#. So I GetRawTransaction and then use the DecodeRawTransaction method to return my JSON object. I can see in the 'vout' of this the receiver addresses but I cannot see the sender addresses in the 'vin'.</p>

<p>Can anyone help? I may have phrased the question poorly so please ask if you need any more informations. Thanks.</p>

<c#>
Sender address from DecodeRawTransaction (C#)
BitcoinLiam
# Sender address from DecodeRawTransaction (C#)

(Asked by: username_0 on 2015-10-11)

I'm trying to get the senders address using the Bitcoin JSON RPC in C#. So I GetRawTransaction and then use the DecodeRawTransaction method to return my JSON object. I can see in the 'vout' of this the receiver addresses but I cannot see the sender addresses in the 'vin'.

Can anyone help? I may have phrased the question poorly so please ask if you need any more informations. Thanks.

**Tags:** c#


---

## 1 answers

### Answer by username_1 on 2015-10-13. Score: 1

The quote below is taken from my answer to [How to implement a game like SatoshiDice?](https://bitcoin.stackexchange.com/a/14073/16) What you are looking for is addressed in this portion of my answer below.

> **Get the customer amount and payment address**
>
> 1. Call `bitcoind getrawtransaction [The incoming transaction ID] 1`. The 1 at the end will return the data in "verbose mode", which
>    essentially the raw data in JSON format.
> 2. From the raw transaction details, take the `txid` and `vout` from the `vin` object. With this transaction, again call `bitcoind
>    getrawtransaction` on the `txid`.
> 3. From these raw transaction details find the `vout` object, referenced by the `vout` index from step #2. Within this `vout`
>    object, there should be a list of payment recipient addresses. Take
>    and store the first address.

It is worth mentioning that a received payment can be a summation of numerous, former transactions to multiple recipient addresses. Getting an originators address isn't always straight-forward because the original payment could consist of multiple payments, from multiple sending addresses.

This is why that in my response to the SatoshiDice question I mention taking the first address from the second `vout` result.

You can safely assume that if someone sends you a payment originating from multiple accounts, they control all accounts. Ergo, picking the first in the list will give you correct address.


---

