<p>"Originating address" is not a valid concept in Bitcoin.</p>

<p>Some sites (like Satoshi Dice) try to make an educated guess but they might as well be throwing darts blindfolded.</p>

<p>The only safe way to refund Bitcoins is to explicitly obtain a refunds address from whomever you're accepting a payment from.</p>

<p>Anything else you do is going to break sooner or later when a customer pays you via a type of wallet or transaction which you weren't anticipating.</p>

<p>"Break" here means sending funds to the wrong entity, or even worse: permanently losing them by sending to an address for which no private key exists.</p>

CC BY-SA 3.0
2014-04-15T10:41:55.797Z
In addition, building infrastructure that assumes a "from address" can be guessed will hurt the ecosystem by making new features which break that assumption harder to deploy (contracts, complex transaction types, script upgrades, coinjoin, ...).
Pieter Wuille
CC BY-SA 3.0
2014-04-08T18:30:47.560Z
2014-04-08T18:30:47.560Z
Justus Ranvier
<p>scriptSig contains a public key that belongs the redeemer of the output transaction and proves the creator is allowed to redeem the outputs value.</p>

<p>So you want to check the referenced output if you're looking for the originating address.</p>

CC BY-SA 3.0
2014-04-08T10:21:01.047Z
2014-04-08T10:21:01.047Z
Luca Matteis
<p>As far as I see there are currently two methods of getting the sender's address in a Bitcoin transaction:</p>

<ol>
<li>Look up the input transaction and read the corresponding output address there (like this: <a href="https://bitcoin.stackexchange.com/questions/3896/how-to-findout-the-sender-of-a-transaction">How to findout the sender of a transaction</a>)</li>
<li>Convert the public key in the scriptSig to the address (like this: <a href="https://bitcoin.stackexchange.com/questions/7838/why-does-gettransaction-report-me-only-the-receiving-address">Why does gettransaction report me only the receiving address?</a>)</li>
</ol>

<p>Is one of those preferable over the other one?</p>

CC BY-SA 3.0
2014-04-08T11:09:24.940Z
Normally, senders aren't even aware of which address(es) they might be using for sending. Some wallet software may allow advanced users to specifically choose which sending address to use, but this is not normal. What information do you hope to discover using the sending address?
Greg Hewgill
CC BY-SA 3.0
2014-04-08T11:12:38.280Z
@GregHewgill I'm thinking about online services which return the Bitcoins to the originating address, e.g. SatoshiDice.
Mark Goldenstein
<transactions><address><api>
What is the best method of getting the originating address of Bitcoin transaction?
Mark Goldenstein
# What is the best method of getting the originating address of Bitcoin transaction?

(Asked by: username_0 on 2014-04-08)

As far as I see there are currently two methods of getting the sender's address in a Bitcoin transaction:

1. Look up the input transaction and read the corresponding output address there (like this: [How to findout the sender of a transaction](https://bitcoin.stackexchange.com/questions/3896/how-to-findout-the-sender-of-a-transaction))
2. Convert the public key in the scriptSig to the address (like this: [Why does gettransaction report me only the receiving address?](https://bitcoin.stackexchange.com/questions/7838/why-does-gettransaction-report-me-only-the-receiving-address))

Is one of those preferable over the other one?

**Tags:** transactions, address, api

> **Comments:**
> **username_1**: Normally, senders aren't even aware of which address(es) they might be using for sending. Some wallet software may allow advanced users to specifically choose which sending address to use, but this is not normal. What information do you hope to discover using the sending address?  
> **username_0**: @username_1 I'm thinking about online services which return the Bitcoins to the originating address, e.g. SatoshiDice.  

---

## 2 answers

### Answer by username_2 on 2014-04-08. Score: 3

"Originating address" is not a valid concept in Bitcoin.

Some sites (like Satoshi Dice) try to make an educated guess but they might as well be throwing darts blindfolded.

The only safe way to refund Bitcoins is to explicitly obtain a refunds address from whomever you're accepting a payment from.

Anything else you do is going to break sooner or later when a customer pays you via a type of wallet or transaction which you weren't anticipating.

"Break" here means sending funds to the wrong entity, or even worse: permanently losing them by sending to an address for which no private key exists.

> **Comments:**
> **username_3**: In addition, building infrastructure that assumes a "from address" can be guessed will hurt the ecosystem by making new features which break that assumption harder to deploy (contracts, complex transaction types, script upgrades, coinjoin, ...).  

---

### Answer by username_4 on 2014-04-08. Score: 1

scriptSig contains a public key that belongs the redeemer of the output transaction and proves the creator is allowed to redeem the outputs value.

So you want to check the referenced output if you're looking for the originating address.


---

