MergeFi

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

MergeFi

Created At

ETHOnline 2025

Winner of

Avail

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

Project Description

MergeFi is 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 by Avail and providing full transactional transparency via Blockscout, 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 Breakdown

A. GitHub Integration (The "Source of Truth")

  • Mechanism: The system uses a GitHub OAuth API for 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: Uses Gemini API to 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 for quality and impact. 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 AI suggests contribution weight or quality factor (e.g., "Commit a1b2c3d by @dev-user fixed a critical security issue. Contribution Weight: 5/10."). The payout amount is calculated using the weights assigned. The maintainer gives the final approval. 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 chain

    • Executes a contract call on the destination chain in the same transaction

    • The 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 address
      • Minting an NFT receipt to record the payout event on-chain

D. 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 claims
    • Track cross-chain USDC bridging status via Avail Nexus
    • Inspect smart contract calls and events
    • Verify transaction details (wallet address, amount, timestamp) Audit metadata (commit SHA, PR number, contributor username)

    Benefits:

    • Complete Transparency: Every transaction publicly verifiable, eliminating trust requirements
    • Cross-Chain Auditability: Track funds across multiple chains in one interface
    • Provable Payments: Immutable records as cryptographic proof of compensation

How it's Made

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 Stack

  • Frontend: 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 a Node.js (Express) server. This backend is the central coordinator. It's responsible for:

    1. GitHub Integration: Authenticating users via OAuth and, most importantly, listening for GitHub Webhooks.

    2. AI Orchestration: Managing the analysis jobs.

    3. 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 using Solidity and powered by the Avail Nexus SDK to handle the most difficult part of crypto: paying anyone, on any chain.

We specifically use Avail's 'BridgeAndExecute' flow for 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 USDC from the maintainer's source chain (like Polygon or Ethereum).

  • It simultaneously executes a custom contract call on 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:

  • Transferring the newly arrived USDC directly to the contributor’s wallet address.

  • Minting an NFT receipt for 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 Together

This 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 use GitHub Webhooks as 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 use Avail Nexus as our cross-chain communication and settlement layer.

    • The Flow:

      1. A maintainer on Arbitrum approves a payment.

      2. Our backend posts this "payout message" to Avail. Avail's Data Availability (DA) layer makes this message verifiable and cheap.

      3. Avail Nexus then picks up this verified message and triggers the corresponding "payout" function on the destination 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 to prove it.

    • 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 to Blockscout.

    • 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 full commit diff (the actual code that was changed) and all the data from any referenced 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 the problem, the solution, and the context provided.

  • 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'.

background image mobile

Join the mailing list

Get the latest news and updates