mirror of
https://github.com/logos-messaging/logos-messaging-simulator.git
synced 2026-01-02 14:03:07 +00:00
merged run_register_rln with the run_nwaku script
This commit is contained in:
parent
36d046b686
commit
98cfe98ae2
3
.gitmodules
vendored
Normal file
3
.gitmodules
vendored
Normal file
@ -0,0 +1,3 @@
|
||||
[submodule "submodules/waku-rln-contract"]
|
||||
path = submodules/waku-rln-contract
|
||||
url = https://github.com/waku-org/waku-rln-contract.git
|
||||
51
run_nwaku.sh
51
run_nwaku.sh
@ -1,5 +1,50 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Install bind-tools package used for domainname resolution
|
||||
apk add bind-tools
|
||||
|
||||
if test -f .env; then
|
||||
echo "Using .env file"
|
||||
. $(pwd)/.env
|
||||
fi
|
||||
|
||||
# Function to extract IP address from URL, resolve the IP and replace it in the original URL
|
||||
get_ip_address_and_replace() {
|
||||
local url=$1
|
||||
local domain_name=$(echo $RPC_URL | awk -F[/:] '{print $4}')
|
||||
local ip_address=$(dig +short $domain_name)
|
||||
valid_rpc_url="${url/$domain_name/$ip_address}"
|
||||
echo $valid_rpc_url
|
||||
}
|
||||
|
||||
# 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@?^=%&\/~+#-])*"
|
||||
# Perform regex matching
|
||||
if [[ $RPC_URL =~ $pattern ]]; then
|
||||
echo "RPC URL is valid"
|
||||
else
|
||||
echo "RPC URL is invalid: $RPC_URL. Attempting to resolve hostname."
|
||||
resolved_rpc_url="$(get_ip_address_and_replace $RPC_URL)"
|
||||
if [ -z "$resolved_rpc_url" ]; then
|
||||
echo -e "Failed to retrieve IP address for $RPC_URL\n"
|
||||
else
|
||||
echo -e "Resolved RPC URL for $RPC_URL: $resolved_rpc_url"
|
||||
RPC_URL="$resolved_rpc_url"
|
||||
fi
|
||||
fi
|
||||
|
||||
if test -f ./$RLN_CREDENTIAL_PATH; then
|
||||
echo "$RLN_CREDENTIAL_PATH already exists. Use it instead of creating a new one."
|
||||
else
|
||||
/usr/bin/wakunode generateRlnKeystore \
|
||||
--rln-relay-eth-client-address="$RPC_URL" \
|
||||
--rln-relay-eth-private-key=$PRIVATE_KEY \
|
||||
--rln-relay-eth-contract-address=$RLN_CONTRACT_ADDRESS \
|
||||
--rln-relay-cred-path=$RLN_CREDENTIAL_PATH \
|
||||
--rln-relay-cred-password=$RLN_CREDENTIAL_PASSWORD \
|
||||
--execute
|
||||
fi
|
||||
|
||||
IP=$(ip a | grep "inet " | grep -Fv 127.0.0.1 | sed 's/.*inet \([^/]*\).*/\1/')
|
||||
|
||||
echo "I am a nwaku node"
|
||||
@ -37,8 +82,8 @@ exec /usr/bin/wakunode\
|
||||
--rest-address=0.0.0.0\
|
||||
--rln-relay=true\
|
||||
--rln-relay-dynamic=true\
|
||||
--rln-relay-eth-client-address=http://10.1.0.4:8545\
|
||||
--rln-relay-eth-contract-address=0x9fE46736679d2D9a65F0992F2272dE9f3c7fa6e0\
|
||||
--rln-relay-eth-client-address="$RPC_URL"\
|
||||
--rln-relay-eth-contract-address=$RLN_CONTRACT_ADDRESS\
|
||||
--dns-discovery=true\
|
||||
--discv5-discovery=true\
|
||||
--discv5-enr-auto-update=True\
|
||||
@ -47,4 +92,4 @@ exec /usr/bin/wakunode\
|
||||
--metrics-server=True\
|
||||
--metrics-server-address=0.0.0.0\
|
||||
--discv5-bootstrap-node=${BOOTSTRAP_ENR}\
|
||||
--nat=extip:${IP}
|
||||
--nat=extip:${IP}
|
||||
@ -1,25 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
|
||||
if test -f ./keystore/keystore.json; then
|
||||
echo "keystore/keystore.json already exists. Use it instead of creating a new one."
|
||||
echo "Exiting"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
if test -f .env; then
|
||||
echo "Using .env file"
|
||||
. $(pwd)/.env
|
||||
fi
|
||||
|
||||
# TODO: Set nwaku release when ready instead of quay
|
||||
|
||||
|
||||
exec /usr/bin/wakunode generateRlnKeystore \
|
||||
--rln-relay-eth-client-address=http://10.1.0.5:8545 \
|
||||
--rln-relay-eth-private-key=0x7c852118294e51e653712a81e05800f419141751be58f605c371e15141b007a6 \
|
||||
--rln-relay-eth-contract-address=0x9fE46736679d2D9a65F0992F2272dE9f3c7fa6e0 \
|
||||
--rln-relay-cred-path=/keystore/keystore.json \
|
||||
--rln-relay-cred-password="my_secure_keystore_password" \
|
||||
--execute
|
||||
1
submodules/waku-rln-contract
Submodule
1
submodules/waku-rln-contract
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit a01daa8b9475a5dd23db47625e86f585963dd473
|
||||
Loading…
x
Reference in New Issue
Block a user