Documentation ¶
Index ¶
- Constants
- type Block
- func (b *Block) BlockHash() string
- func (b *Block) IsGenesisBlock() bool
- func (x *Block) PacketIdentifier() PacketIdentifier
- func (b *Block) PrevBlockHash() string
- func (x *Block) Read(viewer *BlockViewer, reader *karmem.Reader)
- func (x *Block) ReadAsRoot(reader *karmem.Reader)
- func (x *Block) Reset()
- func (x *Block) Write(writer *karmem.Writer, start uint) (offset uint, err error)
- func (x *Block) WriteAsRoot(writer *karmem.Writer) (offset uint, err error)
- type BlockHeader
- func (x *BlockHeader) PacketIdentifier() PacketIdentifier
- func (x *BlockHeader) Read(viewer *BlockHeaderViewer, reader *karmem.Reader)
- func (x *BlockHeader) ReadAsRoot(reader *karmem.Reader)
- func (x *BlockHeader) Reset()
- func (x *BlockHeader) Write(writer *karmem.Writer, start uint) (offset uint, err error)
- func (x *BlockHeader) WriteAsRoot(writer *karmem.Writer) (offset uint, err error)
- type BlockHeaderViewer
- func (x *BlockHeaderViewer) BlockHash() (v []byte)
- func (x *BlockHeaderViewer) GasLimit() (v int64)
- func (x *BlockHeaderViewer) Height() (v int64)
- func (x *BlockHeaderViewer) MerkleRoot() (v []byte)
- func (x *BlockHeaderViewer) Params(reader *karmem.Reader) (v []byte)
- func (x *BlockHeaderViewer) PrevBlockHash() (v []byte)
- func (x *BlockHeaderViewer) PublicKey() (v []byte)
- func (x *BlockHeaderViewer) Timestamp() (v int64)
- type BlockViewer
- type DataCommand
- func (x *DataCommand) PacketIdentifier() PacketIdentifier
- func (x *DataCommand) Read(viewer *DataCommandViewer, reader *karmem.Reader)
- func (x *DataCommand) ReadAsRoot(reader *karmem.Reader)
- func (x *DataCommand) Reset()
- func (x *DataCommand) Write(writer *karmem.Writer, start uint) (offset uint, err error)
- func (x *DataCommand) WriteAsRoot(writer *karmem.Writer) (offset uint, err error)
- type DataCommandViewer
- type GeneralParams
- func (x *GeneralParams) PacketIdentifier() PacketIdentifier
- func (x *GeneralParams) Read(viewer *GeneralParamsViewer, reader *karmem.Reader)
- func (x *GeneralParams) ReadAsRoot(reader *karmem.Reader)
- func (x *GeneralParams) Reset()
- func (x *GeneralParams) Write(writer *karmem.Writer, start uint) (offset uint, err error)
- func (x *GeneralParams) WriteAsRoot(writer *karmem.Writer) (offset uint, err error)
- type GeneralParamsViewer
- func (x *GeneralParamsViewer) Proof(reader *karmem.Reader) (v []byte)
- func (x *GeneralParamsViewer) RandomNumber() (v []byte)
- func (x *GeneralParamsViewer) Result(reader *karmem.Reader) (v []byte)
- func (x *GeneralParamsViewer) S(reader *karmem.Reader) (v []byte)
- func (x *GeneralParamsViewer) T(reader *karmem.Reader) (v []byte)
- type GenesisParams
- func (x *GenesisParams) PacketIdentifier() PacketIdentifier
- func (x *GenesisParams) Read(viewer *GenesisParamsViewer, reader *karmem.Reader)
- func (x *GenesisParams) ReadAsRoot(reader *karmem.Reader)
- func (x *GenesisParams) Reset()
- func (x *GenesisParams) Write(writer *karmem.Writer, start uint) (offset uint, err error)
- func (x *GenesisParams) WriteAsRoot(writer *karmem.Writer) (offset uint, err error)
- type GenesisParamsViewer
- type Hash
- type PacketIdentifier
- type Transaction
- func (x *Transaction) PacketIdentifier() PacketIdentifier
- func (x *Transaction) Read(viewer *TransactionViewer, reader *karmem.Reader)
- func (x *Transaction) ReadAsRoot(reader *karmem.Reader)
- func (x *Transaction) Reset()
- func (tx *Transaction) Verify() bool
- func (x *Transaction) Write(writer *karmem.Writer, start uint) (offset uint, err error)
- func (x *Transaction) WriteAsRoot(writer *karmem.Writer) (offset uint, err error)
- type TransactionBody
- func (x *TransactionBody) PacketIdentifier() PacketIdentifier
- func (x *TransactionBody) Read(viewer *TransactionBodyViewer, reader *karmem.Reader)
- func (x *TransactionBody) ReadAsRoot(reader *karmem.Reader)
- func (x *TransactionBody) Reset()
- func (x *TransactionBody) Write(writer *karmem.Writer, start uint) (offset uint, err error)
- func (x *TransactionBody) WriteAsRoot(writer *karmem.Writer) (offset uint, err error)
- type TransactionBodyViewer
- func (x *TransactionBodyViewer) Address() (v []byte)
- func (x *TransactionBodyViewer) BlockHash() (v []byte)
- func (x *TransactionBodyViewer) Data(reader *karmem.Reader) (v []byte)
- func (x *TransactionBodyViewer) Event(reader *karmem.Reader) (v []byte)
- func (x *TransactionBodyViewer) Expire() (v int64)
- func (x *TransactionBodyViewer) Gas() (v int64)
- func (x *TransactionBodyViewer) Hash() (v []byte)
- func (x *TransactionBodyViewer) Height() (v int64)
- func (x *TransactionBodyViewer) Index() (v int64)
- func (x *TransactionBodyViewer) Nonce() (v int64)
- func (x *TransactionBodyViewer) Opt(reader *karmem.Reader) (v []byte)
- func (x *TransactionBodyViewer) Public() (v []byte)
- func (x *TransactionBodyViewer) Receiver() (v []byte)
- func (x *TransactionBodyViewer) Signature(reader *karmem.Reader) (v []byte)
- func (x *TransactionBodyViewer) State(reader *karmem.Reader) (v []byte)
- func (x *TransactionBodyViewer) Timestamp() (v int64)
- type TransactionViewer
Constants ¶
View Source
const ( PacketIdentifierTransactionBody = 12338327753349604039 PacketIdentifierTransaction = 11306821277700167240 PacketIdentifierGenesisParams = 6807263723591883565 PacketIdentifierGeneralParams = 13469299839833990814 PacketIdentifierBlockHeader = 6888014730382219470 PacketIdentifierBlock = 1202114546008698459 PacketIdentifierDataCommand = 11594215842612946088 )
View Source
const (
HashLength = 32
)
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Block ¶
type Block struct { Header BlockHeader Transactions []Transaction }
func (*Block) IsGenesisBlock ¶
IsGenesisBlock 判断区块是否为创世区块,通过判断前一个区块的哈希值
func (*Block) PacketIdentifier ¶
func (x *Block) PacketIdentifier() PacketIdentifier
func (*Block) PrevBlockHash ¶
PrevBlockHash 获取区块的 hex 格式的前一个区块哈希值
func (*Block) ReadAsRoot ¶
type BlockHeader ¶
type BlockHeader struct { Timestamp int64 PrevBlockHash [32]byte BlockHash [32]byte MerkleRoot [32]byte Height int64 PublicKey [33]byte Params []byte GasLimit int64 }
func NewBlockHeader ¶
func NewBlockHeader() BlockHeader
func (*BlockHeader) PacketIdentifier ¶
func (x *BlockHeader) PacketIdentifier() PacketIdentifier
func (*BlockHeader) Read ¶
func (x *BlockHeader) Read(viewer *BlockHeaderViewer, reader *karmem.Reader)
func (*BlockHeader) ReadAsRoot ¶
func (x *BlockHeader) ReadAsRoot(reader *karmem.Reader)
func (*BlockHeader) Reset ¶
func (x *BlockHeader) Reset()
func (*BlockHeader) WriteAsRoot ¶
func (x *BlockHeader) WriteAsRoot(writer *karmem.Writer) (offset uint, err error)
type BlockHeaderViewer ¶
type BlockHeaderViewer struct {
// contains filtered or unexported fields
}
func NewBlockHeaderViewer ¶
func NewBlockHeaderViewer(reader *karmem.Reader, offset uint32) (v *BlockHeaderViewer)
func (*BlockHeaderViewer) BlockHash ¶
func (x *BlockHeaderViewer) BlockHash() (v []byte)
func (*BlockHeaderViewer) GasLimit ¶
func (x *BlockHeaderViewer) GasLimit() (v int64)
func (*BlockHeaderViewer) Height ¶
func (x *BlockHeaderViewer) Height() (v int64)
func (*BlockHeaderViewer) MerkleRoot ¶
func (x *BlockHeaderViewer) MerkleRoot() (v []byte)
func (*BlockHeaderViewer) Params ¶
func (x *BlockHeaderViewer) Params(reader *karmem.Reader) (v []byte)
func (*BlockHeaderViewer) PrevBlockHash ¶
func (x *BlockHeaderViewer) PrevBlockHash() (v []byte)
func (*BlockHeaderViewer) PublicKey ¶
func (x *BlockHeaderViewer) PublicKey() (v []byte)
func (*BlockHeaderViewer) Timestamp ¶
func (x *BlockHeaderViewer) Timestamp() (v int64)
type BlockViewer ¶
type BlockViewer struct {
// contains filtered or unexported fields
}
func NewBlockViewer ¶
func NewBlockViewer(reader *karmem.Reader, offset uint32) (v *BlockViewer)
func (*BlockViewer) Header ¶
func (x *BlockViewer) Header(reader *karmem.Reader) (v *BlockHeaderViewer)
func (*BlockViewer) Transactions ¶
func (x *BlockViewer) Transactions(reader *karmem.Reader) (v []TransactionViewer)
type DataCommand ¶
func NewDataCommand ¶
func NewDataCommand() DataCommand
func (*DataCommand) PacketIdentifier ¶
func (x *DataCommand) PacketIdentifier() PacketIdentifier
func (*DataCommand) Read ¶
func (x *DataCommand) Read(viewer *DataCommandViewer, reader *karmem.Reader)
func (*DataCommand) ReadAsRoot ¶
func (x *DataCommand) ReadAsRoot(reader *karmem.Reader)
func (*DataCommand) Reset ¶
func (x *DataCommand) Reset()
func (*DataCommand) WriteAsRoot ¶
func (x *DataCommand) WriteAsRoot(writer *karmem.Writer) (offset uint, err error)
type DataCommandViewer ¶
type DataCommandViewer struct {
// contains filtered or unexported fields
}
func NewDataCommandViewer ¶
func NewDataCommandViewer(reader *karmem.Reader, offset uint32) (v *DataCommandViewer)
type GeneralParams ¶
func NewGeneralParams ¶
func NewGeneralParams() GeneralParams
func (*GeneralParams) PacketIdentifier ¶
func (x *GeneralParams) PacketIdentifier() PacketIdentifier
func (*GeneralParams) Read ¶
func (x *GeneralParams) Read(viewer *GeneralParamsViewer, reader *karmem.Reader)
func (*GeneralParams) ReadAsRoot ¶
func (x *GeneralParams) ReadAsRoot(reader *karmem.Reader)
func (*GeneralParams) Reset ¶
func (x *GeneralParams) Reset()
func (*GeneralParams) WriteAsRoot ¶
func (x *GeneralParams) WriteAsRoot(writer *karmem.Writer) (offset uint, err error)
type GeneralParamsViewer ¶
type GeneralParamsViewer struct {
// contains filtered or unexported fields
}
func NewGeneralParamsViewer ¶
func NewGeneralParamsViewer(reader *karmem.Reader, offset uint32) (v *GeneralParamsViewer)
func (*GeneralParamsViewer) Proof ¶
func (x *GeneralParamsViewer) Proof(reader *karmem.Reader) (v []byte)
func (*GeneralParamsViewer) RandomNumber ¶
func (x *GeneralParamsViewer) RandomNumber() (v []byte)
type GenesisParams ¶
func NewGenesisParams ¶
func NewGenesisParams() GenesisParams
func (*GenesisParams) PacketIdentifier ¶
func (x *GenesisParams) PacketIdentifier() PacketIdentifier
func (*GenesisParams) Read ¶
func (x *GenesisParams) Read(viewer *GenesisParamsViewer, reader *karmem.Reader)
func (*GenesisParams) ReadAsRoot ¶
func (x *GenesisParams) ReadAsRoot(reader *karmem.Reader)
func (*GenesisParams) Reset ¶
func (x *GenesisParams) Reset()
func (*GenesisParams) WriteAsRoot ¶
func (x *GenesisParams) WriteAsRoot(writer *karmem.Writer) (offset uint, err error)
type GenesisParamsViewer ¶
type GenesisParamsViewer struct {
// contains filtered or unexported fields
}
func NewGenesisParamsViewer ¶
func NewGenesisParamsViewer(reader *karmem.Reader, offset uint32) (v *GenesisParamsViewer)
func (*GenesisParamsViewer) Order ¶
func (x *GenesisParamsViewer) Order() (v []byte)
func (*GenesisParamsViewer) Seed ¶
func (x *GenesisParamsViewer) Seed() (v []byte)
func (*GenesisParamsViewer) TimeParam ¶
func (x *GenesisParamsViewer) TimeParam() (v int64)
func (*GenesisParamsViewer) VerifyParam ¶
func (x *GenesisParamsViewer) VerifyParam() (v []byte)
type Hash ¶
type Hash [HashLength]byte
type PacketIdentifier ¶
type PacketIdentifier uint64
type Transaction ¶
type Transaction struct {
Body TransactionBody
}
func NewTransaction ¶
func NewTransaction() Transaction
func (*Transaction) PacketIdentifier ¶
func (x *Transaction) PacketIdentifier() PacketIdentifier
func (*Transaction) Read ¶
func (x *Transaction) Read(viewer *TransactionViewer, reader *karmem.Reader)
func (*Transaction) ReadAsRoot ¶
func (x *Transaction) ReadAsRoot(reader *karmem.Reader)
func (*Transaction) Reset ¶
func (x *Transaction) Reset()
func (*Transaction) WriteAsRoot ¶
func (x *Transaction) WriteAsRoot(writer *karmem.Writer) (offset uint, err error)
type TransactionBody ¶
type TransactionBody struct { Hash [32]byte Address [20]byte Receiver [20]byte Gas int64 Nonce int64 Event []byte Opt []byte State []byte Data []byte Expire int64 Height int64 Index int64 BlockHash [32]byte Timestamp int64 Public [33]byte Signature []byte }
func NewTransactionBody ¶
func NewTransactionBody() TransactionBody
func (*TransactionBody) PacketIdentifier ¶
func (x *TransactionBody) PacketIdentifier() PacketIdentifier
func (*TransactionBody) Read ¶
func (x *TransactionBody) Read(viewer *TransactionBodyViewer, reader *karmem.Reader)
func (*TransactionBody) ReadAsRoot ¶
func (x *TransactionBody) ReadAsRoot(reader *karmem.Reader)
func (*TransactionBody) Reset ¶
func (x *TransactionBody) Reset()
func (*TransactionBody) WriteAsRoot ¶
func (x *TransactionBody) WriteAsRoot(writer *karmem.Writer) (offset uint, err error)
type TransactionBodyViewer ¶
type TransactionBodyViewer struct {
// contains filtered or unexported fields
}
func NewTransactionBodyViewer ¶
func NewTransactionBodyViewer(reader *karmem.Reader, offset uint32) (v *TransactionBodyViewer)
func (*TransactionBodyViewer) Address ¶
func (x *TransactionBodyViewer) Address() (v []byte)
func (*TransactionBodyViewer) BlockHash ¶
func (x *TransactionBodyViewer) BlockHash() (v []byte)
func (*TransactionBodyViewer) Data ¶
func (x *TransactionBodyViewer) Data(reader *karmem.Reader) (v []byte)
func (*TransactionBodyViewer) Event ¶
func (x *TransactionBodyViewer) Event(reader *karmem.Reader) (v []byte)
func (*TransactionBodyViewer) Expire ¶
func (x *TransactionBodyViewer) Expire() (v int64)
func (*TransactionBodyViewer) Gas ¶
func (x *TransactionBodyViewer) Gas() (v int64)
func (*TransactionBodyViewer) Hash ¶
func (x *TransactionBodyViewer) Hash() (v []byte)
func (*TransactionBodyViewer) Height ¶
func (x *TransactionBodyViewer) Height() (v int64)
func (*TransactionBodyViewer) Index ¶
func (x *TransactionBodyViewer) Index() (v int64)
func (*TransactionBodyViewer) Nonce ¶
func (x *TransactionBodyViewer) Nonce() (v int64)
func (*TransactionBodyViewer) Opt ¶
func (x *TransactionBodyViewer) Opt(reader *karmem.Reader) (v []byte)
func (*TransactionBodyViewer) Public ¶
func (x *TransactionBodyViewer) Public() (v []byte)
func (*TransactionBodyViewer) Receiver ¶
func (x *TransactionBodyViewer) Receiver() (v []byte)
func (*TransactionBodyViewer) Signature ¶
func (x *TransactionBodyViewer) Signature(reader *karmem.Reader) (v []byte)
func (*TransactionBodyViewer) State ¶
func (x *TransactionBodyViewer) State(reader *karmem.Reader) (v []byte)
func (*TransactionBodyViewer) Timestamp ¶
func (x *TransactionBodyViewer) Timestamp() (v int64)
type TransactionViewer ¶
type TransactionViewer struct {
// contains filtered or unexported fields
}
func NewTransactionViewer ¶
func NewTransactionViewer(reader *karmem.Reader, offset uint32) (v *TransactionViewer)
func (*TransactionViewer) Body ¶
func (x *TransactionViewer) Body(reader *karmem.Reader) (v *TransactionBodyViewer)
Click to show internal directories.
Click to hide internal directories.