Documentation
¶
Index ¶
- Constants
- Variables
- func CreateEmptyRawTransactionAndHash(fromUserID, toAddress string, amount, fee, validHeight int64, txType byte) (string, string, error)
- func Decode(input string, alphabet *Alphabet) ([]byte, error)
- func DecodeCheck(address string) ([]byte, []byte, error)
- func Encode(input []byte, alphabet *Alphabet) string
- func EncodeCheck(prefix []byte, hash []byte) string
- func GetProgramHashFromAddress(address string) ([]byte, error)
- func SignRawTransaction(hash string, prikey []byte) ([]byte, error)
- func VerifyAndCombineRawTransaction(emptyTrans string, sigPub SigPub) (bool, string)
- type Alphabet
- type CommonTx
- type RegisterAccountTx
- type SigPub
Constants ¶
Variables ¶
View Source
var (
BitcoinAlphabet = NewAlphabet("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz")
)
Alphabet: copy from https://en.wikipedia.org/wiki/Base58
View Source
var (
ErrorInvalidBase58String = errors.New("invalid base58 string")
)
Errors
Functions ¶
func CreateEmptyRawTransactionAndHash ¶
func CreateEmptyRawTransactionAndHash(fromUserID, toAddress string, amount, fee, validHeight int64, txType byte) (string, string, error)
fromUserID - user id when txType is TxType_COMMON fromUserID - publick key hex when txType is TxType_REGACCT
func DecodeCheck ¶
return prefix + hash + error
func EncodeCheck ¶
Types ¶
type Alphabet ¶
type Alphabet struct {
// contains filtered or unexported fields
}
Alphabet The base58 alphabet object.
func NewAlphabet ¶
NewAlphabet create a custom alphabet from 58-length string. Note: len(rune(alphabet)) must be 58.
type CommonTx ¶
type CommonTx struct {
TxType byte
Version []byte
ValidHeight []byte
FromUserID []byte
ToID []byte
Fee []byte
Amount []byte
}
func NewCommonTx ¶
type RegisterAccountTx ¶
type RegisterAccountTx struct {
TxType byte
Version []byte
ValidHeight []byte
UserID []byte
Fee []byte
}
func NewRegisterAccountTx ¶
func NewRegisterAccountTx(fromPubkey string, fee, validHeight int64) (*RegisterAccountTx, error)
func (RegisterAccountTx) GetHash ¶
func (tx RegisterAccountTx) GetHash() []byte
func (RegisterAccountTx) ToBytes ¶
func (tx RegisterAccountTx) ToBytes() []byte
Click to show internal directories.
Click to hide internal directories.