Documentation ¶
Index ¶
- Constants
- Variables
- func Cat(x, y data) data
- func CheckEncodeCashAddress(input []byte, prefix string, t AddressType) string
- func CreateChecksum(prefix string, payload data) data
- func DecodeCashAddress(str string) (string, data, error)
- func Encode(prefix string, payload data) string
- func ExpandPrefix(prefix string) data
- func LowerCase(c byte) byte
- func PolyMod(v data) uint64
- func VerifyAddress(addr string) error
- func VerifyChecksum(prefix string, payload data) bool
- type AddressType
Constants ¶
View Source
const CHARSET string = "qpzry9x8gf2tvdw0s3jn54khce6mua7l"
*
- The cashaddr character set for encoding.
Variables ¶
View Source
var ( // ErrChecksumMismatch describes an error where decoding failed due // to a bad checksum. ErrChecksumMismatch = errors.New("checksum mismatch") Prefix = "bitcoincash" )
View Source
var CHARSET_REV = [128]int8{}/* 128 elements not displayed */
*
- The cashaddr character set for decoding.
Functions ¶
func CheckEncodeCashAddress ¶
func CheckEncodeCashAddress(input []byte, prefix string, t AddressType) string
func ExpandPrefix ¶
func ExpandPrefix(prefix string) data
*
- Expand the address prefix for the checksum computation.
func PolyMod ¶
func PolyMod(v data) uint64
*
- This function will compute what 8 5-bit values to XOR into the last 8 input
- values, in order to make the checksum 0. These 8 values are packed together
- in a single 40-bit integer. The higher bits correspond to earlier values.
func VerifyAddress ¶ added in v0.13.16
DecodeAddress decodes the string encoding of an address and returns the Address if addr is a valid encoding for a known address type.
The bitcoin cash network the address is associated with is extracted if possible.
Types ¶
type AddressType ¶
type AddressType int
const ( P2PKH AddressType = 0 P2SH AddressType = 1 )
func CheckDecodeCashAddress ¶
func CheckDecodeCashAddress(input string) (result []byte, prefix string, t AddressType, err error)
CheckDecode decodes a string that was encoded with CheckEncode and verifies the checksum.
Click to show internal directories.
Click to hide internal directories.