Documentation ¶
Index ¶
- Constants
- func AddressToBech32(addr Address) string
- func CRandBytes(numBytes int) []byte
- func CRandHex(numDigits int) string
- func CReader() io.Reader
- func GetFromBech32(bech32str, prefix string) ([]byte, error)
- func PubKeyToBech32(pub PubKey) string
- func Sha256(bytes []byte) []byte
- type Address
- func AddressFromBech32(bech32str string) (Address, error)
- func AddressFromBytes(bz []byte) (ret Address)
- func AddressFromID(id ID) (addr Address, err error)
- func AddressFromPreimage(bz []byte) Address
- func AddressFromString(str string) (addr Address, err error)
- func MustAddressFromString(str string) (addr Address)
- func (addr Address) Bech32() Bech32Address
- func (addr Address) Bytes() []byte
- func (addr Address) Compare(other Address) int
- func (addr *Address) DecodeID(id ID) error
- func (addr *Address) DecodeString(str string) error
- func (addr Address) ID() ID
- func (addr Address) IsZero() bool
- func (addr Address) MarshalAmino() (string, error)
- func (addr Address) MarshalJSON() ([]byte, error)
- func (addr Address) String() string
- func (addr *Address) UnmarshalAmino(b32str string) (err error)
- func (addr *Address) UnmarshalJSON(b []byte) error
- type Bech32Address
- type ID
- type PrivKey
- type PubKey
- type Symmetric
Examples ¶
Constants ¶
View Source
const ( // Bech32AddrPrefix defines the Bech32 prefix of an address Bech32AddrPrefix = "g" // Bech32PubKeyPrefix defines the Bech32 prefix of a pubkey Bech32PubKeyPrefix = "gpub" // Atom in https://github.com/satoshilabs/slips/blob/master/slip-0044.md CoinType uint32 = 118 // BIP44Prefix is the parts of the BIP44 HD path that are fixed by // what we used during the fundraiser. Bip44DefaultPath = "44'/118'/0'/0/0" )
View Source
const ( // AddressSize is the size of a pubkey address. AddressSize = tmhash.TruncatedSize )
View Source
const Version = "v1.0.0-rc.0"
Variables ¶
This section is empty.
Functions ¶
func AddressToBech32 ¶
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 GetFromBech32 ¶
GetFromBech32 decodes a bytestring from a Bech32 encoded string.
func PubKeyToBech32 ¶
Types ¶
type Address ¶
type Address [AddressSize]byte
(truncated) hash of some preimage (typically of a pubkey).
func AddressFromBech32 ¶
func AddressFromBytes ¶
func AddressFromID ¶
func AddressFromPreimage ¶
func AddressFromString ¶
func MustAddressFromString ¶
func (Address) Bech32 ¶
func (addr Address) Bech32() Bech32Address
func (*Address) DecodeString ¶
func (Address) MarshalAmino ¶
func (Address) MarshalJSON ¶
func (*Address) UnmarshalAmino ¶
func (*Address) UnmarshalJSON ¶
type Bech32Address ¶
type Bech32Address string
func (Bech32Address) String ¶
func (b32 Bech32Address) String() string
type PrivKey ¶
type PrivKey interface { // Stable Bytes() []byte Sign(msg []byte) ([]byte, error) PubKey() PubKey Equals(PrivKey) bool }
All operations must be deterministic.
func PrivKeyFromBytes ¶
Source Files ¶
Click to show internal directories.
Click to hide internal directories.