Documentation ¶
Index ¶
- Constants
- func IsValidAttributeType(usage AttributeUsage) bool
- type Asset
- type AssetRecordType
- type AssetType
- type Attribute
- type AttributeUsage
- type Block
- type Header
- type Input
- type OutPoint
- type Output
- type Payload
- type PayloadCoinBase
- type PayloadRechargeToSideChain
- func (t *PayloadRechargeToSideChain) Data(version byte) []byte
- func (t *PayloadRechargeToSideChain) Deserialize(r io.Reader, version byte) error
- func (t *PayloadRechargeToSideChain) GetMainchainTxHash() (*common.Uint256, error)
- func (t *PayloadRechargeToSideChain) Serialize(w io.Writer, version byte) error
- type PayloadRecord
- type PayloadRegisterAsset
- type PayloadRegisterIdentification
- type PayloadTransferAsset
- type PayloadTransferCrossChainAsset
- type Program
- type Transaction
- func (tx *Transaction) Deserialize(r io.Reader) error
- func (tx *Transaction) DeserializeUnsigned(r io.Reader) error
- func (tx *Transaction) GetData() []byte
- func (tx *Transaction) GetDataContainer(programHash *Uint168) interfaces.IDataContainer
- func (tx *Transaction) GetSize() int
- func (tx *Transaction) Hash() Uint256
- func (tx *Transaction) IsCoinBaseTx() bool
- func (tx *Transaction) IsRechargeToSideChainTx() bool
- func (tx *Transaction) IsRegisterIdentificationTx() bool
- func (tx *Transaction) IsSideChainPowTx() bool
- func (tx *Transaction) IsTransferCrossChainAssetTx() bool
- func (tx *Transaction) Serialize(w io.Writer) error
- func (tx *Transaction) SerializeUnsigned(w io.Writer) error
- func (tx *Transaction) String() string
- type TransactionType
Constants ¶
View Source
const ( MaxPrecision = 8 MinPrecision = 0 )
View Source
const ( BlockVersion uint32 = 0 GenesisNonce uint32 = 3194347904 InvalidBlockSize int = -1 )
View Source
const (
InvalidTransactionSize = -1
)
View Source
const PayloadCoinBaseVersion byte = 0x04
View Source
const RechargeToSideChainPayloadVersion byte = 0x00
View Source
const RecordPayloadVersion byte = 0x00
View Source
const RegisterIdentificationVersion = 0x00
Variables ¶
This section is empty.
Functions ¶
func IsValidAttributeType ¶
func IsValidAttributeType(usage AttributeUsage) bool
Types ¶
type Asset ¶
type Asset struct { Name string Description string Precision byte AssetType AssetType RecordType AssetRecordType }
registered asset will be assigned to contract address
func (*Asset) Deserialize ¶
Deserialize is the implement of SignableData interface.
type AssetRecordType ¶
type AssetRecordType byte
const ( Unspent AssetRecordType = 0x00 Balance AssetRecordType = 0x01 )
type Attribute ¶
type Attribute struct { Usage AttributeUsage Data []byte Size uint32 }
func NewAttribute ¶
func NewAttribute(u AttributeUsage, d []byte) Attribute
type AttributeUsage ¶
type AttributeUsage byte
const ( Nonce AttributeUsage = 0x00 Script AttributeUsage = 0x20 DescriptionUrl AttributeUsage = 0x81 Description AttributeUsage = 0x90 Memo AttributeUsage = 0x91 )
func (AttributeUsage) Name ¶
func (self AttributeUsage) Name() string
type Block ¶
type Block struct { Header Transactions []*Transaction }
type Header ¶
type Input ¶
type OutPoint ¶
type OutPoint struct { TxID Uint256 Index uint16 }
func NewOutPoint ¶
func OutPointFromBytes ¶
type Output ¶
type Output struct { AssetID Uint256 Value Fixed64 OutputLock uint32 ProgramHash Uint168 }
type Payload ¶
type Payload interface { // Get payload data Data(version byte) []byte //Serialize payload data Serialize(w io.Writer, version byte) error Deserialize(r io.Reader, version byte) error }
Payload define the func for loading the payload data base on payload type which have different struture
func GetPayload ¶
func GetPayload(txType TransactionType) (Payload, error)
type PayloadCoinBase ¶
type PayloadCoinBase struct {
CoinbaseData []byte
}
func (*PayloadCoinBase) Data ¶
func (a *PayloadCoinBase) Data(version byte) []byte
func (*PayloadCoinBase) Deserialize ¶
func (a *PayloadCoinBase) Deserialize(r io.Reader, version byte) error
type PayloadRechargeToSideChain ¶
func (*PayloadRechargeToSideChain) Data ¶
func (t *PayloadRechargeToSideChain) Data(version byte) []byte
func (*PayloadRechargeToSideChain) Deserialize ¶
func (t *PayloadRechargeToSideChain) Deserialize(r io.Reader, version byte) error
func (*PayloadRechargeToSideChain) GetMainchainTxHash ¶
func (t *PayloadRechargeToSideChain) GetMainchainTxHash() (*common.Uint256, error)
type PayloadRecord ¶
func (*PayloadRecord) Data ¶
func (a *PayloadRecord) Data(version byte) []byte
func (*PayloadRecord) Deserialize ¶
func (a *PayloadRecord) Deserialize(r io.Reader, version byte) error
Deserialize is the implement of SignableData interface.
type PayloadRegisterAsset ¶
type PayloadRegisterAsset struct { Asset Asset Amount Fixed64 Controller Uint168 }
func (*PayloadRegisterAsset) Data ¶
func (a *PayloadRegisterAsset) Data(version byte) []byte
func (*PayloadRegisterAsset) Deserialize ¶
func (a *PayloadRegisterAsset) Deserialize(r io.Reader, version byte) error
type PayloadRegisterIdentification ¶
type PayloadRegisterIdentification struct { ID string Path string DataHash common.Uint256 Proof []byte Sign []byte }
func (*PayloadRegisterIdentification) Data ¶
func (a *PayloadRegisterIdentification) Data(version byte) []byte
func (*PayloadRegisterIdentification) Deserialize ¶
func (a *PayloadRegisterIdentification) Deserialize(r io.Reader, version byte) error
func (*PayloadRegisterIdentification) GetData ¶
func (a *PayloadRegisterIdentification) GetData() []byte
VM IDataContainer interface
type PayloadTransferAsset ¶
type PayloadTransferAsset struct{}
func (*PayloadTransferAsset) Data ¶
func (a *PayloadTransferAsset) Data(version byte) []byte
func (*PayloadTransferAsset) Deserialize ¶
func (a *PayloadTransferAsset) Deserialize(r io.Reader, version byte) error
type PayloadTransferCrossChainAsset ¶
type PayloadTransferCrossChainAsset struct { CrossChainAddresses []string OutputIndexes []uint64 CrossChainAmounts []common.Fixed64 }
func (*PayloadTransferCrossChainAsset) Data ¶
func (a *PayloadTransferCrossChainAsset) Data(version byte) []byte
func (*PayloadTransferCrossChainAsset) Deserialize ¶
func (a *PayloadTransferCrossChainAsset) Deserialize(r io.Reader, version byte) error
type Program ¶
type Program struct { //the contract program code,which will be run on VM or specific envrionment Code []byte //the program code's parameter Parameter []byte }
func (*Program) Deserialize ¶
Deserialize the Program
type Transaction ¶
type Transaction struct { TxType TransactionType PayloadVersion byte Payload Payload Attributes []*Attribute Inputs []*Input Outputs []*Output LockTime uint32 Programs []*Program Fee Fixed64 FeePerKB Fixed64 // contains filtered or unexported fields }
func NewTrimmedTx ¶
func NewTrimmedTx(hash Uint256) *Transaction
func (*Transaction) Deserialize ¶
func (tx *Transaction) Deserialize(r io.Reader) error
deserialize the Transaction
func (*Transaction) DeserializeUnsigned ¶
func (tx *Transaction) DeserializeUnsigned(r io.Reader) error
func (*Transaction) GetDataContainer ¶
func (tx *Transaction) GetDataContainer(programHash *Uint168) interfaces.IDataContainer
func (*Transaction) GetSize ¶
func (tx *Transaction) GetSize() int
func (*Transaction) Hash ¶
func (tx *Transaction) Hash() Uint256
func (*Transaction) IsCoinBaseTx ¶
func (tx *Transaction) IsCoinBaseTx() bool
func (*Transaction) IsRechargeToSideChainTx ¶
func (tx *Transaction) IsRechargeToSideChainTx() bool
func (*Transaction) IsRegisterIdentificationTx ¶
func (tx *Transaction) IsRegisterIdentificationTx() bool
func (*Transaction) IsSideChainPowTx ¶
func (tx *Transaction) IsSideChainPowTx() bool
func (*Transaction) IsTransferCrossChainAssetTx ¶
func (tx *Transaction) IsTransferCrossChainAssetTx() bool
func (*Transaction) Serialize ¶
func (tx *Transaction) Serialize(w io.Writer) error
Serialize the Transaction
func (*Transaction) SerializeUnsigned ¶
func (tx *Transaction) SerializeUnsigned(w io.Writer) error
Serialize the Transaction data without contracts
func (*Transaction) String ¶
func (tx *Transaction) String() string
type TransactionType ¶
type TransactionType byte
for different transaction types with different payload format and transaction process methods
const ( CoinBase TransactionType = 0x00 RegisterAsset TransactionType = 0x01 TransferAsset TransactionType = 0x02 Record TransactionType = 0x03 Deploy TransactionType = 0x04 SideChainPow TransactionType = 0x05 RechargeToSideChain TransactionType = 0x06 WithdrawFromSideChain TransactionType = 0x07 TransferCrossChainAsset TransactionType = 0x08 RegisterIdentification TransactionType = 0x09 )
func (TransactionType) Name ¶
func (self TransactionType) Name() string
Source Files ¶
Click to show internal directories.
Click to hide internal directories.