Bitcoin Forum

Bitcoin => Project Development => Topic started by: The Goat Master on December 25, 2013, 07:56:56 PM



Title: How to create a coin-flip type address?
Post by: The Goat Master on December 25, 2013, 07:56:56 PM
How would one go in the process of creating an address in which when somebody sent some coins to it, it would have a 50% chance of keeping the coins and a 50% chance of sending double the coins back, provided that the transaction is under half of the current wallet balance?  (Kind of like coinsflip.com (http://coinsflip.com), you send and it will send back if you win)

I am interested in claiming some new altcoin bounties.


Title: Re: How to create a coin-flip type address?
Post by: rarkenin on December 25, 2013, 09:18:43 PM
This isn't doable with an address alone, but is easily doable following the same model as most bitcoin-accepting services.

You simply run an instance of bitcoind on your server, and once a transaction comes in, pick true or false in a provably random and fair manner, and send back either nothing or double the amount.


Title: Re: How to create a coin-flip type address?
Post by: The Goat Master on December 26, 2013, 10:20:04 PM
This isn't doable with an address alone, but is easily doable following the same model as most bitcoin-accepting services.

You simply run an instance of bitcoind on your server, and once a transaction comes in, pick true or false in a provably random and fair manner, and send back either nothing or double the amount.

How do I automate the process though?


Title: Re: How to create a coin-flip type address?
Post by: rarkenin on December 26, 2013, 10:35:19 PM
You'd write a script or server program to handle it automatically, from something as simple as a loop that waits for txns to come in, to a large operation teeming with cronjobs and database storage for auditing.


Title: Re: How to create a coin-flip type address?
Post by: fishy on December 26, 2013, 10:45:30 PM
You'd write a script or server program to handle it automatically, from something as simple as a loop that waits for txns to come in, to a large operation teeming with cronjobs and database storage for auditing.

Hello.  I am interested in this as well.  What would be a good language to start with for this? PHP?


Title: Re: How to create a coin-flip type address?
Post by: rarkenin on December 26, 2013, 11:33:45 PM
Naw, PHP is better for handling individual requests, and is somewhat hard to daemonize. I would recommend Java as you can thus have a coin-game backend and a possible web service meshed together natively. With that said, this isn't something you'd do on your average web host.


Title: Re: How to create a coin-flip type address?
Post by: hendo420 on December 27, 2013, 02:21:38 AM
Its not very hard to do in python.


Title: Re: How to create a coin-flip type address?
Post by: smeagol on December 29, 2013, 11:53:12 PM
You'd write a script or server program to handle it automatically, from something as simple as a loop that waits for txns to come in, to a large operation teeming with cronjobs and database storage for auditing.

Hello.  I am interested in this as well.  What would be a good language to start with for this? PHP?

Off topic, but why are you still using the inputs sig?


Title: Re: How to create a coin-flip type address?
Post by: The Goat Master on December 29, 2013, 11:59:47 PM
Its not very hard to do in python.

How would one do that?


Title: Re: How to create a coin-flip type address?
Post by: rarkenin on December 30, 2013, 12:06:26 AM
I can always write a Java implementation for you... It would obviously be for a fee but it's not too complex or drawn out, so the fee wouldn't be too bad.