Bitcoin Forum
November 11, 2024, 08:41:44 PM *
News: Check out the artwork 1Dq created to commemorate this forum's 15th anniversary
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Identify the sender in transactions with more than one sender  (Read 983 times)
NicosKaralis (OP)
Sr. Member
****
Offline Offline

Activity: 416
Merit: 251


★777Coin.com★ Fun BTC Casino!


View Profile
May 05, 2015, 02:15:44 PM
 #1

I'm developing a lottery based game similar to http://luckyb.it for a third party, everything was fine until I come up with this transaction: https://blockchain.info/tx/a7d35ae556e866ca4d2fa692ae4760782c2c95622fbcf22f9c05aa59996e7e5f

How do I detect which address is the sender in a transaction with multiple sender(and if is relevant multiple receivers)?

I sent the BTC to 164fCo3798s6Nk99MRQ5bkT9bEvNnSGc5b but my wallet (HD) also transfer some funds to 15DTdHq2TaZDvzKcHCeCp24CmhNJhQhHpa
In this case how can I detect to which address I should return the winnings?

Outputs
Quote
1HAYB6Sa6nJkB1bgGcAxVHVMnWLuGx5egi (0.01067782 BTC)
15fSktiWqTNf4wsGnG6XHqPpj3r6aMhj9N (0.01617602 BTC)
1ESLiFtyK2nKw98MLbupYSsgGyLz5w3KxU (0.0885 BTC)
1BJ7dZqeQEFV22Dr1KSRKqSY6jqnbFTG3p (0.01142016 BTC)
Inputs
Quote
164fCo3798s6Nk99MRQ5bkT9bEvNnSGc5b - 0.015904 BTC
15DTdHq2TaZDvzKcHCeCp24CmhNJhQhHpa - 0.11077 BTC

I tried to open some old transactions from luckyb.it and I found this examples:

https://blockchain.info/tx/a2a48b476111ca163f917028c11930887b49d9f22354f3c923243b1b528738e9
In this case each output is a different bet, so no problem at all

https://blockchain.info/tx/9456a0715b2ef5bb7274771c7622999d35d3f2991d667f7da3d84a2e5a8ba826
In this one the same address sent 2 outputs but one for luckybit and other for himself, does luckybit recognise 2 bets? I think not.
Also this is fine because each output have the same address, meaning we have just one address to return.

But what about this one: https://blockchain.info/tx/bc7d54aed374fafa0efce2add6b03e446cb3193c38a7c582d5d443af1bb44f05
This have 2 outputs with different addresses and 2 inputs also for different addresses.
How can I determinate in which address I should return the winnings?

DannyHamilton
Legendary
*
Offline Offline

Activity: 3486
Merit: 4832



View Profile
May 05, 2015, 02:50:00 PM
 #2

I'm developing a lottery based game similar to http://luckyb.it for a third party, everything was fine until I come up with this transaction: https://blockchain.info/tx/a7d35ae556e866ca4d2fa692ae4760782c2c95622fbcf22f9c05aa59996e7e5f

How do I detect which address is the sender in a transaction with multiple sender(and if is relevant multiple receivers)?

I sent the BTC to 164fCo3798s6Nk99MRQ5bkT9bEvNnSGc5b but my wallet (HD) also transfer some funds to 15DTdHq2TaZDvzKcHCeCp24CmhNJhQhHpa
In this case how can I detect to which address I should return the winnings?

Outputs
Quote
1HAYB6Sa6nJkB1bgGcAxVHVMnWLuGx5egi (0.01067782 BTC)
15fSktiWqTNf4wsGnG6XHqPpj3r6aMhj9N (0.01617602 BTC)
1ESLiFtyK2nKw98MLbupYSsgGyLz5w3KxU (0.0885 BTC)
1BJ7dZqeQEFV22Dr1KSRKqSY6jqnbFTG3p (0.01142016 BTC)
Inputs
Quote
164fCo3798s6Nk99MRQ5bkT9bEvNnSGc5b - 0.015904 BTC
15DTdHq2TaZDvzKcHCeCp24CmhNJhQhHpa - 0.11077 BTC

I tried to open some old transactions from luckyb.it and I found this examples:

https://blockchain.info/tx/a2a48b476111ca163f917028c11930887b49d9f22354f3c923243b1b528738e9
In this case each output is a different bet, so no problem at all

https://blockchain.info/tx/9456a0715b2ef5bb7274771c7622999d35d3f2991d667f7da3d84a2e5a8ba826
In this one the same address sent 2 outputs but one for luckybit and other for himself, does luckybit recognise 2 bets? I think not.
Also this is fine because each output have the same address, meaning we have just one address to return.

But what about this one: https://blockchain.info/tx/bc7d54aed374fafa0efce2add6b03e446cb3193c38a7c582d5d443af1bb44f05
This have 2 outputs with different addresses and 2 inputs also for different addresses.
How can I determinate in which address I should return the winnings?

