A Discord bot for dispensing testnet tokens.
- Responds to requests for tokens on multiple testnets
- Response includes a link to the transaction detail in the appropriate block explorer
- Limits the tokens a user can get within a time period for a given testnet
- Limits the tokens an address can get within a time period for a given testnet
- Daily cap for each testnet token
- Requests are saved in local csv file: date, cosmos address, amount, and testnet
- Errors are logged to systemd journal
- python 3.8.12+
- dymension v
- Initialized dymension instance
- Faucet keys in dymension keyring
- Python dependencies:
cosmos-discord-faucet$ python -m venv .env
cosmos-discord-faucet$ source .env/bin/activate
cosmos-discord-faucet$ pip install -r requirements.txt
- Create a Discord token
- Set the bot token as a
DISCORD_TOKEN
environment variable. - Modify the nodes, faucet addresses, amount to send, etc. in
config.toml
This bot can be run stand-alone (mostly for testing), or as a service.
python cosmos_discord_faucet.py
- This can be run inside a
tmux
session.
- Modify the
cosmos-discord-faucet.service
file as appropriate. - Make a copy of
cosmos-discord-faucet.service
or create a link to it in/etc/systemd/system/
. - Enable and start the service:
systemctl daemon-reload
systemctl enable cosmos-discord-faucet.service
systemctl start cosmos-discord-faucet.service
systemctl status cosmos-discord-faucet.service
-
Request tokens through the faucet:
$request [dymension address] theta|devnet
- The response will include a ✅ and the transaction hash if it was successful.
-
Request the faucet and node status:
$faucet_status theta|devnet
-
Request the faucet address:
$faucet_address theta|devnet
-
Request information for a specific transaction:
$tx_info [transaction hash ID] theta|devnet
-
Request the address balance:
$balance [dymension address] theta|devnet
The transactions.csv
file can be parsed using cosmos_faucet_analytics.py
to output faucet usage analytics to a Node Exporter-compatible file.
The analytics script can be run stand-alone (mostly for testing), or as a service.
- Modify the log paths and logging period in
config_analytics.toml
as required.
python cosmos_faucet_analytics.py
- This can be run inside a
tmux
session.
- Modify the
cosmos-faucet-analytics.service
file as appropriate. - Make a copy of
cosmos-faucet-analytics.service
or create a link to it in/etc/systemd/system/
. - Enable and start the service:
systemctl daemon-reload
systemctl enable cosmos-faucet-analytics.service
systemctl start cosmos-faucet-analytics.service
systemctl status cosmos-faucet-analytics.service
This repo is based on cosmos-discord-faucet:
- The cosmospy library calls have been replaced by calls to
dymd
to avoid deprecated endpoints and messages. - The address prefix has been switched to
cosmos
.