Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rock-paper scissor #1

Open
cankisagun opened this issue May 29, 2020 · 0 comments
Open

Rock-paper scissor #1

cankisagun opened this issue May 29, 2020 · 0 comments

Comments

@cankisagun
Copy link
Owner

cankisagun commented May 29, 2020

Request

Secret Contracts enable dApps to compute over encrypted data. One simple use-case for this is rock, paper, scissors, which is currently only possible with a 2 step commit-reveal process. Using secret contract, players can keep choices secret until the end of each round (instead of a commit-reveal scheme). This significantly improves the user experience of blockchain based gaming.

Solution Description

Game setup
This solution should enable Alice to create a new game and determine a betting amount (1, 10 or 100 SCRT). Alice, would then submit her move by selecting “rock, paper, or scissors” via a visual interface, encrypt and submit the player’s choice as well as the betting amount to the secret contract. Each new game should be shown on a UI for active games. Note: The secret contract should reject Alice's inputs if the SCRT transferred is not equal to the betting amount

Joining the game
Bob can select an active game from the dashboard, and submit his choice and the betting amount to the secret contract. Note: The secret contract should reject Alice's inputs if the SCRT transferred is not equal to the betting amount

Game logic execution
The secret contract logic should:

  • ensure two different addresses participated in the game and decrypt the selections,
  • select the winner according to the rules of rock, paper, scissors (rock beats scissors, scissors beats paper, and paper beats rock).
  • The winning player’s address should be returned to both players (UI).
  • Total betting amount should be transferred to the winning player's address

This will involve:

Writing an Enigma-JS interface that:

  • enables a player to start or join a game, make their move and
  • submits these moves encrypted and a bet denominated in SCRT to the secret contract.
    Writing a secret contract that:
  • receives player addresses and moves, and bets denominated in SCRT
  • compares them according to the logic of rock, paper, scissors, and returns the winner.

Success

A working application, which should have a simple React-based UI (or similar), enable the solution, and handle failure (i.e., displays a meaningful message when improperly formatted data is submitted). Two users should be able to play one another via the UI.

Bounty Selection

For this first bounty round, the process works as follows:

  1. Developer / team submits a “pre-submission for approval” for a bounty
  2. Enigma reviews submissions, and selects an applicant (we don’t have a firm timeline for this, but hope to work quickly)
  3. Applicant completes the task satisfactorily and receives the bounty

If the task is not completed, or applicant is unable to continue work in a timely manner, Enigma will select another applicant.

Note: Applicants that propose additional functionality or features to increase engagement (such as betting on games, creating leaderboards based on game results, multiple rounds of RPS, live mode with time constraint) will be prioritized

To complete a pre-submission for approval,
First, comment on this issue within github and indicate your interest. Then, please also complete this application form.

Resources

These materials should help you get started: - TO BE UPDATED
Secret Network documentation
[Developer Quickstart Guide] - update with Taariq's secret voting demo
[Secret Contracts Walkthrough] - update with Taariq's secret voting demo
[Enigma-JS
Walkthrough] TBD

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant