Documentation ¶
Index ¶
- Constants
- type BlockTemplate
- type BlockTemplateTransaction
- type Coin
- func (c *Coin) CalculateShareComputePower(targetDifficulty *big.Int) (*big.Int, error)
- func (c *Coin) GetLatestStratumJob(ctx *service.Register) (*service.StratumJobPart, []*service.Transaction, error)
- func (c *Coin) GetNewBlockHeight() (int, error)
- func (c *Coin) GetTargetDifficulty(bitsHex string) (*big.Int, error)
- func (c *Coin) IsSolveHash(hash string, targetDifficulty *big.Int) (bool, error)
- func (c *Coin) IsValidAddress(address string, isUsedTestNet bool) bool
- func (c *Coin) MakeBlock(ctx *service.Register, header *service.BlockHeaderPart, ...) (*service.Block, error)
- func (c *Coin) SetRPCClient(client *RpcClient) *Coin
- func (c *Coin) SubmitBlock(data string) (bool, error)
- type MiningInfo
- type RpcClient
- type RpcResponse
Constants ¶
View Source
const ( PlaceHolder = 0xEE BaseDifficulty uint64 = 4294967296 MaxHash string = "00000000FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF" )
View Source
const ( VersionV1 = "1.0" VersionV2 = "2.0" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BlockTemplate ¶
type BlockTemplate struct { Capabilities []string `json:"capabilities"` Version int32 `json:"version"` Rules []string `json:"rules"` VBAvailable interface{} `json:"vbavailable"` VBRequired int32 `json:"vbrequired"` PreviousBlockHash string `json:"previousblockhash"` Transactions []*BlockTemplateTransaction `json:"transactions"` CoinBaseAux interface{} `json:"coinbaseaux"` CoinBaseValue int64 `json:"coinbasevalue"` LongPollId string `json:"langpollid"` Target string `json:"target"` MinTime int32 `json:"mintime"` Mutable []string `json:"mutable"` NonceRange string `json:"noncerange"` SigOpLimit int32 `json:"sigoplimit"` SizeLimit int32 `json:"sizelimit"` WeightLimit int32 `json:"weightlimit"` CurTime int32 `json:"curtime"` Bits string `json:"bits"` Height int32 `json:"height"` DefaultWitnessCommitment string `json:"default_witness_commitment"` }
type Coin ¶
type Coin struct {
// contains filtered or unexported fields
}
func NewBTCoinWithArgs ¶
func (*Coin) CalculateShareComputePower ¶
func (*Coin) GetLatestStratumJob ¶
func (c *Coin) GetLatestStratumJob(ctx *service.Register) (*service.StratumJobPart, []*service.Transaction, error)
func (*Coin) GetNewBlockHeight ¶
func (*Coin) GetTargetDifficulty ¶
func (*Coin) IsSolveHash ¶
func (*Coin) IsValidAddress ¶
func (*Coin) MakeBlock ¶
func (c *Coin) MakeBlock(ctx *service.Register, header *service.BlockHeaderPart, base *service.BlockCoinBasePart, transactions []*service.Transaction) (*service.Block, error)
func (*Coin) SetRPCClient ¶
type MiningInfo ¶
type MiningInfo struct { Blocks int `json:"blocks"` CurrentBlockWeight int `json:"currentblockweight"` CurrentBlockTx int `json:"currentblocktx"` Difficulty float64 `json:"difficulty"` NetworkHashPs float64 `json:"networkhashps"` PooledTx int `json:"pooledtx"` Chain string `json:"chain"` Warnings string `json:"warnings"` }
type RpcClient ¶
type RpcClient struct {
// contains filtered or unexported fields
}
A rpcClient represents a JSON RPC client (over HTTP(s)).
func (*RpcClient) GetBlockTemplate ¶
func (c *RpcClient) GetBlockTemplate(params interface{}) (*BlockTemplate, error)
func (*RpcClient) GetMiningInfo ¶
func (c *RpcClient) GetMiningInfo() (*MiningInfo, error)
func (*RpcClient) SubmitBlock ¶
type RpcResponse ¶
type RpcResponse struct { Id int64 `json:"id"` Result json.RawMessage `json:"result"` Err interface{} `json:"error"` }
Click to show internal directories.
Click to hide internal directories.