← Back to home

MergeFi

MergeFi: AI-powered "Commit-to-Earn" for GitHub. Cross-chain payouts via Avail & Blockscout.

Problem Statement

MergeFiis a decentralized incentive protocol designed to solve the critical sustainability problem in open-source software (OSS). It directly connects code contributions on platforms like GitHub to an automated, on-chain value-transfer system.By leveraging a cross-chain infrastructure powered byAvailand providing full transactional transparency viaBlockscout, MergeFi transforms open-source development from a donation-based ecosystem into a meritocratic "Commit-to-Earn" economy. It provides a simple workflow for maintainers to fund development and for contributors to be rewarded instantly and globally for their specific, high-impact work.For Contributors:A direct financial incentive to contribute high-quality code. Their work is algorithmically recognized, and they are paid instantly in a borderless digital currency, directly to their own wallet.Core Architecture & Feature BreakdownA. GitHub Integration (The "Source of Truth")Mechanism:The system uses aGitHub OAuth APIfor secure, read-only (or permissioned) access to repository data.Function:MergeFi continuously ingests repository activity, including new commits, pull requests, issue resolutions, and contributor metadata. This data feeds the AI engine and triggers the payout weight association logic.B. The AI Suggestion Engine (The "Curation Layer")Mechanism:UsesGemini APIto analyzes the data (merged commits, issues solved etc.) from the GitHub integration to assign weights or quality factor to each merged commit .Function:This engine analyzes commits forqualityandimpact. Its analysis include:Impact:Does this commit close a "critical" bug or add a "highly-requested" feature? or does this commit solve some issue listed by the maintainer. The AI references the issues and then analyzes the commits based on that.Complexity:How many lines of code were changed? What was the cyclomatic complexity?Context:Does the commit message follow best practices? Is it well-documented?The "Human-in-the-Loop":The AIsuggestscontribution weight or quality factor (e.g., "Commita1b2c3dby@dev-userfixed a critical security issue. Contribution Weight: 5/10."). The payout amount is calculated using the weights assigned. The maintainer gives the finalapproval. This maintains human oversight and prevents gaming of the system.The Maintainer can also check the Contribution Weight of each merged commit made by a contributor and get an analysis summary based on it.C. The Payment Protocol (The "Execution Layer")MergeFi uses the Avail Nexus SDK to enable seamless cross-chain USDC-based payouts for open-source contributors. We use the "BridgeAndExecute" flow, which atomically:Bridges USDC from the source chainExecutes a contract call on the destination chain in the same transactionThe execute step is not just a callback — it is where MergeFi performs post-bridge logic on the destination chain, such as:Transferring the bridged USDC to the contributor’s addressMinting an NFT receipt to record the payout event on-chainD. Blockscout Integration (The "Transparency Layer")MergeFi uses Blockscout to provide full transparency for all on-chain transactions across multiple chains (Base Sepolia, Ethereum Sepolia, Optimism Sepolia, Arbitrum Sepolia).Functions: MergeFi provides direct Blockscout links for every transaction to:View pool funding, contributor payouts, and bounty claimsTrack cross-chain USDC bridging status via Avail NexusInspect smart contract calls and eventsVerify transaction details (wallet address, amount, timestamp) Audit metadata (commit SHA, PR number, contributor username)Benefits:Complete Transparency: Every transaction publicly verifiable, eliminating trust requirementsCross-Chain Auditability: Track funds across multiple chains in one interfaceProvable Payments: Immutable records as cryptographic proof of compensation

Solution

