Skip to main content

Step 4. Run a Midnight node in Validator Mode

Requirements​

  1. DB_SYNC_POSTGRES should have accessible port for the intended Midnight Node instance and synced (Step 2).
  2. Midnight node is available as a Docker image at this time. Therefore, Docker/ Docker Compose is required.

4a. docker-compose up Midnight node in validator mode​

  1. Clone midnight-node-docker Repo:

    A docker-compose repo is provided to easily start the midnight-node on testnet

    • Clone the repo
    git clone git@github.com:midnight-ntwrk/midnight-node-docker.git # clone the repo
    cd midnight-node-docker # enter the project
    ls . # list contents

    This project contains a .env file containing important environment variables to modify.

  2. Update Environment Variables:

    • Open the .env file in a shell editor or VSCode.

    • Update DB_SYNC_POSTGRES_CONNECTION_STRING with the correct IP/ host and password to your instance.

    git clone git@github.com:midnight-ntwrk/midnight-node-docker.git # clone the repo
    cd midnight-node-docker # enter the project
    ls . # list contents
  3. docker-compose up midnight-node:

    • Within the same directory as compose.yml, simply invoke docker-compose up to start the node.
    docker-compose up

    The node should begin to peer with the testnet and validate blocks. Here is an example of a correct logs:

    midnight-node-testnet-1  | 2024-09-24 19:19:03 đŸ’ģ Target environment: gnu    
    midnight-node-testnet-1 | 2024-09-24 19:19:03 đŸ’ģ Memory: 7837MB
    midnight-node-testnet-1 | 2024-09-24 19:19:03 đŸ’ģ Kernel: 6.10.4-linuxkit
    midnight-node-testnet-1 | 2024-09-24 19:19:03 đŸ’ģ Linux distribution: Debian GNU/Linux trixie/sid
    midnight-node-testnet-1 | 2024-09-24 19:19:03 đŸ’ģ Virtual machine: no
    midnight-node-testnet-1 | 2024-09-24 19:19:03 đŸ“Ļ Highest known block at #8936
    midnight-node-testnet-1 | 2024-09-24 19:19:03 ã€Ŋī¸ Prometheus exporter started at 127.0.0.1:9615
    midnight-node-testnet-1 | 2024-09-24 19:19:03 Running JSON-RPC server: addr=127.0.0.1:9944, allowed origins=["http://localhost:*", "http://127.0.0.1:*", "https://localhost:*", "https://127.0.0.1:*", "https://polkadot.js.org"]
    midnight-node-testnet-1 | 2024-09-24 19:19:03 💔 The bootnode you want to connect to at `/ip4/127.0.0.1/tcp/30333/p2p/12D3KooWCp4EyKBtHjYTjUaNBauuE944KtDguFbRmQbXQprD5DmP` provided a different peer ID `12D3KooWA6xLufBTmT5vnW1uaKN1My2UsLeWDVS9MvLgbfrD5S4L` than the one you expect `12D3KooWCp4EyKBtHjYTjUaNBauuE944KtDguFbRmQbXQprD5DmP`.
    midnight-node-testnet-1 | 2024-09-24 19:19:08 ⚙ī¸ Syncing, target=#79809 (6 peers), best: #8960 (0xb3c1â€Ļa312), finalized #8704 (0x0012â€Ļ390d), âŦ‡ 710.7kiB/s âŦ† 6.7kiB/s
    midnight-node-testnet-1 | 2024-09-24 19:19:11 ✅ Validated Midnight transaction 48ad3bdfa2be837a7abde0ad3fc7badb24f32cd8f97beec4e5d2a05b62d21adb
    midnight-node-testnet-1 | 2024-09-24 19:19:12 ✅ Validated Midnight transaction e0fe7c184a6512fe48bb2494cc60ea4583c7be1b10b8100b1be65966894c6191
    midnight-node-testnet-1 | 2024-09-24 19:19:12 ✅ Validated Midnight transaction 43f15469e7e4a12db60627c11554b912b84620d1c76f9ce765cdfee26b4c08df
    midnight-node-testnet-1 | 2024-09-24 19:19:13 ⚙ī¸ Syncing 19.9 bps, target=#79810 (9 peers), best: #9060 (0x3c59â€Ļc88f), finalized #8704 (0x0012â€Ļ390d), âŦ‡ 81.5kiB/s âŦ† 0.9kiB/s
    midnight-node-testnet-1 | 2024-09-24 19:19:13 ✅ Validated Midnight transaction 82d11c6280c0ef43d50f6d38fc760425af5d39c84e1d2f2fd7a637c88c7783be
    midnight-node-testnet-1 | 2024-09-24 19:19:13 ✅ Validated Midnight transaction 20e4c4f60db1a549379bb4ac37720be95fa5e1e8e174aaf4112f93ddc72154b9
    midnight-node-testnet-1 | 2024-09-24 19:19:15 đŸ’ŧ Selected 540 validators for epoch 239829, from 12 permissioned candidates and 6 trustless candidates
    midnight-node-testnet-1 | 2024-09-24 19:19:15 âŗ New epoch 239828 starting at block 9216
    midnight-node-testnet-1 | 2024-09-24 19:19:15 New session 8
    midnight-node-testnet-1 | 2024-09-24 19:19:15 Committee rotated: Returning 540 validators, stored in epoch 239828
    midnight-node-testnet-1 | 2024-09-24 19:19:15 Start session 8, epoch 239828
    midnight-node-testnet-1 | 2024-09-24 19:19:15 đŸ’ŧ Storing committee of size 540 for epoch 239829
    midnight-node-testnet-1 | 2024-09-24 19:19:16 ✅ Validated Midnight transaction ecc8eab39435383a5efb505cee746119f2e1ae19dbf36dba496a878124f17526
    midnight-node-testnet-1 | 2024-09-24 19:19:17 ✅ Validated Midnight transaction 67183e9a12d25d2b58856388918a892a52009ea7d6767df6c1f7af9a8eccd4a9
    midnight-node-testnet-1 | 2024-09-24 19:19:17 ✅ Validated Midnight transaction bcbdba7aa7546331b143d2e7d434a7b285ed18ef42a334529dd7d5ba5f969bde
    midnight-node-testnet-1 | 2024-09-24 19:19:17 ✅ Validated Midnight transaction