Skip to content
This repository has been archived by the owner on Jan 9, 2021. It is now read-only.

Sia stratum protocol

Andras Elso edited this page Jul 12, 2016 · 2 revisions

Sia stratum mining

revision of this document: R1

  1. Introduction & Concept
  2. Specifications (RFC)
  3. Contact

Introduction & Concept

Following block header is used in Sia:

BlockHeaderSize is the size, in bytes, of a block header.
  32 (ParentID) + 8 (Nonce) + 8 (Timestamp) + 32 (MerkleRoot)

Nonce is splitted into 3 parts: ExtraNonce1, ExtraNonce1, RealNonce

First up to 3 bytes of data is used for ExtraNonce1 in standard stratum mining protocol. ExtraNonce1 is set for each miner by the pool and no two miners shall have same ExtraNonce1. Pool makes sure that no two miners ever perform same work.

Following X bytes of ExtraNonce1 are up to 2 bytes used for ExtraNonce2. Size of ExtraNonce2 is defined by the pool (just like in standard stratum protocol). ExtraNonce2 is an extension for miner's nonce, because miner may run out of nonce range, thus it can increase ExtraNonce2 to be able to hash unique work again.

If pool chooses to use 2 bytes for ExtraNonce1 and 2 bytes for ExtraNonce2, then block header would look like:

...
0x29, 0xab, 0x5f, 0x49, // PrevHash
0xf3, 0xe0, 0x01, 0x00, // Nonce
0x00, 0x00, // ExtraNonce1
0x00, 0x00, // ExtraNonce2
0x9a, 0xd6, 0x84, 0x57, 0x00, 0x00, 0x00, 0x00, // Timestamp
0x13, 0x54, 0x8a, 0xf1, ... // Merkleroot

When pool sends out the job (mining.notify), it should set following parameters:
params[0] = Job ID.
params[1] = PrevBlock (32 bytes).
params[2] = MerkleRoot (32 bytes).
params[3] = Unused. Set to "".
params[4][] = Unused. Set to [].
params[5] = Unused. Set to "".
params[6] = Unused. Set to "".
params[7] = Timestamp (miner can roll this value as fast as time goes)
params[8] = Clean Jobs.

Miner generates work for hashing by combining:
PrevBlock (params[1]) + Nonce (selected by miner) + ExtraNonce1 (send by the pool at start) + ExtraNonce2 (selected by miner) + Timestamp (params[7]) + MerkleRoot(params[2])

Specifications (RFC)

Standard stratum protocol is used with adjustments explained in 1.

Miners should support extranonce.subscribe for optimal performance when mining on NiceHash.

Contact

www.nicehash.com
[email protected]

Clone this wiki locally