Guide
Stratum bridge
Serve your node's work to many mining rigs with tenrai-stratum-bridge, step by step. Listeners, TLS, access control, vardiff, every option and the statistics.
On this page
tenrai-stratum-bridge takes work from your node and hands it to miners on other machines. Each miner logs in with its own address, and every block it finds pays that address directly. The bridge keeps no balances and pays nothing itself; for shared payouts, run a pool.
1. Run a synced node
The bridge runs on the node's machine and talks to its mining listener at 127.0.0.1:28702. Set up the node as in Run a node.
2. Start the bridge
tenrai-stratum-bridgeWithout options the bridge serves miners on this machine: it takes work from the node at 127.0.0.1:28702, listens on 127.0.0.1:28720 and shows its dashboard on http://127.0.0.1:28771/. It waits for the node when that is not running yet. The first start writes tenrai-stratum-bridge.json with the default settings next to the program.
For rigs in your local network:
tenrai-stratum-bridge --listen-tls 0.0.0.0 --tls-name 192.168.1.10 --allow 192.168.1.0/24| Option | |
|---|---|
--listen-tls 0.0.0.0 | Accepts miners over TLS on port 28721 on every interface |
--tls-name 192.168.1.10 | The address the rigs connect to, written into the certificate the bridge creates |
--allow 192.168.1.0/24 | Accepts only these addresses |
The first start creates tenrai-stratum-bridge.crt and its key next to the program. The miner sends unencrypted Stratum only to its own machine, so the rigs need TLS and this certificate.
Every listener outside 127.0.0.1 needs one of --allow, --password-file or --public.
3. Point the miners at it
On each rig:
tenrai-miner -a <address> --stratum 192.168.1.10 --tls-ca tenrai-stratum-bridge.crt -w rig1No --pool here: the bridge builds work that pays each miner's own address.
4. Check it
The dashboard at http://127.0.0.1:28771/ shows workers, hashrate, shares and found blocks. The log prints a worker report every 30 seconds.
Over the internet
Use TLS and protect the port:
tenrai-stratum-bridge --listen-tls 0.0.0.0:28721 --tls-cert bridge.crt --tls-key bridge.key \
--password-file bridge.pass --autobantenrai-miner -a <address> --stratum stratum+tls://bridge.example.org:28721 -w rig1 -p "<password>"The certificate and key are PEM files, for example from Let's Encrypt. Miners trust a self-signed certificate with --tls-ca bridge.crt. TLS listeners speak TLS 1.3 with the X25519MLKEM768 key exchange only.
Open to everyone, without a password:
tenrai-stratum-bridge --listen-tls 0.0.0.0:28721 --tls-cert bridge.crt --tls-key bridge.key --public --autobanStratum version 2; miners then use stratum2+tls://:
tenrai-stratum-bridge --listen-v2-tls 0.0.0.0:28722 --tls-cert bridge.crt --tls-key bridge.key --publicBrowser miners, behind a TLS proxy:
tenrai-stratum-bridge --listen-ws 127.0.0.1:28723 --ws-origin https://miner.example --publicThe proxy passes each visitor's address as X-Real-IP; the bridge reads it only from connections that come from 127.0.0.1. Without it, limits and bans would apply to all browser miners together. --ws-origin keeps other web pages from mining through the bridge.
Unencrypted listeners, --listen and --listen-ws, only accept 127.0.0.1; the bridge refuses them on any other address. Miners on other machines connect over TLS, or through a TLS proxy in front of a loopback listener.
Options
The bridge reads tenrai-stratum-bridge.json next to the program and creates it with the default settings on the first start; --config names another file. The file takes the long option names. A value on the command line replaces the file's; lists from both are added together.
Node and listeners
| Option | Default | What it does |
|---|---|---|
--network <NAME> | mainnet | mainnet, testnet or development. Sets the default ports, see Default ports |
-s, --node <HOST[:PORT]> | 127.0.0.1:28702 | Mining listener of the node; a URL works too |
--chain-id <HEX> | Refuses a node on another chain | |
-l, --listen <IP[:PORT]> | 127.0.0.1:28720 | Unencrypted version 1 listener. Repeatable |
--listen-tls <IP[:PORT]> | Version 1 over TLS, port 28721 unless given. Repeatable | |
--listen-v2-tls <IP[:PORT]> | Version 2, always TLS, port 28722 unless given. Repeatable | |
--no-v1 | off | No version 1 listener at all, not even the default; needs --listen-v2-tls |
--listen-ws <IP[:PORT]> | Version 1 over WebSocket for web pages, port 28723 unless given; a proxy adds TLS. Repeatable | |
--ws-origin <ORIGIN> | any page | Web pages that may mine over WebSocket |
--tls-cert <FILE>, --tls-key <FILE> | tenrai-stratum-bridge.crt and .key next to the program | Certificate and key of the TLS and version 2 listeners. Without them the bridge creates a self-signed pair at its first start; miners pass the .crt as --tls-ca |
--tls-name <NAME> | Host name or IP miners connect to, for the created certificate. Repeatable; localhost and the listeners' own addresses are always in it |
Access
| Option | Default | What it does |
|---|---|---|
--password-file <FILE> | Miners must send this password | |
--allow <RANGE> | everyone | Accepts miners only from these addresses or ranges |
--public | off | Accepts miners from anywhere without a password |
--max-clients <N> | 512 | Connections in total, at most 65536 |
--max-clients-per-ip <N> | 64 | Connections from one IPv4 address or IPv6 /64 |
--autoban | off | Bans addresses that send invalid shares or bad requests |
--ban-time <S> | 600 | Length of a ban |
--ban-invalid-percent <P> | 50 | Share of invalid shares in a batch that leads to a ban |
--ban-check-shares <N> | 20 | Shares per batch |
Loopback is never banned.
Shares and blocks
| Option | Default | What it does |
|---|---|---|
--start-difficulty <D> | 65536 | First share difficulty of a connection |
--min-difficulty <D> | 50 | Lowest share difficulty |
--max-difficulty <D> | network difficulty | Highest share difficulty |
--share-interval <S> | 20 | Seconds between two shares of one worker that vardiff aims for |
--tag <TEXT> | the miner's | Writes this tag into every block instead of each miner's own |
--tenq-mode full|light | full | light saves the 2 GiB dataset but checks shares much slower |
--no-tenq-prefetch | off | Builds the next epoch's dataset only when the epoch starts; share checks wait for it |
--verify-concurrency <N> | CPU count | Share checks at the same time; 0 automatic |
--candidate-concurrency <N> | CPU count | Found blocks sent to the node at the same time; 0 automatic |
--candidate-queue <N> | 512 | Found blocks waiting for the node |
A miner can ask for a fixed share difficulty with the password d=131072, or <password>,d=131072.
Statistics and logs
| Option | Default | What it does |
|---|---|---|
--api-bind <IP[:PORT]> | 127.0.0.1:28771 | Dashboard and JSON statistics |
--no-api | off | Serves neither |
--no-dashboard | off | Serves the JSON statistics only |
--explorer-url <URL> | Tenrai Explorer | Explorer the dashboard links to; empty for no links |
--metrics-bind <IP[:PORT]> | off | Prometheus metrics at /metrics, port 28792 unless given |
--stats-interval <S> | 30 | Seconds between worker reports in the log |
-d, --debug, --log-file <FILE>, --no-color | Logging |
Statistics
| Path | Content |
|---|---|
/v1/stats | Hashrate, workers, shares, blocks |
/v1/workers | Every worker of the last hour |
/v1/miners/<address> | One address with its workers and recent blocks |
/v1/miners/<address>/history | Hashrate of one address per minute for a day |
/v1/blocks?limit=N | Recent blocks, at most 100 |
/v1/history | Bridge and network hashrate per minute for a day |
The protocol is described in the stratum reference.
