Documentation
¶
Index ¶
- Variables
- func Base58CheckDecode(input string) (result []byte, version byte, err error)
- func Base58CheckEncode(input []byte, version byte) string
- func Base58Decode(b string) []byte
- func Base58Encode(b []byte) string
- func Bech32Decode(bech string) (string, []byte, error)
- func Bech32Encode(hrp string, data []byte) (string, error)
- func NewIDFromString(hashStr string) ([]byte, error)
- func NewIDToString(hash []byte) string
- func VarIntSerializeSize(val uint64) int
- func WitnessDecode(addr string) (string, byte, []byte, error)
- func WitnessEncode(hrp string, version byte, program []byte) (string, error)
- type Buffer
- func (b *Buffer) Bytes() []byte
- func (b *Buffer) End() bool
- func (b *Buffer) Len() int
- func (b *Buffer) ReadBytes(l int) ([]byte, error)
- func (b *Buffer) ReadU16() (uint32, error)
- func (b *Buffer) ReadU32() (uint32, error)
- func (b *Buffer) ReadU64() (uint64, error)
- func (b *Buffer) ReadU8() (uint8, error)
- func (b *Buffer) ReadVarBytes() ([]byte, error)
- func (b *Buffer) ReadVarInt() (uint64, error)
- func (b *Buffer) ReadVarString() (string, error)
- func (b *Buffer) Remaining() []byte
- func (b *Buffer) Reset()
- func (b *Buffer) Seek() int
- func (b *Buffer) WriteBytes(v []byte)
- func (b *Buffer) WriteU16(v uint32)
- func (b *Buffer) WriteU32(v uint32)
- func (b *Buffer) WriteU64(v uint64)
- func (b *Buffer) WriteU8(v uint8)
- func (b *Buffer) WriteVarBytes(v []byte)
- func (b *Buffer) WriteVarInt(v uint64)
- func (b *Buffer) WriteVarString(v string)
Constants ¶
This section is empty.
Variables ¶
var ( // ErrBase58Checksum -- // indicates that the checksum of a check-encoded string does not verify against the checksum ErrBase58Checksum = errors.New("checksum error") // ErrBase58InvalidFormat -- indicates that the check-encoded string has an invalid format ErrBase58InvalidFormat = errors.New("invalid format: version and/or checksum bytes missing") )
Functions ¶
func Base58CheckDecode ¶
Base58CheckDecode -- decodes a string that was encoded with CheckEncode and verifies the checksum
func Base58CheckEncode ¶
Base58CheckEncode -- prepends a version byte and appends a four byte checksum
func Base58Decode ¶
Base58Decode -- decodes a modified base58 string to a byte slice
func Base58Encode ¶
Base58Encode -- encodes a byte slice to a modified base58 string
func Bech32Decode ¶
Bech32Decode -- decodes a bech32 encoded string, returning the human-readable part and the data part excluding the checksum.
func Bech32Encode ¶
Bech32Encode -- encodes a byte slice into a bech32 string with the human-readable part hrb. Note that the bytes must each encode 5 bits (base32).
func NewIDFromString ¶
NewIDFromString -- returns byte-reverse hash bytes.
func NewIDToString ¶
NewIDToString -- returns byte-reverse hash hex.
func VarIntSerializeSize ¶
VarIntSerializeSize -- returns the number of bytes it would take to serialize val as a variable length integer.
func WitnessDecode ¶
WitnessDecode -- decodes the segwit address to hrp, version and pubkeyscript.
Types ¶
type Buffer ¶
type Buffer struct {
// contains filtered or unexported fields
}
Buffer -- a buffer writer/reader for bitcoin.
func NewBufferReader ¶
NewBufferReader -- creates a new buffer with data initialize.
func (*Buffer) ReadU16 ¶
ReadU16 -- read uint16 from the buffer which with the little-endian byteorder.
func (*Buffer) ReadU32 ¶
ReadU32 -- read uint32 from the buffer which with the little-endian byteorder.
func (*Buffer) ReadU64 ¶
ReadU64 -- read uint64 from the buffer which with the little-endian byteorder.
func (*Buffer) ReadVarBytes ¶
ReadVarBytes -- read variable length bytes from the buffer.
func (*Buffer) ReadVarInt ¶
ReadVarInt -- read variable int from the buffer.
func (*Buffer) ReadVarString ¶
ReadVarString -- read variable length string from the buffer.
func (*Buffer) WriteBytes ¶
WriteBytes -- write bytes to the buffer.
func (*Buffer) WriteVarBytes ¶
WriteVarBytes -- write variables length bytes to the buffer.
func (*Buffer) WriteVarInt ¶
WriteVarInt -- write variable int to the buffer.
func (*Buffer) WriteVarString ¶
WriteVarString -- write variables length string to the buffer.