Auto-generate accounts.csv (#25)

* Auto-generate accounts.csv
This commit is contained in:
Thomas E Lackey 2022-10-14 16:58:46 -05:00 committed by GitHub
parent 071cefa9cc
commit 9e9bb34aee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 24 additions and 14 deletions

View File

@ -1,6 +0,0 @@
m/44'/60'/0'/0/0,0xe6CE22afe802CAf5fF7d3845cec8c736ecc8d61F,0x02cfc16a6212d7bb9dff89b603afbd856157c367de3ef6b626f205d9b150630ea0,0x888814df89c4358d7ddb3fa4b0213e7331239a80e1f013eaa7b2deca2a41a218
m/44'/60'/0'/0/1,0xe22AD83A0dE117bA0d03d5E94Eb4E0d80a69C62a,0x03481404e1b0541b51468cec6b46baf400a56b3f5c6aeee4a2cc75c8175233fc35,0x570b909da9669b2f35a0b1ac70b8358516d55ae1b5b3710e95e9a94395090597
m/44'/60'/0'/0/2,0xf1ac8Dd1f6D6F5c0dA99097c57ebF50CD99Ce293,0x02c3ba9ca4321c7ed9dbe9ead24a6b00a79c0e62c1b560e31108ece7ac55f886e5,0x111b7500bdce494d6f4bcfe8c2a0dde2ef92f751d9070fac6475dbd6d8021b3f
m/44'/60'/0'/0/3,0x9d2edB2B30Bce41375179571944A3f92636ce1Cd,0x02b1ff366ff445fe36bc45a37c37c160552442486832036ae95e186b19692999c9,0xfb1e9af328c283ca3e2486e7c24d13582b7912057d8b9542ff41503c85bc05c0
m/44'/60'/0'/0/4,0x5D81E609c15E292Bb8255bd9b1B2494DC0386062,0x035edb8877dc2c467e5cd5c8d6020d8af8348ad3106a227132bb0843d95628ec09,0xbe4aa664815ea3bc3d63118649a733f6c96b243744310806ecb6d96359ab62cf
m/44'/60'/0'/0/5,0x5929AD4A1d6B899065AcF2a66d5EB086a2863bEe,0x02f8e160837d711d47664264d3ac67be996f71886ded509496172584268c4d3a15,0x6177345b77c4069ac4d553f8b43cf68a799ca4bb63eac93d6cf796d63694ebf0
1 m/44'/60'/0'/0/0 0xe6CE22afe802CAf5fF7d3845cec8c736ecc8d61F 0x02cfc16a6212d7bb9dff89b603afbd856157c367de3ef6b626f205d9b150630ea0 0x888814df89c4358d7ddb3fa4b0213e7331239a80e1f013eaa7b2deca2a41a218
2 m/44'/60'/0'/0/1 0xe22AD83A0dE117bA0d03d5E94Eb4E0d80a69C62a 0x03481404e1b0541b51468cec6b46baf400a56b3f5c6aeee4a2cc75c8175233fc35 0x570b909da9669b2f35a0b1ac70b8358516d55ae1b5b3710e95e9a94395090597
3 m/44'/60'/0'/0/2 0xf1ac8Dd1f6D6F5c0dA99097c57ebF50CD99Ce293 0x02c3ba9ca4321c7ed9dbe9ead24a6b00a79c0e62c1b560e31108ece7ac55f886e5 0x111b7500bdce494d6f4bcfe8c2a0dde2ef92f751d9070fac6475dbd6d8021b3f
4 m/44'/60'/0'/0/3 0x9d2edB2B30Bce41375179571944A3f92636ce1Cd 0x02b1ff366ff445fe36bc45a37c37c160552442486832036ae95e186b19692999c9 0xfb1e9af328c283ca3e2486e7c24d13582b7912057d8b9542ff41503c85bc05c0
5 m/44'/60'/0'/0/4 0x5D81E609c15E292Bb8255bd9b1B2494DC0386062 0x035edb8877dc2c467e5cd5c8d6020d8af8348ad3106a227132bb0843d95628ec09 0xbe4aa664815ea3bc3d63118649a733f6c96b243744310806ecb6d96359ab62cf
6 m/44'/60'/0'/0/5 0x5929AD4A1d6B899065AcF2a66d5EB086a2863bEe 0x02f8e160837d711d47664264d3ac67be996f71886ded509496172584268c4d3a15 0x6177345b77c4069ac4d553f8b43cf68a799ca4bb63eac93d6cf796d63694ebf0

View File

@ -2,11 +2,10 @@
ACCOUNT_PASSWORD=${ACCOUNT_PASSWORD:-secret1212} ACCOUNT_PASSWORD=${ACCOUNT_PASSWORD:-secret1212}
for line in `cat accounts.csv`; do for line in `cat ../build/el/accounts.csv`; do
BIP44_PATH="`echo "$line" | cut -d',' -f1`" BIP44_PATH="`echo "$line" | cut -d',' -f1`"
ADDRESS="`echo "$line" | cut -d',' -f2`" ADDRESS="`echo "$line" | cut -d',' -f2`"
PUBLIC_KEY="`echo "$line" | cut -d',' -f3`" PRIVATE_KEY="`echo "$line" | cut -d',' -f3`"
PRIVATE_KEY="`echo "$line" | cut -d',' -f4`"
echo "$ACCOUNT_PASSWORD" > .pw.$$ echo "$ACCOUNT_PASSWORD" > .pw.$$
echo "$PRIVATE_KEY" | sed 's/0x//' > .key.$$ echo "$PRIVATE_KEY" | sed 's/0x//' > .key.$$

View File

@ -0,0 +1,17 @@
from web3.auto import w3
import json
import ruamel.yaml as yaml
import sys
w3.eth.account.enable_unaudited_hdwallet_features()
testnet_config_path = "genesis-config.yaml"
if len(sys.argv) > 1:
testnet_config_path = sys.argv[1]
with open(testnet_config_path) as stream:
data = yaml.safe_load(stream)
for key, value in data['eth1_premine'].items():
acct = w3.eth.account.from_mnemonic(data['mnemonic'], account_path=key, passphrase='')
print("%s,%s,%s" % (key, acct.address, acct.key.hex()))

View File

@ -7,6 +7,6 @@ mkdir -p ../build/el
tmp_dir=$(mktemp -d -t ci-XXXXXXXXXX) tmp_dir=$(mktemp -d -t ci-XXXXXXXXXX)
envsubst < el-config.yaml > $tmp_dir/genesis-config.yaml envsubst < el-config.yaml > $tmp_dir/genesis-config.yaml
python3 /apps/el-gen/genesis_geth.py $tmp_dir/genesis-config.yaml > ../build/el/geth.json python3 /apps/el-gen/genesis_geth.py $tmp_dir/genesis-config.yaml > ../build/el/geth.json
python3 /apps/el-gen/genesis_chainspec.py $tmp_dir/genesis-config.yaml > ../build/el/chainspec.json python3 ../accounts/mnemonic_to_csv.py $tmp_dir/genesis-config.yaml > ../build/el/accounts.csv
python3 /apps/el-gen/genesis_besu.py $tmp_dir/genesis-config.yaml > ../build/el/besu.json

View File

@ -1,6 +1,6 @@
#!/bin/bash #!/bin/bash
ETHERBASE=`cat /opt/testnet/accounts/accounts.csv | head -1 | cut -d',' -f2` ETHERBASE=`cat /opt/testnet/build/el/accounts.csv | head -1 | cut -d',' -f2`
NETWORK_ID=`cat /opt/testnet/el/el-config.yaml | grep 'chain_id' | awk '{ print $2 }'` NETWORK_ID=`cat /opt/testnet/el/el-config.yaml | grep 'chain_id' | awk '{ print $2 }'`
if [ "true" == "$RUN_BOOTNODE" ]; then if [ "true" == "$RUN_BOOTNODE" ]; then

View File

@ -20,7 +20,7 @@ COPY --from=ethgen /usr/local/bin/eth2-testnet-genesis /usr/local/bin/eth2-testn
COPY --from=ethgen /usr/local/bin/eth2-val-tools /usr/local/bin/eth2-val-tools COPY --from=ethgen /usr/local/bin/eth2-val-tools /usr/local/bin/eth2-val-tools
COPY --from=ethgen /apps /apps COPY --from=ethgen /apps /apps
COPY --from=fnetgeth /opt/testnet/el /opt/testnet/el COPY --from=fnetgeth /opt/testnet/el /opt/testnet/el
COPY --from=fnetgeth /opt/testnet/accounts /opt/testnet/accounts COPY --from=fnetgeth /opt/testnet/build/el /opt/testnet/build/el
RUN cd /opt/testnet && make genesis-cl RUN cd /opt/testnet && make genesis-cl

View File

@ -49,4 +49,4 @@ ETH1_CHAIN_ID=${ETH1_CHAIN_ID:-`cat $ETH1_CONFIG_YAML | grep 'chain_id' | awk '{
ETH1_TTD=${ETH1_TTD:-`cat $ETH1_CONFIG_YAML | grep 'terminal_total_difficulty' | awk '{ print $2 }'`} ETH1_TTD=${ETH1_TTD:-`cat $ETH1_CONFIG_YAML | grep 'terminal_total_difficulty' | awk '{ print $2 }'`}
ETH1_DEPOSIT_CONTRACT_ADDRESS=${ETH1_DEPOSIT_CONTRACT_ADDRESS:-`cat $ETH1_CONFIG_YAML | grep 'deposit_contract_address' | awk '{ print $2 }' | sed 's/"//g'`} ETH1_DEPOSIT_CONTRACT_ADDRESS=${ETH1_DEPOSIT_CONTRACT_ADDRESS:-`cat $ETH1_CONFIG_YAML | grep 'deposit_contract_address' | awk '{ print $2 }' | sed 's/"//g'`}
ETH1_DEPOSIT_CONTRACT_BLOCK=${ETH1_DEPOSIT_CONTRACT_BLOCK:-0x0} ETH1_DEPOSIT_CONTRACT_BLOCK=${ETH1_DEPOSIT_CONTRACT_BLOCK:-0x0}
SUGGESTED_FEE_RECIPIENT=`cat ../accounts/accounts.csv | head -1 | cut -d',' -f2` SUGGESTED_FEE_RECIPIENT=`cat ../build/el/accounts.csv | head -1 | cut -d',' -f2`