Your bot now interacts with the Solana blockchain for all group operations. Every action creates real on-chain transactions!
/create_group <name> <max_members> <type>Example:
/create_group MyCryptoGroup 10 67What Happens:
- ✅ Creates Group PDA on Solana
- ✅ Creates your MemberProfile PDA
- ✅ You become the owner and first trader
- ✅ Stores group in database with on-chain address
- 📋 Returns: Group ID + On-chain address
Requirements:
- Must be registered (
/start) - Wallet must have SOL for transaction fees (~0.01 SOL)
/join <group_id>Example:
/join 507f1f77bcf86cd799439011What Happens:
- ✅ Creates your MemberProfile PDA
- ✅ Adds you to group's member list on-chain
- ✅ Updates database
- 📋 Returns: Confirmation + member count
Requirements:
- Group must have space available
- Must be registered
- Wallet needs SOL for fees
/propose_trade <name> <token_mint> <token_account> <amount> <buy|sell>Example - Buy SOL:
/propose_trade "Buy SOL" So11111111111111111111111111111111111111112 YourTokenAccountAddress 10 buyExample - Sell SOL:
/propose_trade "Sell SOL" EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v YourTokenAccountAddress 500 sellWhat Happens:
- ✅ Creates TradeProposal PDA on-chain
- ✅ Stores proposal details
- ✅ Notifies all group members
- 📋 Returns: Proposal PDA + Transaction signature
Requirements:
- Must be a TRADER (not just a member)
- Valid token mint and account addresses
- Positive amount
/sync_groupWhat Happens:
- ✅ Fetches latest on-chain group data
- ✅ Compares with database
- ✅ Shows comprehensive state info
- 📋 Returns: Both database and on-chain state
Shows:
- Member count (database vs on-chain)
- Trader list
- Group state (Initialized, Trading, Voting, Ended)
- Vote threshold
- Lock status
- Group Type
/fetch_proposalsWhat Happens:
- ✅ Queries all TradeProposal accounts for your group
- ✅ Shows current status of each
- 📋 Returns: List of all proposals with details
Shows Per Proposal:
- Proposer name
- Buy or Sell action
- Token amount
- Vote count
- Execution status
- Created date
- Deadline
This is done via the existing promote function but now integrates on-chain!
Function: addTraderOnChain(group_id, trader_telegram_id, admin_telegram_id)
What Happens:
- ✅ Adds trader to on-chain trader list
- ✅ Updates database
- 📋 Returns: Transaction signature
Requirements:
- Must be group owner
- User must be a member first
Function: removeTraderOnChain(group_id, trader_telegram_id, admin_telegram_id)
What Happens:
- ✅ Removes trader from on-chain list
- ✅ Updates database
- 📋 Returns: Transaction signature
Requirements:
- Must be group owner
- Cannot remove yourself
PDAs are deterministic addresses derived from seeds. They're unique and predictable!
Seeds: "GROUP_SEED" + GroupName + OwnerPublicKey
Example: GROUP_SEED + "MyCrew" + OwnerAddr...
Seeds: "MEMBER_SEED" + GroupPDA + MemberPublicKey
Example: MEMBER_SEED + GroupAddr... + MemberAddr...
Seeds: "PROPOSAL_SEED" + ProposerPDA + GroupPDA + Nonce
Example: PROPOSAL_SEED + ProposerAddr... + GroupAddr... + 12345
- Create Group: ~0.01-0.02 SOL
- Join Group: ~0.005-0.01 SOL
- Create Proposal: ~0.005-0.01 SOL
- Add/Remove Trader: ~0.005 SOL
- Fetch Data: FREE (read-only)
- Fees depend on account size
- Rent is returned when accounts close
- Batching operations saves fees
/create_group TradingMasters 20 70📤 Result: Group PDA created, Owner is first trader
# Member 1
/join <group_id>
# Member 2
/join <group_id>
# Member 3
/join <group_id>📤 Result: Each gets MemberProfile PDA
/propose_trade "Buy 100 BONK" <bonk_mint> <token_account> 100 buy📤 Result: TradeProposal PDA created
/fetch_proposals📤 Result: See all proposals and vote counts
/sync_group📤 Result: Verify on-chain state matches expectations
Problem: Wallet doesn't have enough SOL for transaction fees Solution: Send 0.1 SOL to your bot wallet address
Problem: User hasn't registered with bot
Solution: Run /start command first
Problem: User is a member but not a trader Solution: Owner must promote you first
Problem: Group was created before integration Solution: Create a new group or manually migrate
Problem: RPC endpoint is slow or overloaded Solution:
- Wait and retry
- Check RPC_URL in config
- Use a premium RPC endpoint
- ✅ Keys are encrypted in database
- ✅ Decrypted only for signing
- ✅ Never exposed to users
- ✅ Use ENCRYPTION_KEY environment variable
- Keep bot token secure
- Use dedicated bot wallets (not personal)
- Start with Devnet for testing
- Limit initial capital until tested
- Monitor transaction logs
Initialized → Trading → Voting → Ended
- Initialized: Just created, accepting members
- Trading: Active trading period
- Voting: Vote on proposals
- Ended: Group concluded, distribute profits
Created → Open → Executed/Cancelled
Use Solana Explorer:
https://explorer.solana.com/address/<PDA>?cluster=devnet
https://explorer.solana.com/tx/<signature>?cluster=devnet
solana account <PDA> --url devnetQ: Can I delete a group? A: Once on-chain, accounts can be closed but the history remains in the blockchain.
Q: How do I become a trader? A: Group owner must promote you using the addTrader function.
Q: Can proposals be cancelled? A: Yes, but the on-chain account remains (just marked as cancelled).
Q: What happens if I leave a group? A: Your MemberProfile PDA is closed and rent is returned.
Your bot is now a full-featured on-chain trading platform!
✅ Every action is recorded on Solana blockchain ✅ Transparent and verifiable ✅ Decentralized group management ✅ Real-time state synchronization
Ready to trade? Start with /create_group! 🚀
For technical details, see INTEGRATION_SUMMARY.md