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.11.12+
- gaia v11.0.0+
- Initialized gaia instance
- Faucet keys in gaia 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
- Add the bot token to
config.toml
- 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 [chain] [cosmos address]
- The response will include a ✅ and the transaction hash if it was successful.
-
Request the faucet and node status:
$faucet_status [chain]
-
Request the faucet address:
$faucet_address [chain]
-
Request information for a specific transaction:
$tx_info [chain] [transaction hash ID]
-
Request the address balance:
$balance [chain] [cosmos address]
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
gaiad
to avoid deprecated endpoints and messages. - The address prefix has been switched to
cosmos
.