First exchange listing: the NonKYC campaign needs 100 backers by 2027-02-04, and $5 counts as one. Pledges are donations, refunded if the listing does not happen. Back the campaign →

Bitflash Download

Docs · The pool registry

Everpool: the P2Pool that no one can delete, edit or shut down

Status: design done (Phase A); implemented (Phases B and C, section 16) and proved on testnet with real coins (Phase D); open on mainnet from release 1.2.36. The phases are at the end. The protocol is also published on its own, for any chain to adopt, at https://github.com/bitflash-network/everpool. Main-chain consensus does not change: everything below is node software and P2Pool protocol, and ships in an ordinary release.

Everpool is the name of the feature: pools that live on the chain and travel between nodes. Inside the code and in the rest of this page it is the pool registry, and its parts keep descriptive names (poolrecord, NODE_POOLREG, poolcreate); the name is for people, not for identifiers. It works the same on a network that blocks Tor, through the bridges the node already uses there (section 17).

A pool can also be private: P2Pool local (section 18) uses the same share rules for a group that wants nothing published, with no record on the chain, no burn, and its share chain only on its members' nodes. At creation the user picks one or the other; pool zero, the default P2Pool, stays as it is for whoever picks neither.

What it is for

P2Pool inside the node (docs/p2pool.md) removed the pool operator: no custody, no central template, no company, no domain. One lever is left, and it is the project's own. The rules of the share chain (a 2160-share window, 10 s per share, uncles at 80%) live in the code, and whoever publishes a release can change them for everybody. Alternative pools have nowhere to be found but a website (docs/pool-directory.md).

The registry removes that lever. In plain words:

Today's pool, the one every P2Pool miner already mines, becomes pool zero: entry zero of the registry, fixed in the code with the rules it has today and a fee of zero. It needs no registration, and nodes of 1.2.34 and earlier keep mining it with no change.

Contents

  1. The record
  2. Pool id
  3. Indexing, confirmations and reorgs
  4. Pool zero
  5. Share rules v1
  6. Share format for registered pools
  7. The coinbase anchor
  8. Network messages and version negotiation
  9. Mining a chosen pool
  10. Rotating replication: guardians
  11. Storage and bandwidth bounds
  12. Threat model, Sybil and DoS
  13. What stays out of consensus, and why
  14. Migration
  15. Test plan
  16. Phases
  17. Networks where Tor is blocked
  18. P2Pool local: a private pool

1. The record

A pool is created by a transaction with an output whose script is OP_RETURN followed by one direct push (opcode equal to the length, 42 to 73 bytes) of the record below, and whose value is at least 1 BTF (100,000,000 sat). The value is burned: an OP_RETURN output can never be spent. OP_RETURN with up to 80 bytes is standard since 1.2.28, so this is sendburn, the same call that lists a public community (docs/btfchat.md, src/community.h).

All integers are little-endian, fixed width, unsigned.

