Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
algorand
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nilak
algorand
Commits
badde1b9
Commit
badde1b9
authored
May 02, 2019
by
UNHALE NILESH ARUN
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
completed algorand implementation
parent
24319984
Changes
8
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
546 additions
and
178 deletions
+546
-178
Config.py
Config.py
+12
-3
Links1.dat
Links1.dat
+37
-71
Links2.dat
Links2.dat
+49
-0
Network.py
Network.py
+4
-0
Nodes1.dat
Nodes1.dat
+0
-20
OverlayNode.py
OverlayNode.py
+427
-83
Utility.py
Utility.py
+8
-1
dummy.py
dummy.py
+9
-0
No files found.
Config.py
View file @
badde1b9
...
...
@@ -2,7 +2,7 @@ lambda_proposer = 30# wait time for priority messages to be received
tou_proposer
=
20
# proposer rolecount
ROLE_BLOCK_PROPOSER
=
'BLOCK_PROPOSER'
tou_step
=
2
0
# tou is expected number of users that sortition selects for committee
tou_step
=
2
8
# tou is expected number of users that sortition selects for committee
ROLE_COMMITEE_FOR_VOTE
=
'committee'
lambda_block
=
300
#seconds
...
...
@@ -13,7 +13,16 @@ BLOCK_PROPOSAL_MSG_type = 'BLOCK_PROPOSAL_MSGs'
PRIORITY_MSG_type
=
'PRIORITY_MSG'
COMMITTEE_VOTE_MSG_type
=
"COMMITTEE_VOTE"
TIMEOUT
=
"TIMEOUT"
T
=
2
/
3
# T isa a fraction of expected committee size that defines BA*`s voting thershold
T
=
0.001
#
2/3 # T isa a fraction of expected committee size that defines BA*`s voting thershold
NUMBER_OF_NODES_IN_NETWORK
=
50
T_FINAL
=
0.001
tou_FINAL
=
28
FINALIZED_BLOCK_msg_type
=
"FINALIZED_BLOCK"
TENTATIVE_BLOCK_msg_type
=
"TENTATIVE_BLOCK"
NUMBER_OF_NODES_IN_NETWORK
=
30
MAXSTEP
=
15
FINAL_STEP
=
9999999999
Links1.dat
View file @
badde1b9
0 21
0 39
1 32
1 29
2 34
2 44
3 16
3 25
3 42
3 35
4 18
4 37
4 43
4 30
5 37
5 11
5 23
6 41
6 46
7 14
7 47
0 19
0 24
0 27
1 2
1 20
1 19
2 6
3 22
3 12
4 16
4 7
4 25
5 28
5 15
6 8
6 26
7 28
8 15
8 44
8 35
9 27
9 46
9 13
9 49
10 27
10 48
10 35
11 29
7 23
8 13
8 18
9 22
9 24
10 21
10 16
11 19
11 23
12 22
12 42
13 26
13 33
14 24
14 27
14 39
15 40
16 22
16 40
16 42
17 23
17 45
18 48
19 27
19 31
20 46
20 45
20 38
21 24
21 37
21 30
23 42
25 29
26 41
28 34
29 49
30 31
30 38
31 36
31 34
32 35
32 39
33 47
36 43
37 38
39 47
40 47
41 46
41 49
12 17
13 29
14 25
14 15
14 26
15 29
16 20
17 24
18 23
18 21
18 22
23 27
25 28
Links2.dat
0 → 100644
View file @
badde1b9
0 1
1 2
2 3
3 4
4 5
5 6
6 7
7 8
8 9
9 10
10 11
11 12
12 13
13 14
14 15
15 16
16 17
17 18
18 19
19 20
20 21
21 22
22 23
23 24
24 25
25 26
26 27
27 28
28 29
29 30
30 31
31 32
32 33
33 34
34 35
35 36
36 37
37 38
38 39
39 40
40 41
41 42
42 43
43 44
44 45
45 46
46 47
47 48
48 49
Network.py
View file @
badde1b9
...
...
@@ -33,7 +33,11 @@ class Network():
:return:
'''
w
=
randint
(
1
,
51
,
Config
.
NUMBER_OF_NODES_IN_NETWORK
)
# 51 is excluded - range (1,50)
print
(
'Stakes that are given to the nodes are :
\n
'
)
print
(
w
)
print
(
'
\n
'
)
self
.
badaW
=
np
.
sum
(
w
)
print
(
self
.
badaW
)
i
=
0
with
open
(
'Nodes1.dat'
,
'r'
)
as
f
:
reader
=
csv
.
reader
(
f
)
...
...
Nodes1.dat
View file @
badde1b9
...
...
@@ -28,23 +28,3 @@
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
OverlayNode.py
View file @
badde1b9
This diff is collapsed.
Click to expand it.
Utility.py
View file @
badde1b9
...
...
@@ -64,6 +64,7 @@ def sortition(sk,seed,rolecount,role,w,badaW,pk):
newseed
=
(
seed
,
role
)
hash
,
proof
=
VRF
(
sk
,
newseed
,
pk
)
p
=
rolecount
/
badaW
# p = 0.5
j
=
0
#simplifying the computation : hash/(2**hashlen)
...
...
@@ -88,6 +89,12 @@ def sortition(sk,seed,rolecount,role,w,badaW,pk):
break
j
=
j
+
1
# added by nilesh
if
j
>
0
:
print
(
'
\n
'
)
print
(
'===============> The j value is >>>'
,
j
)
print
(
'
\n
'
)
return
(
hash
,
proof
,
j
)
...
...
@@ -256,7 +263,7 @@ def tester():
roleCount
=
26
role
=
"LEAD"
# w= randint(1,100000,10)
w
=
[
1
,
10
,
100
,
500
,
1000
,
5000
,
8000
,
10000
]
w
=
randint
(
1
,
51
,
50
)
w
.
sort
()
print
(
w
)
# w = 20
...
...
dummy.py
0 → 100644
View file @
badde1b9
import
hashlib
h1
=
hashlib
.
sha256
((
str
(
'asda'
))
.
encode
(
'utf-8'
))
h1hex
=
h1
.
hexdigest
()
print
(
int
(
h1hex
,
16
)
%
2
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment