6

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

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.

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.

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

  • 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? – Afri Apr 7 '16 at 10:39
  • 1
    Possible duplicate of How can an Ethereum contract get data from a website? – Philip Kirkbride Apr 7 '16 at 11:37
  • 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 7 '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 7 '16 at 11:47
  • @PhilipKirkbride You have misunderstood the question, it's not about getting data from other website – Anderson Tess Apr 7 '16 at 11:48
5

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.

  • 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 7 '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 7 '16 at 16:15
  • How can users be sure the "betting coin" can be converted back to usd? – Anderson Tess Apr 9 '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 9 '16 at 10:33
  • What if I don't do that? How can the smart contract enforce me to do so? – Anderson Tess Apr 9 '16 at 10:35
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.

  • Hi Nick, interesting idea. Would be great if you could illustrate this with an actual example. TIA! – Anderson Tess Apr 7 '16 at 15:52
  • @AndersonTess The general tool needed for your problem is a stablecoin ethereum.stackexchange.com/q/2739/42 – eth Apr 7 '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 7 '16 at 16:07
  • @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 1:29

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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