Documentation ¶
Index ¶
- func GetTargetHex(diff int64) string
- func GetTargetHexByScrypt(diff int64) string
- func GetTargetHexBySha256d(diff int64) string
- func HexDifficultyToDifficulty(hexDifficulty string) map[string]*Difficulty
- func NewDifficultyMap(diffNumber int64) map[string]*Difficulty
- func TargetHexToDiff(diffHexStr string) *big.Int
- func TargetHexToDiffByScrypt(diffHexStr string) *big.Int
- func TargetHexToDiffBySha256d(diffHexStr string) *big.Int
- type DiffUnit
- type DiffUnitFormatType
- type Difficulty
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetTargetHexByScrypt ¶
GetTargetHexByScrypt 将难度值转换为目标值的十六进制字符串(莱特币Scrypt 算法类)
func GetTargetHexBySha256d ¶
GetTargetHexBySha256d 将难度值转换为目标值的十六进制字符串(比特币 Sha256d 算法)
func HexDifficultyToDifficulty ¶
func HexDifficultyToDifficulty(hexDifficulty string) map[string]*Difficulty
func NewDifficultyMap ¶
func NewDifficultyMap(diffNumber int64) map[string]*Difficulty
func TargetHexToDiff ¶
TargetHexToDiff 将目标值的十六进制字符串转换为难度值
func TargetHexToDiffByScrypt ¶
TargetHexToDiffByScrypt 将目标值的十六进制字符串转换为难度值(莱特币Scrypt 算法类)
func TargetHexToDiffBySha256d ¶
TargetHexToDiffBySha256d 将目标值的十六进制字符串转换为难度值(比特币 Sha256d 算法)
Types ¶
type DiffUnit ¶
type DiffUnit string
DiffUnit 格式显示
const ( DiffUnitNone DiffUnit = "none" // default none 未知,默认:无单位或基础单位 DiffUnitKilo DiffUnit = "Kilo" // Kilo 千 DiffUnitMega DiffUnit = "Mega" // Mega 兆 DiffUnitGiga DiffUnit = "Giga" // Giga 吉 DiffUnitTera DiffUnit = "Tera" // Tera 太 DiffUnitPeta DiffUnit = "Peta" // Peta 拍 DiffUnitExa DiffUnit = "Exa" // Exa 艾 DiffUnitZetta DiffUnit = "Zetta" // Zetta 泽 DiffUnitYotta DiffUnit = "Yotta" // Yotta 尧 )
type DiffUnitFormatType ¶
type DiffUnitFormatType int
const ( DiffUnitFormatType1000 DiffUnitFormatType = 1000 DiffUnitFormatType1024 DiffUnitFormatType = 1024 )
type Difficulty ¶
type Difficulty struct { Algorithm string Difficulty *big.Int DifficultyStringShort string DifficultyStringShortFull string DifficultyStringShort1024 string DifficultyStringShortFull1024 string DifficultyUnitShort string DifficultyHexString string DifficultyUnit DiffUnit DifficultyUnitExtendStr string // 扩展拼接字段 DifficultyValue *big.Float // 存储计算后的难度值 }
Difficulty 难度结构体
func (*Difficulty) CalculateSpecificDifficulty ¶
func (diff *Difficulty) CalculateSpecificDifficulty()
func (*Difficulty) FormatUnit ¶
func (diff *Difficulty) FormatUnit(fSed int)
FormatUnit 单位计算公式 以 byte 为单位传入,根据数值不同换算成进制单位MB、GB等 fSed 小数点保留位数
Click to show internal directories.
Click to hide internal directories.