What is the best method of getting the originating address of Bitcoin transaction? As far as I see there are currently two methods of getting the sender's address in a Bitcoin transaction:


Look up the input transaction and read the corresponding output address there (like this: How to findout the sender of a transaction)
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?
"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.