Skip to main content
Glama
Bichev
by Bichev
CIRCULAR_ECONOMY.mdโ€ข8.94 kB
# ๐Ÿบโ‚ฟ Circular Economy: USD โ†’ Crypto โ†’ Beer! ## ๐ŸŽ‰ The Complete Virtual Economy We've created a **full circular economy simulation** where you can: 1. **Buy Crypto** with USD (simulate_btc_purchase) 2. **Buy Beer** with Crypto (buy_virtual_beer) 3. **Track Everything** in your wallet and inventory! This demonstrates real-world crypto use cases in a fun, educational way! ## ๐Ÿ”„ The Flow ``` Step 1: Start with $1000 USD โ†“ Step 2: Buy Bitcoin with USD Example: Buy $5 worth of BTC Result: 0.00004531 BTC โ†“ Step 3: Buy Virtual Beer with Bitcoin! Example: Buy 1 beer with BTC Cost: 0.00004531 BTC Result: ๐Ÿบ x1 in inventory! ``` ## ๐ŸŽฏ How to Use ### Method 1: Through Chat (Natural Language) **Simple Request:** ``` You: "Buy me a beer" AI: Let me help you! First, let me check if you have Bitcoin... [Calls get_virtual_wallet] โŒ You don't have enough BTC yet! ๐Ÿ’ก Suggestion: First buy $5 worth of Bitcoin, then buy the beer! You: "OK, buy $5 of Bitcoin first" AI: [Calls simulate_btc_purchase] โœ… Purchased 0.00004531 BTC for $5.00! You: "Now buy me that beer!" AI: [Calls buy_virtual_beer] ๐Ÿบ Beer Purchase Successful! Paid: 0.00004531 BTC Received: 1 ๐Ÿบ ๐ŸŽ‰ Total beers in inventory: 1 Remaining BTC: 0.00000000 ``` **Direct Request (If You Have Crypto):** ``` You: "Buy me a beer with Bitcoin" AI: [Checks balance, then buys] ๐Ÿบ Beer Purchased Successfully! You paid 0.00004531 BTC for 1 beer Total beers: 1 ๐ŸŽ‰ Cheers! Enjoy your virtual beer! ``` ### Method 2: Through Cursor IDE (MCP Tools) Ask Cursor AI: ``` "Buy a virtual beer using my Bitcoin" "Purchase 3 beers with Ethereum" "Buy a beer, and if I don't have crypto, get some first" ``` ### Method 3: Through Wallet Page Coming soon: Buy beer button in the UI! ## ๐Ÿ› ๏ธ New MCP Tool: `buy_virtual_beer` ### Description Buy virtual beer using cryptocurrency! Creates a complete circular economy. ### Parameters - `quantity` (optional): Number of beers (default: 1) - `currency` (optional): Crypto to pay with (default: BTC) - `pricePerBeer` (optional): Price per beer in USD (default: 5) ### Returns **Success Response:** ```json { "success": true, "message": "๐Ÿบ Beer Purchase Successful!...", "transaction": { "id": "tx_...", "type": "buy", "fromCurrency": "BTC", "toCurrency": "BEER", "fromAmount": 0.00004531, "toAmount": 1, "price": 110360.01, "description": "๐Ÿบ Bought 1 virtual beer with BTC" } } ``` **Insufficient Crypto Response:** ```json { "success": false, "needsMoreCrypto": true, "suggestedAmount": 5, "message": "โŒ Insufficient BTC balance!\n\nYou need: 0.00004531 BTC\nYou have: 0.00000000 BTC\n\n๐Ÿ’ก Suggestion: First buy $5 worth of BTC" } ``` ## ๐Ÿ’ก Smart Features ### 1. **Automatic Balance Checking** The system automatically checks if you have enough crypto before purchasing. ### 2. **Helpful Suggestions** If you don't have enough, it tells you exactly how much to buy: ``` "You need 0.00004531 BTC but only have 0.00000000 BTC. ๐Ÿ’ก Suggestion: Buy $5 worth of BTC first!" ``` ### 3. **Inventory Tracking** Your wallet now shows: - ๐Ÿ’ต USD balance - ๐Ÿช™ Crypto balances - ๐Ÿบ Beer inventory (NEW!) ### 4. **Transaction History** All beer purchases are recorded with: - From: BTC amount spent - To: BEER (quantity) - Price at time of purchase - Description: "๐Ÿบ Bought 1 virtual beer with BTC" ## ๐ŸŽฎ Example Scenarios ### Scenario 1: The Happy Path ``` User: "I want to buy a beer with Bitcoin" AI: Checking your BTC balance... [Has 0.00005 BTC] Great! You have enough. Buying 1 beer... โœ… Success! Paid 0.00004531 BTC ๐Ÿบ Beers in inventory: 1 Remaining BTC: 0.00000469 ``` ### Scenario 2: Need to Buy Crypto First ``` User: "Buy me a beer" AI: Checking your crypto... [Has 0 BTC] โŒ You need 0.00004531 BTC You have: 0 BTC ๐Ÿ’ก First buy $5 worth of Bitcoin! User: "OK do it" AI: [Buys $5 of BTC] โœ… Purchased 0.00004531 BTC User: "Now buy the beer" AI: [Buys beer with BTC] ๐Ÿบ Beer purchased! You now have 1 beer! ``` ### Scenario 3: Multi-Step Purchase ``` User: "I want to throw a party. Buy me 5 beers with Bitcoin" AI: Calculating... You need 0.00022655 BTC for 5 beers You have: 0.00005 BTC ๐Ÿ’ก You need $20 more of Bitcoin User: "Buy $20 of Bitcoin then buy the 5 beers" AI: [Executes both] โœ… Step 1: Bought 0.00018131 BTC โœ… Step 2: Bought 5 beers ๐ŸŽ‰ Party time! You have 5 beers! ``` ## ๐Ÿ“Š Supported Currencies for Beer You can buy beer with: - Bitcoin (BTC) - Default - Ethereum (ETH) - Solana (SOL) - Cardano (ADA) - Polygon (MATIC) - Any supported cryptocurrency! ## ๐ŸŽจ UI Features ### In Chat - **Orange boxes** for beer calculations - **Yellow boxes** for "need more crypto" warnings - **Green boxes** for successful beer purchases - **Purple boxes** for wallet with beer inventory ### In Wallet Page - **Orange card** shows beer count in main balance area - **Transaction list** shows BTC โ†’ BEER purchases - **Statistics** track total beers purchased ## ๐Ÿ”ง Technical Implementation ### Database Structure ```typescript interface DemoWallet { balances: { USD: number; BTC: number; // ... other cryptos }; inventory: { beers: number; // Total beer count items: VirtualItem[]; // Detailed purchase history }; transactions: [...]; } ``` ### Transaction Record ```typescript { type: 'buy', fromCurrency: 'BTC', toCurrency: 'BEER', fromAmount: 0.00004531, toAmount: 1, description: '๐Ÿบ Bought 1 virtual beer with BTC' } ``` ## ๐Ÿš€ Advanced Use Cases ### 1. **Price Comparison** ``` "How many beers can I buy with 0.0001 BTC vs 0.01 ETH?" ``` ### 2. **Batch Purchases** ``` "Buy 10 beers with Ethereum" "Stock up on 20 beers using my Solana" ``` ### 3. **Strategic Planning** ``` "If Bitcoin goes up 10%, how many more beers can I afford?" "Calculate beer purchasing power of my portfolio" ``` ### 4. **Full Cycle** ``` "Buy $50 of BTC, then use it all to buy beers, show me how many I get" ``` ## ๐Ÿ“ˆ Educational Value This demonstrates: - **Real crypto utility** - Spending crypto like cash - **Price volatility impact** - Beer costs different BTC amounts as price changes - **Transaction flow** - Understanding crypto payments - **Balance management** - Tracking spending - **Multi-step operations** - Complex workflows ## ๐ŸŽฏ Real-World Analogies This simulates: - **Coffee shops accepting Bitcoin** - **Bars taking crypto payments** - **Merchants using crypto** - **Lightning Network** micro-transactions Just like real crypto adoption! ๐ŸŒ ## ๐Ÿ”ฎ Future Enhancements Potential additions: - [ ] Buy other virtual items (coffee, pizza, etc.) - [ ] Sell items back for crypto - [ ] Trading between users - [ ] Price fluctuation bonuses - [ ] Loyalty rewards in crypto - [ ] NFT receipts for purchases - [ ] Expiring beers (use within time limit) - [ ] Beer quality tiers (premium costs more BTC) ## ๐ŸŽฎ Fun Challenges to Try ### Challenge 1: The Beer Collector ``` Goal: Collect 10 beers in your inventory Strategy: Buy crypto smartly and purchase beers ``` ### Challenge 2: The Efficient Trader ``` Goal: Buy maximum beers with minimum USD spent Strategy: Time your BTC purchases when prices dip ``` ### Challenge 3: The Diversifier ``` Goal: Buy beers using 3 different cryptocurrencies Completion: Have BTCโ†’BEER, ETHโ†’BEER, SOLโ†’BEER transactions ``` ## ๐Ÿ“š API Reference ### Endpoint ``` POST /api/v1/wallet/buy-beer ``` ### Request Body ```json { "quantity": 1, "currency": "BTC", "pricePerBeer": 5 } ``` ### Success Response ```json { "success": true, "data": { /* transaction */ }, "message": "๐Ÿบ Beer Purchase Successful!..." } ``` ### Insufficient Crypto Response ```json { "success": false, "needsMoreCrypto": true, "suggestedAmount": 5, "message": "โŒ Insufficient BTC..." } ``` ## ๐ŸŽ‰ Try It Now! ### In Chat: 1. **Say**: "Buy me a beer" 2. **If needed**: Follow AI's suggestion to buy crypto first 3. **Success**: See your beer in inventory! ### Check Results: - **Chat**: See transaction in tool calls - **Wallet Page**: See beer count in balance cards - **History**: See BTC โ†’ BEER transaction --- ## ๐ŸŒŸ This Is Amazing Because: โœ… **Full circular economy** - USD โ†’ Crypto โ†’ Goods โœ… **Smart error handling** - Suggests buying crypto if needed โœ… **Real-world simulation** - Like actual crypto commerce โœ… **Educational** - Shows how crypto payments work โœ… **Fun & Interactive** - Gamified learning! โœ… **Beautiful UI** - Visual feedback everywhere **You've built a complete crypto commerce simulator! ๐Ÿš€๐Ÿบโ‚ฟ** --- **Go ahead and ask the chat: "Buy me a beer!" and watch the economy work!** ๐ŸŽ‰

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/Bichev/coinbase-chat-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server