Restake

Grants

Give the Restake bot permission to withdraw rewards and delegate on behalf of your wallet

osmosd tx authz grant <bot-restake-address> \
  generic \
  --from <your-wallet> \
  --chain-id osmosis-1 \
  --fees 2000uosmo \
  -y
osmosd tx authz grant <bot-restake-address> \
  delegate \
  --from <your-wallet> \
  --chain-id osmosis-1 \
  --fees 2000uosmo \
  -y

Prerequisites

Install dependencies

sudo apt update
sudo apt install -y git

Install NodeJS

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash
source $HOME/.bashrc
nvm list-remote
nvm install v22

Restake Setup

Clone explorer repository from pinghub

git clone https://github.com/eco-stake/restake
cd restake

Install dependencies

npm install

Set mnemonic

echo "MNEMONIC=your mnemonic for restake bot wallet" > .env

Create custom network for restake

src/network.local.json

{
  "osmosis": {
    "prettyName": "Osmosis",
    "restUrl": [
      "https://osmosis-rest.publicnode.com"
    ],
    "gasPrice": "0.025uosmo",
    "autostake": {
      "retries": 3,
      "batchPageSize": 100,
      "batchQueries": 25,
      "batchTxs": 50,
      "delegationsTimeout": 20000,
      "queryTimeout": 5000,
      "queryThrottle": 100,
      "gasModifier": 1.3
    },
    "operator": {
      "address": "your-valoper-address",
      "minimumReward": "minimum-reward-for-restake"
    }
  },
  
  "cosmoshub": {
    "prettyName": "Cosmos",
    "restUrl": [
      "https://cosmos-rest.publicnode.com"
    ],
    "gasPrice": "0.025ucosm",
    "autostake": {
      "retries": 3,
      "batchPageSize": 100,
      "batchQueries": 25,
      "batchTxs": 50,
      "delegationsTimeout": 20000,
      "queryTimeout": 5000,
      "queryThrottle": 100,
      "gasModifier": 1.3
    },
    "operator": {
      "address": "your-valoper-address",
      "minimumReward": "minimum-reward-for-restake"
    }
  }
}

Start Restake

npm run autostake

Start Restake (SystemD)

Running restake every 1Minutes

tee /etc/systemd/system/restake-fast.service > /dev/null <<EOF
[Unit]
Description=Restake Bot Service (Fast)
After=network.target

[Service]
Type=oneshot
User=${USER}
WorkingDirectory=${HOME}/restake
EnvironmentFile=${HOME}/restake/.env
ExecStart=$(which npm) run autostake
EOF
tee /etc/systemd/system/restake-fast.timer > /dev/null <<EOF
[Unit]
Description=Run Restake bot every 1 minutes

[Timer]
OnBootSec=1min
OnUnitActiveSec=1min
Unit=restake-fast.service

[Install]
WantedBy=timers.target
EOF
sudo systemctl daemon-reload
sudo systemctl daemon-reexec
sudo systemctl enable restake-fast.timer
sudo systemctl start restake-fast.timer
sudo journalctl -u restake-fast.service -f -o cat

Last updated