A Discord bot that enables users to tip each other using Stellar (XLM) cryptocurrency, powered by a Soroban smart contract.
See it in action immediately:
./run-demo.shOr manually:
cd cli
cargo run --releaseThe CLI demo features:
- Beautiful ASCII art interface
- Interactive walkthrough tutorial
- Full tipping simulation
- Statistics and transaction history
- No setup required - runs instantly!
Perfect for presentations, testing, and learning how the system works!
- Seamless Tipping: Tip other Discord users with XLM instantly
- Smart Contract: Secure on-chain tipping via Soroban smart contract
- Wallet Management: Generate or import Stellar wallets
- Balance Tracking: Check your balance and transaction history
- Deposit/Withdraw: Easily move funds in and out
- Statistics: View your tipping stats
.
├── contracts/
│ ├── tipping/ # Soroban smart contract for tips
│ │ ├── src/
│ │ │ ├── lib.rs # Contract logic
│ │ │ └── test.rs # Contract tests
│ │ └── Cargo.toml
│ └── hello-world/ # Example contract
├── cli/ # Interactive CLI demo
│ ├── src/
│ │ ├── main.rs # CLI entry point
│ │ ├── demo.rs # Demo logic
│ │ └── wallet.rs # Wallet models
│ └── Cargo.toml
├── bot/ # Discord bot application
│ ├── src/
│ │ ├── main.rs # Bot entry point
│ │ ├── commands.rs # Discord slash commands
│ │ ├── stellar.rs # Stellar integration
│ │ ├── database.rs # User data management
│ │ ├── config.rs # Configuration
│ │ └── error.rs # Error handling
│ └── Cargo.toml
├── Cargo.toml # Workspace configuration
├── run-demo.sh # Quick demo launcher
└── README.md
- Rust (1.70+)
- Stellar CLI
- Discord Bot Token (Create one here)
- SQLite
-
Clone the repository
git clone <your-repo-url> cd discord-tip-bot
-
Build the smart contract
cd contracts/tipping stellar contract build -
Deploy the contract to testnet
stellar contract deploy \ --wasm target/wasm32-unknown-unknown/release/tipping.wasm \ --network testnet
Save the contract ID that's returned!
-
Initialize the contract
stellar contract invoke \ --id <CONTRACT_ID> \ --network testnet \ -- initialize \ --admin <YOUR_STELLAR_ADDRESS> \ --token <NATIVE_TOKEN_ID>
-
Configure the bot
cd ../../bot cp ../.env.example .env # Edit .env with your configuration
-
Build and run the bot
cargo build --release cargo run --release
Create a .env file in the root directory:
DISCORD_TOKEN=your_discord_bot_token
DATABASE_URL=sqlite:bot.db
STELLAR_NETWORK=testnet
STELLAR_CONTRACT_ID=your_deployed_contract_id
STELLAR_ADMIN_SECRET=your_stellar_secret_key
MIN_TIP_AMOUNT=1000000
MAX_TIP_AMOUNT=10000000000| Command | Description |
|---|---|
/register [address] |
Register your Stellar wallet (generates new if no address provided) |
/balance |
Check your current tip balance |
/tip @user <amount> [message] |
Send a tip to another user |
/deposit |
Get instructions to deposit XLM |
/withdraw <amount> |
Withdraw XLM to your Stellar wallet |
/stats |
View your tipping statistics |
/help |
Show help information |
-
Register with the bot
/registerThe bot will generate a new Stellar wallet and DM you the keys.
-
Deposit XLM
/depositFollow the instructions to fund your account.
-
Tip someone
/tip @friend 5 Thanks for the help!This sends 5 XLM to @friend with a message.
-
Check your balance
/balance -
View statistics
/stats
cd contracts/tipping
cargo test# Terminal 1: Watch and rebuild the bot
cd bot
cargo watch -x run
# Terminal 2: Watch and test the contract
cd contracts/tipping
cargo watch -x test# Build optimized contract
cd contracts/tipping
stellar contract optimize --wasm target/wasm32-unknown-unknown/release/tipping.wasm
# Build optimized bot
cd ../../bot
cargo build --release- Never commit your
.envfile - it contains sensitive keys - Secure storage: In production, use a proper key management solution
- Rate limiting: Consider adding rate limits for tipping
- Audit: Have the smart contract audited before mainnet deployment
- User keys: Implement secure key storage for user wallets
- Testnet: For development and testing (default)
- Mainnet: For production use (set
STELLAR_NETWORK=mainnet)

