Documentation ¶
Index ¶
- Constants
- Variables
- func GenerateKey(rd io.Reader) (PubKey, PrvKey, error)
- func KeypairFromPrvKey(key PrvKey) (PubKey, PrvKey, error)
- func KeypairFromSeed(seed PrvKey, index uint32) (PubKey, PrvKey, error)
- func Reversed(str []byte) (result []byte)
- func ValidateAddress(addr string) bool
- type BlockHash
- type PrvKey
- type PubKey
- type Signature
- type Work
Constants ¶
View Source
const EncodeXrb = "13456789abcdefghijkmnopqrstuwxyz"
Variables ¶
View Source
var WorkThreshold = uint64(0xffffffc000000000)
View Source
var XrbEncoding = base32.NewEncoding(EncodeXrb)
Functions ¶
func ValidateAddress ¶
Types ¶
type BlockHash ¶
type BlockHash [32]byte
func BlockHashFromSlice ¶
func BlockHashFromString ¶
func (BlockHash) MarshalJSON ¶
func (*BlockHash) UnmarshalJSON ¶
type PrvKey ¶
type PrvKey ed25519.PrivateKey
func PrvKeyFromSlice ¶
func PrvKeyFromString ¶
func (PrvKey) MarshalJSON ¶
func (*PrvKey) UnmarshalJSON ¶
type PubKey ¶
func PubKeyFromAddress ¶
func PubKeyFromHex ¶
func PubKeyFromSlice ¶
func (PubKey) MarshalJSON ¶
func (*PubKey) UnmarshalJSON ¶
type Signature ¶
type Signature [64]byte
func NewSignature ¶
func SignatureFromSlice ¶
func (Signature) MarshalJSON ¶
func (*Signature) UnmarshalJSON ¶
type Work ¶
type Work [8]byte
func GenerateWorkForHash ¶
func WorkFromSlice ¶
func WorkFromString ¶
func (Work) MarshalJSON ¶
func (*Work) UnmarshalJSON ¶
func (Work) Validate ¶
ValidateWork takes the "work" value (little endian from hex) and block hash and verifies that the work passes the difficulty. To verify this, we create a new 8 byte hash of the work and the block hash and convert this to a uint64 which must be higher (or equal) than the difficulty (0xffffffc000000000) to be valid.
Click to show internal directories.
Click to hide internal directories.