Insight - Automated Stratum V2 mining pool for Nervos

Title: Automated Stratum V2 mining pool for Nervos

Motivation

The Stratum protocol V2 offers significant improvements to infrastructure efficiency, pool security, and miner privacy. We will implement this latest mining tech into an open-source pool backend system to attract more miners to secure Nervos, and encourage ASIC firmware developers to support V2. Furthermore, we will develop infrastructure-as-code automated deployments to lower technical barriers and facilitate the entry of new pools into the ecosystem.

The Stratum V2 protocol adds several new features and optimizations. Efficiency is increased through judicious selection of what data is broadcast, when it is sent, and how it is encoded. For example, job assignments will begin upon opening a channel, eliminating the unnecessary miner subscription step in V1. Cleverly, a job can be sent separately from the hash of the previous block, which enables miners to plan ahead and begin mining on a cached block template as soon as the previous hash received. Further efficiency is gained by using a binary rather than json encoding, which significantly reduces message size.

This efficiency is complemented and enhanced by flexibility. The specification includes protocols giving miners the ability to choose their own work (transaction set). Or, mining devices can operate in a simplified but more efficient mode via header-only mining. Flexibility along with extensive support for proxies and highly efficient communication channels enables backend infrastructures to maximize productive use of resources while still accommodating a range of miners as well as firmwares / hardware targets. As is a design goal, a balance is achieved between efficiency and decentralization.

Miners’ security and privacy are enhanced by implementing AEAD (authenticated encryption with associated data) to hinder network-level surveillance and prevent hashrate hijacking. The miners can also influence which transactions are included in the block, which is beneficial for network decentralization and censorship resistance.

We will implement a compliant base of Stratum V2 requirements and features into the open-source BTCpool backend system, which supports the Nervos Eaglesong hash function and ckb blockchain. We will contribute or integrate our work into upstream repositories. Deployments will be automated using a combination of Terraform, Terragrunt, and Ansible on both VMs, Kubernetes, and managed services. Users will then be able to quickly adopt the necessary infrastructure components to run the stack independently.

Project Milestones and Timeline

The Stratum V2 protocol is designed to accommodate making the stratum v1/ad-hoc → Stratum V2 transition in stages, with increasing levels of complexity and potential efficiency gains. We will follow the Stratum V2 developers’ advice of starting simple and implementing in stages. The project will proceed toward the following milestones, which allow for the exploration of more sophisticated solutions with high potential for performance while always building on a compliant, tested, and performant base:

Milestone 1: Implement a pool-layer Stratum V2<->V1 translation proxy as a proof-of-concept and design/development tool to guide the next milestone. (Estimated time: 3-5 weeks)

Milestone 2: Implement the Stratum V2 Mining Protocol (the minimal and only required component of Stratum V2) in the btcpool backend system, focusing on the stratum server and ckb C++ source codebases. (Estimated time: 4-6 weeks)

Milestone 3: Develop infrastructure provisioning and automated deployments utilizing the ckb blockchain (Estimated time: 3-4 weeks)

Thus useful and compelling tooling should be completed in about 3.5 months. If minimal challenges arise and milestones are met sooner than expected, further stages of implementation can be explored. These include implementation of optional protocols (Job Negotiation, Template Distribution, Job Distribution) and developing ckb-driven infrastructures/deployments that maximize potential Stratum V2 efficiency gains.

Team

Insight’s crypto R & D team is dedicated to building infrastructure and software to tackle high-impact challenges in the blockchain space. In the last 6 months, we have executed projects that were funded by the Zcash Foundation, Web 3 Foundation, ICON Foundation, Harmony Grants, and Monero CCS.

Insight hosted Nervos during the Rust in Blockchain Workshops (https://fellows.link/rust2019) and became interested in becoming contributors ourselves. We are excited for this opportunity to participate in growing and advancing the Nervos ecosystem!

Lead Engineer: Adam Jacobs

  • DevOps Engineer at Insight
  • Experienced open source engineer in high performance computing, targeting and maintaining deployments on highly parallel heterogeneous architectures
  • Contributed to open standards design and implementation for GPGPUs (OpenACC)
  • Github: ​github.com/adam-m-jcbs
  • LinkedIn: linkedin.com/in/adamjcbs

Infrastructure Automation: Rob Cannon

Project Manager: Mitchell Krawiec-Thayer

6 Likes

Hey Mitchell! Hope you are well! This is really exciting!

2 Likes