Skip to content

Latest commit

 

History

History
57 lines (42 loc) · 1.8 KB

File metadata and controls

57 lines (42 loc) · 1.8 KB

Node Components

A P2Poolv2 node has two components: a Stratum server that miners connect to, and a controller node that runs share accounting and talks to the other nodes in the pool.

The two components of a node
@startuml
skinparam componentStyle rectangle

actor "Miner Rigs" as miner

node "P2Poolv2 node" {
  component "Stratum server" as stratum
  component "Controller node" as controller
  database "Share store" as store
}

cloud "Other P2Poolv2 nodes" as peers
component "bitcoind" as bitcoind

miner --> stratum : shares
stratum --> controller : shares
controller --> stratum : coinbase,\ndifficulty
controller --> store
controller <--> peers : pool shares
bitcoind --> controller : block templates
@enduml

Stratum Server Responsibilities

  1. Listens to blockchain events from bitcoind.

  2. Builds work for mining devices using the Stratum protocol and the details received from the P2Poolv2 controller node.

  3. Receives shares found by mining devices and sends them to the controller node.

Controller Node Responsibilities

  1. Accepts shares from the Stratum server.

  2. Runs share accounting on the last N shares on the sharechain to decide how much each miner is paid.

  3. Builds a coinbase from that accounting.

  4. Tells the Stratum server the current pool difficulty and coinbase.

  5. Validates that shares received from peers meet the pool difficulty and pay the expected payouts derived from the sharechain accounting.

In the figure shares means the shares found by the mining rig that meet the local vardiff. In contrast, pool shares are the shares that also meet the current pool difficulty. Only the pool shares are transmitted to the other P2Poolv2 nodes.

In the source code, the Stratum server and the controller node share a single crate, p2poolv2_lib.