Z-Chain
Merged mining: every share on a SHA-256d or scrypt chain becomes a Sharenote, with no extra hashing.
Summary
A miner securing a proof-of-work chain can mint Sharenotes for free. The note is committed inside the parent chain's coinbase under the z-chain's slot, chain id 0x534E ("SN"). Every share the miner finds, not only full blocks, becomes an attributed note.
The parent chain needs no change. Because every share is public, anyone watching the parent chain can estimate a miner's hashrate from its notes.
minersrig buildersrelay operators
Two new algorithms
SNP-02 adds one registry id per parent proof of work. The work is the parent's 80-byte header hash.
| Algorithm | Parent proof of work |
|---|---|
sha256d-aux | SHA-256(SHA-256(header)) |
scrypt-aux | scrypt(header, salt = header, N = 1024, r = 1, p = 1, 32 bytes) |
| Part | Value |
|---|---|
| z-chain header | the SNP-01 record with nonce length 0 |
| z-chain hash | SHA-256d(z-chain header), a leaf of the aux merkle tree |
nonce | the proof linking the parent header to the commitment |
H | the parent header's PoW hash, byte-reversed |
H ≤ T means the parent header cleared the note's own target. A share is enough. It need not be a parent block.
The commitment
In the first input's script of the parent coinbase, the marker FA BE 6D 6D occurs exactly once, followed by the aux merkle root (32 bytes, byte-reversed), the tree size 2^h (4 bytes LE) and the merkle nonce (4 bytes LE).
The z-chain's slot comes from chain id 0x534E and the merkle nonce n, on unsigned 32-bit integers:
r = n
r = r * 1103515245 + 12345
r = r + 0x534E
r = r * 1103515245 + 12345
slot = r mod 2^h
For n = 1, h = 2 the slot is 1. With h = 0 the z-chain is alone and its hash is the root. Two chains collide when their ids agree in the lowest h bits, so a builder raises h until every slot differs.
One record per header
A parent header commits at most one z-chain record, so the same work is never credited twice: not to two identities, two offers or two algorithms. Three locks fix a single leaf:
| Lock | Verifier checks | Without it |
|---|---|---|
| one root | the marker occurs exactly once | a second marker carries a second tree |
| one height | tree size = 2^(aux branch length) | a forged size shifts the slot |
| one slot | side mask = the z-chain's slot | a z-chain hash in another leaf would verify |
Other merged chains may fill the other leaves. Only the leaf at the z-chain's slot verifies.
Proof and verification
The record's nonce holds, in order: the 80-byte parent header, the coinbase length (2) and coinbase, the coinbase branch (count, then hashes), the aux branch (count, then hashes) and a 4-byte side mask. Each branch has at most 30 hashes; the whole proof at most 65,535 bytes. A merged note is about 300 to 1,000 bytes.
A merged note passes SNP-01 checks 1 to 4 as usual. Check 5 becomes, with any failure a REJECT:
- the nonce parses as a proof with nothing left over;
- the coinbase branch reaches the header's merkle root;
- the commitment is exact and the aux branch climbs from the z-chain hash to its root (the three locks);
H ≤ T.
Changing algorithm, identity, Z-bit or binding changes the z-chain hash. So a share cannot be re-claimed, raised to a higher Z-bit, or pointed at another offer.
Building and solo merged mining
- Z-chain header: the SNP-01 record with the
-auxid, identity, Z-bit, binding and an empty nonce. Hash it. - Tree: alone,
h = 0. Otherwise pickhso every slot differs. - Coinbase: write the marker, root, size and merkle nonce once, beside an extra-nonce.
- Template: coinbase first; the extra-nonce changes the merkle root, not the branch.
- Mine: each header with
H ≤ Tis a share; publish it as a note. A header that clears the parent target is submitted as a block.
A miner needs no pool. From its own node it chooses any binding: a service epoch (access paid in work), a reaction (a like), a sale (a bid) or nothing (an unbound note). A share that is also a block pays the miner as usual.
Hashrate from shares
Take a miner's merged notes in the parent's algorithm, each H once, mined on a block you saw arrive or a descendant. With t seconds since that arrival:
rate ≈ (1 / t) · Σ 2^256 / T_i
Withholding shares only lowers the estimate. The spread is about 1/√n for n shares of one size:
| Shares | Spread |
|---|---|
| 10 | ±32 % |
| 100 | ±10 % |
| 1,000 | ±3 % |
A miner hashing R times per second at z makes about R / 2^z notes per second. Raise the share size to keep relays comfortable. Withheld blocks cannot be detected from notes.
Worked example
The scrypt-aux test vector: a 4z00 note, the z-chain in slot 1 of a tree of height 2 (merkle nonce 1, tree size 4).
| Value | Result | |
|---|---|---|
H | 0ac77cf9…c84126ad | |
note target, 4z00 | 1000…0000 (2^252) | H is below: a valid note |
parent target, bits 1e0fffff | 00000fffff00…00 | H is above: not a block |
The record is 386 bytes: SN4U, version 1, scrypt-aux, identity, 04 00, a 32-byte binding, and a 299-byte nonce holding the 80-byte parent header, a 115-byte coinbase with fa be 6d 6d + aux root + tree size 4 + merkle nonce 1, one coinbase-branch hash, two aux-branch hashes (#3 then #2) and side mask 1.
The aux branch climbs #1 = SHA-256d(#3 ‖ leaf) (mask bit 1, running hash on the right), then #0 = SHA-256d(#1 ‖ #2). If #0 equals the root after the marker, the leaf is in the tree. The header is a share: it mints a note, while the parent chain would refuse it as a block.
Try it
Merged mining
Follow one template from coinbase to share or block, with the z-chain slot.
Hashrate planner
What your hardware mints per second, and what hashrate public shares imply.
Rendered from soprinter/snps/SNP-02.md. The full text has every rule; this page condenses it.
