Documentation
¶
Index ¶
- Variables
- func BigToHash(currentHeight uint64, bignum *big.Int) []byte
- func BigToHash256_v1(bignum *big.Int) []byte
- func BigToUint32_v1(bignum *big.Int) uint32
- func BitsToByte(bits []byte) byte
- func BitsToBytes(bits []byte) []byte
- func ByteToBits(b byte) []byte
- func BytesToBits(stuff []byte) []byte
- func CalculateDifficultyWorthByHeight(blkhei uint64, diffnum uint32) *big.Int
- func CalculateHashWorthByHeight(blkhei uint64, hash []byte) *big.Int
- func CalculateHashWorthForTest(hash []byte) *big.Int
- func CalculateHashWorth_old(hash []byte) *big.Int
- func CalculateHashWorth_old_2022_02_08(hash []byte) *big.Int
- func CalculateHashWorth_old_2022_9_9(hash []byte) *big.Int
- func CalculateNextDiffculty(store interfaces.BlockStoreRead, lastestBlock interfaces.BlockHeadMetaRead) ([]byte, *big.Int, uint32, error)
- func CalculateNextTarget(lastestBits uint32, currentHeight uint64, prev288BlockTimestamp uint64, ...) ([]byte, *big.Int, uint32)
- func CalculateNextTargetDifficulty_v1(currentBits uint32, currentHeight uint64, prevTimestamp uint64, ...) (*big.Int, uint32)
- func CheckHashDifficultySatisfy(result_hash, target_diffculty_hash []byte) bool
- func CheckHashDifficultySatisfyByBlock(blkhash []byte, block interfaces.Block) bool
- func CheckHashDifficultySatisfyByDiffnum(blkhash []byte, blkhei uint64, diffnum uint32) bool
- func ConvertHashToRate(blkhei uint64, hx []byte, usetimesec int64) *big.Int
- func ConvertHashToRateShow(blkhei uint64, hx []byte, usetimesec int64) string
- func ConvertPowPowerToShowFormat(value *big.Int) string
- func ConvertPowPowerToShowFormat_old(value *big.Int) string
- func ConvertPowPowerToShowFormat_old2(value *big.Int) string
- func DifficultyBigToHash(diff_big *big.Int) []byte
- func DifficultyBigToUint32(diff_big *big.Int) uint32
- func DifficultyCalculateNextTarget_v2(currentBits uint32, currentHeight uint64, prevTimestamp uint64, ...) ([]byte, *big.Int, uint32)
- func DifficultyHashToBig(hashbyte []byte) *big.Int
- func DifficultyHashToUint32(hash_byte []byte) uint32
- func DifficultyUint32ToBig(diff_num uint32) *big.Int
- func DifficultyUint32ToHash(diff_num uint32) []byte
- func DifficultyUint32ToHashEx(diff_num uint32, filltail uint8) []byte
- func DifficultyUint32ToHashForAntimatter(diff_num uint32) []byte
- func Hash256ToUint32_v1(hash []byte) uint32
- func HashToBig(currentHeight uint64, hash []byte) *big.Int
- func HashToBig_v1(hash []byte) *big.Int
- func HashToUint32(currentHeight uint64, hash []byte) uint32
- func ReadPrev288BlockTimestamp(store interfaces.BlockStoreRead, blockHeight uint64) (uint64, error)
- func Uint32ToBig(currentHeight uint64, diff_num uint32) *big.Int
- func Uint32ToBig_v1(number uint32) *big.Int
- func Uint32ToHash(currentHeight uint64, diff_num uint32) []byte
- func Uint32ToHash256_v1(number uint32) []byte
- func Uint32ToHash_v1(number uint32) []byte
Constants ¶
This section is empty.
Variables ¶
View Source
var (
LowestDifficultyCompact = uint32(4294967294) // Preset difficulty value before first adjustment of difficulty
)
Functions ¶
func BigToHash256_v1 ¶
func BigToUint32_v1 ¶
func ByteToBits ¶
func CalculateHashWorth_old ¶
func CalculateDifficultyWorth(diffnum uint32) *big.Int { diffhx := DifficultyUint32ToHashForAntimatter(diffnum) return CalculateHashWorthForTest(diffhx) }
func CalculateDifficultyWorth_old_2022_9_9(diffnum uint32) *big.Int { diffhx := DifficultyUint32ToHashForAntimatter(diffnum) return CalculateHashWorthForTest(diffhx) }
func CalculateDifficultyWorth_old_2022_02_08(diffnum uint32) *big.Int { diffhx := DifficultyUint32ToHashForAntimatter(diffnum) worth := DifficultyHashToBig(antimatterHash(diffhx)) return worth //repeat := x16rs.HashRepeatForBlockHeight(curheight) //targetHashWorth := new(big.Int).Mul(worth, new(big.Int).SetUint64(uint64(repeat))) //return targetHashWorth }
Calculate hash value
func CalculateNextDiffculty ¶
func CalculateNextDiffculty(store interfaces.BlockStoreRead, lastestBlock interfaces.BlockHeadMetaRead) ([]byte, *big.Int, uint32, error)
func CalculateNextTarget ¶
func CalculateNextTargetDifficulty_v1 ¶
func CalculateNextTargetDifficulty_v1( currentBits uint32, currentHeight uint64, prevTimestamp uint64, lastTimestamp uint64, eachblocktime uint64, changeblocknum uint64, printInfo *string, ) (*big.Int, uint32)
Calculate the block difficulty of the next stage
func CheckHashDifficultySatisfyByBlock ¶
func CheckHashDifficultySatisfyByBlock(blkhash []byte, block interfaces.Block) bool
func ConvertHashToRate ¶
Convert to hash for calculation force display
func ConvertDifficultyToRateShow(diffnum uint32, usetimesec int64) string { hxworth := CalculateDifficultyWorth(diffnum) hashrate := new(big.Int).Div(hxworth, big.NewInt(usetimesec)) hashrateshow := ConvertPowPowerToShowFormat(hashrate) return hashrateshow }
Convert to hash for calculation force display
func ConvertHashToRateShow ¶
Convert to hash for calculation force display
func DifficultyBigToHash ¶
func DifficultyBigToUint32 ¶
func DifficultyCalculateNextTarget_v2 ¶
func DifficultyCalculateNextTarget_v2( currentBits uint32, currentHeight uint64, prevTimestamp uint64, lastTimestamp uint64, eachblocktime uint64, changeblocknum uint64, printInfo *string, ) ([]byte, *big.Int, uint32)
Calculate the block difficulty of the next stage
func DifficultyHashToBig ¶
func DifficultyHashToUint32 ¶
func DifficultyUint32ToBig ¶
func DifficultyUint32ToHash ¶
func Hash256ToUint32_v1 ¶
func HashToBig_v1 ¶
func HashToUint32 ¶
func ReadPrev288BlockTimestamp ¶
func ReadPrev288BlockTimestamp(store interfaces.BlockStoreRead, blockHeight uint64) (uint64, error)
func Uint32ToBig_v1 ¶
func Uint32ToHash ¶
func Uint32ToHash256_v1 ¶
func Uint32ToHash_v1 ¶
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.