Documentation ¶
Index ¶
- Constants
- func IsValidAttributeType(usage AttributeUsage) bool
- type Attribute
- type AttributeUsage
- type Block
- type BlockEvidence
- type CoinType
- type DPosProposal
- func (p *DPosProposal) Data() []byte
- func (p *DPosProposal) Deserialize(r io.Reader) error
- func (p *DPosProposal) DeserializeUnSigned(r io.Reader) error
- func (p *DPosProposal) Hash() common.Uint256
- func (p *DPosProposal) Serialize(w io.Writer) error
- func (p *DPosProposal) SerializeUnsigned(w io.Writer) error
- type DPosProposalVote
- func (v *DPosProposalVote) Data() []byte
- func (v *DPosProposalVote) Deserialize(r io.Reader) error
- func (v *DPosProposalVote) DeserializeUnsigned(r io.Reader) error
- func (v *DPosProposalVote) Hash() common.Uint256
- func (v *DPosProposalVote) Serialize(w io.Writer) error
- func (v *DPosProposalVote) SerializeUnsigned(w io.Writer) error
- type DPosProposalVoteSlot
- type DposBlock
- type DposIllegalBlocks
- type DposIllegalData
- type DposIllegalProposals
- type DposIllegalVotes
- type Header
- type IllegalDataType
- type Input
- type OutPoint
- type Output
- type OutputPayload
- type OutputType
- type Payload
- type PayloadIllegalBlock
- type PayloadIllegalProposal
- type PayloadIllegalVote
- type ProposalEvidence
- 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() common.Uint256
- func (tx *Transaction) IsCancelProducerTx() bool
- func (tx *Transaction) IsCoinBaseTx() bool
- func (tx *Transaction) IsIllegalBlockTx() bool
- func (tx *Transaction) IsIllegalProposalTx() bool
- func (tx *Transaction) IsIllegalVoteTx() bool
- func (tx *Transaction) IsRechargeToSideChainTx() bool
- func (tx *Transaction) IsRegisterProducerTx() bool
- func (tx *Transaction) IsReturnDepositCoin() bool
- func (tx *Transaction) IsSideChainPowTx() bool
- func (tx *Transaction) IsTransferCrossChainAssetTx() bool
- func (tx *Transaction) IsUpdateProducerTx() 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
- type TransactionVersion
- type VoteEvidence
Constants ¶
View Source
const ( GenesisNonce uint32 = 2083236893 InvalidBlockSize int = -1 )
View Source
const ELACoin = CoinType(0)
View Source
const (
InvalidTransactionSize = -1
)
View Source
const PayloadIllegalBlockVersion byte = 0x00
View Source
const PayloadIllegalProposalVersion byte = 0x00
View Source
const PayloadIllegalVoteVersion byte = 0x00
Variables ¶
This section is empty.
Functions ¶
func IsValidAttributeType ¶
func IsValidAttributeType(usage AttributeUsage) bool
Types ¶
type Attribute ¶
type Attribute struct { Usage AttributeUsage Data []byte }
func NewAttribute ¶
func NewAttribute(u AttributeUsage, d []byte) Attribute
type AttributeUsage ¶
type AttributeUsage byte
const ( Nonce AttributeUsage = 0x00 Script AttributeUsage = 0x20 Memo AttributeUsage = 0x81 Description AttributeUsage = 0x90 DescriptionUrl AttributeUsage = 0x91 Confirmations AttributeUsage = 0x92 )
func (AttributeUsage) Name ¶
func (it AttributeUsage) Name() string
type Block ¶
type Block struct { Header Transactions []*Transaction }
type BlockEvidence ¶
type BlockEvidence struct { Block []byte BlockConfirm []byte Signers [][]byte // contains filtered or unexported fields }
func (*BlockEvidence) BlockHash ¶
func (b *BlockEvidence) BlockHash() common.Uint256
func (*BlockEvidence) Deserialize ¶
func (b *BlockEvidence) Deserialize(r io.Reader) error
type DPosProposal ¶
type DPosProposal struct { Sponsor string //todo [merge] replace with public key BlockHash common.Uint256 ViewOffset uint32 Sign []byte // contains filtered or unexported fields }
func (*DPosProposal) Data ¶
func (p *DPosProposal) Data() []byte
func (*DPosProposal) Deserialize ¶
func (p *DPosProposal) Deserialize(r io.Reader) error
func (*DPosProposal) DeserializeUnSigned ¶
func (p *DPosProposal) DeserializeUnSigned(r io.Reader) error
func (*DPosProposal) Hash ¶
func (p *DPosProposal) Hash() common.Uint256
func (*DPosProposal) SerializeUnsigned ¶
func (p *DPosProposal) SerializeUnsigned(w io.Writer) error
type DPosProposalVote ¶
type DPosProposalVote struct { ProposalHash common.Uint256 Signer string Accept bool Sign []byte // contains filtered or unexported fields }
func (*DPosProposalVote) Data ¶
func (v *DPosProposalVote) Data() []byte
func (*DPosProposalVote) Deserialize ¶
func (v *DPosProposalVote) Deserialize(r io.Reader) error
func (*DPosProposalVote) DeserializeUnsigned ¶
func (v *DPosProposalVote) DeserializeUnsigned(r io.Reader) error
func (*DPosProposalVote) Hash ¶
func (v *DPosProposalVote) Hash() common.Uint256
func (*DPosProposalVote) SerializeUnsigned ¶
func (v *DPosProposalVote) SerializeUnsigned(w io.Writer) error
type DPosProposalVoteSlot ¶
type DPosProposalVoteSlot struct { Hash common.Uint256 Proposal DPosProposal Votes []DPosProposalVote }
func (*DPosProposalVoteSlot) Deserialize ¶
func (p *DPosProposalVoteSlot) Deserialize(r io.Reader) error
func (*DPosProposalVoteSlot) Serialize ¶
func (p *DPosProposalVoteSlot) Serialize(w io.Writer) error
func (*DPosProposalVoteSlot) TryAppend ¶
func (p *DPosProposalVoteSlot) TryAppend(v DPosProposalVote) bool
type DposBlock ¶
type DposBlock struct { BlockFlag bool Block *Block ConfirmFlag bool Confirm *DPosProposalVoteSlot }
type DposIllegalBlocks ¶
type DposIllegalBlocks struct { CoinType CoinType BlockHeight uint32 Evidence BlockEvidence CompareEvidence BlockEvidence // contains filtered or unexported fields }
func (*DposIllegalBlocks) Deserialize ¶
func (d *DposIllegalBlocks) Deserialize(r io.Reader) error
func (*DposIllegalBlocks) GetBlockHeight ¶
func (d *DposIllegalBlocks) GetBlockHeight() uint32
func (*DposIllegalBlocks) Hash ¶
func (d *DposIllegalBlocks) Hash() common.Uint256
func (*DposIllegalBlocks) Type ¶
func (d *DposIllegalBlocks) Type() IllegalDataType
type DposIllegalData ¶
type DposIllegalProposals ¶
type DposIllegalProposals struct { Evidence ProposalEvidence CompareEvidence ProposalEvidence // contains filtered or unexported fields }
func (*DposIllegalProposals) Deserialize ¶
func (d *DposIllegalProposals) Deserialize(r io.Reader) error
func (*DposIllegalProposals) GetBlockHeight ¶
func (d *DposIllegalProposals) GetBlockHeight() uint32
func (*DposIllegalProposals) Hash ¶
func (d *DposIllegalProposals) Hash() common.Uint256
func (*DposIllegalProposals) Serialize ¶
func (d *DposIllegalProposals) Serialize(w io.Writer) error
func (*DposIllegalProposals) Type ¶
func (d *DposIllegalProposals) Type() IllegalDataType
type DposIllegalVotes ¶
type DposIllegalVotes struct { Evidence VoteEvidence CompareEvidence VoteEvidence // contains filtered or unexported fields }
func (*DposIllegalVotes) Deserialize ¶
func (d *DposIllegalVotes) Deserialize(r io.Reader) error
func (*DposIllegalVotes) GetBlockHeight ¶
func (d *DposIllegalVotes) GetBlockHeight() uint32
func (*DposIllegalVotes) Hash ¶
func (d *DposIllegalVotes) Hash() common.Uint256
func (*DposIllegalVotes) Type ¶
func (d *DposIllegalVotes) Type() IllegalDataType
type Header ¶
type IllegalDataType ¶
type IllegalDataType byte
const ( IllegalBlock IllegalDataType = 0x00 IllegalProposal IllegalDataType = 0x01 IllegalVote IllegalDataType = 0x02 )
type Input ¶
type OutPoint ¶
func OutPointFromBytes ¶
type Output ¶
type Output struct { AssetID common.Uint256 Value common.Fixed64 OutputLock uint32 ProgramHash common.Uint168 OutputType OutputType OutputPayload OutputPayload }
func (*Output) Deserialize ¶
func (o *Output) Deserialize(r io.Reader, txVersion TransactionVersion) error
type OutputPayload ¶
type OutputType ¶
type OutputType byte
const ( DefaultOutput OutputType = 0x00 VoteOutput OutputType = 0x01 )
type Payload ¶
type Payload interface { // Get payload data Data(version byte) []byte 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 structure
func GetPayload ¶
func GetPayload(txType TransactionType) (Payload, error)
type PayloadIllegalBlock ¶
type PayloadIllegalBlock struct {
DposIllegalBlocks
}
func (*PayloadIllegalBlock) Data ¶
func (p *PayloadIllegalBlock) Data(version byte) []byte
func (*PayloadIllegalBlock) Deserialize ¶
func (p *PayloadIllegalBlock) Deserialize(r io.Reader, version byte) error
type PayloadIllegalProposal ¶
type PayloadIllegalProposal struct {
DposIllegalProposals
}
func (*PayloadIllegalProposal) Data ¶
func (p *PayloadIllegalProposal) Data(version byte) []byte
func (*PayloadIllegalProposal) Deserialize ¶
func (p *PayloadIllegalProposal) Deserialize(r io.Reader, version byte) error
type PayloadIllegalVote ¶
type PayloadIllegalVote struct {
DposIllegalVotes
}
func (*PayloadIllegalVote) Data ¶
func (p *PayloadIllegalVote) Data(version byte) []byte
func (*PayloadIllegalVote) Deserialize ¶
func (p *PayloadIllegalVote) Deserialize(r io.Reader, version byte) error
type ProposalEvidence ¶
type ProposalEvidence struct { Proposal DPosProposal BlockHeader Header }
func (*ProposalEvidence) Deserialize ¶
func (d *ProposalEvidence) Deserialize(r io.Reader) error
func (*ProposalEvidence) IsMatch ¶
func (d *ProposalEvidence) IsMatch() bool
type Transaction ¶
type Transaction struct { Version TransactionVersion // New field added in TxVersionC0 TxType TransactionType PayloadVersion byte Payload Payload Attributes []*Attribute Inputs []*Input Outputs []*Output LockTime uint32 Programs []*pg.Program Fee common.Fixed64 FeePerKB common.Fixed64 // contains filtered or unexported fields }
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() common.Uint256
func (*Transaction) IsCancelProducerTx ¶
func (tx *Transaction) IsCancelProducerTx() bool
func (*Transaction) IsCoinBaseTx ¶
func (tx *Transaction) IsCoinBaseTx() bool
func (*Transaction) IsIllegalBlockTx ¶
func (tx *Transaction) IsIllegalBlockTx() bool
func (*Transaction) IsIllegalProposalTx ¶
func (tx *Transaction) IsIllegalProposalTx() bool
func (*Transaction) IsIllegalVoteTx ¶
func (tx *Transaction) IsIllegalVoteTx() bool
func (*Transaction) IsRechargeToSideChainTx ¶
func (tx *Transaction) IsRechargeToSideChainTx() bool
func (*Transaction) IsRegisterProducerTx ¶
func (tx *Transaction) IsRegisterProducerTx() bool
func (*Transaction) IsReturnDepositCoin ¶
func (tx *Transaction) IsReturnDepositCoin() bool
func (*Transaction) IsSideChainPowTx ¶
func (tx *Transaction) IsSideChainPowTx() bool
func (*Transaction) IsTransferCrossChainAssetTx ¶
func (tx *Transaction) IsTransferCrossChainAssetTx() bool
func (*Transaction) IsUpdateProducerTx ¶
func (tx *Transaction) IsUpdateProducerTx() bool
func (*Transaction) IsWithdrawFromSideChainTx ¶
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
TransactionType represents different transaction types with different payload format. The TransactionType range is 0x00 - 0x08. When it is greater than 0x08 it will be interpreted as a TransactionVersion.
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 RegisterProducer TransactionType = 0x09 CancelProducer TransactionType = 0x0a UpdateProducer TransactionType = 0x0b ReturnDepositCoin TransactionType = 0x0c IllegalProposalEvidence TransactionType = 0x0d IllegalVoteEvidence TransactionType = 0x0e IllegalBlockEvidence TransactionType = 0x0f )
func (TransactionType) Name ¶
func (self TransactionType) Name() string
type TransactionVersion ¶
type TransactionVersion byte
const ( TxVersionDefault TransactionVersion = 0x00 TxVersion09 TransactionVersion = 0x09 )
type VoteEvidence ¶
type VoteEvidence struct { Vote DPosProposalVote Proposal DPosProposal BlockHeader Header }
func (*VoteEvidence) Deserialize ¶
func (d *VoteEvidence) Deserialize(r io.Reader) error
func (*VoteEvidence) IsMatch ¶
func (d *VoteEvidence) IsMatch() bool
Source Files ¶
- attribute.go
- block.go
- blockconfirm.go
- dposillegalblocks.go
- dposillegaldata.go
- dposillegalproposals.go
- dposillegalvotes.go
- dposproposal.go
- dposproposalvote.go
- dposproposalvoteslot.go
- header.go
- input.go
- outpoint.go
- output.go
- payloadillegalblock.go
- payloadillegalproposal.go
- payloadillegalvote.go
- transaction.go
Click to show internal directories.
Click to hide internal directories.