Documentation
¶
Index ¶
- Constants
- func BytesToHexString(bytes []byte) string
- func Decode(input string) ([]byte, error)
- func DecodeCheck(input string) ([]byte, error)
- func Encode(input []byte) string
- func EncodeCheck(input []byte) string
- func FromHex(s string) ([]byte, error)
- func Has0xPrefix(str string) bool
- func HexToBytes(str string) ([]byte, error)
- type Address
- type Key
- func (key Key) Base58Address() string
- func (key Key) ID() string
- func (key Key) PublicKeyStr() string
- func (key Key) Raw() internal.Raw
- func (key Key) Sign(msg []byte) ([]byte, error)
- func (key Key) ToEncryptedJSON(password string, scryptParams commonkeystore.ScryptParams) (export []byte, err error)
Constants ¶
const ( // HashLength is the expected length of the hash HashLength = 32 // AddressLengthBase58 is the expected length of the address in base58format AddressLengthBase58 = 34 // TronBytePrefix is the hex prefix to address TronBytePrefix = byte(prefixMainnet) // Tron address should have 21 bytes (20 bytes + 1 byte prefix) AddressLength = 21 )
Variables ¶
This section is empty.
Functions ¶
func BytesToHexString ¶
BytesToHexString encodes bytes as a hex string.
func DecodeCheck ¶
func EncodeCheck ¶
func FromHex ¶
FromHex returns the bytes represented by the hexadecimal string s. s may be prefixed with "0x".
func Has0xPrefix ¶
Has0xPrefix validates str begins with '0x' or '0X'.
func HexToBytes ¶
HexToBytes returns the bytes represented by the hexadecimal string str.
Types ¶
type Address ¶
type Address [AddressLength]byte
Address represents the 21 byte address of an Tron account.
func Base58ToAddress ¶
Base58ToAddress returns Address with byte values of s.
func HexToAddress ¶
HexToAddress returns Address with byte values of s.
func PubkeyToAddress ¶
PubkeyToAddress returns address from ecdsa public key
type Key ¶
type Key struct {
// contains filtered or unexported fields
}
func FromEncryptedJSON ¶
FromEncryptedJSON gets key from json and password
func MustNewInsecure ¶
MustNewInsecure return Key if no error This insecure function is used for testing purposes only
func (Key) Base58Address ¶
Base58Address returns the Tron address in Base58 format with checksum
func (Key) PublicKeyStr ¶
PublicKeyStr returns the public key as a hexadecimal string
func (Key) ToEncryptedJSON ¶
func (key Key) ToEncryptedJSON(password string, scryptParams commonkeystore.ScryptParams) (export []byte, err error)
ToEncryptedJSON returns encrypted JSON representing key