A secure Telegram bot for deploying smart contracts on the Mantle Sepolia Testnet using Node.js and ethers.js.
A secure Telegram bot for deploying smart contracts on the Mantle Sepolia Testnet using Node.js and ethers.js.
Mantle Sepolia Testnet: Deploy to Mantle Sepolia Testnet with optimized configuration
Secure Private Key Handling: Session-only usage with comprehensive security warnings
Flexible Contract Input: Support for bytecode + ABI or Solidity source code
Interactive Deployment Flow: Step-by-step guided deployment process
Real-time Feedback: Transaction monitoring and confirmation updates
Block Explorer Links: Direct links to view deployed contracts
Contract Registry Integration: Optional automatic registration of deployed contracts
Session-Only Keys: Private keys are never stored or logged
Clear Warnings: Multiple security reminders throughout the process
Testnet Recommendations: Promotes safe testing practices
Input Validation: Comprehensive validation of all user inputs
Error Handling: Safe failure recovery without exposing sensitive data
Node.js (v16 or higher)
A Telegram Bot Token (from @BotFather)
Some cryptocurrency for gas fees (testnet tokens are free)
Clone or download this repository
Install dependencies:
Configure environment variables:
cp env.example .envEdit .env and add your Telegram bot token:
TELEGRAM_BOT_TOKEN=your_actual_bot_token_here
Start the bot:
npm startTELEGRAM_BOT_TOKEN: Your Telegram bot token from BotFather
You can override the default Mantle Sepolia RPC URL by setting this in your .env file:
MANTLE_RPC_URL (defaults to https://rpc.sepolia.mantle.xyz)
To enable automatic contract registration and viewing:
Deploy the ContractRegistry contract from contracts/ContractRegistry.sol to your desired network
Add the contract address and network to your .env file:
CONTRACT_REGISTRY_ADDRESS=0x1234567890123456789012345678901234567890
CONTRACT_REGISTRY_NETWORK=mantle-testnet
When configured, deployed contracts will be automatically registered with:
Contract name
Contract address
Deployment network
Transaction hash
Deployer address
Timestamp
Users can then view their deployed contracts using /mycontracts.
For testing purposes, you can configure a demo private key:
PRIVATE_KEY=0x1234567890abcdef...
⚠️ SECURITY WARNING: Only use for testing! Never use real funds with the demo key. When users choose "Use Demo Key", contracts will be deployed using this key and owned by you (the bot administrator).
Users will see two options:
Use Demo Key: Deploys with your configured demo key (you own the contract)
Enter My Own Key: Users provide their own private key (they own the contract)
Find your bot on Telegram and send /start
Use /deploy to begin the deployment process
Follow the interactive prompts to provide contract details
Use /mycontracts to view your previously deployed contracts
Contract Input: Choose between bytecode+ABI or Solidity source
Constructor Parameters: Provide parameters as JSON array
Contract Name: Assign a name for registry tracking
Private Key: Choose between demo key or enter your own
Confirmation: Review and confirm deployment
Use /mycontracts to view all contracts you've deployed through this bot:
Send /mycontracts
Provide your Ethereum address
View your complete contract history with:
Contract names and addresses
Deployment networks
Transaction hashes
Timestamps
Block explorer links
{
"bytecode": "0x608060405234801561001057600080fd5b50d3801561001d57600080fd5b50600436106100365760003560e01c80635c60da1b1461003b575b600080fd5b6100436100b5565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b73000000000000000000000000000000000000000090565b9091019056fe",
"abi": [
{
"inputs": [],
"stateMutability": "nonpayable",
"type": "constructor"
},
{
"inputs": [],
"name": "implementation",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
}
]
}pragma solidity ^0.8.0;
contract SimpleStorage {
uint256 private value;
constructor(uint256 _initialValue) {
value = _initialValue;
}
function set(uint256 _value) public {
value = _value;
}
function get() public view returns (uint256) {
return value;
}
}Network | Type | Recommended | Block Explorer |
|---|---|---|---|
Mantle Sepolia Testnet | Testnet | Yes |
NEVER share your private key with anyone!
Private keys give complete control over your funds
This bot only uses your private key for deployment during your session
Keys are never stored, logged, or transmitted anywhere
Always use testnets for development and testing
Use dedicated addresses with minimal funds for deployment
Test on Testnets First: Always deploy to testnets before mainnet
Use Dedicated Addresses: Create separate addresses for deployment
Minimal Funds: Keep only necessary funds in deployment addresses
Verify Contracts: Test your contracts thoroughly before deployment
Backup Information: Save contract addresses and transaction hashes
/start - Initialize the bot and show welcome message
/deploy - Start contract deployment process
/mycontracts - View your deployed contracts from the registry
/networks - List available networks
/help - Show help and security information



This project is open source. Please use responsibly and follow security best practices.