Bitcoin: Stratum connection example

Understanding the Stratum Connection Example: Parameters and Their Functions

In this article, we will dive into the world of Bitcoin’s Stratum protocol and explore the parameters involved in establishing a connection. We will use a Wireshark dump from CCminer to illustrate how each parameter works.

Introduction to Stratum

Stratum is a secure, decentralized, peer-to-peer communication mechanism for Bitcoin nodes. It allows miners to connect to each other using a standardized format, allowing for efficient communication and reducing the risk of node attacks. In this article, we will focus on the parameters involved in establishing a Stratum connection.

Analyzing the CCminer Wireshark Dump

To better understand the functions of Stratum’s parameters, let’s analyze the output of the CCminer Wireshark dump. We will look at the packets transmitted between the miner and the central node (also known as the “server”).


Packet 1: CCminer - Initial Request

+---+0000 ---+-----+-----+-----+

| | | | |

+---+------+-----+-----+-----+

| 0 | H2 | P1P2 | S | W |

+---+------+-----+-----+-----+

In this packet we can identify the following parameters:

  • H2

    Bitcoin: Stratum connection example

    : This is the hash of the transaction.

  • P1P2: This is the previous two blocks.
  • S (Server): The IP address and port number of the server.
  • W (Wallet): The wallet information, which includes the username and password.

Stratum Parameters

Let’s break each parameter down into its constituent parts:

1. Transaction Hash (H2)

The “Transaction Hash” parameter identifies the block that is being mined. This hash is created by combining the two previous blocks (P1 and P2) with a random salt, which is then encrypted using a key.

  • Salt: A random value used to prevent preimage attacks.
  • Key: The encryption key used for hashing.

2. Previous Blocks (P1P2)

The “Previous Blocks” parameter provides information about the two previous blocks that are part of the block that is being mined.

  • Block 0

    : The first block in the current chain.

  • Block n-1: The previous block before the current block.

Stratum Protocol Steps

When establishing a Stratum connection, the following steps occur:

  • Initial Request: The CCminer sends an initial request packet with the “Transaction Hash”, “Previous Blocks”, and other parameters to the central node.
  • Receive Response: The central node responds with its own “Transaction Hash” and “Wallet” information, which confirms the connection and provides additional details about the block being mined.

Key Takeaways

In this article, we explored the parameter functions of the Stratum protocol using a CCminer Wireshark dump. By understanding the role of each parameter, you can better navigate the communication process between your CCminer node and the central node.

To establish a Stratum connection:

  • Use the URLs “stratum+tcp” or “stratum+https” to connect to the server.
  • Provide the transaction hash, previous blocks, and other parameters in your initial request packet.
  • Receive a confirmation from the central node, which will provide additional details about the block being mined.

Be sure to check out the official Stratum documentation and CCminer source code for more information on parameter functions and protocol steps. Happy mining!

Ethereum Migrate Wallet