update mocked start keygen to output 0x bytes

This commit is contained in:
Danny Ryan 2019-08-30 15:04:18 -06:00
parent 6e41fcf383
commit 9a9dbcd95e
6 changed files with 19921 additions and 30037 deletions

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
venv/

View File

@ -1,11 +1,22 @@
from py_ecc.bls.api import privtopub
from hashlib import sha256 as _sha256
from typing import List, Dict
from yaml import dump, Dumper
from ruamel.yaml import YAML
from eth_utils import (
encode_hex,
int_to_big_endian,
)
CURVE_ORDER = 52435875175126190479447740508185965837690552500527637822603658699938581184513
def int_to_hex(n: int, byte_length: int = None) -> str:
byte_value = int_to_big_endian(n)
if byte_length:
byte_value = byte_value.rjust(byte_length, b'\x00')
return encode_hex(byte_value)
def sha256(x):
return _sha256(x).digest()
@ -15,15 +26,19 @@ def generate_validator_keypairs(N: int) -> List[Dict]:
for index in range(N):
privkey = int.from_bytes(
sha256(index.to_bytes(length=32, byteorder='little')),
byteorder='little'
byteorder='little',
) % CURVE_ORDER
pubkey = privtopub(privkey)
keypairs.append({'privkey': privkey, 'pubkey': pubkey})
keypairs.append({
'privkey': int_to_hex(privkey),
'pubkey': '0x' + privtopub(privkey).hex(),
})
return keypairs
if __name__ == '__main__':
yaml = YAML(pure=True)
yaml.default_flow_style = None
keypairs = generate_validator_keypairs(10)
keypairs_yaml = dump(keypairs, Dumper=Dumper)
with open('keygen_test_vector.yaml', 'w') as f:
f.write(keypairs_yaml)
with open('keygen_10_validators.yaml', 'w') as f:
yaml.dump(keypairs, f)

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,20 @@
- {privkey: '0x25295f0d1d592a90b333e26e85149708208e9f8e8bc18f6c77bd62f8ad7a6866',
pubkey: '0xa99a76ed7796f7be22d5b7e85deeb7c5677e88e511e0b337618f8c4eb61349b4bf2d153f649f7b53359fe8b94a38e44c'}
- {privkey: '0x51d0b65185db6989ab0b560d6deed19c7ead0e24b9b6372cbecb1f26bdfad000',
pubkey: '0xb89bebc699769726a318c8e9971bd3171297c61aea4a6578a7a4f94b547dcba5bac16a89108b6b6a1fe3695d1a874a0b'}
- {privkey: '0x315ed405fafe339603932eebe8dbfd650ce5dafa561f6928664c75db85f97857',
pubkey: '0xa3a32b0f8b4ddb83f1a0a853d81dd725dfe577d4f4c3db8ece52ce2b026eca84815c1a7e8e92a4de3d755733bf7e4a9b'}
- {privkey: '0x25b1166a43c109cb330af8945d364722757c65ed2bfed5444b5a2f057f82d391',
pubkey: '0x88c141df77cd9d8d7a71a75c826c41a9c9f03c6ee1b180f3e7852f6a280099ded351b58d66e653af8e42816a4d8f532e'}
- {privkey: '0x3f5615898238c4c4f906b507ee917e9ea1bb69b93f1dbd11a34d229c3b06784b',
pubkey: '0x81283b7a20e1ca460ebd9bbd77005d557370cabb1f9a44f530c4c4c66230f675f8df8b4c2818851aa7d77a80ca5a4a5e'}
- {privkey: '0x055794614bc85ed5436c1f5cab586aab6ca84835788621091f4f3b813761e7a8',
pubkey: '0xab0bdda0f85f842f431beaccf1250bf1fd7ba51b4100fd64364b6401fda85bb0069b3e715b58819684e7fc0b10a72a34'}
- {privkey: '0x1023c68852075965e0f7352dee3f76a84a83e7582c181c10179936c6d6348893',
pubkey: '0x9977f1c8b731a8d5558146bfb86caea26434f3c5878b589bf280a42c9159e700e9df0e4086296c20b011d2e78c27d373'}
- {privkey: '0x3a941600dc41e5d20e818473b817a28507c23cdfdb4b659c15461ee5c71e41f5',
pubkey: '0xa8d4c7c27795a725961317ef5953a7032ed6d83739db8b0e8a72353d1b8b4439427f7efa2c89caa03cc9f28f8cbab8ac'}
- {privkey: '0x066e3bdc0415530e5c7fed6382d5c822c192b620203cf669903e1810a8c67d06',
pubkey: '0xa6d310dbbfab9a22450f59993f87a4ce5db6223f3b5f1f30d2c4ec718922d400e0b3c7741de8e59960f72411a0ee10a7'}
- {privkey: '0x2b3b88a041168a1c4cd04bdd8de7964fd35238f95442dc678514f9dadb81ec34',
pubkey: '0x9893413c00283a3f9ed9fd9845dda1cea38228d22567f9541dccc357e54a2d6a6e204103c92564cbc05f4905ac7c493a'}

