Inspiration
The idea of "I dare U" came to our minds because in the office we usually make bets about events (oscars, football matches, price of Ether, etc.) but most of them were left unpaid either because we forgot, or because one of the persons then said he was not talking seiously. Digging deeper, we saw that it is common that in serious debts between distant acquaintances there are lawyers and signed paper contracts involved. Atomic liberation of payments adds this needed trust and reduces these intermediaries that translates into more fees.
What it does
A user can create 3 different types of game:
- 1 vs 1: The creator chooses the opponent and decides on the quantity that has to be bet. He also has to name an arbiter/judge that will decide who the winner is, and the time frame he has to judge. Examples can be "I bet you are not able to make 30 push-up in 30 seconds"
- Multiplayer: The creator chooses the game and quantity each player has to bet to enter the game. Any player that knows the id of the game can join by betting the right amount and deciding if they are in favour or against the statement of the creator. Examples of bets can be: "I bet Ether will go over $300 before june is over", "I bet the temperature will go over 30º C at some moment during the 1st of June"
- Solo challenge: The creator puts some of its funds in hold, and decides on an account (normally a good cause like NGOs or to projects built on Ethereum) that the money will go to if he/she does not accomplish what he/she states. He/she will decide on the judge that decides if the statement is true or not. An example of this could be: I will lose 30 kg of weight before the end of july. Usually this type of challenge is created to increase motivation towards achieving a goal.
How we built it
We implemented all the logic in Solidity smart contract. The main functions are the following:
- Create a 1vs1 game.
- Create a multiplayer game.
- Create a solo game.
- Join to a multiplayer game: The user inputs the id of the game and if he/she is in favour or against the creator. THis will only be possible if the deadline of addingParticipants is not reached yet.
- Arbiter a game: If you were named as the judge of a game, and if you are between the deadline of addingParticipants and the expiring deadline you can decide if the result is agains or in favour of the creator.
We used an ERC20. When creating the game and joining it, automatic transfers are done to the smart contract. When the judge declares the winning option, total funds of the game are distributed among the winners. Users can also quit a game if the deadline of adding participants is not reached yet. We built an app with React Native where the logIn and all the transactions are done from UPort app. So we integrated the app of Uport. We used web3js to call functions of the smart contract.
Challenges we ran into
We have struggled most of the time with the same error, we were not able to sign transactions from the app via UPort. The communication of apps did not work properly.
Accomplishments that we're proud of
The smart contracts were very complete and all functionalites worked as they should.
What we learned
We learned a lot about UPort and how to integrate it in apps to use self sovereign identity. We improved on our ability to build smart contracts and react native development. Work under pressure in an iterative way with a very short deadline
What's next for I Dare U
As the time for the hackathon is short, there are a lot of extra functionalities to have a robust product:
- Add more possibilities of results (not just true or false)
- Add odds to bets that the creator can define
- Add commissions for arbiters and penalties if they do not judge on time.
- Add business model with small fees on each game
- Add oracles for automatic arbiters
- Add possibility to create private or public games opened to all users of I Dare U
- Possibility to share in social networks your results
Built With
- ethereum
- javascript
- react-native
- rinkeby
- solidity
- truffle
- uport
- web3.js
Log in or sign up for Devpost to join the conversation.