Documentation ¶
Index ¶
- Constants
- Variables
- func GenerateKey() (*ecdsa.PrivateKey, error)
- func GetPrivateKeyByHexString(privateKeyHexString string) (*ecdsa.PrivateKey, error)
- func SetAddressPrefix(p byte)
- func Sign(hash []byte, privateKey *ecdsa.PrivateKey) ([]byte, error)
- func UseMainnet()
- func UseTestnet()
- func VerifySignature(publicKey, hash, signature []byte) bool
- type Address
Constants ¶
View Source
const AddressLength = 21
Variables ¶
View Source
var AddressPrefix = byte(0x41)
AddressPrefix is the byte prefix of the address used in TRON addresses. It's supposed to be '0xa0' for testnet, and '0x41' for mainnet. But the Shasta mainteiners don't use the testnet params. So the default value is 41. You may change it directly, or use the SetAddressPrefix/UseMainnet/UseTestnet methods.
Functions ¶
func GenerateKey ¶
func GenerateKey() (*ecdsa.PrivateKey, error)
func GetPrivateKeyByHexString ¶
func GetPrivateKeyByHexString(privateKeyHexString string) (*ecdsa.PrivateKey, error)
func SetAddressPrefix ¶
func SetAddressPrefix(p byte)
SetAddressPrefix sets the prefix to the provided byte.
func VerifySignature ¶
Types ¶
Click to show internal directories.
Click to hide internal directories.