Documentation ¶
Index ¶
- Constants
- Variables
- func CRandBytes(numBytes int) []byte
- func CRandHex(numDigits int) string
- func CReader() io.Reader
- func Checksum(bz []byte) []byte
- func ProTxHashValidate(val ProTxHash) error
- func SmallQuorumType() btcjson.LLMQType
- type Address
- type BatchVerifier
- type HexStringer
- type KeyType
- type PrivKey
- type ProTxHash
- type PubKey
- type QuorumHash
- type QuorumKeys
- type SortProTxHash
- type Symmetric
- type Validator
Constants ¶
const ( // HashSize is the size in bytes of an AddressHash. HashSize = sha256.Size // AddressSize is the size of a pubkey address. AddressSize = 20 DefaultHashSize = 32 DefaultAppHashSize = DefaultHashSize ProTxHashSize = DefaultHashSize QuorumHashSize = DefaultHashSize )
Variables ¶
var ( // ErrInvalidProTxHash uses in proTxHash validation ErrInvalidProTxHash = errors.New("proTxHash is invalid") )
Functions ¶
func CRandBytes ¶
CRandBytes this only uses the OS's randomness
func CRandHex ¶
CRandHex returns a hex encoded string that's floor(numDigits/2) * 2 long.
Note: CRandHex(24) gives 96 bits of randomness that are usually strong enough for most purposes.
func ProTxHashValidate ¶
ProTxHashValidate validates the proTxHash value
func SmallQuorumType ¶
Types ¶
type Address ¶
Address is an address is a []byte, but hex-encoded even in JSON. []byte leaves us the option to change the address length. Use an alias so Unmarshal methods (with ptr receivers) are available too.
func AddressHash ¶
AddressHash computes a truncated SHA-256 hash of bz for use as a peer address.
See: https://docs.tendermint.com/master/spec/core/data_structures.html#address
type BatchVerifier ¶
type BatchVerifier interface { // Add appends an entry into the BatchVerifier. Add(key PubKey, message, signature []byte) error // Verify verifies all the entries in the BatchVerifier, and returns // if every signature in the batch is valid, and a vector of bools // indicating the verification status of each signature (in the order // that signatures were added to the batch). Verify() (bool, []bool) }
BatchVerifier If a new key type implements batch verification, the key type must be registered in github.com/dashpay/tenderdash/crypto/batch
type ProTxHash ¶
func ProTxHashFromSeedBytes ¶
func RandProTxHash ¶
func RandProTxHash() ProTxHash
func RandProTxHashes ¶
RandProTxHashes generates and returns a list of N random generated proTxHashes
type QuorumHash ¶
func RandQuorumHash ¶
func RandQuorumHash() QuorumHash
type QuorumKeys ¶
func (QuorumKeys) MarshalJSON ¶
func (pvKey QuorumKeys) MarshalJSON() ([]byte, error)
func (*QuorumKeys) UnmarshalJSON ¶
func (pvKey *QuorumKeys) UnmarshalJSON(data []byte) error
type SortProTxHash ¶
type SortProTxHash []ProTxHash
func (SortProTxHash) Len ¶
func (sptxh SortProTxHash) Len() int
func (SortProTxHash) Less ¶
func (sptxh SortProTxHash) Less(i, j int) bool
func (SortProTxHash) Swap ¶
func (sptxh SortProTxHash) Swap(i, j int)