1-phase1.md
1 ### Green Hyperchains - Phase 1 Report 2 3 This document summarizes the activities, findings, and challenges encountered during the first phase of the Green Hyperchains initiative, building upon the initial feasibility study. 4 5 ### Executive Summary 6 7 Phase 1 focused on laying the groundwork for the Green Hyperchains project, including initial technical exploration of Sophia, selecting infrastructure, and beginning development of the Carbon Agent smart contract. While positive progress was made in understanding Sophia's capabilities and establishing a partnership with a carbon-neutral data center, a significant challenge arose from the immaturity and frequent changes in the underlying hyperchain implementation being developed concurrently. This shifting foundation made it difficult to achieve the anticipated traction in integrating our components. 8 9 ### Key Activities & Findings 10 11 #### Carbon Agent Smart Contract Development (Initial) 12 13 Our initial deep dive into Aeternity's Sophia programming language confirmed its potential for implementing complex smart contract logic, compatible with EVM-style paradigms. We were particularly happy with the language's expressiveness and believe it will allow us to push most of the required functionality directly into the contract, with actions triggered by events firing within the system. This approach also allows the contract state to be queried externally without needing additional API endpoints. 14 15 Preliminary implemnentation was completed the `CarbonAgent` smart contract. The focus was on defining the core data structures (`lease`, `receipt`, `epoch`) and entrypoints for registering leases and epochs, and reporting impact. A unit test suite was also developed, covering contract initialization, lease and epoch registration, reporting impact against a lease, and various data retrieval functions for leases, receipts, and epochs to ensure their functionality is accurate while the plugin is being developed. 16 17 #### Infrastructure Setup 18 19 The partnership with Zetta, a carbon-neutral data center in Norway, was solidified. An initial testnet was successfully deployed and configured to run as a hyperchain connected to the Aeternity testnet. However, this deployment was subsequently spun down after a Hyperchain Release Candidate (RC) introduced backward-breaking changes that required new base contracts redeployed. Following this, effort shifted more towards the development, debugging, and gaining a deep understanding of the underlying hyperchain implementation itself, along with configuring a stable development environment to facilitate faster plugin iteration. Initial steps were taken to configure the DevOps environment using OpenTofu and OpenStack for future testnet deployments. 20 21 #### Architectural Shift: Agent to Plugin 22 23 During Phase 1, a deeper understanding of the hyperchain's internal architecture and required integration points led to a significant architectural shift. 24 We moved away from the initial concept of a separate "Carbon Agent" service running alongside the hyperchain towards developing a "Carbon Plugin" designed for direct integration within the hyperchain node itself. 25 This fundamental change was driven by the need for tighter coupling, more efficient data exchange, and the ability to directly hook into internal blockchain events like pins, epochs, and hyperchain functions. 26 27 Relying on external communication via a websocket connection through middleware introduced unnecessary layer traversal for what is inherently an internal piece of functionality, making the plugin approach more suitable for integrating sustainability mechanisms intrinsically into the hyperchain's operation. 28 29 ### Challenges 30 31 #### Unstable Hyperchain Implementation 32 33 The most significant challenge during Phase 1 was the rapid evolution and instability of the core hyperchain implementation being developed in parallel. This included a number of release candidate versions being published. As the hyperchain's architecture, features, and APIs were frequently shifting, with some updates breaking backward compatibility or causing associated tooling to stop working, our efforts to integrate the Carbon Agent and smart contract were significantly hampered. 34 This lack of a stable target made it difficult to build and test our components effectively, impacting the planned development velocity. Despite these challenges, we were able to open pull requests against internal projects to help fix things that broke or were overlooked, and we are happy that we could continue to exercise the rigor of the hyperchains implementation. 35 While we are happy with the maturity of the software as a whole, due to some miscommunications as well as being at arm's length from the core team there was a lot of time spent gaining a deep understanding of the Aeternity core code to navigate these changes. 36 37 #### Community Engagement and Technical Support 38 39 Another challenge encountered was the difficulty in accessing timely technical support and engaging with the development community. We attempted to contact and ask technical questions in the linked Discord and Telegram channels, but found them largely inactive and filled with what appeared to be bots or crypto scammers. 40 While we believe the foundation has done a great job on the website, social media, and is doing good work consolidating the documentation, once developers are past the initial entry points, the resources and active community presence become quite sparse. There is a noticeable lack of official communication from anyone on the core development team in terms of upcoming releases, major changes, or future features from an implementation perspective. 41 This made it challenging to anticipate changes and get clarification on implementation details, contributing to the time spent on understanding the core code base directly. 42 43 #### Embracing the External Perspective 44 45 Reflecting on the challenges faced and the lack of direct access to core developer resources that were initially anticipated, we've come to view this not as a setback, but as a valuable opportunity. Experiencing the hyperchain development process from the perspective of external community members provides a unique and important viewpoint. This position allows us to rigorously test the system as any community developer would, identifying areas for improvement in stability, implementation clarity, and documentation from a user's standpoint. 46 47 Given the Aeternity foundation's goals of broadening adoption and strengthening community engagement, we believe our role as external contributors who can provide candid feedback on the developer experience is highly valuable. We are enthusiastic about continuing in this capacity for Phase 2, contributing to the hyperchain's maturity and helping to ensure a smoother journey for future community developers. 48 49 ### Next Steps (Adjusted) 50 51 Given the challenges encountered in Phase 1, the focus for subsequent phases will need to include: 52 53 - Continuing to monitor and adapt to the evolving hyperchain implementation, prioritizing stabilization and understanding of core features relevant to integration points. 54 - Further developing and refining the Carbon Agent smart contract and Carbon Plugin, enhancing the plugin's maturity to fully expose contract features via emitted events and implementing comprehensive unit tests. 55 - Planning for integration testing once a stable hyperchain version is released. 56 - Planning and deploying the Carbon Attribution NFT system (code-named OCAP), with its architecture to be detailed and released as part of a Phase 2 application. 57 - Prioritizing clear and comprehensive documentation to facilitate the understanding and adoption of carbon-neutral hyperchains by the wider community. 58 59 ### Looking Ahead: Community Redeployment 60 61 Despite the challenges faced in Phase 1, we remain enthusiastic about the potential of Green Hyperchains. We are actively working towards a more stable hyperchain implementation and the maturation of the Carbon Plugin. We look forward to the next phase, where we anticipate being able to redeploy nodes within our carbon-neutral infrastructure and share our progress with the Aeternity community, inviting them to participate in testing and validation of this environmentally conscious blockchain solution. 62 63 ### Resource Allocation 64 65 Phase 1 provided valuable insights and established key partnerships. However, the challenges presented by the unstable underlying hyperchain necessitate an adaptive approach for future phases. We remain committed to the project's goals and will adjust our plans to align with the hyperchain's development progress.