Workers Auto Approve
Non-Fungible Token Lottery
rust, privacy, games, non-fungible, lottery, enigma, ethereum
Enigma Secret Contracts enable dApps to compute over encrypted data. One simple use-case for this is lotteries, as a random() function is part of SGX native functionality. To demonstrate this, we’d like to have an “NFT Lottery” application that accepts entries from 100 whitelisted addresses and selects a winner from these addresses. The winner receives an NFT (non-fungible token) placed into a deposit contract.
## Solution Description
This solution should deploy a contract that receives a list of 10 encrypted addresses, ensure that they are members of a 100-address whitelist. If they are not all whitelisted, the submission should remain open until 10 whitelisted addresses are submitted. From these 10 addresses, the contract logic should randomly pick one using SGX randomness function. The contract should return the winner unencrypted to the ethereum deposit contract containing the NFT, which should in turn send the NFT to the winner.
This will involve:
- Writing a Secret Contract in Rust and deploying it to the Enigma Discovery network that handles the logic for the application (checking for whitelist membership, reaching 5 submissions, selecting one winner)
- Using the Enigma-JS client to enable the contract owner to encrypt and send a list of 100 whitelisted Ethereum addresses.
- Using the Enigma-JS client to allow users to encrypt and submit their addresses to the secret contract.
- Returning a winning address and submitting this to the ethereum contract handling awards
- Write an ethereum smart contract that mints and sends an NFT to the winner’s address
## Implementation Details and Data Flow
1. User A (contract owner) submits list of whitelisted Ethereum addresses via a UI
2. These addresses are encrypted locally via Enigma-JS and submitted to the secret contract.
3. Via the same UI, User A sends an NFT (any type) to a smart contract (deposit contract).
4. User B (via a whitelisted address) submits a task which indicates themselves as a lottery participant via a UI.
5. Additional users submit their interest (until there are 5 participants).
6. The secret contract checks whether participation tasks are being initiated by whitelisted addresses.
7. Once 5 whitelisted participants have joined, the secret contract uses randomness provided by SGX to select a winner from participants.
8. The winner function within the smart contract is called with the winner's address by the secret contract.
9. Owner of the winning address is able to withdraw the NFT from the smart contract.
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).
## 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.
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. ](https://airtable.com/shrN7Bu95f3R21XKx)
These materials should help you get started:
[Enigma Discovery Documentation
[Developer Quickstart Guide](https://blog.enigma.co/the-developer-quickstart-guide-to-enigma-880c3fc4308)
[Secret Contracts Walkthrough](https://blog.enigma.co/getting-started-with-enigma-an-intro-to-secret-contracts-cdba4fe501c2)
Setup your profile
Tell us a little about you:
No results found for
Type to search skills..
Required [[totalcharacter]] / 240
Are you currently looking for work?
[[ option.string ]]
Setup your profile
Our tools are based on the principles of earn (💰), learn (📖), and meet (💬).
Select the ones you are interested in. You can change it later in your settings.
I'm also an organization manager looking for a great community.
Enable your organization profile
Gitcoin products can help grow community around your brand. Create your tribe, events, and incentivize your community with bounties. Announce new and upcoming events using townsquare. Find top-quality hackers and fund them to work with you on a grant.
These are the organizations you own. If you don't see your organization here please be sure that information is public on your GitHub profile. Gitcoin will sync this information for you.
Select the products you are interested in:
Out of the box you will receive Tribes Lite for your organization. Please provide us with a contact email: