@@ -18,11 +18,6 @@ chain_spec=$(realpath "$chain_spec")
18
18
base_path=$( realpath " $base_path " )
19
19
20
20
# Ensure required tools and binaries exist
21
- if ! command -v jq & > /dev/null; then
22
- echo " jq is not installed. Please install it and try again."
23
- exit 1
24
- fi
25
-
26
21
if [ ! -f " ./target/release/argochain" ]; then
27
22
echo " argochain binary not found. Please build it and try again."
28
23
exit 1
@@ -44,53 +39,49 @@ purge_database() {
44
39
if [ $? -eq 0 ]; then
45
40
echo " Database purged successfully."
46
41
else
47
- echo " Error purging database. Exiting."
48
- exit 1
49
- fi
50
- }
51
-
52
- # Function to generate and insert a key
53
- generate_and_insert_key () {
54
- local key_type=" $1 "
55
- local scheme=" $2 "
56
-
57
- echo " Generating $key_type key..."
58
- key_output=$( ./target/release/argochain key generate --scheme " $scheme " --output-type json)
59
-
60
- # Extract secret phrase and public key
61
- secret_phrase=$( echo " $key_output " | jq -r ' .secretPhrase' )
62
- public_key=$( echo " $key_output " | jq -r ' .publicKey' )
63
-
64
- echo " Inserting $key_type key..."
65
- ./target/release/argochain key insert --base-path " $base_path " --chain " $chain_spec " --scheme " $scheme " --suri " $secret_phrase " --key-type " $key_type "
66
-
67
- if [ $? -eq 0 ]; then
68
- echo " $key_type key inserted successfully. Public key: $public_key "
69
- else
70
- echo " Error inserting $key_type key. Exiting."
71
- exit 1
42
+ echo " Error purging database. Attempting manual cleanup..."
43
+ if [ -d " $base_path /chains/argochain/db" ]; then
44
+ sudo rm -rf " $base_path /chains/argochain/db"
45
+ echo " Manual database cleanup completed."
46
+ else
47
+ echo " Database directory not found. Skipping manual cleanup."
48
+ fi
72
49
fi
73
50
}
74
51
75
- # Function to rotate keys for a specific type
76
- rotate_key () {
77
- local key_type=" $1 "
78
- local scheme=" $2 "
79
-
80
- echo " Rotating $key_type key..."
81
- generate_and_insert_key " $key_type " " $scheme "
82
- echo " $key_type key rotated successfully."
83
- }
84
-
85
52
# Purge the database first
86
53
purge_database
87
54
88
- # Rotate keys for all consensus mechanisms
89
- rotate_key " babe" " Sr25519"
90
- rotate_key " gran" " Ed25519"
91
- rotate_key " audi" " Sr25519"
92
- rotate_key " imon" " Sr25519"
93
-
94
- # Start the node with injected keys
95
- echo " Starting the node with the new validator keys..."
96
- ./target/release/argochain --chain " $chain_spec " --name " $name " --validator --base-path " $base_path "
55
+ # Start the node in the background and save logs
56
+ log_file=" $base_path /node.log"
57
+ echo " Starting the node..."
58
+ nohup ./target/release/argochain \
59
+ --chain minervaRaw.json \
60
+ --base-path " $base_path " \
61
+ --port 30333 \
62
+ --rpc-port 9944 \
63
+ --telemetry-url " wss://telemetry.polkadot.io/submit/ 0" \
64
+ --name " $name " \
65
+ --validator \
66
+ --rpc-methods Unsafe \
67
+ --unsafe-rpc-external \
68
+ --rpc-max-connections 100 \
69
+ --rpc-cors all > " $log_file " 2>&1 &
70
+
71
+ # Enhanced SUCCESSFUL message
72
+ if [ $? -eq 0 ]; then
73
+ echo -e " \033[1;32m" # Green color
74
+ echo " =============================================================="
75
+ echo " πππ OPERATION SUCCESSFUL! πππ"
76
+ echo " =============================================================="
77
+ echo -e " \033[0m" # Reset color
78
+
79
+ echo -e " \033[1;33mβ
Your Argochain node is now running successfully! β
\033[0m"
80
+ echo -e " \033[1;34mπ Logs are being written to:\033[0m \033[1;37m$log_file \033[0m"
81
+ echo -e " \033[1;34mπ To monitor logs in real-time, use:\033[0m"
82
+ echo -e " \033[1;36m tail -f $log_file \033[0m"
83
+ echo -e " \033[1;34mπ Ready to validate blocks and explore Argochain! π\033[0m"
84
+ else
85
+ echo -e " \033[1;31mFailed to start the node. Check the logs at:\033[0m $log_file "
86
+ exit 1
87
+ fi
0 commit comments