Inspiration

Every hackathon project starts with a grand vision and a harsh reality check. We looked at the urban spaces around us, the concrete balconies, the empty rooftops, the overgrown community plots, and saw an incredible amount of wasted potential. Urban farming has all the ingredients to succeed: people want fresh food, inflation is driving food costs through the roof, and the land is sitting right there. Yet, every local project we looked at consistently fell apart for the exact same reasons.

It turns out urban farming doesn’t have a resource problem. Rather, it has a coordination problem. Without guidance, amateur growers quit after their first crop failure. Without coordination, every single person independently decides to plant trendy heirloom tomatoes, leading to an absurd local glut of tomatoes in August and an absolute desert for everything else. No one is matching crops to the specific microclimates where they will thrive, and when growers do manage to get a surplus, it ends up rotting because there is no easy friction-free way to distribute it.

We looked to nature for the solution. In a forest, a single tree doesn't survive on its own. It is plugged into a subterranean network of fungal threads, mycelium. Mycelium coordinates the entire ecosystem. It routes nutrients from areas of abundance to areas of scarcity, maximizing the health of the whole forest. We asked ourselves: What if we could build a digital mycelium network for cities? What if we could treat scattered backyards and concrete balconies not as isolated hobbies, but as interconnected nodes of a single, highly optimized, hyper-local food engine? That spark is what drove us to build MyCelium.

What it does

MyCelium turns a chaotic web of independent urban growers into a synchronized, high-yield agricultural network. The system completely abstracts away the complexity of farming logistics, allowing the network to do the thinking while the humans do the growing.

  • The Nodal Input Layer: Every backyard, balcony, or rooftop joins the network as a distinct "node." Farmers simply input their raw plot data, square footage, daily sun exposure hours, growing medium (soil vs. hydroponic), available tools, budget, and weekly time commitments.

  • The Mathematical Optimizer: Instead of using naive matching or basic filters, MyCelium runs an advanced Integer Linear Program (ILP). It builds a massive suitability matrix, weighing every single farm against every potential crop. It factors in spatial routing (using a bipartite reachability graph to ensure nodes can actually reach physical community hubs) and enforces temporal constraints (locking farms mid-crop so no one is told to rip out half-grown plants).

  • The Instruction Bundle: The output of this complex mathematical matrix is distilled into a beautifully simple, step-by-step custom guide pushed to the grower. They are told exactly what to plant, when to water, and when to harvest, tailored perfectly to their unique comparative advantage.

  • The Closed-Loop Token Economy: To make this sustainable without relying on expensive, predatory payment rails, we built Hub Currency (HC). When a farmer delivers their verified surplus to a neighborhood hub, HC is minted directly to their wallet based on real physical delivery. Community members can then purchase this hyper-local produce using HC.

  • The B2B Hotel Layer: To inject external capital directly into the pockets of local growers, we integrated an ingenious demand engine. The platform hooks into real-time hotel accommodation data to turn local hotels into procurement and pickup partners. Hotel kitchens buy pristine, hyper-local ingredients, and tourists can purchase curated local produce baskets directly at checkout, creating an entirely new revenue stream for the network.

How we built it

We built MyCelium as a robust, fully integrated stack capable of handling heavy algorithmic optimization, real-time spatial rendering, and highly secure Web3 financial settlement.

  • The Architecture: The application logic is anchored around a Next.js framework, utilizing TypeScript across the entire repository to ensure strict type safety between our complex data models and financial payloads.

  • The Core Optimizer Engine: The core assignment logic treats agricultural allocation as a true optimization problem. The engine maps out hard gates (minimum requirements) before applying weighted scoring to generate the matrix. We built a rolling horizon scheduler to cleanly separate "locked" farms from "free" farms, running dynamic heuristic overrides for new mid-season nodes so we never have to run a full, computationally expensive re-optimization on the fly.

  • The Web3 Settlement Layer: We engineered our financial rails using Unifold deployed on the Base network using USDC. We built lib/unifold.ts to manage payment intents for user fiat-to-HC top-ups. To handle the complex multi-party splits between farmers, community hubs, and hotel partners, we wrote unifold-payouts.ts to automate programmatic, multi-wallet stablecoin distributions immediately upon physical delivery verification.

  • Data Persistence & Ledgering: MongoDB Atlas serves as the system's absolute source of truth. We built a highly defensive schema setup in lib/mongodb.ts featuring wallet_accounts, wallet_ledger, unifold_intents, and unifold_payouts. By implementing strict unique and sparse indexing, we created an ironclad, off-chain ledger that flawlessly mirrors on-chain transaction events and webhook updates.

  • Identity & Access Management: We integrated Auth0 (lib/auth0.ts) right out of the gate to secure our application state. Instead of rolling a risky custom auth system under a tight deadline, we leveraged Auth0 to manage protected routes, handle sessions, and verify emails via isEmailVerified, mapping every wallet address and hotel node directly to a cryptographically secure user identity.

  • The Visualization Artifact: To prove the math worked in real-time, we built nodalnetwork.html using raw web graphics to simulate nodes dynamically dropping onto a map, pulling assignments, and watching the optimization engine rebalance the network's load live as conditions changed.

