Documentation ¶
Index ¶
- Constants
- Variables
- func CreateEmptyRawTransaction(gasPrice, gasLimit uint64, txState TxState) (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 InsertSignatureIntoEmptyTransaction(txHex string, sp SigPub) (string, error)
- func VerifyRawTransaction(txHex string) bool
- type Alphabet
- type MultiTx
- type NativeInvoke
- type NormalTx
- type SigData
- type SigPub
- type Transaction
- func (t Transaction) GetGasLimit() uint64
- func (t Transaction) GetGasPrice() uint64
- func (t Transaction) GetNonce() uint32
- func (t Transaction) GetPayLoad() string
- func (t Transaction) GetPayer() string
- func (t Transaction) GetTxType() byte
- func (t Transaction) GetVersion() byte
- func (t Transaction) ToBytes() ([]byte, error)
- type TxHash
- type TxState
Constants ¶
View Source
const ( AssetONT = 0 AssetONG = 1 AssetONGWithdraw = 2 )
View Source
const ( DefaultGasPrice = uint64(500) DefaultGasLimit = uint64(20000) )
View Source
const ( ONTContractVersion = byte(0x00) ONGContractVersion = byte(0x00) ONTContractAddress = "0100000000000000000000000000000000000000" ONGContractAddress = "0200000000000000000000000000000000000000" TxTypeInvoke = byte(0xD1) DefaultAttribute = byte(0) )
View Source
const ( MethodTransfer = "transfer" MethodTransferFrom = "transferFrom" NativeInvokeName = "Ontology.Native.Invoke" )
View Source
const ( OpCodeNewStruct = byte(0xC6) OpCodeToALTStack = byte(0x6B) OpCodeDupFromALTStack = byte(0x6A) OpCodeAppend = byte(0xC8) OpCodePush0 = byte(0x00) OpCodePush1 = byte(0x51) OpCodeFromALTStack = byte(0x6C) OpCodePack = byte(0xC1) OpCodeSysCall = byte(0x68) OpCodeCheckSig = byte(0xAC) OpCodeCheckMultiSig = byte(0xAE) )
View Source
const AddressPrefix = byte(0x17)
Variables ¶
View Source
var ( CurveOrder = []byte{0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xBC, 0xE6, 0xFA, 0xAD, 0xA7, 0x17, 0x9E, 0x84, 0xF3, 0xB9, 0xCA, 0xC2, 0xFC, 0x63, 0x25, 0x51} HalfCurveOrder = []byte{0x7F, 0xFF, 0xFF, 0xFF, 0x80, 0x00, 0x00, 0x00, 0x7F, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xDE, 0x73, 0x7D, 0x56, 0xD3, 0x8B, 0xCF, 0x42, 0x79, 0xDC, 0xE5, 0x61, 0x7E, 0x31, 0x92, 0xA8} )
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 CreateEmptyRawTransaction ¶ added in v1.0.1
func DecodeCheck ¶
return prefix + hash + error
func EncodeCheck ¶
func InsertSignatureIntoEmptyTransaction ¶ added in v1.0.1
func VerifyRawTransaction ¶ added in v1.0.1
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 NativeInvoke ¶
func NewNativeInvoke ¶
func NewNativeInvoke(param TxState) NativeInvoke
func (NativeInvoke) ToBytes ¶
func (ni NativeInvoke) ToBytes() ([]byte, error)
type Transaction ¶
type Transaction struct { Version byte TxType byte Nonce []byte GasPrice []byte GaseLimit []byte Payer []byte Payload []byte Attributes byte SigDatas []SigData }
func DecodeRawTransaction ¶
func DecodeRawTransaction(txBytes []byte) (*Transaction, error)
func NewEmptyTransaction ¶
func (Transaction) GetGasLimit ¶
func (t Transaction) GetGasLimit() uint64
func (Transaction) GetGasPrice ¶
func (t Transaction) GetGasPrice() uint64
func (Transaction) GetNonce ¶
func (t Transaction) GetNonce() uint32
func (Transaction) GetPayLoad ¶
func (t Transaction) GetPayLoad() string
func (Transaction) GetPayer ¶
func (t Transaction) GetPayer() string
func (Transaction) GetTxType ¶
func (t Transaction) GetTxType() byte
func (Transaction) GetVersion ¶
func (t Transaction) GetVersion() byte
func (Transaction) ToBytes ¶
func (t Transaction) ToBytes() ([]byte, error)
type TxHash ¶
func CreateRawTransactionHashForSig ¶ added in v1.0.1
func (TxHash) GetNormalTxAddress ¶ added in v1.0.1
func (TxHash) GetTxHashHex ¶
func (TxHash) IsMultisig ¶ added in v1.0.1
Click to show internal directories.
Click to hide internal directories.