stratum

package
v0.4.1-lw Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 5, 2022 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RandomInt

func RandomInt() string

Types

type BlockTemplate

type BlockTemplate struct {
	BlockHashingBlob  string `json:"blockhashing_blob"`
	BlockTemplateBlob string `json:"blocktemplate_blob"`
	Difficulty        int64  `json:"difficulty"`
	PrevHash          string `json:"prev_hash"`
	SeedHash          string `json:"seed_hash"`
	Height            int64  `json:"height"`
}

type DummyOk

type DummyOk struct {
	Id      *json.RawMessage `json:"id"`
	Version string           `json:"jsonrpc"`
	Result  OkMsg            `json:"result"`
}

func GetDummyOk

func GetDummyOk(id *json.RawMessage) DummyOk

type DummyResponse

type DummyResponse struct {
	Id      *json.RawMessage `json:"id"`
	Version string           `json:"jsonrpc"`
	Result  JobWrapper       `json:"result"`
}

func GetDummyResponse

func GetDummyResponse(id *json.RawMessage) DummyResponse

type DummyStratumService

type DummyStratumService struct {
}

func (*DummyStratumService) HandleLogin

func (d *DummyStratumService) HandleLogin(id *json.RawMessage, minerId string) (*LoginResponse, error)

func (*DummyStratumService) HandleLoginWithTemplate

func (d *DummyStratumService) HandleLoginWithTemplate(id *json.RawMessage, params map[string]string) (*LoginResponse, error)

func (*DummyStratumService) HandleNewJob

func (d *DummyStratumService) HandleNewJob(params map[string]string) (*JobResponse, error)

func (*DummyStratumService) HandleSubmit

func (d *DummyStratumService) HandleSubmit(id *json.RawMessage, result *json.RawMessage) (*SubmitResponse, error)

type Job

type Job map[string]string

type JobResponse

type JobResponse struct {
	Version string `json:"jsonrpc"`
	Method  string `json:"method"`
	Params  Job    `json:"params"`
}

type JobWrapper

type JobWrapper struct {
	Id  string `json:"id"`
	Job Job    `json:"job"`
}

func GetDummyJobWrapper

func GetDummyJobWrapper() JobWrapper

type LoginRequest

type LoginRequest struct {
	MinerId string `json:"login"`
	Agent   string `json:"agent"`
}

type LoginResponse

type LoginResponse struct {
	Id      *json.RawMessage       `json:"id"`
	Version string                 `json:"jsonrpc"`
	Result  map[string]interface{} `json:"result,omitempty"`
}

type OkMsg

type OkMsg struct {
	Status string `json:"status"`
}

type StratumRPCService

type StratumRPCService struct {
	// contains filtered or unexported fields
}

func (*StratumRPCService) HandleLoginWithTemplate

func (s *StratumRPCService) HandleLoginWithTemplate(id *json.RawMessage, params map[string]string) (*LoginResponse, error)

func (*StratumRPCService) HandleNewJob

func (s *StratumRPCService) HandleNewJob(params map[string]string) (*JobResponse, error)

func (*StratumRPCService) HandleSubmit

func (s *StratumRPCService) HandleSubmit(id *json.RawMessage, params *json.RawMessage) (*SubmitResponse, error)
"params":{
	"id":"3220921a94dd7ebacc85bdbf508b23e6545c80fb81",
	"job_id":"3220921a94dd7ebacc85bdbf508b23e6545c80fb81",
	"nonce":"f1830100",
	"result":"c68384ce77a3f4b1ffacd7e94b42f7da827e46fd3e8dfba3caa5eacf6cca6a01"
}

type StratumService

type StratumService interface {
	HandleLoginWithTemplate(*json.RawMessage, map[string]string) (*LoginResponse, error)
	HandleSubmit(*json.RawMessage, *json.RawMessage) (*SubmitResponse, error)
	HandleNewJob(map[string]string) (*JobResponse, error)
}

func GetDummyStratumService

func GetDummyStratumService() StratumService

func NewStratumRPCService

func NewStratumRPCService() StratumService

type SubmitResponse

type SubmitResponse struct {
	Id      *json.RawMessage  `json:"id"`
	Version string            `json:"jsonrpc"`
	Result  map[string]string `json:"result,omitempty"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL