by wiesche
This document aims to technically define the requirements for a Telegram bot that can deposit and withdraw GRIN digital cash cryptocurrency.
Such a bot could serve more than one purpose.
To popularize GRIN digital cash currency, some small amount of coins could be distributed free of charge to users who satisfy certain predefined criteria. Such as sending a message, getting a certain number of reactions, etc. In this case, the owner of the group would need to enable both deposit and withdrawal features.
If someone runs a Telegram group and would like to accept donations in GRIN. In this case, only the deposit feature would be enabled.
The bot would use the Owner API. It would load the credentials and API endpoint from a config file provided in the process launch command arguments.
- User runs
/addresscommand. - Bot replies with slatepack address.
- User runs '/donate' to get manual
- Send a Slatepack to donate GRIN
- Bot send repsonse Slatepack
- Finalize
- Bot will automatically inform the user when payment is processed by tagging the user in the group. It will also send a message to the group informing of successful donation.
- User runs '/faucet' to get manual
- Send a Slatepack to receive GRIN
- Bot send repsonse Slatepack
- Finalize
- If correct, the bot will broadcast the transaction and inform the user of it. It will also send a message to the group informing of the successful withdrawal. If not, it will inform you that the slatepack was not correct.
The bot would need to be configurable without restarting. The owner of the group should be able to:
- Enable/disable deposits
- Enable/disable withdrawals
- Update bot response messages templates
- Set the required number of responses to approve the withdrawal
- Set the profile requirements to approve the withdrawal
- Set the approved withdrawal amount
For security reasons, Owner API settings would need to be provided via a config file and not using the admin UI.
###Develop
install Qt 6.9
MSYS2 installieren
pacman -Syu # einmal komplett aktualisieren, danach Shell neu starten pacman -S --needed base-devel mingw-w64-x86_64-toolchain autoconf automake libtool pacman -S git
git clone https://github.com/bitcoin-core/secp256k1.git
cd secp236k1
make distclean # wenn du schonmal gebaut hast
./autogen.sh
./configure --enable-module-ecdh --enable-module-recovery
--enable-shared --disable-static
--host=x86_64-w64-mingw32
make -j$(nproc)
Currently the bot doesnt create a wallet. Copy the following directory structure and files into the project root:
.grin/
└── main/
├── grin-wallet.toml
├── .foreing_api_secret
├── .owner_api_secret
└── wallet_data/
.wallet/
└── password.txt
etc/
├── database/
│ └── database.db
├── messages/
│ └── start.txt
└── settings.ini
Settings.ini are not to setup
Use Qt Creator to build bot from sources
git clone https://github.com/wiesche89/grin-telegram-bot.gitCurrently the bot doesnt create a wallet. Copy the following directory structure and files into the project root:
.grin/
└── main/
├── grin-wallet.toml
├── .foreing_api_secret
├── .owner_api_secret
└── wallet_data/
.wallet/
└── password.txt
etc/
├── database/
│ └── database.db
├── messages/
│ └── start.txt
└── settings.ini
If you don't have Docker installed:
sudo snap install dockercd grin-telegram-bot/This repository contains two compose files:
docker-compose.yml→ Mainnetdocker-compose-testnet.yml→ Testnet
Note: Both compose files use the same
container_name(grin-telegram-bot-container).
Run either mainnet or testnet, not both at the same time (unless you change the container name and ports).
sudo docker compose -f docker-compose.yml up -d --buildView logs:
sudo docker logs -f grin-telegram-bot-containerStop:
sudo docker compose -f docker-compose.yml downsudo docker compose -f docker-compose-testnet.yml up -d --buildView logs:
sudo docker logs -f grin-telegram-bot-containerStop:
sudo docker compose -f docker-compose-testnet.yml downBoth compose files bind-mount the same host directory:
- Host:
~/grin-telegram-bot-data - Container:
/opt/grin-telegram-bot/data
Expected structure inside ~/grin-telegram-bot-data:
.grin/
main/ (mainnet wallet + config)
test/ (testnet wallet + config)
.wallet/
password.txt
etc/
database/database.db
messages/start.txt
messages/donate.txt
messages/faucet.txt
settings.ini
Tip: message templates can be copied from deploy/etc/messages/ into your data directory:
mkdir -p ~/grin-telegram-bot-data/etc/messages
cp -av ./deploy/etc/messages/. ~/grin-telegram-bot-data/etc/messages/