Self hosted Bot to easy vote in cosmos ecosystem
There is no need to vote via cli or web UI, just setup a bot with your validator or wherever you want and get notifications with vote options and vote directly in telegram!
First download the latest release:
wget https://github.com/MELLIFERA-Labs/janusbot/releases/download/0.2.0/janusbot-linux-amd64
- install bun (JavaScript runtime). Go to site and fallow instructions: https://bun.sh
- Run build commands in root of project
- Install dependencies
bun install
- Build binary
bun build ./src/cli/index.ts --compile --outfile janusbot
Now you have janusbot
binary in root of project
janusbot init
cat $HOME/.janus/config.toml
Set env variables, see .env.example
or you can specify path to .env file, e.g. dotenv = '/Home/.janus/.env'
.
Open telegram and look for @BotFather, run command /newbot
and follow instructions.
In the end you should get token for your bot: something like 9999999:ASDjaiodsjioasoidj123123
.
Set token environment variable, variable name is TELEGRAM_BOT_TOKEN
, e.g: TELEGRAM_BOT_TOKEN=9999999:ASDjaiodsjioasoidj123123
.
Now we need chat_id, so our bot knows where to send messages. It may be either group or private chat. In telegram look for @username_to_id_bot
, or any other way you prefer to get chat_id.
Add chat_id to config.toml, e.g: chat_id = 123456789
.
Update key
in config.toml, string and no spaces, e.g: key = 'telegram_cosmos_proposals'
.
Currently we support only telegram, so type = 'telegram'
.
Now let's proceed with keys setup. These keys will be used to vote for proposals. If you want to create new wallet run:
janusbot keys add WALLET_NAME
If you want to import existing one run:
janusbot keys add WALLET_NAME --recover
Follow instructions.
Currently we have initial values for cosmos network, edit those for your preferred network.
transport
is your transport key, we added before: telegram_cosmos_proposals
in our case.
Here is a complete example of config.toml you should have in the end.
Lava is a modular data network for scaling access to any blockchain. The network can flexibly support any RPC and API, and node providers compete to offer the fastest and most reliable service
If you want to use RPC with Lava network, you can add lava
section to config.toml, e.g:
[[network]]
#...
lava = { chain = 'COS5' }
It's also require LAVA_PRIV_KEY
environment variable to be set. Set it in .env or in any other way you prefer.
To get LAVA_PRIV_KEY
look at lava doc.
janusbot run start
And that's it! The bot will check for new proposals every five minutes and send you a message if there are any.
- Create service file
touch /etc/systemd/system/janusbot.service
- Fill service file:
cat <<EOF >> /etc/systemd/system/janusbot.service
[Unit]
Description=Janusbot daemon
After=network-online.target
[Service]
User=<USER>
ExecStart=/usr/bin/janusbot run start
Restart=on-failure
RestartSec=3
LimitNOFILE=4096
[Install]
WantedBy=multi-user.target
EOF
- Reload systemctl
systemctl daemon-reload
- Start service
systemctl start janusbot.service
- In order to watch the service run, you can do the following:
journalctl -u janusbot.service -f
- Cosmos Hub
- Lava Network
- Osmosis
- May work for many others cosmos SDK based networks, but not tested yet.
- COSMOS:
cosmos1qcual5kgmw3gqc9q22hlp0aluc3t7rnsprewgy
- JUNO:
juno1qcual5kgmw3gqc9q22hlp0aluc3t7rnsh3640c
- OSMOSIS:
osmo1qcual5kgmw3gqc9q22hlp0aluc3t7rnsfc277k
Also, you can just delegate in one of our nodes : ) https://mellifera.network