Browse Source

Support non deterministic account creation in ganache

develop
Apostolos Fanakis 4 years ago
parent
commit
ca76cc7034
  1. 2
      docker/README.md
  2. 1
      docker/env/ganache.env
  3. 43
      docker/ganache/start-blockchain.sh

2
docker/README.md

@ -42,7 +42,7 @@ bellow.
| --- | --- | --- | | --- | --- | --- |
| ACCOUNTS_NUMBER | 10 | Set the number of accounts generated | | ACCOUNTS_NUMBER | 10 | Set the number of accounts generated |
| ACCOUNTS_ETHER | 10 | Set the amount of ETH assigned to each account | | ACCOUNTS_ETHER | 10 | Set the amount of ETH assigned to each account |
| MNEMONIC | myth like bonus scare over problem client lizard pioneer submit female collect | The mnemonic phrase sued as a seed for deterministic account generation | | MNEMONIC | NaN | The mnemonic phrase sued as a seed for deterministic account generation |
| HOST | 0.0.0.0 | The hostname to listen on | | HOST | 0.0.0.0 | The hostname to listen on |
| PORT | 8545 | The port to listen on | | PORT | 8545 | The port to listen on |
| NETWORK_ID | 5778 | The network id used to identify ganache | | NETWORK_ID | 5778 | The network id used to identify ganache |

1
docker/env/ganache.env

@ -1,6 +1,5 @@
ACCOUNTS_NUMBER=5 ACCOUNTS_NUMBER=5
ACCOUNTS_ETHER=1 ACCOUNTS_ETHER=1
MNEMONIC="myth like bonus scare over problem client lizard pioneer submit female collect"
HOST=0.0.0.0 HOST=0.0.0.0
PORT=8545 PORT=8545
NETWORK_ID=5778 NETWORK_ID=5778

43
docker/ganache/start-blockchain.sh

@ -2,21 +2,36 @@
N_ACCOUNTS="${ACCOUNTS_NUMBER:-10}" N_ACCOUNTS="${ACCOUNTS_NUMBER:-10}"
ETHER="${ACCOUNTS_ETHER:-10}" ETHER="${ACCOUNTS_ETHER:-10}"
MNEMONIC="${MNEMONIC:-"myth like bonus scare over problem client lizard pioneer submit female collect"}"
HOST="${HOST:-"0.0.0.0"}" HOST="${HOST:-"0.0.0.0"}"
PORT="${PORT:-8545}" PORT="${PORT:-8545}"
ID="${NETWORK_ID:-5778}" ID="${NETWORK_ID:-5778}"
node /app/ganache-core.docker.cli.js \ if [ -z "${MNEMONIC}" ]; then
-a "$N_ACCOUNTS" \ echo "Starting Ganache with non deterministic address generation"
-e "$ETHER" \ node /app/ganache-core.docker.cli.js \
-m "$MNEMONIC" \ --accounts "$N_ACCOUNTS" \
-h "$HOST" \ --defaultBalanceEther "$ETHER" \
-p "$PORT" \ --host "$HOST" \
-i "$ID" \ --port "$PORT" \
--account_keys_path "/home/ganache_keys/keys.json" \ --networkId "$ID" \
--db "/home/ganache_db/" \ --account_keys_path "/home/ganache_keys/keys.json" \
--allowUnlimitedContractSize \ --db "/home/ganache_db/" \
--noVMErrorsOnRPCResponse \ --allowUnlimitedContractSize \
-d \ --noVMErrorsOnRPCResponse \
-v --verbose
else
echo "Starting Ganache with deterministic address generation"
node /app/ganache-core.docker.cli.js \
--accounts "$N_ACCOUNTS" \
--defaultBalanceEther "$ETHER" \
--mnemonic "$MNEMONIC" \
--host "$HOST" \
--port "$PORT" \
--networkId "$ID" \
--account_keys_path "/home/ganache_keys/keys.json" \
--db "/home/ganache_db/" \
--allowUnlimitedContractSize \
--noVMErrorsOnRPCResponse \
--deterministic \
--verbose
fi

Loading…
Cancel
Save