Harvester Protocol
The harvester protocol defines the messages sent between a farmer service and a harvester service. These tend to be on the same machine for small farmers, but for medium or large farmers they can be in multiple machines.
harvester_handshake
The handshake between farmer and harvester. A farmer sends this message to harvesters, to initialize them and tell them which pool public keys and farmer public keys are acceptable to use.
A farmer can be connected to multiple harvesters, but a harvester should only have one farmer connection. The harvester can start using plots which have these keys associated with them.
class HarvesterHandshake(Streamable):
farmer_public_keys: List[G1Element]
pool_public_keys: List[G1Element]
new_signage_point_harvester
This message is a notification from the farmer to the harvester of a new challenge.
The harvester first checks which plots pass the plot filter (see the Harvester Algorithm page), and for those that do, fetches the quality.
For an original-format (v1) plot, this requires around 7-9 random reads (and thus disk seeks) for each quality.
Each plot is expected to have one proof of space (and therefore one quality) on average, so for 50 plots, a harvester would have around 50 qualities.
For those qualities that are sufficiently good to win a block or a pool partial, the whole proof is fetched (64 random reads in the plot),
and then new_proof_of_space is sent to the farmer.
class NewSignagePointHarvester(Streamable):
challenge_hash: bytes32 # The challenge hash for the sub slot in which the signage point lies
difficulty: uint64 # The current blockchain difficulty
sub_slot_iters: uint64 # The current blockchain sub-slot iters
signage_point_index: uint8 # The signage point's index, from 0 to 63. 0 for an end of sub slot signage point
sp_hash: bytes32 # The hash of the signage point, this is == challenge_hash iff the index is 0
pool_difficulties: List[PoolDifficulty] # List of each pool the farmer is in, and what the difficulty is for that pool
filter_prefix_bits: uint8 # The number of leading zero bits a plot's filter hash needs to pass the plot filter
class PoolDifficulty(Streamable):
difficulty: uint64 # The current difficulty that is set for plots belonging to this pool contract
sub_slot_iters: uint64 # The pool sub slot iters, which is static for each network (mainnet, testnet)
pool_contract_puzzle_hash: bytes32 # The pool contract puzzle hash which can be in many plots
The message above is sent to harvesters running protocol version 0.0.36 or older.
Harvesters running protocol version 0.0.38 or newer (Chia 2.7.4 and later) receive NewSignagePointHarvester2 under the same message ID instead.
It drops filter_prefix_bits (the harvester computes the filter itself) and adds the fields below.
class NewSignagePointHarvester2(Streamable):
challenge_hash: bytes32
difficulty: uint64
sub_slot_iters: uint64
signage_point_index: uint8
sp_hash: bytes32
pool_difficulties: List[PoolDifficulty]
peak_height: uint32 # Used to compute the v1 plot filter
last_tx_height: uint32 # Used to compute the v2 plot filter
filter_challenge: Optional[bytes32] # The plot filter challenge for new-format (v2) plots
new_proof_of_space
A successful proof of space that is sent to the farmer. The challenge_hash, sp_hash, and signage_point_index
correspond to the ones sent in new_signage_point_harvester. Many proofs can be submitted for each signage point.
The plot is a string chosen by the harvester to represent the winning plot (and proof index) in future communications between the farmer and harvester. This can be, for example, the filename of the plot with an additional byte for the index. This is relevant, because a certain plot can potentially have more than one proof for each signage point, and we want communications for each proof to be separate and not conflict (specifically to fetch signatures from the harvester).
class NewProofOfSpace(Streamable):
challenge_hash: bytes32
sp_hash: bytes32
plot_identifier: str
proof: ProofOfSpace # The actual proof of space which contains more data, shown below
signage_point_index: uint8
include_source_signature_data: bool # Set by third-party harvesters that want the source data of the messages to sign (CHIP-22)
farmer_reward_address_override: Optional[bytes32] # Set by third-party harvesters to override the farmer reward address
fee_info: Optional[ProofOfSpaceFeeInfo] # Optional fee information from third-party harvesters
class ProofOfSpaceFeeInfo(Streamable):
applied_fee_threshold: uint32
class ProofOfSpace(Streamable):
challenge: bytes32 # This is the challenge for the pospace, explained in the Signage and Infusion Points page
pool_public_key: Optional[G1Element] # Only one of these two should be present
pool_contract_puzzle_hash: Optional[bytes32] # Present only for pooled plots
plot_public_key: G1Element # Explained in the keys section
version: uint8 # 0 for an original-format (v1) proof, 1 for a new-format (v2) proof
plot_index: uint16 # v2 only (0 for v1 proofs)
meta_group: uint8 # v2 only (0 for v1 proofs)
strength: uint8 # v2 only (0 for v1 proofs)
size: uint8 # v1: k size, usually 32 but can vary; 0 for v2 proofs
proof: bytes # v1: proof bytes, 64 k bit values, total size 8k bytes
request_signatures
This is a request from the farmer to the harvester for a signature from the plot key, for a specific plot (using the
plot identifier from new_proof_of_space). The farmer can request signatures from multiple messages.
class RequestSignatures(Streamable):
plot_identifier: str
challenge_hash: bytes32
sp_hash: bytes32
messages: List[bytes32]
respond_signatures
This is a response to request_signatures. The local public key is the public key corresponding to the secret key
in the plot. To see more about the keys for plots, look at the BLS Keys page.
class RespondSignatures(Streamable):
plot_identifier: str
challenge_hash: bytes32
sp_hash: bytes32
local_pk: G1Element # Key in the plot
farmer_pk: G1Element # Key controlled by farmer
message_signatures: List[Tuple[bytes32, G2Element]]
request_plots
A request from the farmer to the harvester for the list of all plots being farmed by the harvester.
class RequestPlots(Streamable):
pass
respond_plots
A response to request_plots request. This message is also sent whenever a new plot is loaded.
class RespondPlots(Streamable):
plots: List[Plot]
failed_to_open_filenames: List[str] # Filenames for files which cannot be opened
no_key_filenames: List[str] # Filenames for files which cannot be farmed by this farmer
class Plot(Streamable):
filename: str
size: uint8
plot_id: bytes32
pool_public_key: Optional[G1Element]
pool_contract_puzzle_hash: Optional[bytes32]
plot_public_key: G1Element
file_size: uint64
time_modified: uint64
compression_level: Optional[uint8]
Harvesters and farmers running protocol version 0.0.38 or newer (Chia 2.7.4 and later) exchange RespondPlots2 instead, with the same fields, whose Plot2 entries also carry plot_index: uint16 and meta_group: uint8 (used by new-format v2 plots).
Implementation Details:
- Plot filter computation is performed entirely on the harvester
- For original-format (v1) plots, only plots whose filter hash starts with 8 zero bits (1 in 256 plots, since the June 2024 hard fork) proceed to quality lookups
- New-format (v2) plots, which can only farm after the Chia 3.0 hard fork, use a different, predictable plot filter
- This optimization maintains the same cryptographic security while improving performance