The installation time depends on many factors, such as your skills, resources and characteristics of your server, the most important: disk speed, internet connection, server load CPU, RAM, so this value may differ from the one indicated by us.
With the help of a one-line script, all the necessary commands will be executed automatically, you only need to check the operation of your node at the end, for this, go directly to 📌Step 3: Node Health Check
📝 Manual installation
📌Step 1: Installation packeges and dependencies
# Install dependencies for building from sourcesudoaptupdatesudoaptinstall-ylz4jqmakegitgccbuild-essentialcurlchronyunzipgzipsnapdtmuxbc# Install Go if you needsudorm-rf/usr/local/gocurl-Lhttps://go.dev/dl/go1.21.6.linux-amd64.tar.gz|sudotar-xzf--C/usr/localecho'export PATH=$PATH:/usr/local/go/bin:$HOME/go/bin'>> $HOME/.bash_profilesource.bash_profile
📌Step 2: Set moniker and install node
Give your validator a name by which you can find yourself in explorer, put it in ""
MONIKER=""
After that, insert the following node installation command
# Clone project repositorycd $HOMErm-rf0g-chaingitclonehttps://github.com/0glabs/0g-chain.gitcd0g-chaingitcheckoutv0.3.1gitsubmoduleupdate--initmakeinstall# Set node CLI configuration0gchaindconfigchain-idzgtendermint_16600-20gchaindconfigkeyring-backendtest0gchaindconfignodetcp://localhost:26657# Initialize the node0gchaindinit"$MONIKER"--chain-idzgtendermint_16600-2# Download genesis and addrbook fileswgethttps://snapshots-testnet.unitynodes.com/0gchain-testnet/addrbook.json-O $HOME/.0gchain/config/addrbook.jsonwgethttps://snapshots-testnet.unitynodes.com/0gchain-testnet/genesis.json-O $HOME/.0gchain/config/genesis.json# Set seeds, peersSEEDS="81987895a11f6689ada254c6b57932ab7ed909b6@54.241.167.190:26656,010fb4de28667725a4fef26cdc7f9452cc34b16d@54.176.175.48:26656,e9b4bc203197b62cc7e6a80a64742e752f4210d5@54.193.250.204:26656,68b9145889e7576b652ca68d985826abd46ad660@18.166.164.232:26656"
sed -i 's|^seeds *=.*|seeds = "'$SEEDS'"|; s|^persistent_peers *=.*|persistent_peers = "'$PEERS'"|' $HOME/.0gchain/config/config.toml
# Set minimum gas pricesed-i"s/^minimum-gas-prices *=.*/minimum-gas-prices = \"0ua0gi\"/" $HOME/.0gchain/config/app.toml# Set pruningpruning="custom"pruning_keep_recent="100"pruning_keep_every="0"pruning_interval="50"sed-i-e"s/^pruning *=.*/pruning = \"$pruning\"/" $HOME/.0gchain/config/app.tomlsed-i-e"s/^pruning-keep-recent *=.*/pruning-keep-recent = \"$pruning_keep_recent\"/" $HOME/.0gchain/config/app.tomlsed-i-e"s/^pruning-keep-every *=.*/pruning-keep-every = \"$pruning_keep_every\"/" $HOME/.0gchain/config/app.tomlsed-i-e"s/^pruning-interval *=.*/pruning-interval = \"$pruning_interval\"/" $HOME/.0gchain/config/app.toml# Download latest chain data snapshotcurl https://snapshots-testnet.unitynodes.com/0gchain-testnet/0gchain-testnet-latest.tar.lz4 | lz4 -dc - | tar -xf - -C $HOME/.0gchain
# Create servicesudotee/etc/systemd/system/0gchaind.service>/dev/null<<EOF[Unit]Description=0G node serviceAfter=network-online.target[Service]User=$USERExecStart=$(which 0gchaind) startRestart=on-failureRestartSec=10LimitNOFILE=65535[Install]WantedBy=multi-user.targetEOF### Start service and run nodeecho""printColorblue"[6/6] Start service and run node"sudosystemctldaemon-reloadsudosystemctlenable0gchaind.servicesudosystemctlstart0gchaind.service
📌Step 3: Node Health Check
Follow the commands to check if your node is working properly
After entering the command, you will receive hash transactions, check the status in the explorer if the status is successful - you have created a validator.
You can find your validator here: explorerIn the Active / Inactive lists.
📌Step 5: Backup.
If you have successfully created a validator, be sure to save your validator.
Show priv_validator_key.json
cat $HOME/.0gchain/config/priv_validator_key.json
SAVE YOUR PRIVATE KEY AFTER ENTERING THE COMMAND
The priv_validator_key.json is the key with which you can always restore the operation of your validator, so keep it and in case of reinstallation/transfer of the validator to another server - transfer it too.
Also remember, if you are a validator with a sufficient number of delegated tokens and you are in an active set, signing blocks, always save priv_validator_state.json - this file contains information about the signed blocks of your validators, and in case of restoring the validator after reinstallation or on another server , this file won't give you the old blocks again, otherwise you'll end up in jail with no way out
💡 Hint: