This repository contains a Telegram bot that allows users to create and manage multisignature wallets on a Polkadot parachain. The bot is built using Python and leverages the substrateinterface library to interact with the parachain.
- Python 3.12
- Telegram Bot API key
- Clone the repository:
git clone https://github.com/rohan-patra/tg-multisig
cd tg-multisig- Create a virtual environment and activate it:
python3.12 -m venv venv
source venv/bin/activate- Install the required dependencies:
pip install -r requirements.txt- Create a
.envfile in the root directory and add your Telegram Bot API key:
TELEGRAM_API_KEY=your_api_key_here
Example .env file:
TELEGRAM_API_KEY=1234567890:ABCdefGHIjklMNOpqrSTUvwxYZ
To obtain a Telegram Bot API key, follow these steps:
- Open the Telegram app and search for the "BotFather" bot.
- Start a conversation with BotFather and send the
/newbotcommand. - Follow the prompts to choose a name and username for your bot.
- BotFather will provide you with an API token. Copy this token and use it in your
.envfile.
To start the bot, run the following command:
python all.pyThe bot will now be active and ready to receive commands from users in Telegram.
/startor/hello: Displays a welcome message with a list of available commands./hi: Registers the user with the bot. All group members must register before creating transactions./create <destination> <amount>: Creates a new transaction proposal./yes: Approves a pending transaction./no: Rejects a pending transaction./balance: Checks the balance of the multisig wallet and its address./privatekey: Retrieves the user's private key (sent via direct message)./switch_chain <rpc_url> <preset>: Switches to a different parachain.
To test the bot locally, you can use the following steps:
- Create a new Telegram group and add your bot to the group.
- Start the bot by running
python all.py. - In the Telegram group, use the
/hicommand to register each group member. - Once all members are registered, you can start creating transactions using the
/createcommand. - Each member can approve or reject the transaction using the
/yesor/nocommands. - You can check the balance of the multisig wallet using the
/balancecommand.
.
├── README.md
├── all.py → the main Python script containing the Telegram bot code.
├── bot
│ └── main.py → bot-related helpers
├── requirments.txt
└── wallet → wallet-related scripts
├── main.py
└── new_wallet.py
