Skip to content

OraiChain

Introduction

Oraichain connects AI APIs to smart contracts, enabling the development of Dapps with AI capabilities.

Recommended Hardware

4 Cores, 4GB RAM, 500GB of storage (NVME)

Services & Sync

html
https://oraichain-mainnet-rpc.eigennode.de
html
https://oraichain-mainnet-api.eigennode.de
html
https://oraichain-mainnet-grpc.eigennode.de

Snapshot

Update every 4 á 5 hours

shell
sudo systemctl stop oraid

cp $HOME/.oraid/data/priv_validator_state.json $HOME/.oraid/priv_validator_state.json.backup

rm -rf $HOME/.oraid/data $HOME/.oraid/wasmPath
curl https://files.eigennode.de/oraichain/snap_oraichain.tar.lz4 | lz4 -dc - | tar -xf - -C $HOME/.oraid

mv $HOME/.oraid/priv_validator_state.json.backup $HOME/.oraid/data/priv_validator_state.json

sudo systemctl restart oraid && sudo journalctl -u oraid -f

State Sync

shell
sudo systemctl stop oraid

cp $HOME/.oraid/data/priv_validator_state.json $HOME/.oraid/priv_validator_state.json.backup
oraid tendermint unsafe-reset-all --home $HOME/.oraid

peers=""  
SNAP_RPC="oraichain-mainnet-rpc.eigennode.de"

sed -i.bak -e "s/^persistent_peers *=.*/persistent_peers = \"$peers\"/" $HOME/.oraid/config/config.toml 

LATEST_HEIGHT=$(curl -s $SNAP_RPC/block | jq -r .result.block.header.height);
BLOCK_HEIGHT=$((LATEST_HEIGHT - 1000));
TRUST_HASH=$(curl -s "$SNAP_RPC/block?height=$BLOCK_HEIGHT" | jq -r .result.block_id.hash) 

echo $LATEST_HEIGHT $BLOCK_HEIGHT $TRUST_HASH && sleep 2

sed -i.bak -E "s|^(enable[[:space:]]+=[[:space:]]+).*$|\1true| ;
s|^(rpc_servers[[:space:]]+=[[:space:]]+).*$|\1\"$SNAP_RPC,$SNAP_RPC\"| ;
s|^(trust_height[[:space:]]+=[[:space:]]+).*$|\1$BLOCK_HEIGHT| ;
s|^(trust_hash[[:space:]]+=[[:space:]]+).*$|\1\"$TRUST_HASH\"| ;
s|^(seeds[[:space:]]+=[[:space:]]+).*$|\1\"\"|" $HOME/.oraid/config/config.toml

mv $HOME/.oraid/priv_validator_state.json.backup $HOME/.oraid/data/priv_validator_state.json

sudo systemctl restart oraid && sudo journalctl -u oraid -f

Installation

Environment variables & dependencies

shell
# set environment variables
echo "export WALLET="wallet"" >> $HOME/.bash_profile
echo "export MONIKER="moniker"" >> $HOME/.bash_profile
echo "export CHAIN_ID="Oraichain"" >> $HOME/.bash_profile
echo "export PROJECT="oraichain"" >> $HOME/.bash_profile
echo "export NETWORK="mainnet"" >> $HOME/.bash_profile
echo "export DIRECTORY="$HOME/.oraid"" >> $HOME/.bash_profile
source $HOME/.bash_profile

# install dependencies
sudo apt -q update
sudo apt -qy install curl git jq lz4 build-essential fail2ban ufw
sudo apt -qy upgrade

# install go
cd $HOME
bash <(curl -s "https://raw.githubusercontent.com/EigenNode/utils/main/go_installer.sh") -v 1.21.3
source ~/.bash_profile

Install node

shell
# download binary
cd $HOME 
rm -rf orai 
git clone https://github.com/oraichain/orai 
cd orai/orai 
git checkout v0.41.7-1s-block-time 
make install

# config and init app
oraid init $MONIKER --chain-id $CHAIN_ID --home "$HOME/.oraid"

# download genesis and addrbook
wget -O $HOME/.oraid/config/genesis.json https://files.eigennode.de/oraichain/genesis.json
wget -O $HOME/.oraid/config/addrbook.json https://files.eigennode.de/oraichain/addrbook.json

# set seeds and peers
SEEDS="[email protected]:26656,[email protected]:26656,[email protected]:26656"
PEERS=""
sed -i -e "s/^seeds *=.*/seeds = \"$SEEDS\"/; s/^persistent_peers *=.*/persistent_peers = \"$PEERS\"/" $HOME/.oraid/config/config.toml

# config pruning
sed -i -e "s/^pruning *=.*/pruning = \"custom\"/" $HOME/.oraid/config/app.toml
sed -i -e "s/^pruning-keep-recent *=.*/pruning-keep-recent = \"100\"/" $HOME/.oraid/config/app.toml
sed -i -e "s/^pruning-interval *=.*/pruning-interval = \"50\"/" $HOME/.oraid/config/app.toml

