Documentation
¶
Index ¶
- Constants
- func OpenCLInit() int
- func OpenCLMinerMine(minerNum int, startNonce int64) int64
- func OpenCLMinerUpdate(minerNum int, headerBytes []byte, ...) int64
- type BlockHeaderHasher
- type GetWorkMessage
- type HashWithRead
- type Message
- type Miner
- type Peer
- type SubmitWorkMessage
- type SubmitWorkResultMessage
- type WorkMessage
Constants ¶
const OPENCL_ENABLED = true
const Protocol = "cruzbit.1"
Protocol is the name of this version of the cruzbit peer protocol.
Variables ¶
This section is empty.
Functions ¶
func OpenCLMinerMine ¶
OpenCLMinerMine is called on every solution attempt by a miner goroutine. It will perform N hashing attempts where N is the maximum number of threads your device is capable of executing. Returns a solving nonce; otherwise 0x7FFFFFFFFFFFFFFF.
Types ¶
type BlockHeaderHasher ¶
type BlockHeaderHasher struct {
// contains filtered or unexported fields
}
BlockHeaderHasher is used to more efficiently hash JSON serialized block headers while mining.
func NewBlockHeaderHasher ¶
func NewBlockHeaderHasher() *BlockHeaderHasher
NewBlockHeaderHasher returns a newly initialized BlockHeaderHasher
type GetWorkMessage ¶
type GetWorkMessage struct { PublicKeys []ed25519.PublicKey `json:"public_keys"` Memo string `json:"memo,omitempty"` }
GetWorkMessage is used by a mining peer to request mining work. Type: "get_work"
type HashWithRead ¶
type HashWithRead interface { hash.Hash // the sha3 state objects aren't exported from stdlib but some of their methods like Read are. // we can get the sum without the clone done by Sum which saves us a malloc in the fast path Read(out []byte) (n int, err error) }
HashWithRead extends hash.Hash to provide a Read interface.
type Message ¶
type Message struct { Type string `json:"type"` Body interface{} `json:"body,omitempty"` }
Message is a message frame for all messages in the cruzbit.1 protocol.
type Miner ¶
type Miner struct {
// contains filtered or unexported fields
}
Miner tries to mine a new tip block.
type Peer ¶
type Peer struct {
// contains filtered or unexported fields
}
Peer is a client in the cruzbit network providing us with mining work.
func NewPeer ¶
func NewPeer(genesisID cruzbit.BlockID, workChan chan<- WorkMessage, submitChan <-chan SubmitWorkMessage) *Peer
NewPeer returns a new instance of a peer.
type SubmitWorkMessage ¶
type SubmitWorkMessage struct { WorkID int32 `json:"work_id"` Header *cruzbit.BlockHeader `json:"header"` }
SubmitWorkMessage is used by a mining peer to submit a potential solution to the client. Type: "submit_work"
type SubmitWorkResultMessage ¶
type SubmitWorkResultMessage struct { WorkID int32 `json:"work_id"` Error string `json:"error,omitempty"` }
SubmitWorkResultMessage is used to inform a mining peer of the result of its work. Type: "submit_work_result"
type WorkMessage ¶
type WorkMessage struct { WorkID int32 `json:"work_id"` Header *cruzbit.BlockHeader `json:"header"` MinTime int64 `json:"min_time"` Target *cruzbit.BlockID `json:"target,omitempty"` // optional pool target Error string `json:"error,omitempty"` }
WorkMessage is used by a client to send work to perform to a mining peer. The timestamp and nonce in the header can be manipulated by the mining peer. It is the mining peer's responsibility to ensure the timestamp is not set below the minimum timestamp and that the nonce does not exceed MAX_NUMBER (2^53-1). Type: "work"