View File

@ -1,30 +0,0 @@
- privkey: 16808672146709759238327133555736750089977066230599028589193936481731504400486
pubkey: !!binary |
qZp27XeW974i1bfoXe63xWd+iOUR4LM3YY+MTrYTSbS/LRU/ZJ97UzWf6LlKOORM
- privkey: 37006103240406073079686739739280712467525465637222501547219594975923976982528
pubkey: !!binary |
uJvrxpl2lyajGMjplxvTFxKXxhrqSmV4p6T5S1R9y6W6wWqJEItrah/jaV0ah0oL
- privkey: 22330876536127119444572216874798222843352868708084730796787004036811744442455
pubkey: !!binary |
o6MrD4tN24PxoKhT2B3XJd/ld9T0w9uOzlLOKwJuyoSBXBp+jpKk3j11VzO/fkqb
- privkey: 17048462031355941381150076874414096388968985457797372268770826099852902060945
pubkey: !!binary |
iMFB33fNnY16cadcgmxBqcnwPG7hsYDz54UvaigAmd7TUbWNZuZTr45CgWpNj1Mu
- privkey: 28647806952216650698330424381872693846361470773871570637461872359310549743691
pubkey: !!binary |
gSg7eiDhykYOvZu9dwBdVXNwyrsfmkT1MMTExmIw9nX434tMKBiFGqfXeoDKWkpe
- privkey: 2416304019107052589452838695606585506736351107897780798170812672519914514344
pubkey: !!binary |
qwvdoPhfhC9DG+rM8SUL8f17pRtBAP1kNktkAf2oW7AGmz5xW1iBloTn/AsQpyo0
- privkey: 7300215445567548136411883691093515822872548648751398235557229381530420545683
pubkey: !!binary |
mXfxyLcxqNVVgUa/uGyuomQ088WHi1ib8oCkLJFZ5wDp3w5AhilsILAR0ueMJ9Nz
- privkey: 26495790445032093722332687600112008700915252495659977774957922313678954054133
pubkey: !!binary |
qNTHwneVpyWWExfvWVOnAy7W2Dc524sOinI1PRuLRDlCf376LInKoDzJ8o+Muris
- privkey: 2908643403277969554503670470854573663206729491025062456164283925661321952518
pubkey: !!binary |
ptMQ27+rmiJFD1mZP4ekzl22Ij87Xx8w0sTscYki1ADgs8d0HejlmWD3JBGg7hCn
- privkey: 19554639423851580804889717218680781396599791537051606512605582393920758869044
pubkey: !!binary |
mJNBPAAoOj+e2f2YRd2hzqOCKNIlZ/lUHczDV+VKLWpuIEEDySVky8BfSQWsfEk6

View File

@ -0,0 +1,9 @@
cytoolz==0.10.0
eth-hash==0.2.0
eth-typing==2.1.0
eth-utils==1.6.4
mypy-extensions==0.4.1
py-ecc==1.7.1
ruamel.yaml==0.16.5
ruamel.yaml.clib==0.1.2
toolz==0.10.0