bitcoin

package
Version: v0.0.0-...-f5d73c0 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2019 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Hash

func Hash(msg string, nonce uint64) uint64

Hash concatentates a message and a nonce and generates a hash value. Only miners should ever need to call this method.

Types

type Message

type Message struct {
	Type         MsgType
	Data         string
	Lower, Upper uint64
	Hash, Nonce  uint64
}

Message represents a message that can be sent between components in the bitcoin mining distributed system. Messages must be marshalled into a byte slice before being sent over the network.

func NewJoin

func NewJoin() *Message

NewJoin creates a join message. Miners send join messages to the server.

func NewRequest

func NewRequest(data string, lower, upper uint64) *Message

NewRequest creates a request message. Clients send request messages to the server and the server sends request messages to miners.

func NewResult

func NewResult(hash, nonce uint64) *Message

New result creates a result message. Miners send result messages to the server and the server sends result messages to clients.

func (*Message) String

func (m *Message) String() string

type MsgType

type MsgType int
const (
	Join MsgType = iota
	Request
	Result
)

Source Files

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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