Inspiration

Over the past few years, I’ve grown increasingly interested in trading cryptocurrencies. I want to make thoughtful, informed trading decisions, but I find modern crypto research overwhelming and impractical to keep up with alongside a full-time job.

However, processing large volumes of information, reasoning across multiple inputs and summarising content are exactly the kind of things AI is good at.

That is why, during this recent AI boom, I began to wonder... what if I could let AI do the heavy lifting and only alert me when a trade is actually worth acting on...

What I Built

I built "Bitcoin Butler", an AI-powered assistant that quietly scouts out crypto trading opportunities and notifies you only when a high-confidence opportunity appears.

The core idea is simple: AI ingests the noise, evaluates opportunities in the context of your holdings, goals, and risk appetite, and only surfaces trades that are worth acting on.

The system works as follows:

  1. Users onboard by defining:
    • Any current crypto holdings
    • Maximum trade size
    • Risk appetite
    • investment goals
  2. A scheduled background job periodically uses an LLM to analyse:
    • Portfolio composition
    • Market conditions
    • Risk alignment
  3. A structured opportunity is generated only if confidence is high
  4. The user receives a push notification about that opportunity
  5. If they agree, they can execute the trade securely in one tap via Coinbase

Trade Execution via Coinbase

Users can optionally connect Coinbase by providing their Coinbase key name and private key, either during onboarding or later in the Settings screen, where they are stored securely on-device.

If valid credentials are present:

  • A Trade button becomes enabled on the opportunity details screen
  • Tapping it shows a clear confirmation dialog
  • The trade is executed via Coinbase’s Advanced Trade API using a short-lived, JWT-signed request

Credentials are never stored server-side. They are sent only at execution time to sign the request, then discarded. This keeps the user firmly in control of when (and if) trades happen.

The goal isn’t to automate trading blindly — it’s to reduce cognitive load while keeping the human in control.

How I Built It

The project is split into three main layers:

AI & Decision Engine

  • Uses an LLM to analyse portfolio context and market signals
  • Strict JSON schemas enforce structured, predictable outputs
  • Defensive parsing ensures malformed AI responses never crash the system
  • Confidence thresholds prevent spammy or low-quality recommendations

Backend (Serverpod)

Handles:

  • User data
  • Scheduled background scans
  • Opportunity persistence
  • Push notifications
  • Integration with Coinbase Advanced Trade via JWT-signed HTTPS requests

Flutter App

  • Clean, minimal UI focused on clarity
  • Secure local storage for Coinbase credentials
  • Reactive state management so features enable/disable instantly
  • Deep linking from push notifications directly into opportunities

Challenges I Faced

LLM reliability

Even when requesting JSON, models can hallucinate, truncate output, or add commentary. This forced me to treat the model as an unreliable external system rather than a trusted component. As a result, I had to implement layered validation, caps and fallbacks to make it production-safe.

Secure trading integration

Coinbase’s Advanced Trade API requires precise JWT construction with correct claims and signing. Debugging silent 401s was painful but educational.

Background execution & scheduling

Ensuring recurring scans ran reliably without duplication required careful handling of Serverpod future calls.

Push notification reliability

Token expiry, background behaviour, and platform differences meant notifications needed defensive handling and re-registration logic.

What I Learned

  • How to design AI systems that support human decision-making rather than fully automating it
  • The importance of strict schemas, validation, and defensive parsing when using LLMs
  • That fewer, higher-confidence notifications build far more trust than frequent alerts
  • How to build a backend with Serverpod, including background jobs, persistence, and push notifications
  • How to integrate with Coinbase Advanced Trade, including:
    • JWT construction and signing
    • Handling trade execution, errors, and edge cases
    • Safely executing real trades via HTTPS

Future Improvements

With more time, there are several areas where Crypto Butler could be taken further.

Smarter Agents

  • Feed the agent from multiple sources (news, on-chain data, macro signals, sentiment)
  • Learn from user behaviour (ignored vs executed opportunities)
  • Adapt confidence thresholds dynamically based on market conditions

User Control

  • Toggle to pause or disable the agent entirely
  • Configurable scan frequency (e.g. 30 minutes, 2 hours)
  • “Check for opportunities now” button for on-demand scans
  • Better visibility into last and next scheduled runs

Trading & Execution

  • Support two-leg trades (via USDC/USD) when no direct market exists
  • Add pre-trade previews using Coinbase’s preview endpoints
  • Improve execution feedback (fills, partial fills, fees)
  • Pre-check portfolio balances before submitting trades (currently delegated to Coinbase)

Security, Scale & Asset Expansion

  • Replace API key authentication with Coinbase OAuth
  • Re-evaluate encrypted server-side key storage
  • Add multi-exchange routing
  • Extend beyond crypto into stocks, ETFs and commodities

Built With

Share this project:

Updates

Submission history