// CASE STUDY

Solana Beer
Keg Tracker

A mobile blockchain application that replaces mutable database records with an immutable decentralized ledger for logistics tracking. Built with Python and Kivy for Android, deployed on the Solana blockchain with QR-code scanning and NFT-based asset management.

Role:DevOps / Mobile Developer
Context:Immutable Logistics Tracking
PythonKivySolanaAndroidRustSmart ContractsNFTsQR ScanningBuildozerWSL2

Replacing Trust with Truth

Moving from mutable database records to an immutable decentralized ledger. Where legacy systems require trust between parties, the Solana blockchain enforces trust through code.

The Problem (Legacy)

Mutable SQL Databases. Records can be altered, deleted, or disputed. Trust is required between all parties in the supply chain, creating friction and opportunities for fraud.

The Solution (Solana)

Immutable Blockchain Ledger. History is cryptographically verified. Trust is enforced by code, eliminating disputes and creating a single source of truth for the entire keg lifecycle.

// THE KEG JOURNEY

Brewery(Mint)

New keg registered as NFT on the blockchain

Transit(Transfer)

Ownership transferred during shipping

Retail(Scan)

QR code scanned to verify provenance

Return(Burn/Recycle)

Keg NFT burned upon return to brewery

Three-Pillar Architecture

A decoupled architecture separating the user interface, business logic, and data persistence into three independent layers for maximum flexibility and testability.

01

The View

(Frontend)
LanguageKV (Kivy Language)
FunctionDecoupled UI Layout
HardwareCamera / QR Scanner
02

The State

(Backend)
LanguagePython 3
FunctionCRUD Operations
LogicState Management
03

The Ledger

(Data Layer)
PrototypeJSON / SQLite
ProductionSolana Mainnet
AssetKeg NFTs

Middleware Pipeline

File: blockchain.py

Bridging Python to Solana through a four-step transaction pipeline.

1. ConnectEstablish session with Solana RPC Endpoint (Devnet)
2. ConstructTranslate keg_id into Transaction Instruction (Mint/Update)
3. SignLoad Admin Keypair. Digitally sign the packet.
4. BroadcastSend via HTTP. Await '200 OK' confirmation.

Smart Contract

File: KegNFT.sol

Logic on the ledger — code that executes on network nodes, creating an immutable record of each keg's state.

struct Keg {
uint id;
address owner;
bool is_empty;
}
registerKeg()

Mints a new NFT representing a physical keg

transferKeg()

Updates the owner address during custody transfer

updateStatus()

Toggles the is_empty boolean for keg state

War Stories

Real-world DevOps challenges encountered and resolved during the build process. Each "war story" demonstrates pragmatic problem-solving under constraint.

War Story I:The Dependency Conflict
The Error

Build Failed. Error: jnius library deprecated. Incompatible binary.

The Investigation

The build environment auto-installed Cython 3.0, which broke compatibility with existing Kivy libraries that relied on Cython 0.29.x syntax.

The Fix

Pinned dependency version in buildozer.spec to exclude version 3.0+ (cython<3)

Takeaway: Upstream updates break builds. Always pin dependency versions for reproducibility.

War Story II:Environment Drift
The Error

FAIL: Gradle requires Java 17. Linux default had OpenJDK 11 pre-installed.

The Investigation

Ubuntu 20.04 (WSL2) shipped with OpenJDK 11, but the Android Gradle plugin required Java 17 for APK compilation.

The Fix

Installed openjdk-17-jdk and executed update-alternatives to switch system default.

Takeaway: Environment assumptions are dangerous. Always validate the full toolchain before building.

War Story III:The Architecture Gap
The Error

BLOCKED: Compilation of `solders` (Rust) library unstable on ARM architecture.

The Investigation

The ideal path was to compile the Rust-based Solana SDK directly for Android ARM, but cross-compilation proved unreliable.

The Fix

Pivoted to direct RPC calls via httpx, using standard HTTP protocols to communicate with Solana nodes.

Takeaway: Pragmatism over perfection. Universal HTTP standards maintained velocity while keeping the 'Source of Truth' accessible.

Multi-Tiered Testing Strategy

Local Mocking

Window Resizing

Forced PC window to 360x640 to validate UI/UX flow rapidly without compilation time.

Emulation

Android Virtual Device (AVD)

Simulated APK installation to check x86 vs ARM architecture compatibility.

Device Debugging

ADB Logcat

Streamed real-time logs from physical hardware to catch crashes invisible to the Python console.

Project Summary

The Build

Automated Python-to-APK compilation using Buildozer and WSL2.

The Logic

Decoupled Architecture: Kivy (UI) | Python (State) | Solana (Data).

The Resilience

Overcame dependency conflicts (Cython) and architecture gaps (Rust/ARM).

The Result

A functional MVP proving immutable tracking is accessible via standard mobile hardware.