Answered step by step
Verified Expert Solution
Question
1 Approved Answer
nspired by proof - of - stake, Amir would like to create an Ethereum smart contract in which people can lock up their funds (
nspired by proofofstake, Amir would like to create an Ethereum smart contract in which
people can lock up their funds in ether and then vote on a very important matter. The matter
can be resolved in one of ways, thus each persons vote is an integer Amir is
asking for your help. Specifically, he would like to have a protocol explained in English in a
pdf file and a smart contract implemented in solidity that provides as many of the following
functionalitydesired properties as possible:
a Anyone on the Ethereum network can sign up in the protocol by depositing ether. One
may sign up several times and thus pay a larger overall deposit.
b At the end of the protocol, everyone can get their deposits back. The returned value may
be a bit smaller than the original deposit, eg ether, if you need to pay for something in
your protocol.
c Each deposit of ether entitles the depositor to one vote.
d After a particular deadline the contract stops accepting deposits and instead only accepts
votes by those who have already deposited money.
e No one can vote twice for the same deposit.
f After a later deadline the contract stops accepting votes.
g After an even later deadline everyone with access to the blockchain should be able to
figure out which option from the set received the maximum number of votes. If
there is a tie, you can break it arbitrarily as you wish.
h No one should be able to know another persons vote.
i If Alice has voted for in and she wants to prove this to Bob, she should be able
to do so You can assume that Bob has access to the blockchain.
j Your contract should not have any of the security vulnerabilities discussed in the lectures.
k Your contract should use as little gas as possible and be affordable. You should find out
exactly how much gas each one of your functions uses in the worst case and report it in
your pdf file.
Finally, you are allowed to have participants in the contract who take roles other than voting,
but any such participation should be wellincentivized, ie you should argue why they can
make money by helping you run your contract if your protocol depends on their participation.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started