MergeFi isn't just one application; it's a hybrid system. We've pieced together three main layers: a central web service, on-chain smart contracts, and a powerful, off-chain AI helper.1. The Core StackFrontend:Our user dashboard is a **React.js ** application. This gives us a fast, modern interface for maintainers to log in, connect their repositories, and see the AI-generated payout suggestions.Backend:The brain of our operation is aNode.js (Express)server. This backend is the central coordinator. It's responsible for:GitHub Integration:Authenticating users via OAuth and, most importantly, listening forGitHub Webhooks.AI Orchestration:Managing the analysis jobs.Transaction Relaying:Securely managing the process of sending the maintainer's "approval" to the blockchain.2. The On-Chain Layer: The 'Decentralized Bank'For our on-chain layer, we moved beyond simple, single-chain treasuries. Our entire payment logic is built usingSolidityand powered by theAvail Nexus SDKto handle the most difficult part of crypto: paying anyone, on any chain.We specifically use Avail's'BridgeAndExecute' flowfor all contributor payouts. This is what makes our system so powerful. When a maintainer approves a payment, it's not just a simple transfer; it's an atomic, cross-chain operation that does two things in a single, secure transaction:It bridges the USDCfrom the maintainer's source chain (like Polygon or Ethereum).Itsimultaneouslyexecutes a custom contract callon the contributor's destination chain.This 'execute' step is the key. It's not just a simple callback. It's where our protocol's logic runs. In that single transaction, our destination contract automatically performs the post-bridge logic, which includes:Transferringthe newly arrived USDC directly to the contributor’s wallet address.Minting an NFT receiptfor the contributor, creating a permanent, on-chain record of the payout and the work it was for.This 'BridgeAndExecute' model means the entire payout process—from funding to final settlement on a totally different network—is one seamless, indivisible operation, which is critical for reliability."3. Partner Technologies: How We Pieced It All TogetherThis is where the real innovation lies. We didn't reinvent the wheel; we integrated best-in-class partner technologies.GitHub (Our "Trigger"):GitHub is more than just a login. We useGitHub Webhooksas the event-driven trigger for our entire system. The moment a maintainer merges a pull request, GitHub pings our backend, and the whole mergeFi workflow begins.Avail (Our "Superpower"):This is our solution to blockchain's "multi-chain problem."The Benefit:We knew it was unrealistic to force a maintainer in the US (who prefers Arbitrum) and a contributor in Vietnam (who prefers a different L2) to be on the same chain.The "How":We useAvail Nexusas our cross-chain communication and settlement layer.The Flow:A maintainer on Arbitrum approves a payment.Our backend posts this "payout message" to Avail. Avail'sData Availability (DA)layer makes this message verifiable and cheap.Avail Nexusthen picks up this verified message and triggers the corresponding "payout" function on thedestination chain—whatever network the contributor specified in their profile.This makes our payments truly borderless and frictionless, which was a core design goal.Blockscout (Our "Trust Layer"):The Benefit:In Web3, you can't just say "Payment Sent." You have toproveit.The "How":We don't build our own explorer. After Avail confirms the final settlement, we take the destination transaction hash and provide a direct link toBlockscout.This gives both the maintainer and the contributor immediate, immutable, and public proof of the payment, which is essential for building trust in an open-source community.4. Our AI Suggestion Engine"Finally, the 'AI Engine.' Building a custom, code-analyzing model from scratch is a massive undertaking. We needed a smart, "hacky" solution for this demo.Data Collation:We gather a complete 'contribution packet.' This isn't just the commit message; it includes the fullcommitdiff(the actual code that was changed) and all the data from anyreferenced issues(like the bug report or feature request).AI Analysis:We send this entire packet through Gemini API, with a highly specific, engineered prompt. We instruct the AI to act as a senior technical reviewer and analyze theproblem, thesolution, and thecontextprovided.The Output:The AI returns a single, objective'contribution weight.'The final "suggested payout" is simply a weighted average of these two scores, translated into a dollar amount from the pool. It's fast, surprisingly accurate, and the maintainer the human-in-the-loop provides the perfect safeguard by giving the final 'yes' or 'no'.

Hackathon

ETHOnline 2025

2025

Prizes

  • 🏆

    Build Unchained Apps with Avail Nexus SDK (General Track)3rd place

    Avail

Contributors