wow

package
v0.0.0-...-211626f Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2023 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Challenge

type Challenge struct {
	// What function to be used to search for an answer
	CostFunction CostFunction
	// Starting number from where the search for the solution should start (inclusive)
	// Big-endian unsigned integer
	BlockStart []byte
	// End number where the search for the solution should stop (exclusive)
	// Big-endian unsigned integer
	BlockEnd []byte
	// Required number of zero bits in the beginning of CostFunction output
	Difficulty int
	// time in Unix seconds, when the challenge expires
	ExpireAt int64
}

type ChallengeRequest

type ChallengeRequest struct {
}

type ChallengeResponse

type ChallengeResponse struct {
	// Challenge, which should be solved
	Challenge *Challenge
	// Challenge signature, which should be passed as-is with further requests
	Signature []byte
}

type Client

type Client interface {
	GetChallenge(ctx context.Context, rq *ChallengeRequest) (*ChallengeResponse, error)
	GetQuote(ctx context.Context, rq *QuoteRequest) (*QuoteResponse, error)
}

func NewClient

func NewClient(cfg *ClientConfig) Client

type ClientConfig

type ClientConfig struct {
	Address string
}

type CostFunction

type CostFunction = int
const (
	Sha256 CostFunction = iota
)

type QuoteRequest

type QuoteRequest struct {
	ChallengeResponse

	// Solution of the challenge on the range starting from BlockStart to BlockEnd
	// CostFunction applied on the Solution should return the result, which has number of leading zero bytes equal to
	// Difficulty.
	// Big-endian unsigned integer
	Solution []byte
}

type QuoteResponse

type QuoteResponse struct {
	Quote string
}

Jump to

Keyboard shortcuts

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