tuweni / org.apache.tuweni.stratum.server / Stratum1Protocol

Stratum1Protocol

class Stratum1Protocol : StratumProtocol (source)

Implementation of the stratum+tcp protocol.

This protocol allows miners to submit EthHash solutions over a persistent TCP connection.

Constructors

<init>

Implementation of the stratum+tcp protocol.

Stratum1Protocol(extranonce: String, jobIdSupplier: () -> String = { val timeValue: Bytes = Bytes.minimalBytes(Instant.now().toEpochMilli()) timeValue.slice(timeValue.size() - 4, 4).toShortHexString() }, subscriptionIdCreator: () -> String = { createSubscriptionID() }, submitCallback: (PoWSolution) -> Boolean, seedSupplier: () -> Bytes32)

Functions

canHandle

Checks if the protocol can handle a TCP connection, based on the initial message.

fun canHandle(initialMessage: String, conn: StratumConnection): Boolean

handle

Handle a message over an established Stratum connection

fun handle(conn: StratumConnection, message: String): Unit

onClose

Callback when a stratum connection is closed.

fun onClose(conn: StratumConnection): Unit

setCurrentWorkTask

Sets the current proof-of-work job.

fun setCurrentWorkTask(input: PoWInput): Unit