Documentation ¶
Index ¶
- Variables
- func BigEndianBytesToHeight(b []byte) uint32
- func BigEndianBytesToNano(b []byte) int64
- func BigEndianBytesToTime(b []byte) *time.Time
- func BigToLEUint256(n *big.Int) [uint256Size]byte
- func CleanAndExpandPath(path string) string
- func HashString(hash *big.Rat) string
- func HeightToBigEndianBytes(height uint32) []byte
- func HexReversed(in string) (string, error)
- func LEUint256ToBig(n [uint256Size]byte) *big.Int
- func NanoToBigEndianBytes(nano int64) []byte
- func ReversePrevBlockWords(hashE string) string
Constants ¶
This section is empty.
Variables ¶
var ( // ZeroInt is the default value for a big.Int. ZeroInt = new(big.Int).SetInt64(0) // ZeroRat is the default value for a big.Rat. ZeroRat = new(big.Rat).SetInt64(0) // KiloHash is 1 KH represented as a big.Rat. KiloHash = new(big.Rat).SetInt64(1000) // MegaHash is 1MH represented as a big.Rat. MegaHash = new(big.Rat).SetInt64(1000000) // GigaHash is 1GH represented as a big.Rat. GigaHash = new(big.Rat).SetInt64(1000000000) // TeraHash is 1TH represented as a big.Rat. TeraHash = new(big.Rat).SetInt64(1000000000000) // PetaHash is 1PH represented as a big.Rat PetaHash = new(big.Rat).SetInt64(1000000000000000) )
Functions ¶
func BigEndianBytesToHeight ¶
BigEndianBytesToHeight returns the block height of the provided 4-byte big endian representation.
func BigEndianBytesToNano ¶
BigEndianBytesToNano returns nanosecond time of the provided 8-byte big endian representation.
func BigEndianBytesToTime ¶
BigEndianBytesToTime returns a time instance of the provided 8-byte big endian representation.
func BigToLEUint256 ¶
BigToLEUint256 returns the passed big integer as an unsigned 256-bit integer encoded as little-endian bytes. Numbers which are larger than the max unsigned 256-bit integer are truncated.
func CleanAndExpandPath ¶
CleanAndExpandPath expands environment variables and leading ~ in the passed path, cleans the result, and returns it.
func HashString ¶
HashString formats the provided hashrate per the best-fit unit.
func HeightToBigEndianBytes ¶
HeightToBigEndianBytes returns an 4-byte big endian representation of the provided block height.
func LEUint256ToBig ¶
LEUint256ToBig returns the passed unsigned 256-bit integer encoded as little-endian as a big integer.
func NanoToBigEndianBytes ¶
NanoToBigEndianBytes returns an 8-byte big endian representation of the provided nanosecond time.
func ReversePrevBlockWords ¶
ReversePrevBlockWords reverses each 4-byte word in the provided hex encoded previous block hash.
Types ¶
This section is empty.