Skip to content

How to setup local dev nodes for apps development?

sxlwar edited this page Dec 15, 2021 · 6 revisions

Create docker-compose.yml and run docker-compose up -d

services:

  crab:
    container_name: crab
    image: quay.io/darwinia-network/darwinia:v0.11.7
    ports:
      - 9930:9933
      - 9940:9944 # 9940: local machine port; 9944: docker container internal port
    command:
      - --chain
      - crab-dev
      - --unsafe-ws-external
      - --alice
      - --rpc-methods
      - Unsafe
      - --rpc-external
      - --rpc-cors
      - all
      - --tmp

If you are directly using docker, can start with

docker run -it --name crab \
  -p 9930:9933 -p 9940:9944 \
  quay.io/darwinia-network/darwinia:v0.11.7 \
  --chain crab-dev \
  --alice \
  --unsafe-ws-external \
  --rpc-methods Unsafe \
  --rpc-external \
  --rpc-cors all \
  --tmp

After these are executed, 9930 9940 will be bound in the local machine and 9933 9944 in the mapping container will be retained.

Use docker run -dit if you want to start the docker command in the background, and if you are using docker-compose given above, it is already started in the background. If you do not want to start in the background, execute docker-compose up, then it is not started in the background, the container will stop after Ctrl+C (edited).

After the dev nodes launched successfully, you can use them in apps, polkadot apps, or wormhole

apps

  1. Go to https://apps.darwinia.network/, click the network logo on the left-top side.

  2. Click to select the network, select the Local node option which is at the bottom, then click the save & reload button.

The default port set in the Local node option is 9944, you may need to change it to fit yours, as the docker-compose.yml above, the port should be 9940

Polkadot apps

  1. Go to https://polkadot.js.org/apps, click the network logo on the left-top side.

  2. Click the development group at the left side menus, set the value of the endpoint, select the Local node, then click the Transform button at the top of the menu panel.

The default port set in the Local node option is 9944, you may need to change it to fit yours, as the docker-compose.yml above, the port should be 9940. In addition, the protocol is ws, not wss.

Wormhole

  1. Go to https://wormhole.darinwia.network, scroll down to the bottom, click the Custome Configuration button.

  2. Select the network, scroll the content on the right side, you will find the provider option which includes two properties. Set the value of the rpc property, e.g: ws://127.0.0.1:9940.

  3. Click the Store And Replace The System Configuration button, which is on the right-bottom of the content area, then reload the page manually.

After the testing, you can restore the system, there is a button named Restore System Configuration at the position of the Store And Replace The System Configuration button.