Documentation ¶
Index ¶
- Constants
- Variables
- func CreateEmptyRawTransactionAndHash(fromUserID, to, appID 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 CallContractTx
- 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, to, appID 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 to - contract Hex when txType is TxType_CONTRACT
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 CallContractTx ¶ added in v1.0.29
type CallContractTx struct { TxType byte Version []byte ValidHeight []byte FromUserID []byte AppID []byte Fee []byte Amount []byte ContractHex []byte }
func NewCallContractTx ¶ added in v1.0.29
func NewCallContractTx(fromUserID, appID, contractHex string, validHeight, fee, amount int64) (*CallContractTx, error)
func (CallContractTx) GetHash ¶ added in v1.0.29
func (tx CallContractTx) GetHash() []byte
func (CallContractTx) ToBytes ¶ added in v1.0.29
func (tx CallContractTx) ToBytes() []byte
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.