You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: README.md
+99-22
Original file line number
Diff line number
Diff line change
@@ -1,38 +1,104 @@
1
1
# janusbot
2
-
Self hosted Bot to easy vote in cosmos ecosystem
3
2
3
+
Self hosted Bot to easy vote in cosmos ecosystem
4
4
5
5
<imgsrc="janus.jpeg"width="30%">
6
6
7
-
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!***
7
+
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!_**
1. install bun (JavaScript runtime). Go to site and fallow instructions: https://bun.sh
21
+
2. Run build commands in root of project
22
+
3. Install dependencies
23
+
```bash
24
+
bun install
19
25
```
20
-
mv janusbot-linux-amd64 /usr/bin/janusbot
26
+
4. Build binary
27
+
```bash
28
+
bun build ./src/cli/index.ts --compile --outfile janusbot
21
29
```
22
-
### Setup app config
30
+
Now you have `janusbot` binary in root of project
31
+
32
+
## Initialize the bot:
23
33
```
24
34
janusbot init
25
35
```
26
-
Fill all forms step by step as in example:
36
+
## Verify that config is created
37
+
38
+
```
39
+
cat $HOME/.janus/config.toml
40
+
```
41
+
42
+
## Configure environment variables
43
+
Set env variables, see `.env.example` or you can specify path to .env file, e.g. `dotenv = '/Home/.janus/.env'`.
44
+
45
+
## Create telegram bot
46
+
Open telegram and look for @BotFather, run command `/newbot` and follow instructions.
47
+
In the end you should get token for your bot: something like `9999999:ASDjaiodsjioasoidj123123`.
48
+
Set token environment variable, variable name is `TELEGRAM_BOT_TOKEN`, e.g: `TELEGRAM_BOT_TOKEN=9999999:ASDjaiodsjioasoidj123123`.
27
49
28
-
<imgsrc="fill_init_example.png"width="90%">
50
+
## Retrieve chat_id
51
+
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.
52
+
Add chat_id to config.toml, e.g: `chat_id = 123456789`.
53
+
Update `key` in config.toml, string and no spaces, e.g: `key = 'telegram_cosmos_proposals'`.
54
+
Currently we support only telegram, so `type = 'telegram'`.
55
+
56
+
## Configure bot
57
+
### Keys management
58
+
Now let's proceed with keys setup. These keys will be used to vote for proposals.
59
+
If you want to create new wallet run:
60
+
61
+
```
62
+
janusbot keys add WALLET_NAME
63
+
```
64
+
If you want to import existing one run:
65
+
```
66
+
janusbot keys add WALLET_NAME --recover
67
+
```
68
+
Follow instructions.
69
+
70
+
### Setup network
71
+
Currently we have initial values for cosmos network, edit those for your preferred network.
72
+
`transport` is your transport key, we added before: `telegram_cosmos_proposals` in our case.
73
+
Here is a [complete example](./config.example.toml) of config.toml you should have in the end.
74
+
#### Lava integration
75
+
> [Lava](https://lavanet.xyz) 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
76
+
77
+
If you want to use RPC with Lava network, you can add `lava` section to config.toml, e.g:
78
+
```toml
79
+
[[network]]
80
+
#...
81
+
lava = { chain = 'COS5' }
82
+
```
83
+
It's also require `LAVA_PRIV_KEY` environment variable to be set. Set it in .env or in any other way you prefer.
84
+
To get `LAVA_PRIV_KEY` look at [lava doc](https://docs.lavanet.xyz/sdk-backend/#%EF%B8%8F-recommended-flow).
85
+
86
+
## Run the bot
87
+
```
88
+
janusbot run start
89
+
```
90
+
And that's it! The bot will check for new proposals every five minutes and send you a message if there are any.
91
+
92
+
## Setup service file
93
+
94
+
1. Create service file
29
95
30
-
### Setup service file
31
-
1. Create service file
32
96
```
33
97
touch /etc/systemd/system/janusbot.service
34
98
```
99
+
35
100
2. Fill service file:
101
+
36
102
```
37
103
cat <<EOF >> /etc/systemd/system/janusbot.service
38
104
[Unit]
@@ -41,7 +107,7 @@ After=network-online.target
41
107
42
108
[Service]
43
109
User=<USER>
44
-
ExecStart=/usr/bin/janusbot start
110
+
ExecStart=/usr/bin/janusbot run start
45
111
Restart=on-failure
46
112
RestartSec=3
47
113
LimitNOFILE=4096
@@ -50,22 +116,33 @@ LimitNOFILE=4096
50
116
WantedBy=multi-user.target
51
117
EOF
52
118
```
53
-
3. Reload systemctl
119
+
120
+
3. Reload systemctl
121
+
54
122
```
55
123
systemctl daemon-reload
56
124
```
125
+
57
126
4. Start service
127
+
58
128
```
59
129
systemctl start janusbot.service
60
130
```
131
+
61
132
4. In order to watch the service run, you can do the following:
62
-
```
63
-
journalctl -u janusbot.service -f
64
-
```
65
-
### VIDEO GUIDES
66
-
- EN - https://www.youtube.com/watch?v=U3DSN1M8tQM
0 commit comments