If you find our work valuable, please consider giving us a star on GitHub!
- Official Website: ecolab-web3.github.io
- Whitepaper: e-co-lab.gitbook.io/whitepaper
- Discord Community: discord.gg/Q6BNyUDNtm
- Twitter: x.com/ecolab_web3
This project, developed for the Avalanche Jungle Hackathon, introduces a robust, dual-gateway architecture to tokenize Recycling Credits as Real-World Assets (RWAs) on the Avalanche blockchain. The system is designed to bring transparency, liquidity, and verifiable trust to the circular economy by serving both the formal (document-based) and informal recycling sectors.
The entire system developed during the hackathon was built using Hardhat, achieved 100% test coverage, and was successfully deployed and verified on the Avalanche Fuji Testnet.
This section provides links to interact with and verify the project's components.
This is the most effective way to validate our technical execution. The link below launches a pre-configured cloud development environment directly from GitHub, cloning the repository and installing all dependencies automatically.
➡️ Launch Live Technical Demo on GitHub Codespaces
Instructions for Judges:
Once the environment loads (it might take a minute), a terminal will open and automatically run npm install. After it finishes, you can run the following commands to verify our work:
npx hardhat coverage- This will run all 42 unit and integration tests and generate a report showing 100% test coverage for all contracts.npx hardhat run scripts/proofAllGatewayIntegration.ts- This will execute our final integration test on a fork of the Fuji testnet, proving the end-to-end functionality of the system architecture.
- RecyclingCredits (RWA NFT):
0xe18e...f4f(Pre-existing contract) - VerifierGateway:
0x6750...90DD(Built during hackathon) - FiscalGateway:
0xeaF0...1Fa7(Built during hackathon)
These dApps were part of the pre-existing project. Note: They are not integrated with the new gateway architecture built during the hackathon.
This project is based on a pre-existing RWA contract (RecyclingCredits.sol). The work performed during the Avalanche Jungle Hackathon focused on building the entire verification, automation, and integration layer required to make the system functional and scalable.
- VerifierGateway Contract: A secure gateway for the informal recycling sector, enabling the minting of credits based on cryptographic signatures from trusted human verifiers.
- FiscalGateway Contract: An advanced gateway designed to automate the verification of fiscal documents (Brazilian NFe) using Chainlink Functions. Its most innovative feature is an on-chain fallback queue, which automatically flags inconsistent documents for manual review, ensuring system resilience without a centralized backend.
- End-to-End Test Suite: A comprehensive suite of 42 tests was developed, achieving 100% test coverage across all new contracts and their complex interactions.
- Chainlink Functions Script: The complete off-chain Javascript source code (
functions-source.js) was developed to query a real-world API, validate data, and handle inconsistencies. - Fork Integration Scripts: We created and successfully executed scripts on a fork of the Fuji testnet, proving that our new gateways could correctly interact with the live
RecyclingCreditscontract and execute the full integrated workflow, including the manual fallback mechanism.
Our primary technical challenge arose during the final on-chain configuration of the FiscalGateway. We discovered that our deployed contract was missing a necessary parameter in its request function to pass a reference to the off-chain secrets (API key). Due to the immutable nature of the contract and the hackathon's time limit, we could not redeploy this component.
This experience was a crucial lesson in the complexities of integrating on-chain and off-chain systems. Importantly, our architecture's design proved its value: the on-chain fallback queue is fully functional, allowing any NFe to be processed securely through the VerifierGateway's manual verification flow, ensuring no data is lost and the system remains operational.
The system's innovation lies in its dual-gateway architecture, which separates concerns and creates a robust, auditable pipeline for RWA tokenization.
-
VerifierGateway (For the Informal Sector):
- Purpose: To provide a trust-minimized entry point for recycled materials that lack formal documentation.
- Security Model: Relies on
ECDSAsignatures. A pre-approved set of real-world "Verifiers" (VERIFIER_ROLE) can attest to a collection's legitimacy by signing its data. This signature is the sole authorization required to mint a credit, creating a strong, auditable link to a trusted individual.
-
FiscalGateway (For the Formal Sector):
- Purpose: To automate the verification of official documents (like NFes) to scale the system.
- Integration: Designed to use Chainlink Functions to call an external API, parse the document data, and validate it against on-chain rules.
- On-Chain Fallback Queue: If the Chainlink Functions script detects inconsistent data (e.g., wrong unit of measurement), it signals the
FiscalGateway. The gateway then creates a task in a public, on-chain queue. This task can then be resolved by an administrator via theVerifierGateway, unifying the human verification process.
This project has a clear and viable roadmap for production.
- Redeploy FiscalGateway: The immediate next step is to redeploy the
FiscalGatewaywith the corrected function signature to fully enable the Chainlink Functions automation with secrets. - Develop a Unified dApp: Build a production-grade dApp that provides interfaces for all user roles: recyclers, verifiers (for the manual queue), and administrators.
- Support for EIP-1271: Refactor the
VerifierGatewayto support the EIP-1271 standard, allowing multi-signature wallets (like Gnosis Safe) to act as verifiers, further decentralizing the governance and approval process. - Expand Country Support: Add new Javascript sources and configurations to the
FiscalGatewayto support electronic fiscal documents from other Latin American countries (e.g., Mexico's CFDI, Argentina's Factura Electrónica).
This project is licensed under the MIT License. See the LICENSE file for details.