forked from paritytech/substrate
-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #50 from PureStake/crystalin-add-standalone-script
Adds standalone run script
- Loading branch information
Showing
7 changed files
with
181 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
#!/bin/bash | ||
|
||
# User port XX000 | ||
# Standalone port XX500 | ||
# 42 for p2p | ||
# 43 for http | ||
# 44 for ws | ||
# | ||
# Ex: USER_PORT=20000 scripts/run-moonbase-standalone.sh | ||
# will open port 21542, 21543, 21544 | ||
|
||
# Loading binary/specs variables | ||
source scripts/_init_var.sh | ||
|
||
if [ ! -f "$STANDALONE_BINARY" ]; then | ||
echo "Standalone binary $STANDALONE_BINARY is missing" | ||
echo "Please run: cargo build --release -p moonbase-standalone" | ||
exit 1 | ||
fi | ||
|
||
STANDALONE_PORT=$((USER_PORT + 500 + 42)) | ||
STANDALONE_INDEX=0 | ||
STANDALONE_BOOTNODES_ARGS="" | ||
while nc -z -v -w5 ${RELAY_IP} ${STANDALONE_PORT} 2> /dev/null | ||
do | ||
echo "Found existing relay on ${STANDALONE_PORT}." | ||
BOOTNODES_ARGS="$BOOTNODES_ARGS --bootnodes /ip4/$RELAY_IP/tcp/${STANDALONE_PORT}/p2p/${RELAY_LOCAL_IDS[$STANDALONE_INDEX]}" | ||
STANDALONE_INDEX=$((STANDALONE_INDEX + 1)) | ||
STANDALONE_PORT=$((STANDALONE_PORT + 100)) | ||
|
||
if [ $STANDALONE_PORT -ge $((USER_PORT + 800)) ] | ||
then | ||
echo "No more standalone port available! (limited to 3 standalone nodes)" | ||
exit 1 | ||
fi | ||
done | ||
|
||
echo "Node $STANDALONE_INDEX - p2p-port: $((STANDALONE_PORT)), http-port: $((STANDALONE_PORT + 1)) , ws-port: $((STANDALONE_PORT + 2))" | ||
|
||
if [ -z "$BASE_PREFIX" ]; then | ||
BASE_PATH="--tmp" | ||
else | ||
BASE_PATH="$BASE_PREFIX-relay-$STANDALONE_INDEX" | ||
fi | ||
|
||
EXECUTABLE=$STANDALONE_BINARY | ||
if [ ! -z "$PERF" ]; then | ||
EXECUTABLE="$PERF $STANDALONE_BINARY" | ||
fi | ||
|
||
$EXECUTABLE \ | ||
--node-key ${NODE_KEYS[$STANDALONE_INDEX]} \ | ||
--dev \ | ||
--port $((STANDALONE_PORT)) \ | ||
--rpc-port $((STANDALONE_PORT + 1)) \ | ||
--ws-port $((STANDALONE_PORT + 2)) \ | ||
--validator \ | ||
--name STANDALONE_$STANDALONE_INDEX \ | ||
$STANDALONE_BASE_PATH \ | ||
'-linfo,evm=trace,ethereum=trace,rpc=trace' \ | ||
$STANDALONE_BOOTNODES_ARGS |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
{ | ||
"name": "Moonbase Alpha Dev", | ||
"id": "local_testnet", | ||
"chainType": "Local", | ||
"bootNodes": [], | ||
"telemetryEndpoints": null, | ||
"protocolId": null, | ||
"properties": null, | ||
"relay_chain": "local_testnet", | ||
"para_id": 1000, | ||
"consensusEngine": null, | ||
"genesis": { | ||
"runtime": { | ||
"frameSystem": { | ||
"changesTrieConfig": null, | ||
"code": "<runtime_code>" | ||
}, | ||
"palletBalances": { | ||
"balances": [ | ||
] | ||
}, | ||
"palletSudo": { | ||
"key": "13jU2C8jiAMkMv5iXiJ8Ue2xLTmJo4byfKm5gBehqPAvkGC4" | ||
}, | ||
"parachainInfo": { | ||
"parachainId": 1000 | ||
}, | ||
"palletEvm": { | ||
"accounts": { | ||
"0x6Be02d1d3665660d22FF9624b7BE0551ee1Ac91b": { | ||
"balance": "0x11529215046068469760001", | ||
"nonce": "0x0", | ||
"storage": {}, | ||
"code": [] | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |