-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathapp.py
More file actions
33 lines (31 loc) · 1 KB
/
app.py
File metadata and controls
33 lines (31 loc) · 1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import vote_chain
chain = vote_chain.BlockChain()
israel_election = chain
# candidate_1 = "Bibi Natanyao"
# candidate_2 = "Yair Lapid"
#
# #Lets assume there are 2 candidates running
# vote_chain.candidates.append(candidate_1)
# vote_chain.candidates.append(candidate_2)
#
# Yossef = vote_chain.Voter("Yossef", "1")
# Mica = vote_chain.Voter("Mica", "2")
# Shimon = vote_chain.Voter("Shimon", "3")
#
# # Now Voters can create vote for election
#
# yossef_vote = vote_chain.Vote(Yossef.key, candidate_1)
# mica_vote = vote_chain.Vote(Mica.key, candidate_1)
# shimon_vote = vote_chain.Vote(Shimon.key, candidate_2)
#
# # The blockchain then creates blocks from the votes
# israel_election.create_block(yossef_vote)
# israel_election.create_block(mica_vote)
# israel_election.create_block(shimon_vote)
#
# #performs a proof of work to validate each vote(block)
# israel_election.validate_unvalidated_blocks()
#
# # The blockchain can check the election results
# israel_election.is_chain_valid()
# israel_election.get_votes()