Skip to content

Instantly share code, notes, and snippets.

@fxfactorial
Last active April 7, 2020 05:59
Show Gist options
  • Save fxfactorial/eecd254773b6f317159eb4a69d2e6761 to your computer and use it in GitHub Desktop.
Save fxfactorial/eecd254773b6f317159eb4a69d2e6761 to your computer and use it in GitHub Desktop.
Running a Harmony validator node on Open Staking Testnet, the EASY WAY with docker

Prereq

  1. You have docker installed
  2. You have a BLS private key, see this link

Getting the container

let's say my BLS key is in my current directory and its called

790f87868d56594bff73320b50a2b9b9818ed30780a2aeacea6ec5e6c098e6ad073d61c73946d3855a9498cee8eca200.key

NOTE I shorted the key to 790f8..eca200.key in the following command for breivity.

$ docker run -v "$(pwd)/790f8..eca200.key:/root/injected-bls.key" -p 9500:9500 -t algebr/ostn-node 

And that's it!

Assuming that your container is running , you can also now use hmy to check the status of your local node, try:

$ hmy blockchain latest-headers
{
  "id": "1",
  "jsonrpc": "2.0",
  "result": {
    "beacon-chain-header": {
      "block-header-hash": "0x70411758f778ac4f00bdd277a6c2935b31f91b4b9c63e2affb4c4b1ee77a26f0",
      "block-number": 664,
      "epoch": 17,
      "shard-id": 0,
      "view-id": 664
    },
    "shard-chain-header": {
      "block-header-hash": "0x70411758f778ac4f00bdd277a6c2935b31f91b4b9c63e2affb4c4b1ee77a26f0",
      "block-number": 664,
      "epoch": 17,
      "shard-id": 0,
      "view-id": 664
    }
  }
}

to see how well blockchain is syncing on your node

Next level

You can also play around in the running container,

Follow this shell history as an example:

> docker container ls
CONTAINER ID        IMAGE               COMMAND                  CREATED             STATUS              PORTS                    NAMES
c6fa7c201f53        algebr/ostn-node    "/bin/sh -c './node.…"   3 minutes ago       Up 3 minutes        0.0.0.0:9500->9500/tcp   confident_mclean
(Mon Apr-4 9:05:18pm)-(CPU 38.3%:1:Net 72)-(edgar:~/Repos/running-hmy-node)-(62M:25)
> docker container exec -it c6fa7c201f53 /bin/bash 
go version go1.13.6 linux/amd64
root@c6fa7c201f53:~# ./hmy blockchain latest-headers 
{
  "id": "1",
  "jsonrpc": "2.0",
  "result": {
    "beacon-chain-header": {
      "block-header-hash": "0x135919a76583f085a1144eec4a54b5a847d7e96c5b1bcc8a37b4cfc6442e6382",
      "block-number": 1400,
      "epoch": 36,
      "shard-id": 0,
      "view-id": 1400
    },
    "shard-chain-header": {
      "block-header-hash": "0x135919a76583f085a1144eec4a54b5a847d7e96c5b1bcc8a37b4cfc6442e6382",
      "block-number": 1400,
      "epoch": 36,
      "shard-id": 0,
      "view-id": 1400
    }
  }
}

In this example shard-chain-header is same as beacon-chain-header but that would be different if this BLS key was on a shard other than shard 0.

MultiBLS

To do multibls things, you'll have to use the previous example going into the node and doing these steps https://docs.harmony.one/home/validators/first-time-setup/running-a-node#multiple-bls-keys-optional

Stopping the container

You find your running container in

...here's an example

> docker container ls
CONTAINER ID        IMAGE               COMMAND                  CREATED              STATUS              PORTS                    NAMES
732e076ce7a4        algebr/ostn-node    "/bin/sh -c './node.…"   About a minute ago   Up About a minute   0.0.0.0:9500->9500/tcp   ecstatic_bhabha
(Mon Apr-4 8:52:17pm)-(CPU 38.4%:1:Net 71)-(edgar:~/Repos/running-hmy-node)-(62M:25)
> docker container stop 732e076ce7a4
@lijiang2087
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment