Mining - Activations
Miners become eligible to mine in Spacemesh by publishing an Activation Transaction (ATX). The ATX is a Spacemesh-specific data structure that contains a NIPoST, a publicly verifiable, self-contained proof that the miner committed some space-time resources to the protocol.
The previous documents in this section describe the theory behind a set of independent protocols (PoST, PoET, NIPoST) that form the foundation of the Spacemesh mining construction. With ths background in place, we are now ready to see how these building block fit together in practice to enable the Spacemesh mining construction in the production network. In particular, we'll see how the NIPoST (which itself contains the PoST and PoET) is wrapped, with accompanying metadata, into an ATX and used in the Spacemesh protocol.
#Epochs and eligibility
In Spacemesh, multiple blocks are produced at each block height: the set of blocks produced at a given height is known as a layer. Time is divided into epochs, where an epoch is a fixed number of layers (unlike protocols like Bitcoin where blocks are produced probabilistically, and thus at random intervals, in Spacemesh the length of time between each layer is perfectly fixed and always the same). Every miner publishes one ATX per epoch, which causes the protocol to consider them “active” in the following epoch.
Due to the race-free nature of the Spacemesh protocol, being “active” guarantees a miner eligibility to produce blocks. The reward calculation and total voting weight of the blocks produced by a given miner in the consensus protocol are proportional to the space-time resources attested to by that miner in the NIPoST (contained in their ATX). An active miner is also eligible to participate in Hare consensus protocol [LINK forthcoming].
An epoch is long enough that each active miner should be able to generate at least one block per epoch (and probably many more)—e.g., if there are 100,000 active miners, and 200 blocks per layer, each epoch should be at least 500 layers long. The positions of a given miner’s blocks within layers in the epoch and the participation period in the Hare protocol are selected using a verifiable random function (VRF), a source of randomness that is verifiable, unpredictable and unbiasable by an adversary. This is necessary to ensure (with high probability) that the majority of blocks in every layer is generated by honest parties.
[Consider adding an illustration or animation here to make it clearer how and when ATXs are generated, broadcasted, stored, etc.]
Unlike the PoST and PoET constructions, an ATX is not itself a proof and as such it does not require any additional commitment of resources or complex computation. Instead, like NIPoST, it’s a data structure that wraps the ATX along with relevant metadata. An ATX is a “freestanding” transaction: it does not have to be included in a block to be valid, but can just be gossiped to the network directly.
In addition to the full NIPoST attested to by the ATX, the ATX also contains fields such as the ID of the previous ATX from the same miner, the time when the eligibility for this ATX starts and ends, and the miner’s signature. See the full protocol specifications for an elaboration of the full contents of the ATX.
Every valid block [LINK forthcoming] contains a pointer to a valid ATX that authorizes the miner in question to produce a block in the epoch and layer where the block was produced. In order to determine whether a given block is valid, a miner first fetches the ATX that the block points to, and validates that ATX. The ATX is considered valid if it has a valid signature from the miner, if no duplicate ATX was published, if the NIPoST it contains is valid, and if the time indicated by the ATX matches the duration attested to by the NIPoST. These validation rules prevent a dishonest miner from pre-generating ATXs for multiple identities, reusing the same storage space, and publishing them all in a single future epoch. See the full protocol specifications for a full elaboration of the validation rules for an ATX.
Congratulations, dear reader, on making it to the bottom of this deep, dark rabbit hole! With all of the building blocks in place—PoST, PoET, NIPoST, and ATX—you now fully understand all of the components of the Proof of Space-time protocol underlying the Spacemesh blockchain, and how they fit together to allow miners to prove in a publicly verifiable, self-contained, non-interactive fashion that they’ve committed a certain amount of space-time resources to the protocol. Read on to learn about the other parts of the protocol.