Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Developing a Ethereum Smart Contract for a lottery. Here are the steps that should be followed: 1. Start with the ballot Solidity contract, then delete

Developing a Ethereum Smart Contract for a lottery.

Here are the steps that should be followed:

1. Start with the ballot Solidity contract, then delete most of the contents to get a skeleton Solidity contract.

2. Create the "constructor" function that stores the contract creator as the owner (just like the ballot example). Test it in remix.

3. Create a function that allows players to play and commit their choice. It should store the player's choice. Test it in remix.

3.Add a deadline for playing to your contract. If a player tries to play after the deadline, the play should be rejected. The deadline to play can be set by the contract creator at the time of creation and stored. Test it in remix.

4. Create a function that allows the owner to submit the winning numbers after the deadline to play has passed. Test it in remix.

5. Create a function that allows players to reveal their choices to the lottery after the owner has submitted the winning numbers. Test it in remix.

6. Add a new deadline for revealing choices to your contract. If a player tries to reveal after that deadline, the reveal should be rejected. The deadline to reveal can be set by the contract creator at the time of creation and stored. Test it in remix.

7. Create a function that allows winning players to request withdrawal of their share of the winnings after the deadline to reveal has passed. Note that you will need to determine how many winners there are, and divide the jackpot between them.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Visual C# And Databases

Authors: Philip Conrod, Lou Tylee

16th Edition

1951077083, 978-1951077082

More Books

Students also viewed these Databases questions

Question

What has been your desire for leadership in CVS Health?

Answered: 1 week ago

Question

Question 5) Let n = N and Y Answered: 1 week ago

Answered: 1 week ago