Local testnet

Below you can find the guide how to setup local Swisstronik testnet with one or multiple validators using Docker

Single validator testnet

For convenient development and testing of your dApps we've prepared the ghcr.io/sigmagmbh/swisstronik-chain:latest Docker image which contains preconfigured network with one validator.

You can start local node by running:

docker run --rm -it -p 0.0.0.0:26657:26657 \
    -p 0.0.0.0:8545:8545 -p 0.0.0.0:8546:8546 \
    ghcr.io/sigmagmbh/swisstronik-chain:latest swisstronikd start --minimum-gas-prices=0uswtr \
    --json-rpc.api eth,txpool,personal,net,debug,web3 \
    --api.enable --enclave.address 0.0.0.0:8999 \
    --json-rpc.address 0.0.0.0:8535 --json-rpc.ws-address 0.0.0.0:8546

Multiple validators testnet

Prerequisites

Build and start

Before starting a local testnet run following command to generate genesis.json file with initial state of blockchain and multiple validator configs

This command will create .testnets folder with validator private keys, configuration, etc.

Now you can start your local testnet using Docker and docker-compose by running command below from root directory of clonedswisstronik-chain repo:

The command above will run docker containers in the background using docker-compose. You will see created network and containers

Stop local testnet

Once you are done, execute:

Logging

To see what happening inside node you can use following command:

The logs will look like:

You can disregard the Can't add peer's address to addrbook warning. As long as the blocks are being produced and the app hashes are the same for each node, there should not be any issues.

Follow logs​

You can also watch logs as they are produced via Docker with the --follow (-f) flag, for example:

Ethereum JSON-RPC & Websocket Ports​

To interact with the testnet via WebSockets or RPC/API, you will send your request to the corresponding ports:

EVM JSON-RPC
Eth Websocket

8545

8546

You can send a curl command such as:

Last updated