Using Docker
The faster option to run Selendra in Docker. These images use the latest official release of the Selendra binary, pulled from our package repository.
Option 1
Clone this script (opens in a new tab) into your local machine. Then run it as below;
sudo sh docker-run-test-node.sh
Once the node is up. You can Ctr + C to stop it, then run;
sudo docker restart
Note write you container name and don't forget to delete the
{}
.
Option 2
A manual process through which you can learn step by step how it is executed.
Install docker
To install docker see here (opens in a new tab).
Run docker
Let's first check the version we have and pull image from docker image. This takes a bit of time, be patient:
docker pull selendrachain/selendra-chain:latest
You can also pass any argument/flag that Selendra supports:
docker run selendrachain/selendra-chain:latest --dev --name "DockerNode"
Run selendra node
You can start Selendra as daemon, exposes the Selendra ports and mount a volume that will keep your blockchain data locally. Make sure that you set the ownership of your local directory to the Selendra user that is used by the container. Set user id 1000 and group id 1000, by running chown 1000.1000 /my/local/folder -R
if you use a bind mount.
To start a Selendra node on default rpc port 9933 and default p2p port 30333 use the following command. If you want to connect to rpc port 9933 and wss port 9944, then must add Selendra startup parameter: --rpc-external
, -ws-external
.
Run docker node
docker run \
-d \
-p 30333:30333 \
-p 9933:9933 \
-p 9944:9944 \
-v /my/local/folder:/selendra/data/testnet \
--name testnet \
selendrachain/selendra-chain:latest \
--base-path selendra/data/testnet \
--chain selendra \
--rpc-external \
--ws-external \
--rpc-cors all \
--name "Dockernode" \
--pruning=archive
If you want to operate it on the internet. Do not expose RPC and WS ports, if they are not correctly configured.
Insert key to selendra node
docker exec -it testnet selendra key insert \
--base-path selendra/data/testnet \
--chain selendra \
--suri <Private key> \
--password-interactive \
--key-type babe \
--scheme Sr25519
docker exec -it testnet selendra key insert \
--base-path selendra/data/testnet \
--chain selendra \
--suri <Private key> \
--password-interactive \
--key-type gran \
--scheme ed25519