Introduction

Here, we’ll be installing go-quai-stratum, the Go implementation of the stratum proxy on Quai Network. This tutorial is focused on Linux Distributions and MacOS systems.

Running go-quai-stratum on Windows or WSL2 is not currently supported.

Prefer a video tutorial? Check out a video walkthrough on setting up a stratum proxy here:

Environment Setup

For the simplest installation process, we recommend installing and running go-quai-stratum on the same computer that you’re running go-quai. Running go-quai-stratum on a separate computer is only recommended for advanced users as it requires additional networking configuration.

Install Dependencies

To run an instance of go-quai-stratum, you’ll need to install a few dependencies. You can install dependencies with your favorite package manager (apt, brew, etc.).

1

Go v1.21.0+

Snap is not default installed on all Linux distros

  # install snapd if you don't have it already
  sudo apt install snapd

  # install go
  sudo snap install go --classic

If you’re not on Ubuntu or MacOS, instructions on how to install go directly can be found on the golang installation page.

2

Git, Make, and G++

Install git, make, and g++ with the following command:

# install git and make
sudo apt install git make g++
3

go-quai-stratum

Now that you’ve installed the base dependencies, we can go ahead and clone the go-quai-stratum repo.

To clone the go-quai-stratum repo and navigate to it, run the following commands:

git clone https://github.com/dominant-strategies/go-quai-stratum
cd go-quai-stratum

This command installs the main branch to your local machine. Unless you intend to develop, you must checkout the latest release.

You can find the latest release on the go-quai-stratum releases page. Then, check out the latest release with:

git checkout put-latest-release-here

For example (this not the latest release, check the releases page for the latest release number):

git checkout v01.2.3-rc.4

Configuration

To run the Quai stratum proxy, you’ll need to do some minor configuration. Start by copying the example configuration file to a local configuration file:

cp config/config.example.json config/config.json

This will copy the example config and create a new config file within the config directory. Within the newly created config.json file, you’ll be able to configure networking settings and other relevant variables:

Running the Proxy

Build

Before running the proxy, we need to build the source. You can build via Makefile by running the following command:

make go-quai-stratum

Run

Now that we’ve built the source, we can start our proxy. We recommend using a process manager like tmux or screen to run the proxy.

To run the proxy, you’ll need to select a shard to run against.

Start the proxy by passing either the corresponding web socket ports or chain names for the region and zone you’ve selected to run. Run with chain names using this command:

./build/bin/go-quai-stratum --region=REGION-NAME --zone=ZONE-NAME

Or to run with ports use:

./build/bin/go-quai-stratum --region=REGION-WS-PORT --zone=ZONE-WS-PORT

Running the proxy will only work for chains your node is validating state for. Global nodes validate state for all chains, whereas slice nodes only validate state for the chains you specify.

Available options for REGION-NAME, ZONE-NAME, REGION-PORT, and ZONE-PORT can be found below. You must select a corresponding region and zone, i.e. paxos and paxos3 or hydra and hydra2.

If you’re running a version of go-quai-stratum prior to v0.9.0-rc.0, you’ll need to pass in the corresponding web socket ports as chain names are not supported prior to this version.

Chain NameTypeChain IndexWeb Socket PortStratum Command
CyprusRegion8579
PaxosRegion8581
HydraRegion8583
Cyprus-1Zone[0 0]8611./build/bin/go-quai-stratum —region=cyprus —zone=cyprus1
Cyprus-2Zone[0 1]8643./build/bin/go-quai-stratum —region=cyprus —zone=cyprus2
Cyprus-3Zone[0 2]8675./build/bin/go-quai-stratum —region=cyprus —zone=cyprus3
Paxos-1Zone[1 0]8613./build/bin/go-quai-stratum —region=paxos —zone=paxos1
Paxos-2Zone[1 1]8645./build/bin/go-quai-stratum —region=paxos —zone=paxos2
Paxos-3Zone[1 2]8677./build/bin/go-quai-stratum —region=paxos —zone=paxos3
Hydra-1Zone[2 0]8615./build/bin/go-quai-stratum —region=hydra —zone=hydra1
Hydra-2Zone[2 1]8647./build/bin/go-quai-stratum —region=hydra —zone=hydra2
Hydra-3Zone[2 2]8679./build/bin/go-quai-stratum —region=hydra —zone=hydra3

Do not open the above web socket ports except in the specific case where your miner is on a different network than your node/stratum (and even then, be sure to only open the port to the necessary machine). You may be putting your local network security at risk.

The proxy by default listens for miner connections on the 3333 port. You can change the port the proxy listens on by passing it in with the --stratum flag in the run command if you’d like.

./build/bin/go-quai-stratum --region=REGION-NAME --zone=ZONE-NAME --stratum=LISTENING-PORT

Changing the proxy listening port is useful for running multiple proxies on a single global node. If you’re only mining on a single shard, there is no need to change the listening port.

The proxy should begin streaming logs to the terminal that look similar to below.

WARN[0000] One ethash cache must always be in memory requested=0
2023/09/06 13:47:17 main.go:45: Loading config: 0x14000032970
2023/09/06 13:47:17 main.go:84: Running with 4 threads
2023/09/06 13:47:17 policy.go:80: Set policy stats reset every 1h0m0s
2023/09/06 13:47:17 policy.go:84: Set policy state refresh every 1m0s
2023/09/06 13:47:17 policy.go:100: Running with 8 policy workers
WARN[0000] One ethash cache must always be in memory requested=0
2023/09/06 13:47:17 proxy.go:104: Set block refresh every 120ms
2023/09/06 13:47:17 stratum.go:38: Stratum listening on 0.0.0.0:3333
2023/09/06 13:47:17 proxy.go:294: New block to mine on Zone at height [1 1 1]
2023/09/06 13:47:17 proxy.go:295: Sealhash: 0xc4a31a763af09272a5da7f237978f5e0ead1e409c1e19a034ff8e40e7d727561
2023/09/06 13:47:17 proxy.go:228: Starting proxy on 0.0.0.0:0
2023/09/06 13:47:17 stratum.go:280: Broadcasting new job to 0 stratum miners

To stop the proxy, use CTRL+C in your terminal.

After configuring and pointing your proxy at a shard, you’re now ready to point a GPU miner at it and start mining.