A powerful, multi-user crypto wallet built with Python, designed to operate seamlessly within Telegram. With initial support for the TON blockchain, TONPAY offers a convenient way for users to manage crypto assets directly from Telegram. Future updates may bring support for Ethereum (ETH) and Binance Coin (BNB).
TONPAY is a Telegram-based crypto wallet bot developed to provide users a secure, easy-to-use solution for managing their TON assets directly within Telegram. The bot leverages Python, SQLModel as its ORM, and the TON blockchain to enable transactions, storage, and management of wallets for multiple users With a focus on simplicity and accessibility.
- User-Friendly Interface - Interact with the bot within Telegram for seamless crypto management.
- Multi-User Support - Capable of handling multiple users concurrently.
- Secure Wallet Management - Each user can create and manage their own wallet.
- TON Blockchain Integration - Currently supports TON with plans to support ETH and BNB.
- Scalable ORM - Built with SQLModel to efficiently manage user data and wallet information.
- Fully Asynchronous - fully asynchronous code for almost all interactions even connecting to database.
- python-telegram-bot: Enables integration with Telegram, allowing the bot to handle user commands and actions.
- TonTools / ton: Provides essential tools and libraries for interacting with the TON blockchain.
- wolfcrypt: used for Authentication.
- asyncpg: user for connceting to postgres database asynchronously.
- psycopg2: for connceting to postgres database.(make sure binaries properly installed)
For a complete list of dependencies, see the requirements.txt file.
make sure above packages installed properly as sometimes there are problems with their installation.
To set up TONPAY on your local environment (Ubuntu 22.04 recommended):
- Clone the repository:
git clone https://github.com/hadif1999/tonpay.git
cd tonpay
- Set up a virtual environment (optional but recommended):
python3 -m venv env
source env/bin/activate # On Windows: env\Scripts\activate
- Install dependencies:
pip install -r requirements.txt
- setup config.json file for your own needs
- add Telegram bot TOKEN, Database uri and other parameters
- define your own authorization method by edditing "wallet_encryption" params.
- start a sql database server (postgres recommended)
- you can run a postgres database by running the docker-compose.yml file provided for testing
docker compose up -d
- Set up environment variables (e.g., Telegram Bot Token, database URI) in a .env file:
TELEGRAM_TOKEN=your_telegram_token
DB_URI=<DB_USER>:<DB_SECRET>@<DB_HOST>/<DB_NAME>
- Run the bot:
python3 __main__.py # or just run "python3 ."
TONPAY includes a configuration file, config.json, which allows users to customize various aspects of the wallet bot to suit their needs. In this file, users can:
- Set up blockchain parameters - Define the blockchain networks supported (currently TON, with plans for ETH and BNB).
- Adjust authentication settings - Modify the template used for the wallet authentication key (see details below).
- Define scheduler options - Customize the intervals for scheduled tasks, such as regular balance updates.
- Set logging preferences - Configure log levels, formats, and outputs for easier debugging and monitoring.
TONPAY uses a symmetric authentication mechanism to secure user wallets. Each wallet is protected by a unique key that is generated based on specific user data, the date the wallet was created, and other details. This symmetric key provides a semi-reliable method for user authentication within the bot.
Warning
this Authentication method might not be reliable enough for production, this only used for development. use with your own risk
The key generation template used in TONPAY is configurable in the config.json file. By modifying this template, users can adjust the elements used to create the authentication key, such as including additional user-specific information or modifying the date format. This customization option allows developers to enhance security or adjust the key structure to fit specific operational requirements.
Multi-blockchain Support - Adding support for Ethereum (ETH) and Binance Coin (BNB).