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
229dbcb5
Commit
229dbcb5
authored
Apr 16, 2019
by
UNHALE NILESH ARUN
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
nilesh has questions
parent
a959668c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
2 deletions
+33
-2
README.md
README.md
+9
-1
Utility.py
Utility.py
+24
-1
No files found.
README.md
View file @
229dbcb5
...
...
@@ -20,4 +20,12 @@
*
Requirements
*
How to run
\ No newline at end of file
*
How to run
### Nilesh doubts:
1 Why start ticking function has a callback arg.?
\
2 What does callback do?
3 What simulate do ?
4 What compute range ?
5 node and links
\ No newline at end of file
Utility.py
View file @
229dbcb5
from
ecdsa
import
SigningKey
,
SECP256k1
from
ecdsa.keys
import
BadSignatureError
from
numpy.random
import
randint
import
numpy
as
np
import
binascii
import
random
...
...
@@ -187,6 +189,26 @@ def testSortition():
print
(
proof
)
print
(
j
)
def
tester
():
sk
,
pk
=
genratePublicPrivateKey
()
seed
=
(
"a"
,
1
,
2
)
roleCount
=
26
role
=
"LEAD"
# w= randint(1,100000,10)
w
=
[
1
,
10
,
100
,
500
,
1000
,
5000
,
8000
,
10000
]
w
.
sort
()
print
(
w
)
# w = 20
badaW
=
np
.
sum
(
w
)
print
(
badaW
)
for
i
in
w
:
hash
,
proof
,
j
=
sortition
(
sk
,
seed
,
roleCount
,
role
,
i
,
badaW
,
pk
)
# print(hash) #this is a real content of hash it should be used as final thing and not hexlify
# print(binascii.hexlify(hash))
# print(proof)
print
(
"w = "
+
str
(
i
)
,
"w/badaW = "
,
str
(
i
/
badaW
),
"j = "
,
str
(
j
))
def
testVerifySort
():
sk
,
pk
=
genratePublicPrivateKey
()
seed
=
(
"a"
,
1
,
2
)
...
...
@@ -237,5 +259,6 @@ def testVerifyVRF():
if
__name__
==
'__main__'
:
# testSortition()
# testVerifyVRF()
testVerifySort
()
# testVerifySort(0
tester
()
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