merge_mining

package
v4.0.5 Latest Latest
Warning

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

Go to latest
Published: Aug 9, 2024 License: MIT Imports: 11 Imported by: 2

Documentation

Index

Constants

View Source
const MaxChains = 256
View Source
const MaxChainsLog2 = 8

Variables

This section is empty.

Functions

func FindAuxiliaryNonce

func FindAuxiliaryNonce(auxId []types.Hash, maxNonce uint32) (nonce uint32, ok bool)

func GetAuxiliarySlot

func GetAuxiliarySlot(id types.Hash, nonce, numberAuxiliaryChains uint32) (auxiliarySlot uint32)

GetAuxiliarySlot Gets the slot for an auxiliary chain

Types

type AuxiliaryJob

type AuxiliaryJob struct {
	Hash       types.Hash       `json:"aux_hash"`
	Blob       types.Bytes      `json:"aux_blob"`
	Difficulty types.Difficulty `json:"aux_diff"`
}

type Client

type Client interface {
	GetChainId() (id types.Hash, err error)
	GetJob(chainAddress string, auxiliaryHash types.Hash, height uint64, prevId types.Hash) (job AuxiliaryJob, same bool, err error)
	SubmitSolution(job AuxiliaryJob, blob []byte, proof crypto.MerkleProof) (status string, err error)
}

type GenericClient

type GenericClient struct {
	Address *url.URL
	Client  *http.Client
}

func NewGenericClient

func NewGenericClient(address string, client *http.Client) (*GenericClient, error)

func (*GenericClient) GetChainId

func (c *GenericClient) GetChainId() (id types.Hash, err error)

func (*GenericClient) GetJob

func (c *GenericClient) GetJob(chainAddress string, auxiliaryHash types.Hash, height uint64, prevId types.Hash) (job AuxiliaryJob, same bool, err error)

func (*GenericClient) SubmitSolution

func (c *GenericClient) SubmitSolution(job AuxiliaryJob, blob []byte, proof crypto.MerkleProof) (status string, err error)

type MergeMiningGetChainIdResult

type MergeMiningGetChainIdResult struct {
	Result struct {
		ChainID types.Hash `json:"chain_id"`
	} `json:"result"`
	Error string `json:"error"`
}

type MergeMiningGetJobJSON

type MergeMiningGetJobJSON struct {
	// Address A wallet address on the merge mined chain
	Address string `json:"address"`

	// AuxiliaryHash Merge mining job that is currently being used
	AuxiliaryHash types.Hash `json:"aux_hash"`

	// Height Monero height
	Height uint64 `json:"height"`

	// PreviousId Hash of the previous Monero block
	PreviousId types.Hash `json:"prev_id"`
}

type MergeMiningGetJobResult

type MergeMiningGetJobResult struct {
	Result AuxiliaryJob `json:"result"`
	Error  string       `json:"error"`
}

type MergeMiningSubmitSolutionJSON

type MergeMiningSubmitSolutionJSON struct {
	// AuxiliaryBlob blob of data returned by merge_mining_get_job.
	AuxiliaryBlob types.Bytes `json:"aux_blob"`

	// AuxiliaryHash A 32-byte hex-encoded hash of the aux_blob - the same value that was returned by merge_mining_get_job.
	AuxiliaryHash types.Hash `json:"aux_hash"`

	// Blob Monero block template that has enough PoW to satisfy difficulty returned by merge_mining_get_job.
	// It also must have a merge mining tag in tx_extra of the coinbase transaction.
	Blob types.Bytes `json:"blob"`

	// MerkleProof A proof that aux_hash was included when calculating Merkle root hash from the merge mining tag
	MerkleProof crypto.MerkleProof `json:"merkle_proof"`
}

type MergeMiningSubmitSolutionResult

type MergeMiningSubmitSolutionResult struct {
	Result struct {
		Status string `json:"status"`
	} `json:"result"`
	Error string `json:"error"`
}

type RPCJSON

type RPCJSON struct {
	JSONRPC string `json:"jsonrpc"`
	Id      string `json:"id"`
	Method  string `json:"method"`
	Params  any    `json:"params,omitempty"`
}

type Tag

type Tag struct {
	NumberAuxiliaryChains uint32
	Nonce                 uint32
	RootHash              types.Hash
}

func (*Tag) FromReader

func (t *Tag) FromReader(reader utils.ReaderAndByteReader) error

FromReader Decodes the merge mining tag located in coinbase transaction Format according to https://github.com/SChernykh/p2pool/blob/e6b8292d5b59692921af23613456674ccab4958b/docs/MERGE_MINING.MD

func (*Tag) MarshalBinary

func (t *Tag) MarshalBinary() (buf []byte, err error)

func (*Tag) MarshalTreeData

func (t *Tag) MarshalTreeData() uint64

Jump to

Keyboard shortcuts

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