# set minimum gas price, enable prometheus and disable indexing
sed -i 's|minimum-gas-prices =.*|minimum-gas-prices = "0.025orai"|g' $HOME/.oraid/config/app.toml
sed -i -e "s/prometheus = false/prometheus = true/" $HOME/.oraid/config/config.toml
sed -i -e "s/^indexer *=.*/indexer = \"null\"/" $HOME/.oraid/config/config.toml

# create and enable service file
sudo tee /etc/systemd/system/oraid.service > /dev/null <<EOF
[Unit]
Description=Oraichain node
After=network-online.target
[Service]
User=$USER
WorkingDirectory=$HOME/.oraid
ExecStart=$(which oraid) start --home $HOME/.oraid
Restart=on-failure
RestartSec=5
LimitNOFILE=65535
[Install]
WantedBy=multi-user.target
EOF
sudo systemctl daemon-reload
sudo systemctl enable oraid

# download latest chain data snapshot
if curl -s --head https://files.eigennode.de/oraichain/snap_oraichain.tar.lz4 | head -n 1 | grep "200" > /dev/null; then
    curl https://files.eigennode.de/oraichain/snap_oraichain.tar.lz4 | lz4 -dc - | tar -xf - -C $HOME/.oraid
else
    bash <(curl -s https://raw.githubusercontent.com/EigenNode/utils/main/find_snap.sh)
fi

# start service
sudo systemctl restart oraid && sudo journalctl -u oraid -f --no-hostname -o cat

Create wallet

Check Sync status, once your node is fully synced, the output will say False

shell
oraid status 2>&1 | jq .SyncInfo

Create wallet

shell
oraid keys add $WALLET

Restore existing wallet

shell
oraid keys add $WALLET --recover

Check balance

shell
oraid q bank balances $(oraid keys show $WALLET -a)

Create validator

shell
oraid tx staking create-validator \
--amount 1000000orai \
--pubkey $(oraid tendermint show-validator) \
--chain-id Oraichain \
--moniker "$MONIKER" \
--identity "" \
--details "❤️ Thank you, EigenNode" \
--website "https://eigennode.de/" \
--from $WALLET \
--commission-rate 0.1 \
--commission-max-rate 0.2 \
--commission-max-change-rate 0.01 \
--min-self-delegation 1 \
--gas auto --fees 0.025orai \
-y

Security

Firewall security Set the default to allow outgoing connections, deny all incoming, allow ssh and node p2p port

shell
sudo apt install -y ufw
sudo ufw default allow outgoing 
sudo ufw default deny incoming 
sudo ufw allow ssh/tcp 
sudo ufw allow 26656/tcp
sudo ufw enable

Delete node

DANGER

Please, note before proceeding with the next step! All data will be lost! Make sure you have backed up your keys!

shell
cd $HOME
sudo systemctl stop oraid 
sudo systemctl disable oraid 
sudo rm /etc/systemd/system/oraid.service 
sudo systemctl daemon-reload 
sudo rm -rf $HOME/.oraid
sudo rm -rf $(which oraid)

Cheat Sheet

Service operations

Check logs

shell
sudo journalctl -u oraid -f

Start service

shell
sudo systemctl start oraid

Stop service

shell
sudo systemctl stop oraid

Restart service

shell
sudo systemctl restart oraid

Sync info

shell
oraid status 2>&1 | jq .SyncInfo

Check service status

shell
sudo systemctl status oraid

Reload services

shell
sudo systemctl daemon-reload

Enable Service

shell
sudo systemctl enable oraid

Disable Service

shell
sudo systemctl disable oraid

Node info

shell
oraid status 2>&1 | jq .NodeInfo

Your node peer

shell
echo $(oraid tendermint show-node-id)'@'$(wget -qO- eth0.me)':'$(cat $HOME/.oraid/config/config.toml | sed -n '/Address to listen for incoming connection/{n;p;}' | sed 's/.*://; s/".*//')

Key management

Add New Wallet

shell
oraid keys add $WALLET

Restore executing wallet

shell
oraid keys add $WALLET --recover

List All Wallets

shell
oraid keys list

Delete wallet

shell
oraid keys delete $WALLET

Check Balance

shell
oraid q bank balances $(oraid keys show $WALLET -a)

Export Key (save to wallet.backup)

shell
oraid keys export $WALLET

View EVM Prived Key

shell
oraid keys unsafe-export-eth-key $WALLET

Import Key (restore from wallet.backup)

shell
oraid keys import $WALLET wallet.backup

Edit existing validator

shell
oraid tx staking edit-validator \
--chain-id Oraichain \
--new-moniker "$MONIKER" \
--identity "" \
--details "❤️ Thank you, EigenNode" \
--website "https://www.eigennode.de/" \
--from $WALLET \
--commission-rate 0.1 \
--gas auto --fees 0.025orai \
-y

EigenNode