How to setup your own node in a blink of an eye (Now support multi-nodes per host)

Change log:

Click to read

2021-12-19T17:00:00Z

  • Include:
    – Hardware recommendation.
    – Cloud setup.
    – How to add my vnode to Incognito app.

2021-12-07T17:00:00Z

  • Add interactive mode
  • One-line setup command

2021-08-30T17:00:00Z:

  • Support multiple node per host (check the guide below for details)

2021-05-10T17:00:00Z

  • First version.

How much power does a node need?

Click to read

For single validator per host, the recommended configuration is:

  • 4GB RAM
  • 4 CPUs
  • 250GB SSD

Preparation

Hardware preparation

There are 2 choices:

  1. Build your own hardware with your favorite brand and configuration of CPU, memory, SSD
  2. To the could:

You can run Incognito on a low-cost server. If you don’t have a server yet, it’s really simple and takes just a couple of minutes. You can set up an account with a VPS provider or a cloud service provider like DigitalOcean, AWS, Vultr, Heroku, Microsoft Azure, or Linode.

Always check the TOS of the host for rules on “mining” cryptocurrency using their servers before you signup for one of their plans. Not every host allows you to run mining scripts.

Useful instructions:

Setup your Infura
  • Go to infura.io
  • Register a free infura account
  • Create new project and name it
    image
  • On Setting tab of project, copy the mainnet endpoint api url to use for the installation
    image

How to set up Incognito node properly?

Method 1: One-line command, interactive setup (recommended)

Just run the following command on your favorite terminal and follow its steps:

