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 PayloadRecord
- type PayloadRegisterAsset
- type PayloadSideChainPow
- type PayloadTransferAsset
- type PayloadTransferCrossChainAsset
- type PayloadWithdrawFromSideChain
- type Program
- type Transaction
- func (tx *Transaction) Deserialize(r io.Reader) error
- func (tx *Transaction) DeserializeUnsigned(r io.Reader) error
- func (tx *Transaction) GetSize() int
- func (tx *Transaction) Hash() Uint256
- func (tx *Transaction) IsCoinBaseTx() bool
- func (tx *Transaction) IsRechargeToSideChainTx() bool
- func (tx *Transaction) IsSideChainPowTx() bool
- func (tx *Transaction) IsTransferCrossChainAssetTx() bool
- func (tx *Transaction) IsWithdrawFromSideChainTx() 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 = 2083236893 InvalidBlockSize int = -1 CheckTxOut = 1 << 1 BlockHeightCheckTxOut = 88812 )
View Source
const (
InvalidTransactionSize = -1
)
View Source
const PayloadCoinBaseVersion byte = 0x04
View Source
const RecordPayloadVersion byte = 0x00
View Source
const SideChainPowPayloadVersion byte = 0x00
View Source
const WithdrawFromSideChainPayloadVersion byte = 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 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 PayloadSideChainPow ¶ added in v0.1.1
type PayloadSideChainPow struct { SideBlockHash Uint256 SideGenesisHash Uint256 BlockHeight uint32 SignedData []byte }
func (*PayloadSideChainPow) Data ¶ added in v0.1.1
func (a *PayloadSideChainPow) Data(version byte) []byte
func (*PayloadSideChainPow) Deserialize ¶ added in v0.1.1
func (a *PayloadSideChainPow) Deserialize(r io.Reader, version byte) error
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 PayloadWithdrawFromSideChain ¶ added in v0.1.1
type PayloadWithdrawFromSideChain struct { BlockHeight uint32 GenesisBlockAddress string SideChainTransactionHashes []common.Uint256 }
func (*PayloadWithdrawFromSideChain) Data ¶ added in v0.1.1
func (t *PayloadWithdrawFromSideChain) Data(version byte) []byte
func (*PayloadWithdrawFromSideChain) Deserialize ¶ added in v0.1.1
func (t *PayloadWithdrawFromSideChain) 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) 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 ¶ added in v0.1.1
func (tx *Transaction) IsRechargeToSideChainTx() bool
func (*Transaction) IsSideChainPowTx ¶ added in v0.1.1
func (tx *Transaction) IsSideChainPowTx() bool
func (*Transaction) IsTransferCrossChainAssetTx ¶ added in v0.1.1
func (tx *Transaction) IsTransferCrossChainAssetTx() bool
func (*Transaction) IsWithdrawFromSideChainTx ¶ added in v0.1.1
func (tx *Transaction) IsWithdrawFromSideChainTx() 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 )
func (TransactionType) Name ¶
func (self TransactionType) Name() string
Source Files ¶
Click to show internal directories.
Click to hide internal directories.