Commit 229dbcb5 authored by UNHALE NILESH ARUN's avatar UNHALE NILESH ARUN

nilesh has questions

parent a959668c
...@@ -21,3 +21,11 @@ ...@@ -21,3 +21,11 @@
* How to run * 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
from ecdsa import SigningKey,SECP256k1 from ecdsa import SigningKey,SECP256k1
from ecdsa.keys import BadSignatureError from ecdsa.keys import BadSignatureError
from numpy.random import randint
import numpy as np
import binascii import binascii
import random import random
...@@ -187,6 +189,26 @@ def testSortition(): ...@@ -187,6 +189,26 @@ def testSortition():
print(proof) print(proof)
print(j) 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(): def testVerifySort():
sk, pk = genratePublicPrivateKey() sk, pk = genratePublicPrivateKey()
seed = ("a", 1, 2) seed = ("a", 1, 2)
...@@ -237,5 +259,6 @@ def testVerifyVRF(): ...@@ -237,5 +259,6 @@ def testVerifyVRF():
if __name__ == '__main__': if __name__ == '__main__':
# testSortition() # testSortition()
# testVerifyVRF() # testVerifyVRF()
testVerifySort() # testVerifySort(0
tester()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment