Skip to content

Commit d2b637a

Browse files
authored
Subnet Generator V1 with UI (#155)
* use formatter * add helper scripts * add xdc-zero config generation * added configuration generator ui * add helpers with address generator and useful links * add faucet and faucet-server * minor fixes * bump version for v1 release
1 parent 524d0fd commit d2b637a

37 files changed

+1917
-518
lines changed

.gitignore

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,11 @@ subnet/logs
1111
subnet/relayer
1212
subnet/stats-service
1313
subnet/deployment-generator/script/gen.env*
14+
.DS_Store
1415
XDC-Subnet
1516
keys.json
1617
node_modules
1718
package-lock.json
1819
generated
19-
*.env
20-
temp
20+
*.env*
21+
**temp

subnet/deployment-generator/docker/Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ FROM node:18.15
33
WORKDIR /app
44

55
COPY ./src /app/src
6+
COPY ./scripts /app/scripts
67
COPY ./docker/start.sh /app/start.sh
78

89
RUN chmod +x /app/start.sh
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
#!/bin/bash
2-
node /app/src/gen.js
2+
node /app/src/ui.js
3+
# node /app/src/gen.js

subnet/deployment-generator/script/generate.sh

Lines changed: 0 additions & 42 deletions
This file was deleted.
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/bin/bash
2+
3+
echo "getting latest block"
4+
resp=$(curl -s --location 'http://localhost:8545' \
5+
--header 'Content-Type: application/json' \
6+
--data '{"jsonrpc":"2.0","method":"XDPoS_getV2BlockByNumber","params":["latest"],"id":1}')
7+
8+
num=$(echo $resp | grep -o '"Number":[0-9]*' | cut -d':' -f2 | tr -d ' ')
9+
echo $num
10+
11+
if [[ $num == "null" ]] || [[ $num == "" ]]; then
12+
echo "no block has been mined, please check if nodes are peering properly"
13+
exit
14+
else
15+
for i in 2 3 4
16+
do
17+
sleep 3
18+
echo "getting latest block $i"
19+
resp=$(curl -s --location 'http://localhost:8545' \
20+
--header 'Content-Type: application/json' \
21+
--data '{"jsonrpc":"2.0","method":"XDPoS_getV2BlockByNumber","params":["latest"],"id":1}')
22+
nextnum=$(echo $resp | grep -o '"Number":[0-9]*' | cut -d':' -f2 | tr -d ' ')
23+
echo $nextnum
24+
done
25+
fi
26+
27+
if [[ $nextnum > $num ]]; then
28+
echo "subnet successfully running and mining blocks"
29+
fi
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/bin/bash
2+
3+
resp=$(curl -s --location "http://localhost:8545" \
4+
--header 'Content-Type: application/json' \
5+
--data '{"jsonrpc":"2.0","method":"net_peerCount","params":[],"id":1}')
6+
echo $resp
7+
num_peers=$(echo $resp | grep -o '"result":"[^"]*"' | cut -d'"' -f4)
8+
num_peers_dec=$(printf "%d\n" $num_peers)
9+
echo "peers: $num_peers_dec"
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/bin/bash
2+
3+
cd "$(dirname "$0")"
4+
5+
if [[ -z $1 ]] || [[ -z $2 ]]; then
6+
echo "Missing argument"
7+
echo "Usage: csc.sh VERSION MODE"
8+
echo "Version: latest or check documentation for available versions"
9+
echo "Mode: lite, full, or reverse"
10+
exit
11+
fi
12+
13+
14+
docker pull xinfinorg/csc:$1
15+
docker run --env-file ../contract_deploy.env --network generated_docker_net xinfinorg/csc:$1 $2
16+
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/bin/bash
2+
3+
cd "$(dirname "$0")"
4+
5+
6+
if [[ -z $1 ]]; then
7+
echo "Missing argument"
8+
echo "Usage: docker-down.sh PROFILE"
9+
echo "Profile:"
10+
echo " machine1 - subnet nodes"
11+
echo " services - relayer, backend, frontend"
12+
exit
13+
fi
14+
15+
docker compose --env-file ../docker-compose.env --profile $1 down
16+
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/bin/bash
2+
3+
cd "$(dirname "$0")"
4+
5+
if [[ -z $1 ]]; then
6+
echo "Missing argument"
7+
echo "Usage: docker-up.sh PROFILE"
8+
echo "Profile:"
9+
echo " machine1 - subnet nodes"
10+
echo " services - relayer, backend, frontend"
11+
exit
12+
fi
13+
14+
docker compose --env-file ../docker-compose.env --profile $1 pull
15+
docker compose --env-file ../docker-compose.env --profile $1 up -d
16+

subnet/deployment-generator/script/docker.env.example renamed to subnet/deployment-generator/scripts/docker.env.example

File renamed without changes.

0 commit comments

Comments
 (0)