Node Service Providers
A gRPC service that streams block templates to miners, who fill in their own z-chain commitment.
Summary
A Node Service Provider (NSP) runs proof-of-work chain nodes and serves block templates to miners' clients. The client turns each template into jobs for its own identity, Z-bit and binding by filling in the z-chain commitment (SNP-02).
Every share is a merged note. Every header that is a block goes back to the NSP, which submits it. The coinbase pays the client: an NSP serves templates, not pay, and may keep at most its announced fee.
minersrig buildersnode operators
Kinds and tags
| Kind | Name | How |
|---|---|---|
| 31725 | NSP announcement (SNP-03) | signed, addressable; names chains, -aux algorithms, url and fee |
| 27235 | HTTP Auth (NIP-98) | signed by the client, sent as gRPC metadata on every call |
Transport and auth
gRPC over HTTP/2 with TLS, at the announcement's url. The service is snp07.v1.Templates:
| RPC | Shape | Does |
|---|---|---|
WorkStream | WorkRequest → stream Template | templates for one chain, algorithm and payout, pushed on every change |
SubmitBlock | BlockSubmission → BlockResult | a merged note whose header is a block |
ChainEvents | ChainEventsRequest → stream ChainEvent | tips connected and disconnected |
Every call carries authorization: Nostr <base64 event>: a NIP-98 kind:27235 event signed by the client, with u = url + /<service>/<method> and method = POST. Requests with a body add NIP-98's payload tag. The NSP may refuse or rate-limit keys. Clients may send keepalive pings every 60 seconds.
Templates
WorkRequest names a chain (genesis id), an announced algorithm and the client's payout_script. Each template carries:
id, unique across all the NSP's streams and never reused;announcement, the 31725 version it is served under;- parent header fields
height,version,prev_block,time,bits;version_mask; the client may roll time up to +600 seconds; clean: true whenprev_blockchanged;coinbase_head,coinbase_middle,coinbase_tail,extranonce_size(4 to 16),coinbase_branch;tree_size,merkle_nonce,slot,aux_branch.
The coinbase is head ‖ commitment ‖ middle ‖ extranonce ‖ tail. The 44-byte commitment is FA BE 6D 6D, the aux root byte-reversed, tree size and merkle nonce. A new identity, Z-bit or binding needs no new template.
What the NSP must serve
For each template, the NSP must serve:
- a previous block that is its node's tip;
- outputs that pay only the client's
payout_script, plus at most one other non-zero output, the NSP's, worth at mostfeeppm of all outputs, plus zero-value outputs; - one
FA BE 6D 6Din the first input's script, provided by the commitment; - a z-chain
slotthat differs from every other merged chain's.
The NSP fills the other leaves of the aux tree with the chains it merges. An NSP sees the client's blocks first and could withhold one; the client keeps the note and can submit the block elsewhere.
Client checks
The client must check every template before mining it, and drop it on any failure:
- 1. Well-formed: every field has its size,
bitsencodes a target above zero, and the assembled coinbase parses with the commitment and extra-nonce in the first input's script. - 2. Commitment: the marker occurs only there,
tree_size = 2^len(aux_branch), andslotmatches the z-chain's slot formerkle_nonce. - 3. Pay:
announcementnames the version the client accepted, and the outputs pay as above against that version'sfee(at most 1000000). Outputs sum to at most2^64 - 1. - 4. Tip:
prev_blockis the tip known fromChainEvents, compared after byte-reversing.
bits is Bitcoin's compact form. A set sign bit, a result over 256 bits, or zero is no target.
Blocks
A client tests every header against two targets: T(z) for a share and the target of bits for a block. Neither test depends on the other. A header that clears bits but not T(z) is a block but no note.
The client must submit every header that clears bits, whatever its Z-bit, with the template id, at once. Where it picks its own Z-bit, it may lower it so every block is also a share.
The NSP rebuilds the block and submits it, with the AuxPoW of each merged chain. Errors: INVALID_ARGUMENT for a bad record or a header not clearing bits; NOT_FOUND for an unknown or expired template. A block sent again gets its earlier result, kept at least 24 hours.
Worked example
From the SNP-07 test vector, on regtest (bits = 545259519, 0x207fffff). The NSP announces fee = 10000 ppm (1 %). Template t1, height 42, has tree_size 2, merkle_nonce 3 and slot 1, with one coinbase-branch hash and one aux-branch hash.
| Output | Value | Check 3 |
|---|---|---|
client's payout_script | 4,950,000,000 | the client's pay |
| NSP's script | 50,000,000 | 1 % of 5,000,000,000: within fee |
The client builds a job for an 8z00 sha256d-aux note with a 32-byte binding. It hashes its z-chain header, climbs the aux branch with side mask 1 to the root, writes the 44-byte commitment fabe6d6d…02000000 03000000, adds an 8-byte extra-nonce and mines. On regtest the parent target (7fffff00…) is easier than T(8z00), so every header that is a note here is also a block. The client sends each block back through SubmitBlock, whether or not it is also a note.
Try it
Merged mining
Follow one template from coinbase to share or block, with the z-chain slot.
liveNetwork directory
Providers, NSPs and Pay announcements on relays.
Rendered from soprinter/snps/SNP-07.md. The full text has every rule; this page condenses it.
