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)
  2. Convert the public key in the scriptSig to the address (like this: Why does gettransaction report me only the receiving address?)

Is one of those preferable over the other one?

  • 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? Commented Apr 8, 2014 at 11:09
  • @GregHewgill I'm thinking about online services which return the Bitcoins to the originating address, e.g. SatoshiDice. Commented Apr 8, 2014 at 11:12

2 Answers 2


"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.

  • 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, ...). Commented Apr 15, 2014 at 10:41

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.