mirror of
https://github.com/logos-messaging/logos-messaging-simulator.git
synced 2026-01-07 16:33:07 +00:00
foundry container now does work of extracting private keys
This commit is contained in:
parent
894f73462d
commit
da0cbd0da4
@ -16,8 +16,6 @@ services:
|
|||||||
com.centurylinklabs.watchtower.enable: '${WATCHTOWER_ENABLED:-false}'
|
com.centurylinklabs.watchtower.enable: '${WATCHTOWER_ENABLED:-false}'
|
||||||
ports:
|
ports:
|
||||||
- 0.0.0.0:8545:8545
|
- 0.0.0.0:8545:8545
|
||||||
environment:
|
|
||||||
- ANVIL_ACC=${ACCOUNTS}
|
|
||||||
command:
|
command:
|
||||||
- anvil
|
- anvil
|
||||||
--port=8545
|
--port=8545
|
||||||
@ -28,8 +26,10 @@ services:
|
|||||||
--block-time=12
|
--block-time=12
|
||||||
--silent
|
--silent
|
||||||
--config-out=/shared/anvil-config.txt
|
--config-out=/shared/anvil-config.txt
|
||||||
|
- /getPrivateKeys.sh
|
||||||
volumes:
|
volumes:
|
||||||
- accounts-volume:/shared
|
- accounts-volume:/shared
|
||||||
|
- ./getPrivateKeys.sh:/getPrivateKeys.sh
|
||||||
networks:
|
networks:
|
||||||
- simulation
|
- simulation
|
||||||
|
|
||||||
@ -85,7 +85,6 @@ services:
|
|||||||
- '/opt/run_nwaku.sh'
|
- '/opt/run_nwaku.sh'
|
||||||
volumes:
|
volumes:
|
||||||
- ./run_nwaku.sh:/opt/run_nwaku.sh:Z
|
- ./run_nwaku.sh:/opt/run_nwaku.sh:Z
|
||||||
- ./parseAccountsDetails.sh:/opt/parseAccountsDetails.sh:Z
|
|
||||||
- accounts-volume:/shared
|
- accounts-volume:/shared
|
||||||
depends_on:
|
depends_on:
|
||||||
contract-repo-deployer:
|
contract-repo-deployer:
|
||||||
|
|||||||
15
getPrivateKeys.sh
Normal file
15
getPrivateKeys.sh
Normal file
@ -0,0 +1,15 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
# Install json parser
|
||||||
|
apk update
|
||||||
|
apk add jq
|
||||||
|
|
||||||
|
# Read the JSON file
|
||||||
|
json_content=$(cat /shared/anvil-config.txt)
|
||||||
|
|
||||||
|
# Extract private_keys array values using jq
|
||||||
|
private_keys=$(echo "$json_content" | jq -r '.private_keys[]')
|
||||||
|
|
||||||
|
# Write private keys to a new file for easier access
|
||||||
|
echo "Writing private keys to file"
|
||||||
|
echo "$private_keys" > /shared/private-keys.txt
|
||||||
@ -1,23 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# Read the JSON file
|
|
||||||
json_content=$(cat /shared/anvil-config.txt)
|
|
||||||
|
|
||||||
# Extract available_accounts and private_keys arrays using jq
|
|
||||||
available_accounts=$(echo "$json_content" | jq -r '.available_accounts[]')
|
|
||||||
private_keys=$(echo "$json_content" | jq -r '.private_keys[]')
|
|
||||||
|
|
||||||
# Convert the extracted strings to Bash arrays
|
|
||||||
available_accounts_array=()
|
|
||||||
while IFS= read -r account; do
|
|
||||||
available_accounts_array+=("$account")
|
|
||||||
done <<< "$available_accounts"
|
|
||||||
|
|
||||||
private_keys_array=()
|
|
||||||
while IFS= read -r key; do
|
|
||||||
private_keys_array+=("$key")
|
|
||||||
done <<< "$private_keys"
|
|
||||||
|
|
||||||
# echo "ACCOUNT: ${available_accounts_array[$1-1]}"
|
|
||||||
# echo "PRIVATE KEY: ${private_keys_array[$1-1]}"
|
|
||||||
echo ${private_keys_array[$1-1]}
|
|
||||||
13
run_nwaku.sh
13
run_nwaku.sh
@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
# Install bind-tools package used for domainname resolution
|
# Install bind-tools package used for domainname resolution
|
||||||
apk add bind-tools
|
apk add bind-tools
|
||||||
apk add jq
|
# apk add jq
|
||||||
apk add bash
|
# apk add bash
|
||||||
|
|
||||||
if test -f .env; then
|
if test -f .env; then
|
||||||
echo "Using .env file"
|
echo "Using .env file"
|
||||||
@ -21,6 +21,7 @@ get_ip_address_and_replace() {
|
|||||||
|
|
||||||
# the format of the RPC URL is checked in the generateRlnKeystore command and hostnames are not valid
|
# the format of the RPC URL is checked in the generateRlnKeystore command and hostnames are not valid
|
||||||
pattern="^(https?):\/\/((localhost)|([\w_-]+(?:(?:\.[\w_-]+)+)))(:[0-9]{1,5})?([\w.,@?^=%&:\/~+#-]*[\w@?^=%&\/~+#-])*"
|
pattern="^(https?):\/\/((localhost)|([\w_-]+(?:(?:\.[\w_-]+)+)))(:[0-9]{1,5})?([\w.,@?^=%&:\/~+#-]*[\w@?^=%&\/~+#-])*"
|
||||||
|
|
||||||
# Perform regex matching
|
# Perform regex matching
|
||||||
if [[ $RPC_URL =~ $pattern ]]; then
|
if [[ $RPC_URL =~ $pattern ]]; then
|
||||||
echo "RPC URL is valid"
|
echo "RPC URL is valid"
|
||||||
@ -52,18 +53,16 @@ INDEX=`dig -x $IP +short | sed 's/.*_\([0-9]*\)\..*/\1/'`
|
|||||||
# Hello
|
# Hello
|
||||||
echo "Hello I'm container $INDEX of $COUNT"
|
echo "Hello I'm container $INDEX of $COUNT"
|
||||||
|
|
||||||
|
|
||||||
###########################################################################
|
|
||||||
if test -f .$RLN_CREDENTIAL_PATH; then
|
if test -f .$RLN_CREDENTIAL_PATH; then
|
||||||
echo "$RLN_CREDENTIAL_PATH already exists. Use it instead of creating a new one."
|
echo "$RLN_CREDENTIAL_PATH already exists. Use it instead of creating a new one."
|
||||||
else
|
else
|
||||||
val=$(/bin/bash ./opt/parseAccountsDetails.sh $INDEX)
|
PRIVATE_KEY=$(sed -n "${INDEX}p" /shared/private-keys.txt)
|
||||||
echo $val
|
echo $PRIVATE_KEY
|
||||||
|
|
||||||
echo "Generating RLN keystore"
|
echo "Generating RLN keystore"
|
||||||
/usr/bin/wakunode generateRlnKeystore \
|
/usr/bin/wakunode generateRlnKeystore \
|
||||||
--rln-relay-eth-client-address="$RPC_URL" \
|
--rln-relay-eth-client-address="$RPC_URL" \
|
||||||
--rln-relay-eth-private-key=$val \
|
--rln-relay-eth-private-key=$PRIVATE_KEY \
|
||||||
--rln-relay-eth-contract-address=$RLN_CONTRACT_ADDRESS \
|
--rln-relay-eth-contract-address=$RLN_CONTRACT_ADDRESS \
|
||||||
--rln-relay-cred-path=$RLN_CREDENTIAL_PATH \
|
--rln-relay-cred-path=$RLN_CREDENTIAL_PATH \
|
||||||
--rln-relay-cred-password=$RLN_CREDENTIAL_PASSWORD \
|
--rln-relay-cred-password=$RLN_CREDENTIAL_PASSWORD \
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user