offsetbytesfieldallowed values
04magic"BTFP"
41record format1
51share rules version1 (section 5)
62share spacing, seconds20 to 120, and spacing x uncle depth at least 60 (section 17). Pool zero's 10 is valid only in pool zero's own record
82PPLNS window, shares360 to 2160
102retarget window, shares120 to 720, and no more than the PPLNS window
124share floor, compact targetcanonical (below), above 0, no easier than the network floor 0x1f0fffff
161uncle depth1 to 3 (pool zero's 3)
171uncle share, percent80 to 100 (pool zero's 80)
182creator fee, basis points0 to 300 (3%)
201fee script type0 none, 1 P2PKH, 2 P2SH
2120fee script hashthe HASH160 of the address; twenty zero bytes when the type is 0
411 to 32nameASCII A-Z, a-z, 0-9, - and _, tested as byte ranges (not with isalnum, which depends on the C locale)

The name's length is what is left of the push: there is no length byte, so a record is 42 to 73 bytes.

Canonical encoding. A record is read only if writing back what was read gives the same bytes. Concretely, a record is ignored (it is not a registry entry, and nothing about it is an error) when any of these holds:

So every pool has exactly one record, and every record exactly one pool.

Why these ranges. A short spacing multiplies orphaned shares over Tor's latency, and over a bridge (Snowflake, meek) far more. Registered pools start at 20 s, always keep uncles, keep them at least 60 s of shares deep, and pay an uncle at least 80% of its work, so a miner behind a bridge is paid for a late share rather than orphaned out; section 17 gives the loss each allowed combination still has. Pool zero keeps its 10 s, which it cannot change; above 120 s a share is as rare as a block. The window cap of 2160 is pool zero's: every coinbase pays one output per distinct address in the window, and the bounds on share size, block space for the coinbase and memory (MAX_SHARE_BYTES, P2POOL_COINBASE_BYTES, MAX_CHAIN_BYTES) were all sized for it. A pool that wants a longer PPLNS horizon takes a longer spacing: 2160 shares at 30 s is 18 hours. The 3% fee cap keeps a fee pool from being a trap; nothing stops a 0% clone of it.

2. Pool id

poolId = SHA256d( "Bitflash/pool/1" || network magic (4 bytes) || record )

SHA256d is the double SHA-256 the node uses everywhere (Hash). The network magic is the message start of the chain the record is on (pchMessageStart: mainnet bf 20 5c fd, testnet ce e2 c0 ff), so the same rules on testnet and mainnet are two different pools and no share can be replayed across them. The id is a uint256, shown like a block hash (GetHex, byte-reversed); wallets show its first 8 hex digits as the pool's fingerprint.

Consequences:

3. Indexing, confirmations and reorgs

Every node reads the main chain for records, the way it reads it for community listings (src/chatdir.cpp), with two differences: it follows reorgs, and an entry counts only once it is buried.

The registry is a pure function of the active main chain. Fold the blocks of the active chain from genesis, in order (block, then transaction, then output); every output that is a valid record (section 1) with a value of at least 1 BTF is an appearance of its pool id. A pool's first appearance is the earliest one. The node's index (pool-registry.dat) is a cache of that fold and nothing else; deleting it makes the node read the chain again and reach the same registry.

Confirmations. A pool is active when its first appearance has at least 30 confirmations (about an hour of 120 s blocks): the block holding it and 29 on top. Before that the pool is pending: listed, not carried, not mined, its shares not taken. 30 is far deeper than any reorg the network has seen and costs a pool's creator an hour once, which nobody minds.

Reorgs. The index remembers the hash of the last block it read. On each pass it walks back from that block to the first one still on the active chain (the fork point), forgets every appearance above it, and reads forward again. So:

What a pool's state may decide, and what it may not. Whether a pool is active depends on this node's view of the main chain, which can differ for a block or two between two honest nodes. So it decides only what a node carries (mines, keeps, relays, announces), never whether a share of the pool is valid. A share is judged on its pool's rules and its pool's share chain alone, exactly as pool zero's are today (docs/p2pool.md: "a share is judged on the share chain and itself alone"). In particular there is no rule like "shares older than the registration are invalid": that would make validity depend on when each node saw the registration, and two honest nodes would part ways. Somebody who mines a pool's share chain before registering it has only spent work.

What the index also keeps. Per pool: the first appearance (height, block hash, txid, output, burn), the number of appearances, and the main-chain anchors that name it (section 7): the last 64 (height, block hash, share data hash) and the count over the last 720 blocks. All of it is undone by a reorg the same way.

Anchors that name no registered pool are kept only for a while. A "p2x" push costs nothing to write, so a miner could name a new made-up id in every coinbase; kept forever, those claims would grow the index without any burn, against section 11. So at every height that is a multiple of 144, an id that is neither pool zero nor registered at that height loses its anchors older than 2160 blocks. A dropped anchor stays in the file for 1440 more blocks, so a reorg above the sweep restores it exactly; a reorg below an anchor dropped for good is detected and the chain is read again. The sweep is part of reading the chain, so a rebuild gives the same result. A pool whose record appears later starts with the anchors of its last 2160 blocks before the burn.

The file and restarts. The index lives in pool-registry.dat, written atomically, with a checksum, and rebuildable from the block files: deleting it and starting again gives the same registry. It keeps the hashes of the last 64 blocks it read and one every 144 blocks, so a node whose block index lost its last blocks in an unclean stop resumes from the newest one it still has instead of reading from genesis. A rebuild from genesis (a damaged file, a reorg deeper than the kept anchors allow) is read into a second registry while the old one keeps answering, and takes over at the tip. The index has a thread of its own, started once the node's network is up (never by a one-shot command such as -newaddress or -rescan); on the way out the node waits for its last save, best effort, for at most 30 s, and a save cut short leaves the previous file.

Cost. One parse per OP_RETURN output of at least 1 BTF, a few hundred bytes per pool on disk and in memory. There is no cap on the number of entries: a cap would let whoever fills it stop everybody else from creating a pool, which is deleting the registry by other means. Its size is bounded by the burn instead (section 12).

4. Pool zero

Pool zero is the share chain every P2Pool node runs today. It becomes entry zero of the registry with its current rules written as a record:

fieldvalue
record format, rules version1, 1
share spacing10 s
PPLNS window2160 shares
retarget window720 shares
floor0x1f0fffff (bnProofOfWorkLimit)
uncle depth, uncle share3, 80%
creator fee0, no fee script
namebitflash
record (49 bytes):
4254465001010a007008d002ffff0f1f03500000000000000000000000000000000000000000000000626974666c617368

pool zero id, mainnet
  shown (GetHex):  d925f36f20d98092d034dc083e46040fcb292c5f5437bc834130da088b197c8a
  internal order:  8a7c198b08da304183bc37545f2c29cb0f04463e08dc34d09280d9206ff325d9
pool zero id, testnet
  shown (GetHex):  a97d439cb065f828545a5b45f098297ca79adebba56a80a87cb0b095fddb2736
  internal order:  3627dbfd95b0b07ca8806aa5bbde9aa77c2998f0455b5a5428f865b09c437da9

(Computed from the definitions above and recomputed by the review; Phase B pins all of them in a self-test, and the code and this page must agree before anything merges.)

The floor is the same target. Pool zero today uses bnProofOfWorkLimit (~uint256(0) >> 12) as its floor, not SetCompact(0x1f0fffff), which is slightly harder (0x0fffff * 2^224). No compact value lies strictly between the two, and every share target and retarget result is compact, so the floor check (CheckShareCheap) and the clamp in NextShareBits give identical answers with either. v1 uses SetCompact(record floor); Phase B pins this equivalence in a self-test.

What this changes for the project: from this release on, a release that wanted other rules for pool zero cannot have them. It can only create another pool, with another id, and miners choose. That is the point.

5. Share rules v1

A share rules version is a complete, frozen definition of share validity and chain choice, given a record's parameters. Version 1 is the code of 1.2.34 with its constants made parameters, plus the creator fee (below), and nothing else. With pool zero's parameters and no fee it is 1.2.34 exactly:

today's constantv1 parameter
SHARE_SPACING = 10share spacing
WINDOW_SHARES = 2160PPLNS window
RETARGET_SHARES = 720retarget window
bnProofOfWorkLimit as the floorshare floor
MAX_UNCLE_DEPTH = 3uncle depth (1 to 3)
uncle paid 80%, includer 20%uncle share p%: the uncle is paid floor(work * p / 100) (computed as work / 100 * p + (work % 100) * p / 100, exact without overflow; for p = 80 it equals today's work / 5 * 4 + (work % 5) * 4 / 5), the includer the rest
HISTORY_SHARESwindow + retarget + 2 x uncle depth + 10
chain choice over lines that do not meet: last 2160 shareslast window shares
TIP_MAX_AGE = 30 min180 x spacing (30 min for pool zero)
coinbase outputs at most 3 * WINDOW_SHARES (CheckShareCheap)at most 3 x window, plus 1 when the fee is above 0
MAX_CHAIN_SHARES = 4 * HISTORY_SHARES4 x the pool's HISTORY_SHARES
NEAR_TIP_SHARES = 2 * MAX_UNCLE_DEPTH + 102 x uncle depth + 10
SYNC_GAP = 2 * MAX_UNCLE_DEPTH + 10 (p2pool_net.cpp)2 x uncle depth + 10
history shares a peer may send, 3 * HISTORY_SHARES + 2 * SHARES_PER_MESSAGE3 x HISTORY_SHARES + 2 x 100 with the pool's HISTORY_SHARES (registered parts hold at most 100 shares, section 17)

Outside validity, the template reserve for the coinbase (P2POOL_COINBASE_SIGOPS, P2POOL_COINBASE_BYTES in rpc.cpp) follows the same output count, plus one for the fee.

Unchanged in v1, for every pool: at most 2 uncles; payout scripts are P2PKH or P2SH only; 120 s of future time; the median-of-11 lower bound on time; the first retarget window shares at the floor, then a retarget every share over the last retarget window, by at most 4x either way, never easier than the floor; most cumulative work as the chain choice; the coinbase meets every rule a block's coinbase meets.

The creator fee. When the record's fee is above 0, a share's coinbase must pay, out of its total value T (subsidy plus fees, at least the subsidy, as today):

  1. fee = floor(T * bps / 10000) to the fee script (P2PKH or P2SH of the record's hash), computed in 128-bit integers. A P2SH fee address is safe because rules v3 (P2SH spending) is active on mainnet from 2026-11-21, before this ships;
  2. T - fee over the window with ComputePayouts, unchanged;
  3. if the fee script is also in the window (the creator mines too), its two amounts are one output; otherwise the fee output takes its place in the order by script bytes. A fee that rounds to 0 is no output.

The coinbase must equal that list exactly, as today, so the fee is enforced by share validity: a template that skips or shrinks it is not a share of the pool, and its block, if it is one, earns no share credit. No covenant, no consensus rule. The fee can never grow, because the record cannot change.

The freeze. Every share rules version is frozen forever, the way consensus code never forgets old rules. A release may add version 2, 3, and so on for new records; it may never stop validating version 1, nor change what version 1 means. If a version turns out to have a bug, the fix is a new version and new pools; a release may refuse to build templates for a version known to be broken, and say why, but it keeps validating it. The self-tests of a version are frozen with it.

6. Share format for registered pools

Pool zero keeps its format (section 4). Every other pool uses share format 1, which differs in one field:

ShareDataX {
    uint256 poolId;               // the pool this share belongs to
    uint256 hashPrevShare;        // as ShareData
    vector<uint256> vUncles;
    unsigned int nShareHeight;
    unsigned int nShareBits;
    vector<unsigned char> payoutScript;
}

serialized in that order with the node's ordinary serialization, and hashed with SerializeHash. A format 1 share (ShareX) is a pool zero Share with ShareDataX in place of ShareData: the same header fields, coinbase and merkle branch.

A local pool's share (section 18) adds one field to this, a random salt after poolId that never goes on the chain; a registered pool's share has none.

On top of the v1 rules, a format 1 share is valid only if:

So one PoW counts on at most one share chain. Pool zero's frozen rule (FindCommitment in 1.2.34) counts only 35-byte "p2p" pushes, so a pool zero coinbase may also carry a "p2x" push; that is why the exclusion has to sit on the format 1 side. A format 1 share cannot be a pool zero share, since it has no "p2p" push, and a pool zero share cannot be a format 1 share, since format 1 refuses any coinbase with a "p2p" push. Two registered pools cannot share a PoW either, since the push names one pool id.

7. The coinbase anchor

Today every P2Pool coinbase carries, after the height, a 35-byte push: "p2p" and the hash of the share's ShareData. Pool zero keeps it unchanged. A registered pool's coinbase carries instead a 67-byte push:

"p2x" (3 bytes) || poolId (32 bytes, internal byte order) || SerializeHash(ShareDataX) (32 bytes)

The template's scriptSig is then the height (at most 5 bytes with its push opcode, up to MAX_BLOCK_HEIGHT), nBits (at most 6), the extra nonce (at most 6), this push (68 with its opcode), and the stratum's extranonce2, which BuildMinerBlock appends after it (at most 6): at most 91 bytes, inside the 100 a coinbase scriptSig may have (CheckTransaction). A format 1 share whose scriptSig would pass 100 bytes is no share, as for pool zero.

The anchor names the pool, so anyone can count, from the main chain alone, how many blocks each pool's template produced: a "p2p" push is pool zero, a "p2x" push names its pool in full. The count reads a coinbase the way a share is read: the scriptSig must parse fully, and it counts for pool zero with exactly one "p2p" push and no "p2x" push, for a registered pool with exactly one "p2x" push and no "p2p" or "p2l" push; anything else counts for no pool (a "p2l" push is a local pool's, and counts for none, section 18). A "p2x" push naming pool zero's own id also counts for no pool: pool zero's shares never carry its id (section 6), so such a push cannot come from its template. The index keeps these counts (section 3). They are claims: anybody can put a "p2x" push in a solo block's coinbase. Only a node that carries the pool can tell a real one (the coinbase pays that pool's window, the share data is in its share chain) from a label, and wallets must say which they show (section 12).

8. Network messages and version negotiation

A new service bit, NODE_POOLREG = (1 << 3), says a node reads the registry and speaks the messages below. Nodes of 1.2.34 and earlier do not set it; nothing below is ever sent to them, and nothing changes in what they are sent. A node says the bit only where registered pools are open (testnet, and mainnet from 1.2.36, where POOL_REGISTRY_MAINNET_OPEN is set): a release cut while mainnet was closed drops every message below unread, so it does not claim to answer them. Pool zero traffic stays on its own messages, to every NODE_P2POOL peer, old or new, exactly as today.

New messages, only between NODE_POOLREG peers (an older node ignores unknown commands, ProcessMessage, but they are not sent to it anyway):

messagecarrieswhat it does
poolinvup to 32 pool idsthe registered pools this node can serve now (below). Sent after version, and again when the set changes (at most once a minute; a peer that sends them faster is not scored, since that is judged on the receiver's clock, and the receiver simply acts on the latest one at most once a minute)
p2xsharepool id, ShareXa share, as p2pshare
p2xgetshpool id, up to 500 share idsask for shares by id, as p2pgetsh
p2xsyncpool id, resume point (a share id, or 0)ask for a line, as p2psync; with a resume point the server holds, its snapshot from where that share's branch meets its line, less the uncle depth (section 17)
p2xsharespool id, the snapshot's tip height, an end flag, up to 100 shares and 256 x 1024 bytesa part of a line, as p2pshares but smaller and paced, only in answer to p2xsync for that pool (section 17)
p2xnonepool id"I hold nothing of this pool": the answer to p2xsync or p2xgetsh for a pool this node does not carry, or carries with no shares
pooltktan epoch, the ticket seed hash the sender checked them against, up to 512 guardian ticketstickets, relayed or in answer to poolgettkt (section 10, Phase C)
poolgettktan epochask a peer for the tickets it holds for that epoch; answered with pooltkt parts, at most 4096 tickets in all (section 10, Phase C)
poolwho / poolata pool id / up to 32 .btf addressesask a peer who carries a pool; the answer is hints, as p2ppeers (Phase C)

What poolinv names. Only active pools this node carries now (mines, carries by -poolcarry, or guards) and holds shares of, plus the pool it mines even before it has shares: at most 1 mined, 8 by -poolcarry and 8 guarded with shares (section 11), so 17, within the 32 the message allows. A chain kept on disk after a reorg or after a guard slot ended is not carried and not announced. In what follows, "announced" and "carried" mean the same set. A guarded pool with no shares is not announced: there is nothing to send for it, and announcing every empty pool a node is drawn for would let cheap registrations crowd real pools out of the message.

Routing.

Every p2x* message starts with its pool id, so the receiver decides before reading the rest. For a pushed p2xshare:

A share of a carried pool refused because it waits on its parent, or on this node's own clock, scores nobody (InnocentRefusal), as today. A share of a carried pool that is invalid in itself is scored, as a pool zero share is: validity never depends on the receiver's view, so an honest peer never sends one.

Per connection, per pool. The per-connection P2Pool state of today (nP2PoolSyncAskedAt, nP2PoolHistoryRecv, nP2PoolSyncServed, the deferred asks, "one history in the life of an unproven connection", SYNC_SERVE_INTERVAL) is kept per (connection, pool) for registered pools, with at most 8 registered pools served per connection per SYNC_SERVE_INTERVAL. One connection can then hand over several pools, which handoff needs (section 10), and no pool's history counts against another's. Registered histories are served paced, in smaller parts, and within these limits (section 17, Resumable fetches). An ask here is a p2xsync, and nothing else. Per (connection, pool this node carries): one serve in flight (a new ask replaces it), at most 3 asks per SYNC_SERVE_INTERVAL (a fourth is dropped silently), and at most one history's worth of shares sent per interval, a resumed serve continuing the count. On an unproven inbound connection that count is for the life of the connection, as "one history" is today: resuming continues it, and more takes a new connection, through the registered serve budget. Asks about pools this node does not carry, or holds but has not completed, keep no per-pool state: one counter per connection answers at most 8 of them per interval with p2xnone, and drops the rest unread, unscored. p2xgetsh (single shares by id, for missing parents and uncles) is not an ask and is limited as p2pgetsh is today, by the send queue.

Pool zero is isolated from everything registered pools do. The rule is that nothing an honest peer, or a 1.2.34 node, does with registered pools, guardians or tickets may change how pool zero's traffic is treated, so that a 1.2.34 node asking an upgraded node for pool zero's line is served exactly as a 1.2.34 node would serve it. (A peer that sends invalid registered shares or forged tickets is scored, and like any scored peer it loses its standing for pool zero too; only a dishonest peer can get there.) Every piece of shared P2Pool state in p2pool_net.cpp is split into two classes, pool zero and registered:

The rule covers every other piece of shared state too, and Phase B lists each in the code: the global cap on deferred entries (MAX_DEFERRED) and the OlderHeld order used by PeerWorkGate and HistoryServeDecision; setOrphanSeen and setOrphanBadWork; the history-waiting state (nFirstHistoryAsk, P2PoolAwaitingHistory), which becomes per pool; and nP2PoolLastGood, which only a pool zero share sets, so that a floor share of some unmined registered pool never makes a peer proven for pool zero (the registered class keeps its own "last good" per connection). Two limits stay shared because they are the socket's: the hard send buffer cap (MAX_SEND_BUFFER_HARD, 64 MB) is the whole vSend, so the registered caps are set to keep pool zero's largest queue plus the registered one under it; and a connection dropped by the registered slow-reader rule loses pool zero on that connection too, which is acceptable (it was reading nothing).

The tip height and the seed hashes the ticket and registry checks need are read without cs_main, from a snapshot updated under cs_main when the tip changes and read under cs_p2pool, so the lock-free path stays lock-free.

The worst a peer can make an upgraded node hash or send is bounded by the sum of the classes, a small constant multiple of today's, never by the number of pools. Phase B carries a self-test for the rule: registered traffic that drains every registered budget and fills the registered queues leaves a pool zero history request served at once.

The lock-free path. Today ProcessMessages hands commands starting with "p2p" to P2PoolProcessMessage without cs_main (main.cpp, near the version check), because a RandomX check under cs_main stalls the node. The p2x* and pool* commands must take the same path; Phase B changes that test to the full list of P2Pool commands.

Version of the protocol. NODE_POOLREG with share rules version 1 is the whole negotiation. A later format adds a later bit or a later record format; a node announces in poolinv only pools whose record format and rules version it can validate, so two nodes never exchange shares one of them cannot judge.

9. Mining a chosen pool

RPC (in src/jsonrpc.cpp, with the other wallet calls):

calldoes
`poolcreate everpool {"name", "spacing", "window", "retarget", "floor", "uncledepth", "unclepct", "feebps", "feeaddress"} ["send" \"dryrun" \"publishzero"]`builds the record, checks it canonically (the record's own check, the bytes read back as the same record, and the burn's script read back by the parser the index uses), and returns its hex, its id, its fingerprint, the fee and the burn, and whether the index already has it. Nothing is sent unless the third parameter is "send" or "publishzero": then it burns 1 BTF into the record through the wallet's burn path (the one sendburn uses) and returns the txid too. The name is required; other unset fields take these defaults: window 2160, retarget 720, floor 0x1f0fffff, uncle depth 3, uncle share 80, no fee (pool zero's values), and a spacing of 30 or ceil(60 / depth), whichever is larger, so the defaults with any given depth make a valid record (pool zero alone may have 10). A record that breaks a rule of section 1 is refused with the rule it breaks, sent or not. "send" is refused for a pool the index already has (it would burn 1 BTF for nothing), for a burn of the same record already waiting to be mined or unconfirmed in the node's wallet, while the node is catching up and while the index is behind the node's tip (it could not tell); the checks and the burn run under one hold of the chain lock, so a block cannot land between them. The answer lists the other pools whose names look the same (samename). A record equal to pool zero's is refused with "send"; "publishzero" is the explicit word for the one-time publication of section 4. Before 1.2.36, which opens registered pools on mainnet, "send" and "publishzero" were refused there before any other check (one constant, POOL_REGISTRY_MAINNET_OPEN in src/poolindex.h, opens them), so nobody burned 1 BTF for a pool that could not be mined; the preview worked on mainnet and said so. Testnet was always open
poolcreate local {...} [password], pooljoin, poolpeers, poolleavea local pool, never on the chain (section 18). poolcreate with no mode is refused, naming the two, so nobody burns 1 BTF by default
poollistpool zero first, then the recorded pools, pending and active, each with its status: id, fingerprint, name, rules, fee, first height, confirmations, appearances, anchors in the last 720 blocks (as claims), and, once pools are carried, whether carried and the share chain's height and work. Ordered by recent share work for carried pools, then by anchors, then by first appearance, never by name. Every entry lists the other pools named alike (case, - and _ set aside), pool zero's "bitflash" included, by id and fingerprint, at most 32 of them; the answer carries the index's state and a note that names are not unique (section 12)
poolinfo <poolid>one pool: the record decoded, its appearances, its last anchors, the index's height, its share chain if carried, its guardians this epoch (Phase C). An id nobody burned that blocks name shows as unknown with its claims only

In the wallet window

The window's Everpool screen (menu bar, or the button beside Backup Wallet; src/gui_everpool.cpp) shows the same registry without the command line, and runs nothing until it is opened:

10. Rotating replication: guardians

The registry makes a pool permanent; the share chain still has to live somewhere. Miners keep the chain of the pool they mine. Guardians keep it when nobody does, and they are where a new miner finds it.

What guardians are and are not

A guardian of pool P is a node that, for one epoch, keeps P's share chain (the line behind the tip, HISTORY_SHARES deep, with its uncles), relays its shares and serves p2xsync/p2xgetsh for it, whether or not it mines P.

Guardians are availability, never trust. Every share is PoW-valid on its own, and a line is chosen by its work, so a guardian cannot forge a share, cannot forge a lighter line into a heavier one, and cannot change a payout. What a malicious guardian can do is withhold: not answer, or answer with an old line. Everything below is built so that withholding by every guardian of a pool at once costs that pool, at worst, a restart (see Reviving), and costs nobody coins already paid: PPLNS pays a share in every block found while it is in the window, and a block that was found has paid.

Guardians do not vote and do not lead. There is no leader among a pool's guardians, no election and no threshold signature. Each one checks shares against the pool's frozen rules version and follows the line with the most work, exactly as every pool zero node does today. Two honest guardians cannot disagree about a share's validity, and the old and new sets during a handoff cannot either; a guardian that refuses a valid share is only withholding it, and the miner sends it to every node that announces the pool.

Guardians are not hidden. Being a guardian is public by design: the tickets are broadcast and a seeker computes a pool's sixteen so that it can dial them. What stays private is what stays private for every node, its IP address, which Tor hides. Cover traffic or padding to disguise guardian traffic was considered and left out: it would cost every node bandwidth to hide a role that does not need hiding, and a pool's share traffic is small (a share every spacing, a few kilobytes) and paced (section 17).

There is no minimum number of guardians. A pool works with none while somebody mines it, because its miners hold its line; guardians only keep it when nobody does and give a new miner somewhere to find it. On a network with fewer tickets than places, every node is drawn for every pool and the guard budget (section 11) keeps the pools with the most work. As nodes join, the next epoch's draw spreads the pools over them with no step of its own.

Epochs and seeds

Nothing in a ticket can prove when it was made, so the deadline is enforced by each node on its own view, and the draw is built so that a ticket made after the seed is known gains nothing for free: a ticket's score depends on its RandomX work hash (see The draw), so every try at a good score costs a whole ticket of work. Were the score to depend on the .btf key alone, an attacker who saw the seed could generate keys for free until 16 of them topped one pool, and pay for only those 16 tickets. The deadline matters for nodes that were online before it; a node that starts later asks its peers for the tickets they hold (poolgettkt), and the work in the score is what protects it.

Why not a VRF. Algorand-style sortition, where each node evaluates a VRF on the seed and keeps quiet unless it is selected, was considered and is not used, for two reasons. A BIP340 signature is not a VRF: the signer picks the nonce, so one key can produce many valid signatures over the same message and keep the one that scores best. A real VRF (ECVRF, RFC 9381) would be new cryptography and a new dependency for a property the ticket already has: its work hash is fixed an epoch before the draw seed exists, one ticket per key counts, and anyone can recompute the score. The second reason is that silent self-selection does not fit what guardians are for. A guardian exists to be found by a miner who needs a pool's line, so the seeker has to be able to compute who guards the pool, which needs the tickets to be public. Tickets are broadcast for that reason, not as a cost of the scheme.

Who can be drawn: candidates and tickets

A candidate for epoch e is a node with a .btf identity (every node on this network has one: the secp256k1 x-only key its address encodes, signed with BIP340 Schnorr, src/btfaddr.h) that publishes a guardian ticket for e:

A ticket is 118 bytes. Its body is the first 54:

offsetbytesfield
04network magic (pchMessageStart)
44"BTFG"
84epoch e, little-endian
1232the node's .btf public key, x-only, as its address encodes it
442guard capacity in MB, little-endian (what it offers; informative)
468nonce, little-endian
5464BIP340 Schnorr signature by that key over `SHA256("Bitflash/guard-ticket/1" \\the 54 bytes of the body), made and checked as descriptors are (SignDescriptor, VerifyDescriptor: secp256k1_schnorrsig_sign32, secp256k1_xonly_pubkey_parse and secp256k1_schnorrsig_verify`)

BIP340 verification is specified to the bit, so every node agrees on whether a signature is valid; that matters because a bad signature is scored.

Its work is the main chain's PoW v2 RandomX hash (GetPoWHash, with no new hash code) of this 80-byte header:

header fieldvalue
nVersion0x47465442 (the bytes "BTFG"), a domain tag. What actually keeps a ticket from being a share or a block is the merkle field: SHA256d of 54 bytes is neither a transaction id (a coinbase is longer) nor a merkle node (64 bytes)
hashPrevBlockthe ticket seed of epoch e
hashMerkleRootSHA256d of the 54-byte body
nTimethe network's PoW v2 switch time (PoWV2Time()), so the v2 key and layout are always the ones used
nBitsthe ticket target, a fixed compact value per network
nNoncethe low 32 bits of the body's nonce

The ticket is valid when that hash is at or under the ticket target, the signature verifies, the magic is this network's and the epoch is the previous, the current or the next one by this node's tip. The previous epoch is needed only through handoff: with the tip in epoch c, tickets of epoch c - 1 are taken, held and served while the tip is below 720c + 180, the height at which that epoch's guardians let go, and are dropped and forgotten from that height on. The work hash is that RandomX hash.

Byte orders. Hashes enter SHA256d in their internal byte order (as the node serializes a uint256); the work hash and the score are compared as uint256 numbers, the way a block's PoW hash is compared with its target. Phase C pins vectors for the body, the header, the work hash and the score.

The checked set. A body (SHA256d of its 54 bytes) enters this epoch's checked set only once its signature has verified and its work has passed, and stays whether the ticket is then kept or loses (outranked for its key, or past the cap). So:

A ticket that passes and enters the held set is held and relayed; one that passes but is not held (outranked for its key, or past the cap) stays in the checked set and is not relayed. A connection whose relays keep coming back outranked or past the cap is not scored for it, and is served last from the ticket budget. Only a failure in step 1 or 3 scores the sender, once per message: a pooltkt is read up to its first invalid ticket, and the rest of it is dropped. An unasked relay that finds the ticket budget empty is dropped, unscored (the ticket will come again, or in an answer). A bad signature is never honest, and neither is work that fails against the seed the sender itself named: whatever the two nodes' views of the chain, that check gives the same answer on both. Answered tickets that wait in the queue for budget go through step 2 again when they leave it, the queue is emptied when a seed changes, and a disconnected peer's queued tickets are dropped.

A node that does not listen on an onion cannot be dialled and does not make tickets. A node with -poolguard=0 makes none either.

The draw

For every active registered pool P except pool zero, and every ticket t of epoch e:

score(t, P) = SHA256d( "Bitflash/guard/1" || draw seed of e || poolId of P || work hash of t )

Lowest score first. The guardians of P in epoch e are the 8 tickets with the lowest scores; ranks 9 to 16 are its reserve. With 16 tickets or fewer, every candidate is a guardian or reserve of every pool, within its budget.

This is rendezvous hashing: every pool gets its own random order of all candidates, so an attacker cannot aim at one pool without winning that pool's order, and a node's pools change completely every epoch. Each node computes its own ranks only: pools times tickets SHA256d, about ten million for ten thousand pools and a thousand tickets, a few seconds once a day.

The draw is deterministic over the tickets a node holds, and two nodes may hold slightly different sets (a ticket still travelling). That is acceptable because guardianship is availability, not agreement: no share and no payout depends on who the guardians are. Disagreement at the edges means one guardian more somewhere, never a share judged differently.

When a node is drawn for more pools than its budget holds, it ranks them by the work of the line it holds or was offered, over the pool's last window, heaviest first, and keeps the top 8 that fit (section 11). It learns that work by pulling at handoff, and a pool that turns out empty takes no slot. Pulls are paced by the registered request budget (on a small network every node is drawn for every pool, and pulls them all); a pool whose work is not known yet ranks last. Anchors and registration age do not rank: anyone mining a block can add an anchor, and age would let old spam outrank a new real pool. Work cannot be faked: a spam pool with a few floor shares (seconds of CPU each) ranks below any pool that is really mined. A never-mined pool costs a guardian one p2xsync per epoch, within the request budgets, and a p2xnone when somebody asks; a lightly mined spam pool costs it that and a few shares, and loses its slot to any real pool.

A pool that starts mid-epoch. A guardian of P that holds nothing of it does not announce it, so nobody pushes it shares. So when a guardian sees a poolinv naming a pool it guards and holds no line of, it sends that peer p2xsync for it, within its budgets. Once it holds the line, it announces the pool and shares are pushed to it like to any carrier. A pool started the morning after a draw has guardian copies within minutes, not at the next epoch.

Nodes may disagree about who guards what. Ticket sets differ at the edges, reserve take-up depends on each node's room, and budgets rank on what each node was offered, so there are no tie-breaks to agree on. That only changes who keeps a copy, never a share's validity, and a seeker asks all 16 plus every announcing peer.

Handoff

Reviving a dormant pool

A pool is dormant when nobody mines it: its newest share is older than its TIP_MAX_AGE. To revive it, a miner starts the node with -p2pool=<poolid>:

  1. The node looks for P (above) and asks every source for its line. It takes the heaviest; with no tip of its own, the dormant line is taken whatever its age (Heavier: an empty tip is replaced by anything checked in full).
  2. The anchors pick out the true line. The index knows the main-chain blocks whose coinbase anchored P (section 7), each naming one share's data hash. A line containing the most recently anchored share is the line the pool's last block was found on. When the line that ends a fetch does not hold that share although it reaches back past that block's time, the node logs a warning (the sign of a peer serving a stale or private line), asks up to 4 other announcers for their lines, which join the chain beside it, and logs 10 minutes later whether the chain now holds the anchored share (RegCheckAnchor, p2pool_net.cpp). The anchor decides what is fetched, never which line is mined on: the tip stays the line with the most work, as for every pool. An earlier draft had the node prefer the anchored line "among histories of equal standing"; that is dropped. Equal work almost never happens, a stale prefix of the true line is lighter than the line itself (so fetching the true line is what fixes it), and a tip chosen by which main blocks a node holds would split honest nodes for good, the failure docs/p2pool.md records from testnet. (It is not a validity rule either: an honest guardian may not hold a share that was a block on a side line, and an anchor is a claim anybody may put in a block of their own; a false one costs that block and buys a log line and a few asks.)
  3. The node mines on the tip. The retarget is slow to ease after a long gap: the first share after it is at the old difficulty (its retarget window does not contain the gap), and from then on each share's target is the mean of the last retarget window targets times a factor clamped to 4, so the easing does not compound per share. A lone miner with 1% of the pool's old hashrate needs on the order of a day to bring the line back to its pace. That miner may instead start a new line from a first share (step 4): a live line replaces a dormant one (Heavier, TIP_MAX_AGE), its first retarget window shares are at the floor, and the pool is the same pool. Continuing pays the old window's miners from the reviver's blocks, starting over does not. This is not the reviver's choice alone: once a line is dormant, anybody can replace it with a cheap live one, since live beats dormant whatever the work (pool zero has the same rule today), and the anchor check of step 2 does not stop it. A dormant window's value is the goodwill of whoever mines next; a pool whose miners want their window paid keeps mining it.
  4. If no copy is left anywhere, the node waits as long as a starting pool zero node waits for history, then starts P's chain from a new first share (hashPrevShare = 0), exactly as a pool zero node does with no peers. The pool is the same pool: same id, same rules, same fee, same anchors on the chain. What is lost is the unpaid part of the old window, which had value only if somebody mined on it.

Why the old window cannot be rebuilt from the chain. A main-chain anchor names one share's data hash, and the coinbase it sits in shows the payout list at that moment, but not the shares behind it. Crediting that list to a new chain would make share validity depend on main-chain data, which docs/p2pool.md forbids for a reason the testnet proved: two honest nodes, one holding a main block and one not, judged the same share differently and parted ways for good. So "rebuilt from on-chain anchors" means what it can mean safely: the record alone restarts the pool, and the anchors tell a reviving node which offered line is the real one.

Opting out

Guarding is on by default on every node of a release with the registry, mining or not, because pools travel only if ordinary nodes carry them. It is on through bridges too: a node on Snowflake or meek makes its ticket and holds, serves and pulls pools like any other, at whatever speed its circuit carries (section 17). What that costs a node that never touches an option: one ticket a day (a few minutes of one core at idle priority), at most 128 MB of guarded share chains, at most 64 KB/s serving them, and the ticket traffic of section 11 (about 0.5 MB of tickets a day for each peer it relays them to, plus up to 1.9 MB when it asks peers for a set, 5.8 MB at start).

-poolguard=0: no tickets, never drawn, carries only pool zero, the pool it mines and -poolcarry pools. Mining is unaffected. Such a node also takes no part in ticket traffic: it drops pooltkt and poolgettkt unread, as a node where registered pools are closed does, and a pool it mines is found through announcing peers and poolwho only. -poolguardmb sets the guard budget in MB (default 128); -poolguardkbps sets the pace of each registered history serve in KB/s (default 64, section 17).

In the node (Phase C)

What the rules above leave to each node, as Phase C does it. None of it is a rule another node checks; two nodes doing it differently disagree at most about who keeps a copy.

11. Storage and bandwidth bounds

whatbound
registry indexa few hundred bytes per pool, on disk and in memory; grows only by burns of 1 BTF
pools carriedpool zero, the pool mined, up to 8 by -poolcarry, and guarded pools within the guard budget
guard budget, bytes-poolguardmb, default 128 MB of share chains in all guarded pools, at most 64 MB of it for one pool. A pool whose whole line does not fit in what is left is not guarded by this node at all (not announced; the next in its ranking, and the reserve, hold it): a partial line is useless, since AddHistory needs a whole window behind the newest retarget window shares. Pulls (at most 4) stop at that per-pool cap too (section 10, Pulls)
guard budget, pools with sharesat most 8 at once, whatever the bytes (pools with no shares do not count)
disk writes of lineseach save writes a pool's whole line again: pool zero and local pools every 120 s at most, as before; registered pools (guarded, mined or carried) every 120 s while small, and slower as they grow, so all their lines together are written at 64 KB/s on average (the default guard budget about every 34 minutes). A line not yet written when the node stops is caught up from peers after the restart
on Snowflake or meekexactly as every node: the same budgets, slots, rates and pulls; the circuit alone sets the speed (section 17)
a mined or -poolcarry poolthe caps pool zero has today (MAX_CHAIN_SHARES, MAX_CHAIN_BYTES, MAX_TRUSTED_BYTES), each pool on its own. Pool zero's byte cap rises with what its tip's line and the uncles it names hold (ShareChain::ByteCap), which for pool zero takes most of the network's hashrate; a registered pool's creator alone at the floor could fill a window of 2160 with shares that each pay 6480 addresses (about 220 KB a share, about 2 GB of line). So a registered pool whose chain passes its byte cap and half again (192 MB) is let go, memory and files, and neither fetched, carried nor mined again until a restart (poolinfo says so, and mining it says why). The ceiling is the operator's choice: pool zero, the mined pool and 8 -poolcarry pools at 128 MB each is about 1.3 GB, plus the guard budget; a node with neither option holds pool zero and the guard budget only
guard bandwidth-poolguardkbps, default 64 KB/s, pacing every registered history serve (guarded, mined and carried pools alike, section 17); past it a p2xsync waits (DeferSync), never refused for good. A local pool's serves (section 18) keep 64 KB/s whatever it says
share relayas pool zero: one share per spacing on average (the retarget keeps it there), each at most MAX_SHARE_BYTES, sent only to peers that announced the pool
ticketsat most 4096 per epoch, 118 bytes each: about 0.5 MB a day for each peer they are relayed to; an asked set adds up to 4 answers of 480 KB, about 1.9 MB per epoch, 5.8 MB at start (section 10)
RandomXthree budgets: pool zero's (unchanged), one for all registered pools together, one for tickets; never one per pool
requests from one connectionat most 8 registered pools' histories per SYNC_SERVE_INTERVAL; per carried pool one paced serve in flight, 3 p2xsync asks and one history's worth of shares per interval, resumed asks included; asks about pools not carried, 8 per interval per connection, the rest dropped (section 8)
a fetch in progresspools/<poolid>.part: only the shares the share chain took (never one it already held, whatever its bytes), written from the chain's own copies, and never past the pool's byte cap (MAX_CHAIN_BYTES; past it the fetch goes on in memory only, and a restart resumes from what the file holds); read back no further than that cap. Deleted once the line is complete and written to pools/<poolid>.dat, after 24 hours without a new share (shares already held do not count), or when the index, loaded and at its tip, says the pool is no longer active (section 17)
local pools (section 18)at most 4 per node, each with pool zero's caps (MAX_CHAIN_SHARES, MAX_CHAIN_BYTES, MAX_TRUSTED_BYTES), 16 listed peers and 16 sessions; their traffic in the registered class

What it costs in practice: an honest pool's line is about 2900 shares with their uncles; with a few dozen miners a share is 1 to 3 KB, so a line is 3 to 9 MB, and the default budget holds a dozen or more such pools. A share every spacing (10 s for pool zero, 20 s or more for others) of 2 KB to each of up to 8 peers that carry the pool is under 2 KB/s per pool.

A line bigger than the 64 MB a guardian gives one pool (shares near MAX_SHARE_BYTES, payouts to very many miners) is guarded by nobody on the default settings. It lives with its miners and with -poolcarry nodes, at pool zero's caps; if every one of them leaves, it restarts like any pool with no copy left (section 10, Reviving), and no coins already paid are lost.

-poolguard=0 brings all of it to zero.

12. Threat model, Sybil and DoS

What the registry protects: the rules of every pool, against everybody, including its creator and the project. What guardians protect: the availability of every pool's share chain, against ordinary churn and against anybody short of capturing every copy. What neither protects: the main chain against a hashrate majority (unchanged, as in docs/p2pool.md).

threatwhat happensdefence
spam registrationsthe index grows; guardians are drawn for junk1 BTF burned per pool; a few hundred bytes each; a never-mined pool costs a guardian one request per epoch; guard slots are ranked by line work, so junk with a few floor shares never displaces a mined pool
a pool named like the default ("bitflash", "official") with a 3% feeminers luredwallets show the fingerprint (with the full id), the age, the fee and the work, never the name alone; pool zero is marked as entry zero; poollist and poolinfo list, on each entry, the other pools named alike, pool zero included, and say that names are not unique; the fee is capped and can never rise
fragmentationa small network split into many small pools, each with more variancepool zero stays the default; poollist orders by work; the choice is the miner's
a frozen bug in a rules versiona pool cannot be fixedthe fix is a new version and new pools; releases may refuse to build templates for a broken version, never stop validating it
a fake anchor (a solo block labelled "p2x" + id)a pool looks more successful than it isanchors are shown as claims; a node that carries the pool shows the blocks its share chain confirms, and orders by share work, not anchors
a malicious guardian withholdsa new miner cannot fetch the line from itreserve, lingering set, miners, every announcing peer, poolwho; at worst a restart, no coins lost
all 16 guardians of a pool flooded at once while a miner M is activea new miner N cannot reach the guardiansM announces the pool to its own peers (poolinv) whatever the guardians do, and N asks its peers (poolwho): one peer in common is enough for N to fetch M's line. Hints are not passed on (a lie costs one dial), so with no peer in common N waits and starts its own line; when the two meet, M's line has more work and wins, N's lone shares are orphaned, and M's window and the blocks it found are untouched. The attack costs flooding 16 onion services for the whole time and cutting every common peer, and buys an hour's delay for one newcomer
a malicious guardian serves an old or private linea reviving node mines on the wrong linechain choice by work, TIP_MAX_AGE, and the anchor check (section 10); a forged heavier line needs real PoW
a forged deep historydisplaces an honest lineunchanged from pool zero: the deep end of a history is trusted on work alone, so a forgery needs as much work as the honest line, and is taken only from a peer this node asked: for pool zero within 5 minutes of asking, as today; for a registered pool the first part within 60 minutes of asking, each next one within 5 minutes of the one before, never more than 60 minutes after asking, and never more shares than one history (section 17)
Sybil: many tickets to capture a pool's guardiansthe attacker holds all 8 and the reserve of one pool for one epocheach ticket costs RandomX work, every epoch; the score depends on the work hash, so aiming at one pool after seeing the seed costs a ticket per try; the held set is the 4096 lowest work hashes, so an attacker's share of it, and of every pool's places, follows its share of all ticket work; and capture only buys withholding, which the rows above bound
Sybil: flooding the ticket set to switch guardians off everywhereevery node's 4096 places filled by attacker ticketsthe attacker must out-work honest tickets slot by slot (lowest hash wins, not first arrival); honest guardians whose tickets fall out still hold what they held, miners hold their pools, poolwho still finds announcing peers
grinding the draw seeda miner withholds a block to change the drawthe seed is one block two hours before the epoch; each retry costs a block reward and gives one random redraw; tickets are fixed a whole epoch before; and the prize is withholding
flooding p2x* for pools not carriedCPU, memorydropped at the pool id, unread and unhashed, nobody scored (section 8: scoring would punish honest races and change how pool zero treats the peer); requests rationed by the registered budgets
flooding shares of a carried poolCPUthe shared RandomX budget, the orphan queue cap, scoring of invalid shares, as pool zero
a pool whose shares are as big as rules allowmemoryper-pool and total guard caps (a line that does not fit is not guarded, never kept in part to be served); a fetch in progress is kept in part only by the node fetching it, within the pool's cap, and is not announced, served, relayed or mined on until complete (section 17); a pool's own miners carry it at pool zero's caps
flooding ticketsCPU, memorythe work, the signature, the deadline, the same-body check before any hash, one per key per epoch, 4096 per epoch, the tickets' own RandomX budget, scoring only for bad framing, bad signatures and failed work against a buried seed. Workless relays with valid signatures from throwaway keys over many new connections (each scored message costs a token) cannot starve the sets a node asked for, nor its own pool-tickets.dat: relays and answers take the tokens in turn while both wait, and a connection scored once waits behind every answer for the interval (section 10, In the node)
registered pools crowding out pool zeroa starting 1.2.34 node cannot get pool zero's linepool zero keeps its 1.2.34 budgets and queues for itself alone (section 8)
lies in poolinv / poolwhowasted dialshints only, never passed on; a lie costs one dial, as p2ppeers
PoW reused on two chainsdouble creditexactly one commitment, of one pool, per coinbase (section 6)
a share replayed across networksdouble creditthe network magic is in the pool id
a dormant line replaced by a cheap live onethe dormant window goes unpaidinherent, as in pool zero today (live beats dormant); only a dormant line is exposed, and its window is worth only what the next miner chooses to pay (section 10, Reviving)
the registration reorged outthe pool disappearsit comes back when the same bytes are mined again, by anybody, with the same id; its chain stays on disk meanwhile
main-chain miners refusing registrationsa pool cannot be createdany miner, solo or P2Pool with its own template, can include it; censoring it for good takes orphaning blocks, a majority attack on the main chain
the creator disappearsnothingthe creator has no role after the burn; the fee keeps going to the record's address, which nobody can change

Why the Sybil defence is enough. No scheme that an honest node can afford every day keeps a well-funded attacker from buying many identities; burning coins for tickets or binding tickets to mining payouts would cost honest nodes money or privacy and still only raise the price. What makes the guardian scheme safe is that capture buys nothing but withholding of one pool for one epoch, and withholding is bounded: miners hold their own pool's line, every node that announces a pool is asked, and a pool that loses every copy restarts with the same id and rules, losing no coins already paid. The ticket work is there to make capture cost something and to bound the traffic, not to carry safety.

What capture costs, with the cap. Say honest nodes make H tickets an epoch and an attacker A, all at the same target. The held set is the 4096 lowest work hashes of all H + A, so while H + A stays under 4096 everybody holds everything, and past it the attacker's share of the set is about A / (H + A). Each place of each pool then goes to the attacker with about that probability, independently, so holding all 16 places of one chosen pool takes about (A / (H + A))^16 per epoch: with A = H, one pool in 65,536 per epoch; taking a chosen pool with even odds takes A around 22 times H. Aiming instead, grinding tickets after the draw seed is known until 16 of them top one pool, costs on the order of 16 times H tickets for that one pool, but the cost is heavy-tailed: measured (the attack harness, -selftest=attack-stale), the median is about 20.5 H, the 10th percentile 5.8 H and the 90th 97.4 H, so a lucky grinder captures a chosen pool for a few H and an unlucky one pays around a hundred. The same order as the blind figure above. Raising H is the honest answer: every guarding node makes one ticket a day.

The estimate (A / (H + A))^16 treats the 16 places as independent. They are drawn without replacement from the held set, so the true figure is a little lower, and the difference shows only when the set is small: with 384 attacker tickets among 512, the estimate gives 100 pools in 10,000 and the exact count is 92.5. With thousands of tickets the two agree.

These counts are in tickets, and a ticket is a fixed number of hashes. Honest nodes make theirs at idle priority on one core; a miner's rig in RandomX fast mode makes many times more. In hashes: if a ticket costs W hashes, 22 H tickets is 22 H W hashes, which for any miner is affordable, and filling all 4096 places is too. That is why this section does not rest on the cost: the ticket work bounds traffic and makes capture cost something, and capture still buys only withholding.

13. What stays out of consensus, and why

Nothing in this design needs rules v5 or any main-chain change:

Two things would need consensus and are deliberately left out:

A chain split. Because nothing here is consensus, a split of the main chain (a soft fork that some nodes do not follow, or an attack) needs no rule of its own. Each node reads the registry from its own active chain, the one with the most work. A record mined before the split exists on both sides with the same id; one mined after exists only on the side that mined it. A share commits to a template built on the node's own tip, so its payout lands on that side only. When the split heals, the losing side's registrations and anchors are undone like any reorg (section 3) and come back if mined again, and the pool's share chain is kept on disk throughout. Nothing is re-anchored by hand.

14. Migration

15. Test plan

Self-tests and fuzzing (Phase B, every build)

Testnet proof with real coins (Phase D)

On testnet blocks, with coins that mature and are spent, on at least two machines (this bench and the 202, in private directories), plus a 1.2.34 node on the same network the whole time:

  1. Two pools mined at once. Register pool A (window 720, spacing 20 s) and pool B (window 1440, spacing 30 s, 1% fee to a fresh address); mine both, on different nodes, until each has found blocks. Check each coinbase to the satoshi against its share chain, the fee output to the satoshi, and that the 1.2.34 node kept mining pool zero alongside without a refused share.
  2. An "edit" makes a new pool. Register A' (A with window 1080); show its id differs, A's record and share chain are untouched, and A keeps mining.
  3. The creator goes offline and the pool goes on. Shut down the node that registered B, for good; B keeps finding blocks from other miners.
  4. Dormant and revived from guardians. Stop every miner of A; wait past an epoch change; check the new guardians pulled A's line from the old ones; start a fresh node with -p2pool=<A> and an empty data directory; it fetches A's line from the guardians and its first block pays the old window. Then stop every guardian of A at once, old and new set, during the next handoff, with one node still carrying A by -poolcarry: a fresh node fetches A's line from that node through poolwho.
  5. Revived from the record alone. Delete every copy of A's line everywhere; a fresh miner restarts A from a first share, same id, and finds a block.
  6. Reorg. On the isolated bench pair (-isolate), register a pool, reorg it out before 30 confirmations, and show it disappears from poollist and comes back when re-mined.
  7. Through bridges. Two testnet nodes run behind the bridge ladder for the whole proof, on hosts whose clocks are synced by NTP (offset logged under 0.5 s), in this order:
  8. Neither node has a bridges.txt. Each is first started, runs settorbridges "forget" so no remembered rung changes where it starts, and is stopped; then both start with -torbridges (the bundled Snowflake rung); one stays there, the other is moved once with settorbridges "now" to the next rung, obfs4. gettorinfo confirms each: transport "snowflake" and "obfs4", and transports to match. (A user obfs4 line would show transport "user" and transports ["obfs4"]; that case is a Phase B self-test.)
  9. Pool A (spacing 20 s, depth 3) is mined by direct-Tor nodes holding at least 60% of its hashrate, and by each bridge node with at most 20%, until each bridge node has found at least 200 shares. For each of a bridge node's shares, its delay is measured: found in its log against arrival in a direct node's log, cross-checked against half the round trip of a p2xgetsh for a share the peer holds and its p2xshare answer, both logged with timestamps (ping has no reply to time); the reverse direction is measured the same way. Pass mark: each bridge node loses at most 5% of its shares (neither on the line nor named as an uncle), and its paid fraction (work credited, uncles at their share, over work found) is within 3 points of what the model of section 17 gives when fed each share's measured delays and the measured rate of the other miners' shares. The delays go into section 17.
  10. Both make tickets with default settings, and on testnet's few tickets both are drawn for A within an epoch or two (the step waits for that). Each holds and announces A like a direct guardian; the Snowflake node serves A's line to a fresh node, paced by its circuit, and the obfs4 node serves it too.
  11. With A dormant, a fresh Snowflake node with an empty data directory fetches A's window from guardians; it announces nothing and builds no template while the chain is not complete; its managed Tor is killed halfway and the node restarted; it reloads pools/<A>.part and resumes from its newest share, the shares asked for again after the restart are at most one part's worth, and it starts mining once the chain is complete.
  12. The same with a live pool: while A is mined, a fresh obfs4 node fetches A's line, is restarted halfway, and resumes; the shares found on A meanwhile, and any reorg of its line, end up in its chain, and its first template is on the same tip as the miners'.
  13. Neither bridge node made a connection outside Tor: its firewall log, or netstat showing only the managed Tor's sockets, for the whole step.
  14. A local pool. The proof of section 18 (Tests and proof): two members mine a password-protected local pool to a block whose coinbase pays both, a wrong-password peer gets nothing, nothing public names the pool, one member behind Snowflake.

Each step's proof goes into the PR with explorer links, and the public proofs become text for the #dev channel.

Mainnet

After the release: burn pool zero's record, and publish one real block found through a registered pool, with the explorer link to its "p2x" anchor.

16. Phases

phasecontentstatus
Athis design, revieweddone (PR #82); bridges and the name (PR #84); P2Pool local (section 18, a follow-up)
B1the record checks (both magics), share rules v1 as parameters, the ShareX structure, the "p2l" anchor, the class split of section 8 (registered RandomX budget, orphan queue, send-queue accounting, slow-reader rule, deferred slots and last-good state, all apart from pool zero's) with its isolation self-test, p2l* on the lock-free command path, P2Pool local (section 18: code, password, id, keys, hello, p2l* messages, its RPCs), the job rebuild, paced snapshot serves and resumable fetches, mining a local pool on testnet with real coins (step 8); self-tests and fuzz. Lands first: no registry, no guardiansmerged (#83)
B2the index with reorgs, poolcreate everpool/poollist/poolinfo, pool zero as entry zero, the "p2x" anchor, NODE_POOLREG and the p2x* messages, mining a chosen registered pool on testnetpart 1 (the index and its RPCs) merged (#87); part 2 (NODE_POOLREG, poolinv, the p2x* messages, poolwho/poolat, carried pools, pools/<id>.dat and .part, -p2pool=<pool id>, -poolcarry) merged (#91)
Cguardians: tickets, the draw, handoff, revival, budgets, the transports field of section 17part 1 (tickets, the draw, the guard budget, no network) merged (#89); part 2 (pooltkt/poolgettkt, the ticket thread, guarded pools, handoff and revival, -poolguard*, poolinfo guardians, self-test p2pool-guardians, fuzz-pooltkt) merged (#95); the transports field of section 17 done (gettorinfo, self-test managed-tor)
Dthe testnet proof of section 15done on testnet, every step, payouts spent (PROOFS.md in the Everpool repository)

17. Networks where Tor is blocked

Everpool has to work, in full, for a node that reaches Tor only through the bridge ladder (docs/censored-networks.md: Snowflake, obfs4, webtunnel, meek): mining a registered pool, relaying its shares, fetching a dormant pool's window from guardians, and being a guardian. Nothing in the pool protocol knows or needs to know how Tor reached the network; a bridge is below it. This section is about what bridges cost, and how the design absorbs it.

Latency

What bridges add. A message between two onion services already crosses six relays. A bridge replaces the first hop of one side; obfs4 and webtunnel add little, Snowflake adds a volunteer's WebRTC proxy, meek a CDN round trip, each a second or more. This design plans for 10 s one way between a bridge user and the rest of the network in the worst case, and Phase D replaces that figure with measurements (section 15, step 7).

A bridge user is late twice. It hears a new share d seconds after the others, and keeps mining on the old tip meanwhile; then its own share reaches the others d seconds after it is found. A share it finds can therefore meet a competing share at the same height if another share appeared within about L = 2d seconds around it (20 s in the planned worst case). With the other miners' shares arriving at random at a rate r, that happens to a fraction 1 - e^(-L r) of its shares: this is the contested fraction. For a miner with a small part of the pool's hashrate, r is about one share per S seconds (spacing); for one with a fraction f of it, r = (1 - f) / S. The table below takes r = 1 / S, the worst case.

A contested share is an uncle, not a loss, if it is named in time. It can be named by a share on the line at most D (uncle depth) heights above it. With the job rebuilt as soon as an uncle candidate arrives (section 9), the next share found after it arrives names it, so it is lost only when the line has already grown D or more shares past it by then. The delay from the competing share to the late one's arrival is between 0 and L (taken as uniform); with N the number of line shares found in that delay (Poisson, mean delay times r), the share is lost when N >= D. Without the rebuild it would be lost at N >= D - 1, since only a template built at the next tip change could name it: for pool zero at the planned worst case that is 23% of a bridge user's shares lost instead of 9%. (The 9% needs the nodes finding the next shares to rebuild; while most of pool zero's hashrate runs 1.2.34, it stays near 23%.) A rebuild every 2 s does not waste miners' work: the stratum keeps the last MAX_RECENT_JOBS (8) jobs valid, at least 16 s of them.

What it costs, at the planned worst case (L = 20 s) and at a typical obfs4 or webtunnel link (L = 6 s), with the uncle share at 80%. Lost shares earn nothing; contested shares that are named earn 80% of their work; the rest earn in full. "Paid" is the work credited over the work found. A direct-Tor miner, at L of 2 to 3 s, is paid 97 to 99% at 20 s or more.

spacing, depthcontested at 20 slost at 20 spaid at 20 spaid at 6 s
10 s, 3 (pool zero)87%9.4%75%91%
20 s, 363%1.5%86%95%
30 s, 249%2.6%88%96%
40 s, 239%1.3%91%97%
60 s, 128%4.2%91%98%
90 s, 120%2.1%94%98%
120 s, 115%1.2%96%99%

So the record rule (section 1) is set on the loss: spacing times depth of at least 60 s, no depth 0, uncle share of at least 80% keeps a bridge user's lost shares under 5% in the planned worst case, for every registered pool. What remains is the uncle discount on contested shares. A creator who expects many miners behind Snowflake or meek can lower it with a longer spacing, or with a higher uncle share; the uncle share is also what an includer gives up by naming uncles, and pool zero's 80% is a balance between the two. Pool zero stays usable through bridges, at the cost the first row shows, and its rules cannot change; a miner on a slow bridge does better in a pool with a longer spacing, and poollist shows every pool's spacing and depth.

The model is approximate (a steady share rate, a uniform delay), and Phase D checks it: the pass mark of step 7 is a lost fraction of at most 5%, and a paid fraction within 3 points of what this model gives when it is fed, share by share, the delay measured for that share and the rate of the other miners' shares measured over the run.

The time rules need no change: a share may run 120 s ahead of a node's clock, and a line counts as live for 180 share intervals. That clock is the later of the node's own and the one its peers' version messages suggest. The peers' clock alone does not do: over Tor those messages come in late, and only late, so their median drifts behind (184 s measured on a Snowflake node in Phase D while it caught up after its start, 39 to 62 s on direct nodes started beside it), which put every fresh share past the 120 s and had it refused. The own clock alone does not do either, on a node whose clock is slow and has no NTP; the later of the two serves both, and peers still move it at most 70 minutes ahead, as before. Keep the system clock right (NTP); a share's time is each node's own policy, so no other node judges anything differently for it.

Histories over slow links. A line of 3 to 9 MB takes minutes over meek, and a guardian behind Snowflake serves at whatever its circuit carries. Pool zero keeps its rules as they are (section 8: p2pshares parts of 400 shares and up to 2 MB, the whole history queued at once, taken within 5 minutes of asking, SYNC_ANSWER_WINDOW). Registered pools have their own messages and are served differently:

So the slowest link a fetch survives moves a part every 5 minutes, about 1 KB/s, and a server at the default rate gives every serve at least 8 KB/s of it, when its circuit carries that. A stalled fetch ends 5 minutes after its last part, and no peer can keep a window or a slot open longer than an hour, or push more than one history into a window. A 9 MB line takes about 19 minutes at 8 KB/s; over a circuit that carries only 2 KB/s it takes about 75 minutes and spans two asks, and the resume point makes the second one cost only the rest. A sliding window for pool zero would be local to the receiver and change nothing a server sees; whether pool zero needs it is measured over meek in Phase D before any change.

Bandwidth

What the node knows about its transport. BtfTorTransportMode() (tor.cpp) gives the rung for the bundled ladder, but only "user" for the operator's own lines (settorbridges, -torbridge, bridges.txt), and "direct" with an external Tor. So the node also classifies the bridge lines it gave Tor, by their first word (BtfBridgeTransport over g_torBridges, read under cs_managedTor, which BtfSetTorBridges then takes to write it too): snowflake, obfs4, webtunnel, meek_lite reported as meek, and any other kind passed through as written. gettorinfo gains a field transports: the sorted list of the kinds in the lines Tor has now, empty when Tor runs without bridges; with an external Tor the node cannot tell, and says so: transports is null and a transportsnote explains why. The field is for the operator and for Phase D, and is redone each time Tor is restarted on new lines (the ladder climbs, the operator calls settorbridges). Nothing in the pool protocol depends on it: every choice below is the same on every transport.

Guarding through bridges is on, and looks the same. Tickets are public, the draw is deterministic, poolinv is seen by peers, and a peer can compare how fast a node serves pool zero's history (queued whole, at the circuit's speed) with how fast it serves a registered one. So anything a node on a censored network did differently would point it out: stopping its ticket, holding fewer pools than its ticket and the draw say it should, capping its serving rate below what its circuit carries, or pulling fewer pools at once. A node behind any bridge therefore does all of it exactly like any other: the same ticket, the same byte and pool budgets (section 11), the same 8 serve slots, the same default serving rate (64 KB/s, -poolguardkbps), and the same handoff pulls (at most 2 pools at a time). A slow bridge needs no rule of its own: paced serving queues the next part only when the previous one has left the send queue, so the circuit itself sets the pace, which is what any slow circuit looks like. A lower -poolguardkbps or -poolguardmb, or -poolguard=0, stays an explicit operator choice, as on any node (an operator on a metered link makes it; the budget shows in the ticket, or the ticket is absent, as for anyone who chose so).

A pull goes to the announcing peer that serves fastest, and moves to another (with its resume point) when a serve averages under 1 KB/s over 5 minutes; a guarded line of up to 64 MB takes from about 20 minutes to a few hours, and the old guardians, the reserve and the miners hold it meanwhile (section 10, linger).

No "low-bandwidth" flag on the wire. A flag in tickets or in poolinv would tell every node which nodes sit on censored networks. So a node never says so: the ticket's capacity field carries only an explicit -poolguardmb, or the same default for everybody, and a slow bridge changes only how fast bytes move, which is what any slow circuit looks like.

Bounded handoff. A guarded line is at most 64 MB (section 11). Ticket traffic is about 0.5 MB a day for each peer the node relays tickets to, plus up to 1.9 MB per epoch when it asks peers for a set, 5.8 MB at start (section 10).

Resumable fetches. A history arrives oldest first, in parts, and each part is taken as it arrives (AddHistory per part).

Metered links. A node that only mines a pool pays for one history, then each share of the pool in and out once for each peer that carries the pool (the share relay sends it whole to each), plus the share relay of pool zero as today. -poolguard=0 and no -poolcarry keep it there.

No new fingerprint

Testing

Section 15: the Phase B self-tests for the spacing rules, the job rebuild, resumable fetches, paced serving, the receiving window, the complete state and transports; and Phase D step 7, where a Snowflake node and an obfs4 node on testnet mine a registered pool against the pass mark above, guard it, and fetch a dormant window and a live line across a restart, with the measured delays written back here.

The delays are read from sharetime.log, which a node started with -sharetimelog writes in its data directory: one line per registered share event, <unix ms> <event> <pool id, 16 hex> <share id> <share height> <peer>, for a share found on this node (found), received from a peer (recv), sent to one (send) and asked for (getsh, probe). debug.log carries no time and collapses share lines within 3 s of each other, so it cannot serve. The poolprobe <pool id> RPC asks every connected peer that announced the pool for this node's tip share; the probe line and the answer's recv line give the round trip. The answer is a share already held: taken for nothing, nobody scored. Both are off unless asked for, and change nothing in the protocol.

18. P2Pool local: a private pool

Everpool is public on purpose: anyone can find a pool, join it and keep it alive. Some groups want the opposite: the machines of one home, one office or a few friends, mining together and paying each other fairly, with nothing published anywhere. (Each payee runs a node of its own: the stratum pays every share found through one node to that node's -p2poolpayto, so several machines behind one node pay one person.) That is P2Pool local. At creation the user picks one of the two:

EverpoolP2Pool local
where the pool is definedan OP_RETURN record on the chain, 1 BTF burneda pool code the members share among themselves; nothing on the chain, nothing burned
who can find iteveryone (poollist)only who is given the code (and the password, if it has one)
who carries its share chainits miners, guardians drawn at random, anyone with -poolcarryonly its members' nodes
who it talks toevery NODE_POOLREG peer that carries itonly the peers its members listed
when its nodes all go awayit lives on in guardians, and the record restarts itit is gone, by design

Pool zero, the default P2Pool, stays as it is for whoever picks neither.

What a local pool is

A local pool has the same parameters as an Everpool pool and obeys the same share rules v1 (section 5), and its shares have the ShareX/ShareDataX structure of section 6 plus a salt, with the anchor rule below in place of section 6's "p2x" rule: it is the same code with a different identity and a different reach. A share whose ShareDataX.poolId is not the session's pool is invalid, and its sender scored, as in section 8. Its parameters are a record in the format of section 1, with three differences:

Every other rule of section 1 applies unchanged, the canonical encoding included (spacing 20 to 120, spacing times depth at least 60, uncle share 80 to 100, the fee rules), so the share rules code has one path, and a local group whose members sit behind bridges gets the same latency margins as any pool (section 17).

Identity: the pool code and the password

A node stores the record, K and the listed peers in pools/local/<id>.conf, never the password. Whoever reads that file can join the pool, as whoever has the code and the password can: membership is the only thing it protects.

What a password buys. Without one, the pool is private only as long as its code is: anyone who has the code, or guesses it (a default record with a common name is easy to guess), computes the same id and key. With one, the code can be shared openly and the pool is still closed. Precisely: someone who holds the code but not the password can test a password guess offline only against a hello sent to it, which a member sends only to a peer it listed. Everything on the chain, and everything sent to anyone else, gives it nothing to test against: the id and the shares go only to members in session; the coinbase anchor (below) hashes a 256-bit random salt that never goes on the chain, so checking a guess against it means guessing the salt as well; and a hello is bound to the onion it was sent to, so only the listed peer that receives it can check it, at one Argon2id run per guess. The salt does this for the anchor, not the key C: whoever holds the code derives C from each guess as easily as the id. Members can test guesses (they hold shares, which carry the id and the salt), but they already hold K. The operator's own copies of the id and password are kept out of argv and logs (above, and Using it).

The coinbase anchor

A local pool's share data is section 6's ShareDataX with one more field, a salt, right after poolId:

ShareDataL {
    uint256 poolId;               // as ShareDataX
    uint256 salt;                 // 32 random bytes, fresh for every template
    uint256 hashPrevShare;        // and the rest as ShareDataX
    vector<uint256> vUncles;
    unsigned int nShareHeight;
    unsigned int nShareBits;
    vector<unsigned char> payoutScript;
}

serialized in that order, so a local share (ShareL) is a ShareX with 32 more bytes after the pool id. The node that builds a template draws the salt from its strong random source; the share carries it to the members, in p2lshare and p2lshares and in each member's pools/local/<id>.dat, and nothing puts it on the chain. Pool zero's share bytes do not change, and a registered pool's share has no salt.

The coinbase carries a 35-byte push: "p2l" and HMAC-SHA256(C, SerializeHash(ShareDataL)) (the share data, poolId and salt included). Members check it with C.

Why the salt. Everything else in the share data is often public or guessable: poolId follows from the code and a guessed password, hashPrevShare is 0 or the hash of a block on the chain, vUncles is often empty, the height is small, nShareBits is the record's floor for the first retarget window, and payoutScript is one of the coinbase outputs. The first share of a chain, mined into a block, is all of that: (id, 0, [], 0, floor, the one output). Keying the hash with C adds nothing against someone who holds the code, since C follows from the guess as the id does. Without the salt, such a block would let them run a dictionary offline, one Argon2id run per guess. With it, a guess can only be checked by also guessing 256 random bits, so the block tells them nothing about the password (section What a password buys). A restart from the same code and password, or a block whose parent share was also a block, gets a fresh salt like any other.

It carries no pool id, so:

The share rules of section 6 extend to it, so that one PoW counts on at most one share chain:

The scriptSig is at most 59 bytes (the anchor is 32 bytes shorter than "p2x"). The anchor counts of section 3 ignore "p2l" pushes: there is no pool to count them for.

Members find each other, and nobody else finds them

There is no discovery. A local pool is never announced in poolinv, never named in poolwho, never given a ticket or drawn for guardians, never relayed to a peer that did not prove membership, and never listed by poollist on any node but its members' own. Members exchange, out of band: the pool code, the password if any, and the onion addresses of the member nodes that accept connections.

So a non-member that a member listed by mistake (it receives that member's hellos) can neither replay one to another node (the tag names its own onion), nor relay a handshake between two members (the receiver checks the tag against its own onion, and the reply and ack are bound the same way), nor learn who the other members are. The session is named on that connection by h = HMAC(A, "session" || O || nA || nB), first 8 bytes, and every later message of the pool carries h, never the pool id. A receiver checks at most one p2lhello per connection per minute and 8 in the life of a connection, and keeps the last 256 nA of each pool to drop a repeated one; a reply not acked within 30 s is forgotten and holds no session. A member's hello on a connection that already holds a session of that pool is answered, and its ack replaces that session: the other side has lost it (its operator took this node off the list and put it back). At most 16 sessions per local pool, inbound and outbound together; a hello beyond that gets the same silence as no match. Hellos over these limits are dropped unread, and nobody is scored for a hello that matches nothing (a non-member listing this node by mistake is not an attack).

Limits

A local pool spends from the registered class of section 8, never from pool zero's: its shares are checked through the registered RandomX budget (a member in session is proven, and its shares still draw on budgets of their own: one per session, twice the pool's share rate with a small burst, and one per local pool for all its sessions together, one share every 8 s with a burst of 16, so the members of one pool cannot spend another's; a share over them is held, not hashed and not scored). Within a pool the sessions take turns for the pool's budget: the session that wasted fewer of its tokens lately goes first, then the one that had a token longer ago, and a share that comes in live waits behind one held for a session ahead of it. A token is wasted when the share it paid for is a side share: it did not become this node's tip (judged after the orphans it lets in are connected), it did not build on this node's tip when it came, and this node did not ask for it in the last 10 minutes. A share whose line becomes the tip pays one back; a share that built on the tip when it came (it lost a race, or waited in this node's queue while the tip moved on) and a parent or uncle this node asked for change nothing. A new session, a member's reconnect among them, starts with as many wasted tokens as the session of its pool that has the most, and its last token now: at the back. So a member flooding side shares from many sessions falls behind every member whose shares extend the pool's line; sessions it keeps idle get one turn each ahead of such a member, no more, and the member loses no place for having waited behind them. Its orphans wait in the registered queue, its serves take the 8 registered slots and the per-(connection, pool) limits of sections 8 and 17, with the session in place of the pool. On top of that: at most 4 local pools per node, at most 16 listed peers and 16 sessions each (above), and the byte caps pool zero has (MAX_CHAIN_SHARES, MAX_CHAIN_BYTES, MAX_TRUSTED_BYTES) for each. A peer that sends an invalid share in a session is scored, as for any pool.

Sessions that are not proven yet (inbound ones whose peer has not sent a share this node took) have no budgets of their own: they share the registered class's pieces with the unproven peers of every local pool on the node, and of every pool of that class later: the RandomX budget for unproven peers (32 hashes, one more every 2 s), the orphan queue of 256 shares, and the 64 held slots (one share and one history ask per connection). A member flooding from unproven sessions so delays the other pools' unproven sessions too, never pool zero and never a proven session. Only members hold such sessions (a message needs a session's handle), at most 16 a pool, so the 64 held slots are always enough for one each. What it costs an honest member: the first share of a member that has just reconnected inbound (and is not proven again until a share of it is taken) may wait behind the held shares of a flooding member's other sessions, at most 15, served one every 2 s once the budget's burst is spent: up to about 32 s. An orphan of it may also lose its place in the queue of 256 to the flooder's orphans (each of which cost the flooder a hash on the same budget). Once one of its shares is taken, it is proven, and its own budgets apply.

When the members go away

The share chain lives in pools/local/<id>.dat (and a fetch in progress in pools/local/<id>.part) on each member node. When every member stops, the pool stops; when one comes back with its file, the pool goes on from there, and when none has the file any more, starting again from the same code and password gives the same id and a fresh chain. Nothing is left anywhere else to clean up. The file starts with a format byte (1 in this release); a node reads its own format only, and starts a pool whose file has another one from its peers, saying so in its log. That file is set aside first, as pools/local/<id>.dat.other, so nothing saved later writes over it; it goes with the pool's other files when the pool is left.

Using it

calldoes
poolcreate everpool {params} ["send"]an Everpool pool: the record of section 1, burned on the chain with "send" (or "publishzero" for pool zero's own record), shown without it (section 9)
poolcreate local {params} [password]a local pool: checks the record as section 1 does, with the defaults of section 9, derives the id, saves pools/local/<id>.conf, and returns the name, the pool code and the note below. A name already used by a local pool on this node is refused. Nothing is sent anywhere
pooljoin "<pool code>" [password]joins a local pool from its code: checks the checksum and the record, derives the id, saves the file, returns the name and the note. A name already used by a local pool on this node is refused (after joining with a mistyped password, poolleave and join again)
poolpeers local:<name> ["ADDR@HOST.onion", ...]sets the listed peers of a local pool (at most 16); with no list, shows each and its state: connected with a session, this node at its session cap, or no proof (not a member, a wrong password, or the peer at its own cap, which answers with silence)
poolleave local:<name>forgets a local pool: closes its sessions and deletes its files. Refused while this node mines it: restart the node without -p2pool=local:<name> first
poollist, poolinfoshow this node's local pools too, marked "local": true, with their sessions; never any other node's

poolcreate with no mode is refused with a message that names the two, so nobody burns 1 BTF by default. Mining a local pool is -p2pool=local:<name> (section 9 otherwise unchanged). The password is typed in the GUI's dialog, or read by the RPC client from a prompt or from stdin, never passed as a command-line argument, where other users of the machine, and the shell history, would keep it.

The result of poolcreate local and pooljoin, the GUI, and the release notes carry the same informative note, without alarm:

A local pool finds blocks in proportion to your machines' hashrate: rarer but larger payouts; the average is the same as any pool.

Tests and proof


Rendered from docs/pool-registry.md in the repository. Read the source.