8

Let’s say I want to enter into a bet with my friend — if it rains 10 days from now, I will pay him $100; if it doesn’t, he will pay me $100.

  1. Would it be possible to take advantage of smart contract on Ethereum to do automatic payout to the winner of the bet?

One idea is to have each of us deposit $100 worth of ether into the contract and at the end of 10 days have the contract automatically send the contract balance to the winner upon consulting an external oracle for weather information.

  1. At the end of 10 days, if ether depreciated, how can the winner of the bet get $200 from the contract, thereby netting $100 himself from winning the bet?

I want to see if it's possible to model a bet using smart contracts but it seems if the underlying crypto-currency depreciates, the bet agreement could not be honored.

Anderson Tess
  • 309
  • 1
  • 6
  • Welcome to Ethereum! It is preferred if you can post separate questions instead of combining your questions into one. That way, it helps the people answering your question and also others hunting for at least one of your questions. Please clarify, are you asking about the smart contract itself or about how to pegg the value to the USD equivalents? – q9f Apr 07 '16 at 10:39
  • 1
  • I marked as duplicate because I think the more general question linked to could be used to answer your question of linking contracts with real world information. – Philip Kirkbride Apr 07 '16 at 11:38
  • @5chdn The question is: at the end of 10days if ether depreciated, how can the winner of the bet get $200 from the contract, thereby netting $100 himself from winning the bet. – Anderson Tess Apr 07 '16 at 11:47
  • @PhilipKirkbride You have misunderstood the question, it's not about getting data from other website – Anderson Tess Apr 07 '16 at 11:48
  • Ok I see you're asking about time triggered events in contracts. – Philip Kirkbride Apr 07 '16 at 11:52
  • Right, I want to see if it's possible to model a bet using smart contract but it seems if the underlying crypto currency depreciates, the bet agreement could not be honored – Anderson Tess Apr 07 '16 at 11:54
  • @AndersonTess you can edit your question any time you like and as often you like. Maybe do that now and we could prune some comments here and you will eventually get a faster answer. The question has potential. – q9f Apr 07 '16 at 11:57
  • @AndersonTess IMO your original question is clearer than it is now. The title is what could be improved, and you've added the word "depreciates" which can probably help with a better title. – eth Apr 07 '16 at 15:35

2 Answers2

4

You can issue a new Ethereum token called "USD" and mint some coins for you and your friend. Then you can bet with this coin and later sell whenever you want this "USD" coins to the friend who lost for the amount of real USD you both had bet.

It's not the smartest solution, but if you both trust each other is the way of not losing money if eth depreciates.

If you wanted to scale it you should issue a intermediate "betting coin" which has always the same USD value, and can be deposited or withdrawn whenever your users need it.

arodriguezdonaire
  • 3,027
  • 3
  • 20
  • 37
  • When you say Ethereum token, do you mean to create a subcurrency using smart contract which is no more than a number with no monetary value? If I want to scale this, how is the "betting coin" idea different from the Ethereum subcurrency idea? TIA – Anderson Tess Apr 07 '16 at 14:37
  • Is the same idea but with the value you want to issue to the token, not limiting to the usd value – arodriguezdonaire Apr 07 '16 at 16:15
  • How can users be sure the "betting coin" can be converted back to usd? – Anderson Tess Apr 09 '16 at 10:28
  • Because you (the one who sells and buys the betting coin) will withdraw them giving the equivalent USD in ether at the moment of the withdrawal via a smart contract operation, which is public and immutable :) – arodriguezdonaire Apr 09 '16 at 10:33
  • What if I don't do that? How can the smart contract enforce me to do so? – Anderson Tess Apr 09 '16 at 10:35
  • you'll have written it, the only way to avoid paying would be to not have founds in the contract, but then when someone bought a coin you'll have then ether for paying, so if you want to be trustful you need to do it – arodriguezdonaire Apr 09 '16 at 10:37
  • My point is if I want to walk away without paying, I can. It's not like the user can convert the "betting coins" into usd themselves, right? Because unlike ether, the "betting coin" are just numbers without any monetary value – Anderson Tess Apr 09 '16 at 10:40
  • That's why you have the ensure them the withdrawal with smartcontract guarantees – arodriguezdonaire Apr 09 '16 at 10:45
4

The obvious way to do this is to combine your betting contract with an (external) options contract. An options contract allows you to specify "I will pay x eth now for $100 worth of eth in a week". The option relies on an external oracle on the USD/ETH price, and at the end of the week, you get the amount specified (up to some maximum set in the contract), and the counterparty gets the difference.

In principle, the options contract can deliver its proceeds to your betting contract, which can pay out to the appropriate party.

Nick Johnson
  • 8,144
  • 1
  • 28
  • 35
  • Hi Nick, interesting idea. Would be great if you could illustrate this with an actual example. TIA! – Anderson Tess Apr 07 '16 at 15:52
  • @AndersonTess The general tool needed for your problem is a stablecoin http://ethereum.stackexchange.com/q/2739/42 – eth Apr 07 '16 at 16:04
  • @AndersonTess Options contracts are still pretty new to Ethereum; I'm only aware of one exchange, and don't know how healthy it is. And, I'm not going to write your code for you. :) – Nick Johnson Apr 07 '16 at 16:07
  • 1
    @AndersonTess - With a couple of years hindsight here, how would you now approach hedging against price fluctuation. Stablecoin or futures contract? Can you point to any contracts services that you may see as being most easily integrated with Ethereum? I guess Bitmex API would work? – Holland Risley Mar 11 '18 at 01:29