sudo bash -c "apt install curl -y && curl -L https://raw.githubusercontent.com/incognitochain/incognito-chain/production/bin/inc_node_installer.sh -o blink.sh && chmod +x blink.sh && ./blink.sh"
Method 2: Non-interactive setup
  1. Preparation: install curl and docker if you haven’t done them yet

    sudo apt install curl docker.io
    
  2. Download node setup shell script here

    curl -O https://raw.githubusercontent.com/incognitochain/incognito-chain/production/bin/inc_node_installer.sh 
    
  3. open it with your favorite text editor and change the following settings:

    # change config here:
    BOOTNODE="mainnet-bootnode.incognito.org:9330"  # this should be left as default
    VALIDATOR_K=("validator_key_1,
                 validator_key_2,
                 validator_key_3"
      "! Input validator keys here, multiple validator keys must be separated by commas (no spaces):\n\t> ")
    GETH_NAME=("https://mainnet.infura.io/v3/xxxyyy"
      "! Infura link. Example: 'https://mainnet.infura.io/v3/xxxyyy' ")
    PORT_RPC=("8334"
      "! RPC port, should be left as default (8334),
       The first node uses this port, the next one uses port+1, and so on: ")
    PORT_NODE=("9433"
      "! Node port, should be left as default (9334),
       The first node uses this port, the next one uses port+1, and so on: ")
    CHECK_INTERVAL=("3600"
      "! Interval (second) to check for new release, default=3600s (1 hour): ")
    FULLNODE=""  # set to 1 to run as a full node, empty to run as normal node

    # New parameters since privacy v2
    NUM_INDEXER_WORKERS=(100
      "! Number of coin indexer workers, default = 100. To disable this, set it to 0: ")
    INDEXER_ACCESS_TOKEN=("edeaaff3f1774ad2888673770c6d64097e391bc362d7d6fb34982ddf0efd18cb" 
      "! Indexer access token, can be generated by running: $ echo 'bla bla bla' | sha256sum
        (default: edeaaff3f1774ad2888673770c6d64097e391bc362d7d6fb34982ddf0efd18cb):\n\t> ")
  1. Make it executable and run to install Incognito node:
    sudo chmod +x inc_node_installer.sh
    sudo ./inc_node_installer.sh
    
  2. Blink your eye (yes! one eye is enough) and it’s done. If it’s not, just blink a few more times faster :rofl:

To make some changes to your node:

Just follow the exact same steps as the installation

Uninstall:

Just run:

sudo ./inc_node_installer.sh uninstall

What does the inc_node_installer.sh script do?

Click to read

For installation:

  1. Create a new user name “incognito” in your system.
  2. Create a systemd service “IncognitoUpdater” to check for new node release every hour. You can change the interval as your wish by changing the “CHECK_INTERVAL” setting in the script
  3. Create a “/bin/run_node.sh” script, which will be invoked by systemd service when a new tag is found, to download and run the latest docker image.

For uninstalling:

  1. Stop then remove the systemd “IncognitoUpdater” service.
  2. Stop and remove docker container “inc_mainnet
  3. Delete all Incognito blockchain data
  4. Remove “incognito” user

What is the difference using the previous method compared to this?

Click to read

The previous method uses only a while loop in a shell script to check for a new release. For some reason, if that update-checking script gets killed then your node will never get updated automatically again unless starting that script again manually.

This method uses systemd service to check for updates and to install the updates. Even when the update-checking script gets killed or your node gets rebooted, systemd will start it again. In short, you just have to set up your node with this method for once and leave it there, the node will always be up to date, you don’t have to worry about your node getting in trouble because it cannot update itself for different reasons.

How to add my vnode to the Incognito app?

Click to read

to be added later…

Is there any other way to monitor my node?

Luckily, YES. And here it is: How to use the Node monitor

17 Likes
Thinking about buying a node.
(Solved) Setting up new Vnode not working...
Virtual node error
Official vNode Troubleshooting Guide
Incognito chain’s code upgrade (tag: 20210906_1)
How to host a Virtual Node
getbalancebyprivatekey RPC, OTA Key submission returns Error
getbalancebyprivatekey RPC, OTA Key submission returns Error
getbalancebyprivatekey RPC, OTA Key submission returns Error
Incognito chain’s code upgrade (tag: 20210929_4)
Official vNode Troubleshooting Guide
Incognito chain’s code upgrade (tag: 20210908_1)
Introducing Slashing V2
Incognito chain’s code upgrade (tag: 20210824_1)
Incognito chain’s code upgrade (tag: 20210824_1)
Incognito chain’s code upgrade (tag: 20210820_1)
Incognito chain’s code upgrade (tag: 20210815_2)
Common fixes for stalled, non voting and offline nodes.
Incognito chain’s code upgrade (tag: 20210810_1)
How to use the Node monitor
[Solved] vNode sync errors since version 20210313_3
Incognito chain's code upgrade (tag: 20210531_1)
[Solved] vNode sync errors since version 20210313_3
Shard 2 Stalling at 433077 on Multiple vNodes
Incognito chain’s code upgrade (tag: 20220117_1)
[Shipped] Network Monitor
Incognito chain’s code upgrade (tag: 20211228_1)
Incognito chain’s code upgrade (tag: 20220112_1)
Reflections on the new App
Incognito chain’s code upgrade (tag: 20211119_1)
Vnode not showing up in Incognito App under Power
Hello from 2022
Incognito chain’s code upgrade (tag: 20211026_1)
Node Operator Bootstrapping Introduction & Guide :cowboy_hat_face:
How to use the staking service to earn block rewards
Incognito chain’s code upgrade (tag: 20211005_1)

Does this solution cover multi-nodes case (for both one-by-one installation and one-by-one uninstallation) in one machine?

2 Likes

nope, this is only for one node per host

Has been updated to work for both single and multiple nodes from the same script.

2 Likes

Why this method instead of what we have been using?

The previous method uses only a while loop in a shell script to check for new release. For some reason, if that update-checking script gets killed then your node will never get updated automatically again unless starting that script again manually.

This method uses systemd service to check for updates and to install the updates. Even when the update-checking script gets killed or your node gets rebooted, systemd will start it again. In short, you just have to set up your node with this method for once and leave it there, the node will always be up to date, you don’t have to worry about your node getting in trouble because it cannot update itself for different reasons.

This is a good question, I also edited the post to add the answer to your question.

6 Likes

Well, I’ve blinked my eyes a few times and I still can’t figure it out. How do I get that script onto the node to run sudo ./inc_node_installer.sh? I feel like there’s a step missing to make this easy. I’m using Contabo, so can you give me a few simple steps to get that running?

No issues the old way of running the curl command.

I am trying to start from scratch, but got the following in error.log right after docker started:

panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0xd0466b]

goroutine 1 [running]:
github.com/incognitochain/incognito-chain/instruction.(*StakeInstruction).SetRewardReceivers(0xc0000120c0, 0xc0000b7fc0, 0x1, 0x1, 0x0)
        /Users/autonomous/projects/incognito-chain/instruction/instruction_stake.go:82 +0xab
github.com/incognitochain/incognito-chain/instruction.ImportInitStakeInstructionFromString(0xc00017aa80, 0x6, 0x8, 0xc000f8e270)
        /Users/autonomous/projects/incognito-chain/instruction/instruction_stake.go:187 +0x1ce
github.com/incognitochain/incognito-chain/blockchain/committeestate.(*BeaconCommitteeEngineV1).InitCommitteeState(0xc0002a5900, 0xc0004e6420)
        /Users/autonomous/projects/incognito-chain/blockchain/committeestate/beacon_committee_state_v1.go:348 +0x584
github.com/incognitochain/incognito-chain/blockchain.(*BeaconBestState).initBeaconBestState(0xc000f02700, 0xc000f6e540, 0xc00023cdc0, 0x2050880, 0xc0002a5540, 0xc0003def70, 0xc000fa6b00)
        /Users/autonomous/projects/incognito-chain/blockchain/beaconprocess.go:624 +0x734
github.com/incognitochain/incognito-chain/blockchain.(*BlockChain).initBeaconState(0xc00023cdc0, 0xc000d60280, 0x2)
        /Users/autonomous/projects/incognito-chain/blockchain/blockchain.go:261 +0x3b9
github.com/incognitochain/incognito-chain/blockchain.(*BlockChain).InitChainState(0xc00023cdc0, 0xe, 0x0)
        /Users/autonomous/projects/incognito-chain/blockchain/blockchain.go:135 +0x202
github.com/incognitochain/incognito-chain/blockchain.(*BlockChain).Init(0xc00023cdc0, 0xc000f8f700, 0xd18c2e2800, 0xc000d60120)
        /Users/autonomous/projects/incognito-chain/blockchain/blockchain.go:113 +0x130
main.(*Server).NewServer(0xc0002f4e10, 0x7fff217d3cff, 0xc, 0xc0002a75c0, 0x2047dc0, 0xc0001000e0, 0x2ef3520, 0xc000408be0, 0xb, 0xc000579040, ...)
        /Users/autonomous/projects/incognito-chain/server.go:306 +0xfce
main.mainMaster(0x0, 0x0, 0x0)
        /Users/autonomous/projects/incognito-chain/incognito.go:177 +0xcc7
main.main()
        /Users/autonomous/projects/incognito-chain/incognito.go:248 +0x241

Then the docker container just kept restarting itself. What could be wrong here?

1 Like

Same issue. I rebuilt one vnode two days ago, used the new script with the Infura key, and sudo docker ps showed only inc_mainnet. Decided to rebuild all my vnodes on new servers and now inc_mainnet continually restarts and eth_mainnet/parity has showed back up again. I thought that wasn’t supposed to be there by adding Infura. Any help @Rocky @khanhj?

Can you use wget to download that script to your Linux host?

$ wget https://raw.githubusercontent.com/incognitochain/incognito-chain/production/bin/inc_node_installer.sh

1 Like

Can you tell me what parameters did you change in the install script?

I changed GETH_NAME, set VALIDATOR_K="", and FULLNODE=1.

@Rocky That worked but then I get this error: “sudo: unable to execute ./inc_node_installer.sh: No such file or directory” Any idea?

This is because the file is not in your current working directory. Make sure that the wget command runs successfully first so you can edit the file. Then enable the execution permission:

$ sudo chmod +x inc_node_installer.sh

After that you can run the script:

$ sudo ./inc_node_installer.sh

1 Like

We’re checking, please hang on!

Update: I successfully got off the ground at syncing from scratch by using an older version first, and then stop it and switch to the new version. Now the sync is in progress.

But please fix the reported issue that this new version cannot do a fresh sync from scratch. Or at least confirm whether it is reproducible by dev. It is very easy to reproduce from my end. Thanks!

Thank for the report. There’s a new release about 2 hours ago that fix the issue.

1 Like

Ok, got that to work. But when spinning up a vnode, do we still have to use this?

curl -LO https://node.incognito.org/run.sh && sed -i s/xxx/validator_key/ run.sh
sed -i s/YYYZZZ/infura_api_key/ run.sh
sudo bash run.sh

Otherwise, how else does docker run? Then we have to:

$ wget https://raw.githubusercontent.com/incognitochain/incognito-chain/production/bin/inc_node_installer.sh
$ sudo chmod +x inc_node_installer.sh
$ sudo ./inc_node_installer.sh

And when editing the script, we change it to this:

change config here:
BOOTNODE=“mainnet-bootnode.incognito.org:9330
PORT_RPC=“8334”
PORT_NODE=“9433”
VALIDATOR_K="[ENTER VALIDATOR KEY]"
GETH_NAME="mainnet.infura.io/v3/xxxyyy/[ENTER INFURA KEY] " #infura link
GETH_PROTOCOL=“https”
GETH_PORT=“80”
CHECK_INTERVAL=“3600” # 1 hour
FULLNODE=0 # set to 1 to run as a full node, 0 or empty to run as normal node

And then once that is all save, life should be good? Is that the right order or what should I do different? I can sudo docker stats and sudo docker ps, and it looks like everything is running, but the node monitor now says they’re all offline.

Without a linux background, starting up a vnode from the original instructions back in 2019 was easy. Going to need those complete, easy-to-follow instructions, if you want adoption from the masses.

With this method, you will only have to edit and run the inc_node_installer.sh script, it will take care of everything for you.
The instruction in this post is completed, you don’t have to do anything else. Once you do all the steps, the node should be up and running.

1 Like

YES! It makes sense now. Thanks. Next question:

In the app, I went to Power, added a vnode IP and imported the private key. However, now there is a blank node with the import button still there. If I click on the vnode, it shows the IP but nothing else. It’s like I can’t add a node now. Any ideas?