You should never try to guess what address to send bitcoins to.  If you guess wrong, then the bitcoins are permanently lost.

You should never look at inputs to try to figure out where bitcoins should be sent "back" to, since the original sender might not have control of that address.

Instead you should ALWAYS ask your users where they want their bitcoins sent.  You should allow them to enter a bitcoin address, and then send the bitcoins to the entered address.

(There's no such thing as a "sending address".  Attempting to guess at a "return address" by looking at the previous outputs that were used to supply value for the inputs of a transaction is a good way to cause frustration, lose money, and create confusion.)
spin
Sr. Member
****
Offline Offline

Activity: 362
Merit: 262


View Profile
May 05, 2015, 02:51:45 PM
 #3

You probably want to read up on this: https://en.bitcoin.it/wiki/From_address
Which Danny gave a short summary of.

If you liked this post buy me a beer.  Beers are quite cheap where I live!
bc1q707guwp9pc73r08jw23lvecpywtazjjk399daa
grtthegreat
Legendary
*
Offline Offline

Activity: 1246
Merit: 1029



View Profile WWW
May 05, 2015, 04:25:46 PM
 #4

----------SNIP---------

If you are developing a game similar to LuckyBit, then you need to know that it allows only some wallets, which they call "compatible wallets". These wallets are those which specifically allow you to control your own private keys. Some wallets are Electrum, Bitcoin-Qt, Multibit, Armory. Third party wallets like Coinbase, Xapo, etc use multiple addresses (also, they are anonymous) and they send money from completely new addresses every time which aren't under your control. So, better notify users to use only the compatible wallets like Blockchain, Electrum, Bitcoin-Qt, Multibit, Armory once the site comes live. If someone still uses incompatible wallets, its something you cannot help the user with.

Anyways, wishing you good luck with your new game.
altcoinex
Sr. Member
****
Offline Offline

Activity: 293
Merit: 251


Director - www.cubeform.io


View Profile WWW
May 05, 2015, 04:52:47 PM
 #5

In addition to everything outlined above, 'reusing addresses' is considered bad practice. It is better and more secure for them to have a new receiving address, rather than it returned to the sending one, even if that one could be verified as the sender. (see: https://en.bitcoin.it/wiki/Address_reuse)


                                     ╓╢╬╣╣╖
                                   ┌║██████║∩
                                   ]█████████
                                    ╜██████╝`
                                      ╙╜╜╜`
                                   ╓╥@@@@@@╥╓
         ╓╖@@╖,                 ,@║██████████╢@,                 ,╓@@╖╓
       ╓╢██████╢.              ╓╢███████████████╖               ║╢█████║╓
       ║█████████    ,,╓╓,,   ┌║█████████████████┐   ,,╓╓,,    ]█████████
       └╢██████║` ╓╢║██████╢║∩``╙╙╙╙╙╙╙╙╙╙╙╙╙╙╙╙╙`»╢╢██████╢║╖  ║███████╜
         "╜╜╜╜` ╖╢█████████╣╜                      └╢██████████@ `╜╜╜╜╜
               ║██████████╜                          ╙╢██████████
              ┌█████████╜                              ╙╢█████████
              └███████╨`                                 ╜████████
               ║████╨╜                                    `╢█████
                ╙╢╣╜                                        └╢█╜
                ,,                                            ,,
             ╓@║██┐                                          ┌██║@╓
            ╢██████                                          ]█████H
           ╢███████∩                                        ┌████████
  ╓@@@@╓   █████████                                        ║████████`  ╓@@@@╖
╓╢██████║. █████████∩                                      ┌█████████ ,║███████╖
██████████ └█████████                                      ██████████ ]█████████
`║██████╜`  └╢████████                                    ┌███████╣╜   ╙██████╨`
  `╙╜╜╙`      `╙╨╢████                                    █████╝╜`       `╙╜╜`
                      ]@╓                              ╓╖H
                      ███╢║@╓,                    ,╓@╢╢███`
                      ████████╢@╖╓.           ╓╖@║████████`
                      ]███████████╢║@╓,  ,╓@╢╢████████████
                       ╙╢█████████████╨` ╜██████████████╜
                         ╙╝╢███████║╜`    `╜║████████╝╜`
                     ,╓@@@╓  `²╙``             `╙²`  ╓@@@╖,
                    ║╢█████╢H                      ╓╢██████H
                    █████████                      █████████`
                    ╙╢██████╜                      ╙╢██████╜
                      └╨╩╝┘                          └╨╩╝╜
WINFLOW.
██
██
██
██
██
██
██
██
██
██
██
██
██
..
██
██
██
██
██
██
██
██
██
██
██
██
██
.
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!