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

Change log:

Click to read

2022-10-04T17:00:00Z

  • Fix tag sorting, update the fix by running:
    sudo bash -c "rm -f blink.sh && curl -LO https://raw.githubusercontent.com/incognitochain/incognito-chain/production/bin/blink.sh && chmod +x blink.sh && ./blink.sh -y2"

2022-09-07T17:00:00Z

  • Bugs fix
  • Better usage for -y1 and -y2 option
  • More improvement on readability
  • NOTE: since this version, the “inc_node_latest_tag” file is no longer needed. If you want to force a re-pull, stop then remove the container “inc_mainnet_0” and then start the IncognitoUpdater service again (or execute “/home/incognito/run_node.sh” is equivalent)

2022-09-04T17:00:00Z

  • Update hub.docker APIv2 (Thanks to @fiend138 for pointing this out)
  • Add RandomizedDelaySec=1000, avoid spamming hub.docker
  • Add an option to update the IncognitoUpdater service without interrupting the node operation
  • Improve readability

2022-01-25T17:00:00Z

  • Read validator keys from files to start nodes, easier to add more nodes.
  • Moving run_node.sh to incognito folder for easier management.
  • Systemd service changes: -> avoid harmless error log in journalctl -> avoid confusion
    – “oneshot” service type instead of “simple”
    – Using timer instead of Restart = on-failure

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 -LO https://raw.githubusercontent.com/incognitochain/incognito-chain/production/bin/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/blink.sh 
    
  3. open it with your favorite text editor and change the following settings:

    # ============================= CHANGE CONFIG HERE ===========================================
declare -A CONFIGS HINTS
CONFIGS[VALIDATOR_K]="validator_key_1,validator_key_2,validator_key_3"
CONFIGS[GETH_NAME]="https://mainnet.infura.io/v3/xxxyyy"
CONFIGS[RPC_PORT]="8334"
CONFIGS[NODE_PORT]="9433"
CONFIGS[NUM_INDEXER_WORKERS]="0"
CONFIGS[INDEXER_ACCESS_TOKEN]="edeaaff3f1774ad2888673770c6d64097e391bc362d7d6fb34982ddf0efd18cb"
  1. Make it executable and run to install Incognito node:
    sudo chmod +x blink.sh
    sudo ./blink.sh -y1
    
  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 ./blink.sh -u

How to add more nodes after running the setup script already?

Click to read

NOTE: Only works for those who use the script newer than 2022-01-25T17:00:00Z

  1. Open /home/incognito/validator_keys, append more keys to it (separate by commas, no spaces)
  2. Remove all current docker containers:
    docker container rm inc_mainnet_0 inc_mainnet_1 ....
    
  3. Start IncognitoUpdater service again:
    sudo systemctl start IncognitoUpdater.service
    
    or just run the run_node.sh script:
    sudo /home/incognito/run_node.sh
    

How to update the IncognitoUpdater service if I already install an older version of it?

Click to read

There are 2 ways to do this:

  1. Just run the blink.sh script, then when asked, select option 2 to update the IncognitoUpdater service
  2. Rune the blink.sh script with [-y2] argument
sudo ./blink.sh -y2

What does the blink.sh script do?

Click to read

For installation:

  1. Create a new user name “incognito” in your system.
  2. Create a systemd “IncognitoUpdater.service” to check for new node release.
  3. Create a systemd “IncognitoUpdater.timer” to trigger the updater service hourly. You can change the schedule by changing the “OnCalendar” param of the “/etc/systemd/system/IncognitoUpdater.timer” file, more about this here
  4. Create a “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

20 Likes
Thinking about buying a node.
(Solved) Setting up new Vnode not working...
Virtual node error
Incognito chain’s code upgrade (tag: 20210906_1)
Official vNode Troubleshooting Guide
How to use the staking service to earn block rewards
Reflections on the new App
Incognito chain’s code upgrade (tag: 20220117_1)
Incognito chain’s code upgrade (tag: 20220112_1)
Incognito chain’s code upgrade (tag: 20211228_1)
Vnode not showing up in Incognito App under Power
Incognito chain’s code upgrade (tag: 20211119_1)
Hello from 2022
Incognito chain’s code upgrade (tag: 20211026_1)
Node Operator Bootstrapping Introduction & Guide :cowboy_hat_face:
Incognito chain’s code upgrade (tag: 20211005_1)
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
Adding Epic Cash
[Solved] vNode sync errors since version 20210313_3
Shard 2 Stalling at 433077 on Multiple vNodes
[Shipped] Network Monitor
Incognito chain's code upgrade (tag: 20210531_1)
[Protocol release] Incognito chain’s code upgrade (tag: 20221119_1)
[Protocol release] Incognito chain’s code upgrade (tag: 20221030_1)
Recent Node Updates (Docker Hub API v2)
Incognito chain’s code upgrade (tag: 20220921_1)
Incognito chain’s code upgrade (tag: 20220830_1)
Incognito chain’s code upgrade (tag: 20220801_1)
Incognito chain’s code upgrade (tag: 20220714_1)
[Announcement] Limited Edition pNodes
Incognito chain’s code upgrade (tag: 20220701_2)
Raspberry Pi 400 or Pi 4 Vnode Setup (for experienced linux users)
Incognito chain’s code upgrade (tag: 20220621_1)
How to host a Virtual Node
Start here 4 - The PRV Economy
Start here 1 - What is Incognito?
Current Node Operator Earnings
Incognito chain’s code upgrade (tag: 20220427_1)
Incognito chain’s code upgrade (tag: 20220408_1)
Incognito chain’s code upgrade (tag: 20220322_1)
Incognito chain’s code upgrade (tag: 20220228_1)
Incognito chain’s code upgrade (tag: 20220217_1)
Incognito chain’s code upgrade (tag: 20220214_1)
Incognito 2022: Technical Roadmap

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?