OracleMiner

package module
v0.0.0-...-884ca32 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2019 License: MIT Imports: 13 Imported by: 0

README

OracleMiner

This code has been merged into the OracleRecord Repository, and is now deprecated.

API to launch and mine Oracle values for the PegNet

The go process is pretty simple. You pass an Oracle Price Record (OPR) to

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddAssetEntry

func AddAssetEntry(mstate *MinerState)

The Pegged Network has a defining chain. This function builds and returns the expected defining chain for the network.

func AddOpr

func AddOpr(mstate *MinerState, nonce []byte)

The Pegged Network has a defining chain. This function builds and returns the expected defining chain for the network.

func CreateOPRChain

func CreateOPRChain(mstate *MinerState)

The Pegged Network has a defining chain. This function builds and returns the expected defining chain for the network.

func CreatePegNetChain

func CreatePegNetChain(mstate *MinerState)

The Pegged Network has a defining chain. This function builds and returns the expected defining chain for the network.

func FundWallet

func FundWallet(m *MinerState) (err error)

FundWallet() This is just a debugging function. These addresses work when run against a LOCAL network simulation.

func GetFirstNonce

func GetFirstNonce() []byte

Create a nonce of eight bytes of zeros followed by 24 bytes of random values

func GradeLastBlock

func GradeLastBlock(mstate *MinerState, opr *oprecord.OraclePriceRecord, dbht int64, miner *Mine)

func InitNetwork

func InitNetwork(mstate *MinerState, minerNumber int, opr *oprecord.OraclePriceRecord)

func NewEntry

func NewEntry(chainID string, extIDs [][]byte, content []byte) *factom.Entry

func NewEntryStr

func NewEntryStr(chainID string, extIDs []string, content string) *factom.Entry

Types

type FactomEvent

type FactomEvent struct {
	Type  int
	Value int
	Msg   string
}

type FactomdMonitor

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

FactomdMonitor Running multiple Monitors is problematic and should be avoided if possible

func (*FactomdMonitor) GetBlockTime

func (f *FactomdMonitor) GetBlockTime() int64

GetBlockTime Returns the blocktime in seconds. All blocks are divided into 10 "minute" sections. But if the blocktime is not 600 seconds, then a minute = the blocktime/10

func (*FactomdMonitor) GetHighestSavedDBlock

func (f *FactomdMonitor) GetHighestSavedDBlock() int64

Returns the highest saved block

func (*FactomdMonitor) Start

func (f *FactomdMonitor) Start() chan int

func (*FactomdMonitor) Stop

func (f *FactomdMonitor) Stop()

type Mine

type Mine struct {
	MinerNum int // When running many miners, the number of the miner that is this one.

	Dbht           int32        // Height that we are mining at
	Response       chan int     // Returns 0 when the MinerNumber stops
	Control        chan int     // sending any int to the Mine will stop mining
	OPR            []byte       // The oracle Record that we were mining
	OprHash        []byte       // The hash of the oracle record
	BestDifficulty uint64       // Highest Difference Found
	BestNonce      []byte       // The Nonce that produced the bestDifference
	BestHash       []byte       // The best hash we found (to check the Best Difficulty against)
	Hashcnt        int          // Count of hash rounds performed.
	HashFunction   hashFunction // The Hash function we will be using to mine
	// contains filtered or unexported fields
}

func (*Mine) Events

func (m *Mine) Events(event chan FactomEvent)

func (*Mine) Init

func (m *Mine) Init()

func (*Mine) Mine

func (m *Mine) Mine(opr []byte)

Mine a given Oracle Price Record (OPR)

func (*Mine) Start

func (m *Mine) Start(opr []byte)

Start mining on a given OPR

func (*Mine) Stop

func (m *Mine) Stop()

type MinerState

type MinerState struct {
	MinerNumber int                        // If running multiple miners, this is the number
	Monitor     *FactomdMonitor            // The facility that tracks what blocks we are processing
	ConfigDir   string                     // Must end with a /
	OPR         oprecord.OraclePriceRecord // The price record we mine against
	Config      *config.Config             // Configuration file with data for mining and Oracle data
}

func (*MinerState) GetCoinbasePNTAddress

func (m *MinerState) GetCoinbasePNTAddress() string

func (*MinerState) GetECAddress

func (m *MinerState) GetECAddress() string

func (*MinerState) GetFCTAddress

func (m *MinerState) GetFCTAddress() string

func (*MinerState) GetIdentityChainID

func (m *MinerState) GetIdentityChainID() string

GetIdentityChainID Returns a pointer to a string for the chainID. Takes the raw chain if specified, but if not, returns the chainID computed from the fields. If no chainID is specified in the config file, a nil is returned.

func (*MinerState) GetOraclePriceRecordChain

func (m *MinerState) GetOraclePriceRecordChain() string

GetOraclePriceRecordChain Returns the chainID for all the Oracle Price Records. Note that this ID is the same as the ProtocolChain + the field "OPR"

func (*MinerState) GetOraclePriceRecordExtIDs

func (m *MinerState) GetOraclePriceRecordExtIDs() []string

func (*MinerState) GetProtocolChain

func (m *MinerState) GetProtocolChain() string

GetProtocolChain Get the chain for the protocol. Versions of the protocol (when updates are deployed) will be recorded in this chain.

func (*MinerState) GetProtocolChainExtIDs

func (m *MinerState) GetProtocolChainExtIDs() []string

func (*MinerState) LoadConfig

func (m *MinerState) LoadConfig()

Directories

Path Synopsis
util

Jump to

Keyboard shortcuts

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