Giter Site home page Giter Site logo

cosmos-discord-faucet-1's Introduction

cosmos-discord-faucet

A Discord bot for dispensing testnet tokens.

Features

  • 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

Requirements

  • python 3.8.12+
  • gaia v6.0.3+
  • Initialized gaia instance
  • Faucet keys in gaia keyring

Installation

  1. Python dependencies:
cosmos-discord-faucet$ python -m venv .env
cosmos-discord-faucet$ source .env/bin/activate
cosmos-discord-faucet$ pip install -r requirements.txt
  1. Create a Discord token
  2. Add the bot token to config.toml
  3. Modify the nodes, faucet addresses, amount to send, etc. in config.toml

Usage

This bot can be run stand-alone (mostly for testing), or as a service.

Stand-alone

python cosmos_discord_faucet.py
  • This can be run inside a tmux session.

Service

  1. Modify the cosmos-discord-faucet.service file as appropriate.
  2. Make a copy of cosmos-discord-faucet.service or create a link to it in /etc/systemd/system/.
  3. 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

Discord Commands

  1. Request tokens through the faucet:
    $request [cosmos address] theta|devnet

    • The response will include a โœ… and the transaction hash if it was successful.
  2. Request the faucet and node status:
    $faucet_status theta|devnet

  3. Request the faucet address:
    $faucet_address theta|devnet

  4. Request information for a specific transaction:
    $tx_info [transaction hash ID] theta|devnet

  5. Request the address balance:
    $balance [cosmos address] theta|devnet

Analytics

The transactions.csv file can be parsed using cosmos_faucet_analytics.py to output faucet usage analytics to a Node Exporter-compatible file.

Analytics Usage

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.

Analytics Stand-alone

python cosmos_faucet_analytics.py
  • This can be run inside a tmux session.

Analytics Service

  1. Modify the cosmos-faucet-analytics.service file as appropriate.
  2. Make a copy of cosmos-faucet-analytics.service or create a link to it in /etc/systemd/system/.
  3. 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

Acknowledgements

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.

cosmos-discord-faucet-1's People

Contributors

dasanchez avatar xiti922 avatar prtk418 avatar uditvira avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.