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

Change log:

Click to read

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

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

2021-05-10T17:00:00Z

  • First version.

How to install Incognito node

  1. Preparation: install curl, wget and docker if you haven’t done it yet

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

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

    or if you prefer curl:

    curl https://raw.githubusercontent.com/incognitochain/incognito-chain/production/bin/inc_node_installer.sh > 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"  
      # mandatory if you want to run a validator node, multiple validator keys must be separate by commas
    
    GETH_NAME="https://mainnet.infura.io/v3/xxxyyy"  
       # infura link (*) (follow step 3 on this thread to setup infura https://we.incognito.org/t/194)
    
    PORT_RPC="8334"  # change this if you prefer other port, 
      # the first node will use the port the next one use this port+1 and so on
    
    PORT_NODE="9433"  # change this if you prefer other port,
      # the first node will use the port the next one use this port+1 and so on
    
    CHECK_INTERVAL="3600" # 1 hour, interval to checking for new node update
    
    FULLNODE=""  # set to 1 to run as a full node, empty to run as normal node
    
    # New parameters since privacy v2
    INDEXER_ACCESS_TOKEN="edeaaff3f1774ad2888673770c6d64097e391bc362d7d6fb34982ddf0efd18cb" 
      # can be generate by running: $ echo "bla bla bla" | sha256sum
    NUM_INDEXER_WORKERS=100
    

(*) follow step 3 on this thread to setup infura.

  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 change to your node:

Just follow the exact same steps as installation

Uninstall:

Just run:

sudo ./inc_node_installer.sh uninstall

What does the inc_node_installer.sh script does?

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 block chain data
  4. Remove “incognito” user

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

Click to read

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.

14 Likes

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

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?