Challenges we ran into

The human experience of a hackathon is hitting a wall at 3:00 AM when your eyes are bloodshot, your code is breaking, and your team is running purely on caffeine and willpower. We hit several massive walls.

Our first major hurdle was algorithmic thrashing. In early iterations of our Integer Linear Program, if a single farm's sun exposure data shifted slightly, or a new backyard joined the network, the math would completely re-optimize and tell a farmer who was six weeks into growing tomatoes to suddenly rip them up and plant kale. It was mathematically optimal but humanly impossible. We had to dive back into the math and introduce a strict mathematical "stability penalty" into our objective function, alongside our rolling-horizon temporal locks, to ensure the system respected real-world biological timelines.

The second, and most stressful, roadblock was our Web3 payment bridge. During local integration testing, our backend was successfully communicating with Unifold, but our in-browser checkout flow would catastrophically freeze right after creating a payment intent. We spent hours digging through README.md logs, tracking asynchronous webhook events, and auditing our MongoDB database states. We realized that our webhooks were firing so fast that they were attempting to update the ledger before the initial document write had fully propagated across Atlas. Resolving this race condition under intense time pressure forced us to completely rewrite our database transaction handling and implement a robust retry mechanism.

Accomplishments that we're proud of

We are incredibly proud of how deeply we integrated every single sponsor API—nothing here is a shallow "bolt-on" feature just to check a box.

First and foremost, we are proud of completely subverting the Stay22 API. The prompt challenged hackers not to build just another generic hotel booking carousel. We took that to heart. We imported live Toronto accommodation inventory from lib/stay22-data.ts and toronto-stay-map.tsx and used it as a live demand signal for agricultural logistics. Turning hotel stays into procurement nodes and physical pickup spots for hyper-local produce is a wild, slightly unhinged, and highly effective way to recontextualize a travel API.

We are also immensely proud of building a legitimate, non-inflationary Web3 token economy. Our Hub Currency isn't speculative magic money; it is a stablecoin-backed local token that is strictly minted through verified physical asset delivery. To see our Unifold payout architecture successfully calculate a complex multi-party split, distribute USDC on Base to separate farmer and hotel wallets, and accurately log it in our MongoDB Atlas ledger without dropping a single cent felt like a massive victory.

What we learned

This project taught us that engineering for the real world requires a profound balance between software architecture and human incentives. You can write the cleanest, most sophisticated Integer Linear Program on earth, but if the user experience is confusing or the economic incentive isn't there, no one will use it.

We learned how to design a dual-ledger system that bridges the chaotic, asynchronous world of blockchain webhooks with the deterministic needs of a traditional database application. More than anything, we learned how to look at APIs creatively. Prior to this weekend, we viewed an accommodation API as a tool for booking flights or rooms. Now, we see it as a geospatial map of high-density consumption zones that can be leveraged to empower local communities and eliminate carbon footprints.

What's next for MyCelium

While we accomplished an incredible amount during this sprint, we are just scratching the surface of what MyCelium can become.

  • Frictionless UI Polish: Our immediate next step is to completely eliminate the front-end checkout freeze we encountered during our Unifold integration, smoothing out the user journey from selecting a local produce basket to executing the wallet transaction.

  • IoT Hardware Nodes: We want to transition from manual data entry to automated edge computing. By introducing low-cost IoT soil moisture, NPK, and UV sensors to our farmer nodes, the MyCelium engine will be able to pull live environmental data to adjust suitability scores in real-time.

  • Dynamic Logistics Routing: We plan to expand our bipartite reachability graphs to include dynamic crowd-sourced delivery routing, allowing community members who are already commuting past a specific hub to act as "transporters" within the mycelial network, earning HC for moving food across the city.

  • Global Scale: We designed our data structures and optimization matrices to be entirely geography-agnostic. We want to scale MyCelium beyond Toronto, allowing any urban center globally to deploy their own local agricultural internet.

Built With

Share this project:

Updates