Stratum protocol for bitcoin mining easy explained

Follow and share now!

The stratum protocol is a since 2012 used protocol to communicate between miner and mining pool for encrypted currency. It was initial developed by Slush Pool, one of the oldest and biggest Bitcoin mining pools. It was implemented by pool- and mining software, but not defined in a Bitcoin Improvement Proposal (BIP), a document similar to a Request for Comments (RFC), hence it is not part of the Bitcoin standard. The development of such a protocol was need, since the old getwork method delegated all work to build a block to bitcoind. This became very fast a bottleneck, while mining pool powers raised.

How the stratum protocol works:

Stratum describe both the different functions and the transfer method over network. It is designed to works like Remote Procedure Calls (RPC) by defines so-called methods with a name and optional arguments and a return value. Each of these methods exists either on the mining pool or the mining software and gets called from each other.

Methods of the stratum protocol:

 

NameArgumentsReturn valueCall directionShort description
client.get_versionText (String)Pool → MinerAsk the Mining software for a text line to identify.
client.reconnectHost (String), Port (Number), Waittime (Number)Pool → MinerAsk the software to disconnect, wait the Waittime in seconds and connect to host:port.
Clients have to be very strict on honoring this request for security reasons!
mining.set_difficultyText (String)Pool → MinerThe mining client should show the text to his user in any way.
mining.authorizeUsername (String), Password (String)true if sucessfull, false otherwise (Boolean)Miner → PoolAuthenticate the miner in the pool. It is usual possible to mine without Authenticate, but you need to authenticate to link the work to your account. Many Pools ignore the password argument.
mining.extranonce.subscribeMiner → PoolNarrate the pool about the support of mining.set_extranonce
mining.get_transactionsJob ID (String)Bytes as HexstringMiner → PoolAsk the pool for dumps of all transactions in the block of the job with this id.
mining.configureUnsorted List of config extensions, Map with config values.Map with data about extension support and used valuesMiner → PoolAsk for support of config extensions and suggest values in one step.
mining.notifyJob ID (Integer as Hexstring),
Previous block hash (Bytes as Hexstring),
Coinbase transaction part 1 (Bytes as Hexstring) + ExtraNonce1 (Number as Hexstring) + ExtraNonce2 (Number as Hexstring),
Coinbase transaction part 2 (Bytes as Hexstring),
List of elements to build the merkel root,
Bitcoin block version (Number),
Bits (Bytes as Hexstring),
Time (Number as Hexstring),
Clean Jobs (Boolean)
Pool → MinerTransmits the Miner a new job
mining.set_difficultyDifficulty (Number)Pool → MinerInform the client about the pool difficulty for the next job.
mining.set_extranonceDifficulty (Number)Pool → MinerReplace the on subscription transmitted extranonce starting with the next job.
mining.submitUsername (String), Job ID (String), ExtraNonce2 (Number as Hexstring), Time (Number as Hexstring), Nonce (Number as Hexstring)true if accepted, false otherwise (Boolean)Miner → PoolSend the pool data to construct a matching block.
mining.subscribeIdentifier (String, optional), Extranonce (Hexstring, optional)List(List(List("mining.set_difficulty", initial difficulty), List("mining.notify", Subscription ID)), Extranonce1 (Hexstring), Extranonce2_size (Num))Miner → PoolSubscript the mining pool for job broadcasts. Usual the first method called on connect.
mining.suggest_difficultyDifficulty (Number)Miner → PoolPrefer the pool a Difficulty to use.

(Last valid 2019-11-17)

How is a stratum protocol remote procedure call transferred:

The connection is build up from the miner to the pool over TCP. All characters are UTF-8-encoded, after each command follows a line feed (byte 10/0x0A). The commands are JSON Maps with a fixed structure:

The request:

{
"id": <request id>,
"method": <methodname>,
"params": [ <arguments> ]
}
(\n)
  • All calls are sent with the key id. It is usual a unique number for methods with return value or the key object null, which means the same as “nothing” for methods without response, but it could be virtually anything. Responses contain the same key with an equal object to refer to the belonging request.
  • The key method contains just the name of the method to call as string.
  • In the key params is a list of arguments. A request without argument transfer empty brackets.

Stratum protocol example:

So a real method call looks like this:

{
"id": 1,
"method": "mining.authorize",
"params": [ "Myuser", "" ]
}
(\n)

Hint:

Byte arrays become transferred as Hexadecimal-encoded strings in little endian byte ordering.

The response:

{
"id": <request id>,
"result": <return value>,
"error": <error description>
}
(\n)
  • The field id contains the same, that the request did.
  • result contains the return value for the request.
  • In error is a string, containing an error description in human readable form, if any occurred.
{
"id": 1,
"result": true,
"error": ""
}
(\n)

Warning:

Much software has a very strict implement of JSON. The last column of a map or list must not end with a comma (,), that will cause in compatibility issues!

Post Your Comment Here

Your email address will not be published. Required fields are marked *

Free Demo!

Join the Calloway Crypto System now,
to get a free demo account:

Join the Calloway Crypto Soft now!

Read now the whole review!

If you have additional questions or stumble, please email immediate to earnmoneytodayblog@gmail.com or use the simple contact form.

 

earn-money.today successful challenge: 1041/2000 successful trader. Test now Calloway Crypto System or other verified trading systems for free and send us how successful you are and how much profit you made, and may what we can do for you.

52%

Last successful trader:
Antje B.
Be the next!