sudo apt-get updatesudo apt-get install clang cmake build-essential openssl pkg-config libssl-dev
cd $HOME && \ver="1.22.0" && \wget "https://golang.org/dl/go$ver.linux-amd64.tar.gz" && \sudo rm -rf /usr/local/go && \sudo tar -C /usr/local -xzf "go$ver.linux-amd64.tar.gz" && \rm "go$ver.linux-amd64.tar.gz" && \echo "export PATH=$PATH:/usr/local/go/bin:$HOME/go/bin" >> ~/.bash_profile && \source ~/.bash_profile && \go version
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh. "$HOME/.cargo/env"
cd $HOMErm -rf 0g-storage-nodegit clone https://github.com/0glabs/0g-storage-node.gitcd 0g-storage-nodegit checkout v0.8.0git submodule update --init
Build :
cargo build --release
wget -O $HOME/0g-storage-node/run/config-testnet-turbo.toml https://josephtran.co/config-testnet-turbo.toml
printf '\033[34mEnter your private key: \033[0m' && read -s PRIVATE_KEYsed -i 's|^\s*#\?\s*miner_key\s*=.*|miner_key = "'"$PRIVATE_KEY"'"|' $HOME/0g-storage-node/run/config-testnet-turbo.toml && echo -e "\033[32mPrivate key has been successfully added to the config file.\033[0m"
grep -E "^(network_dir|network_enr_address|network_enr_tcp_port|network_enr_udp_port|network_libp2p_port|network_discovery_port|rpc_listen_address|rpc_enabled|db_dir|log_config_file|log_contract_address|mine_contract_address|reward_contract_address|log_sync_start_block_number|blockchain_rpc_endpoint|auto_sync_enabled|find_peer_timeout)" $HOME/0g-storage-node/run/config-testnet-turbo.toml
sudo tee /etc/systemd/system/zgs.service > /dev/null <<EOF[Unit]Description=ZGS NodeAfter=network.target [Service]User=$USERWorkingDirectory=$HOME/0g-storage-node/runExecStart=$HOME/0g-storage-node/target/release/zgs_node --config $HOME/0g-storage-node/run/config-testnet-turbo.tomlRestart=on-failureRestartSec=10LimitNOFILE=65535 [Install]WantedBy=multi-user.targetEOF
sudo systemctl daemon-reload && \sudo systemctl enable zgs && \sudo systemctl restart zgs && \sudo systemctl status zgs
tail -f ~/0g-storage-node/run/log/zgs.log.$(TZ=UTC date +%Y-%m-%d)
sudo systemctl stop zgssudo systemctl disable zgssudo rm /etc/systemd/system/zgs.servicerm -rf $HOME/0g-storage-node