File tree Expand file tree Collapse file tree 1 file changed +55
-0
lines changed
Expand file tree Collapse file tree 1 file changed +55
-0
lines changed Original file line number Diff line number Diff line change 1+ #! /bin/bash
2+
3+ test -z " ${2} " && echo " USAGE: ${0} <network_id> <file://build.yml> [data dir]" && exit 1
4+
5+ network_id=${1}
6+ network_build=${2}
7+ dir=${3:-/ tmp}
8+ socket=${dir} /appchain.sock
9+
10+ cat << EOF
11+ Initialize Network:
12+ data directory: '${dir} '
13+ network id: '${network_id} '
14+ network build file: '${network_build} '
15+ EOF
16+
17+ mkdir -p " ${dir} "
18+
19+ node \
20+ --experimental-specifier-resolution=node \
21+ --experimental-vm-modules \
22+ --experimental-wasm-modules \
23+ --experimental-wasm-threads \
24+ --no-warnings \
25+ dist/index.js \
26+ --admin \
27+ --debug \
28+ --ipfs \
29+ --ipfs-data ${dir} /ipfs \
30+ --key ${dir} /admin.key \
31+ --listen \
32+ --nonce \
33+ --socket ${socket} \
34+ --tx-status-retries 0 \
35+ &
36+ PID=$!
37+
38+ # Wait for the socket to exist
39+ while [ ! -S ${socket} ]; do sleep 1; done
40+
41+ appchain () {
42+ echo " $@ " | tee >( cat >&2 ) | nc -U -q 0 ${socket}
43+ sleep 0.2s
44+ }
45+
46+ appchain admin setAdmin
47+ appchain nodes setRegistrationStake 0
48+ appchain nodes openRegistration
49+ appchain networks register ${network_id} ${network_build}
50+ sleep 1s # avoid nonce collision from slower register command (IPFS)
51+ appchain networks setActive ${network_id}
52+
53+ kill ${PID}
54+
55+ rm -f ${socket}
You can’t perform that action at this time.
0 commit comments