53 lines
1.5 KiB
Nim
53 lines
1.5 KiB
Nim
import
|
|
os, ospaths, strutils, strformat,
|
|
chronos, nimcrypto, json_serialization, confutils,
|
|
spec/[datatypes, digest, crypto], conf, time, ssz,
|
|
../tests/testutil
|
|
|
|
proc writeFile(filename: string, value: auto) =
|
|
Json.saveFile(filename, value, pretty = true)
|
|
echo "Wrote ", filename
|
|
|
|
cli do (validators: int = 100000,
|
|
outputDir: string = "validators"):
|
|
|
|
for i in 0 ..< validators:
|
|
# there can apparently be tops 4M validators so we use 7 digits..
|
|
let
|
|
depositFn = outputDir / &"v{i:07}.deposit.json"
|
|
privKeyFn = outputDir / &"v{i:07}.privkey.json"
|
|
|
|
if existsFile(depositFn) and existsFile(privKeyFn):
|
|
continue
|
|
|
|
let
|
|
privKey = makeFakeValidatorPrivKey(i)
|
|
pubKey = privKey.pubKey()
|
|
|
|
let
|
|
withdrawalCredentials = makeFakeHash(i)
|
|
|
|
proofOfPossessionData = DepositInput(
|
|
pubkey: pubKey,
|
|
withdrawal_credentials: withdrawalCredentials)
|
|
|
|
proofOfPossession = bls_sign(
|
|
privkey, hash_tree_root_final(proofOfPossessionData).data,
|
|
0 # TODO - domain
|
|
)
|
|
|
|
let
|
|
deposit = Deposit(
|
|
deposit_data: DepositData(
|
|
amount: MAX_DEPOSIT_AMOUNT,
|
|
timestamp: now(),
|
|
deposit_input: DepositInput(
|
|
pubkey: pubKey,
|
|
proof_of_possession: proofOfPossession,
|
|
withdrawal_credentials: withdrawalCredentials)))
|
|
|
|
writeFile(privKeyFn, privKey)
|
|
writeFile(depositFn, deposit)
|
|
|
|
echo "Keys generated by this tool are only for testing!"
|