Skip to content

Create script to start a local network with gas station #280

@Thoralf-M

Description

@Thoralf-M

Similar to what's done in the CI in this PR #260 we should have a script so one can easily run the examples locally

Some code that can help (should be adjusted, create a new address for the gas station instead of using an existing address for example):

# change this in ./github/actions/start-local-network/config.yaml
``
storage-config:
  redis:
    redis_url: "redis://127.0.0.1:6379"
fullnode-url: "http://127.0.0.1:9000/"
``
# add the following to redis and gas_station services in ./github/actions/start-local-network/gas_station_compose.yml
`    network_mode: host` 

# start a local iota network with a faucet, an indexer and GraphQL
docker start postgres || docker run -d --name postgres -e POSTGRES_PASSWORD=postgrespw -e POSTGRES_INITDB_ARGS="-U postgres" -p 5432:5432 postgres:15 -c max_connections=1000

RUST_LOG="info,consensus=warn,iota_core=warn,fastcrypto_tbls=off,iota_indexer=warn,iota_data_ingestion_core=error,iota_graphql_rpc=warn" iota start --force-regenesis --with-faucet --with-indexer --with-graphql

# Start gas station and request faucet coins
GAS_STATION_AUTH=test
# Use current active address/privkey for the gas station
iota keytool update-alias $(iota client active-address) gas_station

echo "Getting keypair"
private_key="$(iota keytool export gas_station --json | jq -r '.["exportedPrivateKey"]')"
key="$(iota keytool convert $private_key --json | jq -r '.["base64WithFlag"]')"

echo "Setting keypair in config"
sed -i "s|<keypair>|$key|g" ./.github/actions/start-local-network/config.yaml

echo "Requesting faucet coins"
iota client faucet --address gas_station

echo "Starting Gas Station"
docker compose -f ./.github/actions/start-local-network/gas_station_compose.yml up -d

# optional see some gas station logs
docker logs iota-gas-station

# stop it
docker compose -f ./.github/actions/start-local-network/gas_station_compose.yml down

Metadata

Metadata

Assignees

Labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions