DEV Community

Uduak Gabriel Akpan
Uduak Gabriel Akpan

Posted on

Orakle: Turning Raw Blockchain Data into Intelligence with Gemma 4

Gemma 4 Challenge: Write about Gemma 4 Submission

This is a submission for the Gemma 4 Challenge: Write About Gemma 4

Table of Contents

  • The Problem: Blockchain Data Is Unreadable
  • The Solution: Orakle
  • Why Gemma 4?
  • How Gemma 4 Powers Orakle
  • Technical Architecture
  • Live Demo (Video)
  • Lessons Learned
  • Try It Yourself

The Problem: Blockchain Data Is Unreadable

Every day, millions of blockchain transactions occur. Compliance officers, security analysts, and developers face a common nightmare: raw blockchain data.

When you look at a typical transaction on Etherscan, you see:

Transaction Hash: 0x1afd338e7ce7c734895602dfd2ce1ee62225ff86594a8864153d8f7fcf467b2c
From: 0xf03976e82ab12db83c5e52b1008d439019bc5005
To: 0x8c8d7c46219d920f056f28fee5950ad564d7465
Value: 0.0731478752426811 ETH
Gas Price: 0.000000028 Gwei
Input Data: 0x
Enter fullscreen mode Exit fullscreen mode

What does this mean? Is this safe? Is it suspicious? Should I be worried?

This is the problem Orakle solves.


The Solution: Orakle

Orakle is an AI‑powered blockchain intelligence platform that transforms raw on‑chain data into human‑readable security insights. It combines deterministic risk analysis with Google Gemma 4 to deliver:

  • Wallet Intelligence – Risk scores, behavior patterns, and actionable recommendations for any Ethereum or Solana wallet.
  • Contract Audit – Detection of dangerous functions (e.g., mint, blacklist, delegatecall) with plain‑English explanations.
  • Transaction Translation – Raw transaction hashes become clear narratives (e.g., “Standard peer‑to‑peer transfer of 0.073 ETH between individual wallets”).
  • Professional PDF Reports – One‑click export of any analysis for compliance or record‑keeping.

The result? From bytes to brilliance – a 10‑minute manual decoding job becomes a 2‑second AI insight.

Why Gemma 4?

When building Orakle, I evaluated several open‑weight models. I needed:

  1. Strong instruction following
  2. The model must return structured JSON (summary, threat assessment, key findings, recommendations, confidence score) without extra markdown or commentary.
  3. Fast inference – Responses under 2 seconds to maintain a smooth user experience.
  4. Free tier availability – Hackathon budget is zero, but the model must be reliable enough for a live demo.
  5. Reasoning capability – Blockchain analysis requires logical deduction (e.g., “100 transactions but zero volume → likely contract interaction”).

Gemma 4 (specifically the instruction‑tuned gemma-4-26b-a4b-it variant) checked every box. It is:

  • Lightweight – The 26B total parameters with ~4B active parameters (MoE) make it fast enough for real‑time inference.
  • Instruction‑tuned – The -it suffix means it excels at following complex prompts, which is critical for consistent JSON output.
  • Open and free – No upfront cost, no usage quotas that kill a demo, and transparent licensing.

Compared to other models, Gemma 4 gave me the best balance of accuracy, speed, and safety – essential for a security‑focused product.

How Gemma 4 Powers Orakle

The Separation Principle

Orakle follows a strict two‑layer architecture:

  1. Deterministic Intelligence Layer – Fetches blockchain data, calculates metrics (transaction count, wallet age, risk signals), detects dangerous contract patterns. No AI here.
  2. AI Reasoning Layer – Only receives the structured deterministic output. Gemma 4 then explains the risks, generates key findings, and provides recommendations.

Why? Because AI should never calculate risk scores directly * that’s a job for deterministic code. AI is for interpretation, explanation, and recommendation.

Prompt Engineering

I crafted a system prompt that positions Gemma 4 as an elite blockchain forensic analyst. The prompt forces a strict JSON output:

{
  "summary": "Plain‑English explanation of behaviour.",
  "threat_assessment": "Low / Medium / High",
  "key_findings": ["Finding 1", "Finding 2", ...],
  "recommendations": ["Action 1", "Action 2", ...],
  "confidence_score": 0-100
}
Enter fullscreen mode Exit fullscreen mode

Example real output from a wallet with 100 transactions but zero volume:

{
  "summary": "The wallet exhibits high‑frequency, zero‑value transactions within an 18‑day lifespan, suggesting automated contract interaction rather than monetary transfers.",
  "threat_assessment": "Low",
  "key_findings": [
    "100 transactions in 18 days (approx. 5.5 tx/day).",
    "Zero ETH and USD volume recorded.",
    "Currently active – ongoing programmatic activity."
  ],
  "recommendations": [
    "Monitor for a sudden shift to high‑value transfers.",
    "Review transaction input data to distinguish between legitimate contract calls and spamming."
  ],
  "confidence_score": 95
}
Enter fullscreen mode Exit fullscreen mode

Fallback Chain for Stability

To ensure the demo never crashes, I implemented a model fallback chain:

  1. Primary: gemma-4-26b-a4b-it (Gemma 4)
  2. First fallback: gemini-1.5-flash
  3. Second fallback: gemini-1.5-pro

If Gemma 4 hits a rate limit or returns a 500 error, the system automatically switches to the next model within milliseconds – so the user always gets an AI response.

Note: The primary model is Gemma 4. The fallbacks are only for temporary stability.

Technical Architecture

Backend (Django + Supabase)

  • wallets/ – Fetches transaction history, computes risk signals.
  • contracts/ – Scans Solidity source code for dangerous patterns.
  • transactions/ – Translates raw transaction data into structured events.
  • ai/ – GemmaService handles prompt construction, API calls, and fallback logic.

Frontend (React + Tailwind)

  • Responsive dashboard with four tabs: Wallet, Contract, Transaction, Solana.
  • Real‑time loading states that say “Gemma 4 is analyzing...” (branding matters).
  • One‑click PDF generation using fpdf2.

Live Demo (Video)

Watch the full demo on YouTube:
https://youtu.be/XFJkZgRsYFo?si=AspqBMz3ElIz8eZq

The video shows:

  • Wallet Intelligence (Vitalik’s wallet → risk score 0, AI findings)
  • Contract Audit (USDC → mint/blacklist detection)
  • Transaction Translation (raw hash → human summary)
  • Solana wallet analysis

Everything works exactly as shown.

Lessons Learned

  1. Instruction tuning is everything

The -it variant of Gemma 4 made prompt engineering dramatically easier. Without it, I would have needed extensive few‑shot examples to get reliable JSON.

  1. Fallbacks are non‑negotiable for demos

Even the best APIs have hiccups. Implementing a model fallback chain saved my demo when the free tier hit rate limits.

  1. Separating deterministic logic from AI is powerful

By never letting the AI see raw blockchain data, I eliminated hallucinations about “risk scores” – the AI only explains what the deterministic engine already knows. This separation made the system more trustworthy.

  1. Mobile responsiveness matters

Judges often view submissions on phones. Adding a few media queries to stack cards and enlarge touch targets took 30 minutes but made the project look professional.

  1. Always have a backup plan for deployment

Power outages are unpredictable. Recording a thorough demo video was the best decision I made – it proves the project works regardless of deployment status.

Try It Yourself

The code is open‑source and ready to run locally:

Clone both repositories and run locally.

Backend (Django)

git clone https://github.com/uduakgabriel-netizen/Orakle-backend.git
cd Orakle-backend/backend
python -m venv venv
source venv/bin/activate  # Windows: venv\Scripts\activate
pip install -r requirements.txt
cp .env.example .env       # Add your API keys (Gemini, Etherscan, etc.)
python manage.py migrate
python manage.py runserver
Enter fullscreen mode Exit fullscreen mode

Frontend (React)

git clone https://github.com/uduakgabriel-netizen/Orakle-frontend.git
cd Orakle-frontend
npm install
echo "NEXT_PUBLIC_API_URL=http://localhost:8000/api" > .env.local
npm run dev
Enter fullscreen mode Exit fullscreen mode

Open http://localhost:3000 and test with:

· Ethereum wallet: 0xab5801a7D398351b8bE11C439e05C5B3259aeC9B
· Smart contract: 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48
· Solana wallet: 7mJziEGU3iKgdvLhNWN7E5FupJ7X6VAVXfvtqzDHtUoW

All features – wallet scan, contract audit, transaction translation – will work immediately.
Then open http://localhost:3000 (frontend) or use the Django REST API directly.

Environment variables needed:

· GEMINI_API_KEY (for Gemma 4 access)
· ETHERSCAN_API_KEY
· ETH_RPC_URL (Alchemy or other)
· DATABASE_URL (Supabase or local PostgreSQL)

See .env.example in the repo for all variables.

Test addresses from the demo:

· Ethereum wallet: 0xab5801a7D398351b8bE11C439e05C5B3259aeC9B (Vitalik Buterin)
· Smart contract: 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48 (USDC)
· Solana wallet: 7mJziEGU3iKgdvLhNWN7E5FupJ7X6VAVXfvtqzDHtUoW

Final Thoughts

Gemma 4 made it possible to build a production‑grade AI feature on a zero budget and tight timeline. Its instruction‑following ability, speed, and open‑weight license are exactly what developers need to create real‑world tools – not just toys.

Orakle is proof that deterministic analysis + Gemma 4 reasoning can turn incomprehensible blockchain data into clear, actionable intelligence.

Thank you to the Google Gemma 4 team for empowering builders.
— Happily built for the Gemma 4 Challenge, May 2026

Top comments (0)