Documentation ¶
Index ¶
- Constants
- func CheckBlockPairIntegrity(block interfaces.IEntryCreditBlock, prev interfaces.IEntryCreditBlock) error
- func NewECBlock() interfaces.IEntryCreditBlock
- func NewECBlockBody() interfaces.IECBlockBody
- func NextECBlock(prev interfaces.IEntryCreditBlock) (interfaces.IEntryCreditBlock, error)
- func UnmarshalECBlock(data []byte) (interfaces.IEntryCreditBlock, error)
- type CommitChain
- func (c *CommitChain) CommitMsg() []byte
- func (c *CommitChain) ECID() byte
- func (c *CommitChain) GetEntryHash() (rval interfaces.IHash)
- func (c *CommitChain) GetHash() (rval interfaces.IHash)
- func (c *CommitChain) GetSigHash() (rval interfaces.IHash)
- func (c *CommitChain) GetTimestamp() interfaces.Timestamp
- func (c *CommitChain) Hash() (rval interfaces.IHash)
- func (c *CommitChain) Init()
- func (c *CommitChain) Interpret() string
- func (c *CommitChain) IsInterpretable() bool
- func (c *CommitChain) IsSameAs(b interfaces.IECBlockEntry) bool
- func (c *CommitChain) IsValid() bool
- func (c *CommitChain) JSONByte() ([]byte, error)
- func (c *CommitChain) JSONString() (string, error)
- func (c *CommitChain) MarshalBinary() (rval []byte, err error)
- func (c *CommitChain) MarshalBinarySig() (rval []byte, err error)
- func (c *CommitChain) MarshalBinaryTransaction() (rval []byte, err error)
- func (c *CommitChain) Sign(privateKey []byte) error
- func (c *CommitChain) String() string
- func (c *CommitChain) UnmarshalBinary(data []byte) (err error)
- func (c *CommitChain) UnmarshalBinaryData(data []byte) ([]byte, error)
- func (c *CommitChain) ValidateSignatures() error
- type CommitEntry
- func (e *CommitEntry) CommitMsg() []byte
- func (e *CommitEntry) ECID() byte
- func (e *CommitEntry) GetEntryHash() (rval interfaces.IHash)
- func (e *CommitEntry) GetHash() (rval interfaces.IHash)
- func (e *CommitEntry) GetSigHash() (rval interfaces.IHash)
- func (e *CommitEntry) GetTimestamp() interfaces.Timestamp
- func (e *CommitEntry) Hash() (rval interfaces.IHash)
- func (e *CommitEntry) Init()
- func (e *CommitEntry) Interpret() string
- func (e *CommitEntry) IsInterpretable() bool
- func (e *CommitEntry) IsSameAs(b interfaces.IECBlockEntry) bool
- func (e *CommitEntry) IsValid() bool
- func (e *CommitEntry) JSONByte() ([]byte, error)
- func (e *CommitEntry) JSONString() (string, error)
- func (e *CommitEntry) MarshalBinary() (rval []byte, err error)
- func (e *CommitEntry) MarshalBinarySig() (rval []byte, err error)
- func (e *CommitEntry) Sign(privateKey []byte) error
- func (e *CommitEntry) String() string
- func (e *CommitEntry) UnmarshalBinary(data []byte) (err error)
- func (e *CommitEntry) UnmarshalBinaryData(data []byte) ([]byte, error)
- func (e *CommitEntry) ValidateSignatures() error
- type ECBlock
- func (e *ECBlock) AddEntry(entries ...interfaces.IECBlockEntry)
- func (e *ECBlock) BuildHeader() error
- func (e *ECBlock) DatabasePrimaryIndex() (rval interfaces.IHash)
- func (e *ECBlock) DatabaseSecondaryIndex() (rval interfaces.IHash)
- func (e *ECBlock) GetBody() interfaces.IECBlockBody
- func (e *ECBlock) GetChainID() (rval interfaces.IHash)
- func (e *ECBlock) GetDatabaseHeight() uint32
- func (e *ECBlock) GetEntries() []interfaces.IECBlockEntry
- func (e *ECBlock) GetEntryByHash(hash interfaces.IHash) interfaces.IECBlockEntry
- func (e *ECBlock) GetEntryHashes() []interfaces.IHash
- func (e *ECBlock) GetEntrySigHashes() []interfaces.IHash
- func (e *ECBlock) GetFullHash() (interfaces.IHash, error)
- func (e *ECBlock) GetHash() (rval interfaces.IHash)
- func (e *ECBlock) GetHeader() interfaces.IECBlockHeader
- func (e *ECBlock) HeaderHash() (interfaces.IHash, error)
- func (e *ECBlock) Init()
- func (e *ECBlock) IsSameAs(b interfaces.IEntryCreditBlock) bool
- func (e *ECBlock) JSONByte() ([]byte, error)
- func (e *ECBlock) JSONString() (string, error)
- func (e *ECBlock) MarshalBinary() (rval []byte, err error)
- func (e *ECBlock) New() interfaces.BinaryMarshallableAndCopyable
- func (e *ECBlock) String() string
- func (e *ECBlock) UnmarshalBinary(data []byte) (err error)
- func (e *ECBlock) UnmarshalBinaryData(data []byte) ([]byte, error)
- func (e *ECBlock) UpdateState(state interfaces.IState) error
- type ECBlockBody
- func (e *ECBlockBody) AddEntry(entry interfaces.IECBlockEntry)
- func (e *ECBlockBody) GetEntries() []interfaces.IECBlockEntry
- func (e *ECBlockBody) IsSameAs(b interfaces.IECBlockBody) bool
- func (e *ECBlockBody) JSONByte() ([]byte, error)
- func (e *ECBlockBody) JSONString() (string, error)
- func (e *ECBlockBody) SetEntries(entries []interfaces.IECBlockEntry)
- func (e *ECBlockBody) String() string
- type ECBlockHeader
- func (e *ECBlockHeader) GetBodyHash() (rval interfaces.IHash)
- func (e *ECBlockHeader) GetBodySize() uint64
- func (e *ECBlockHeader) GetDBHeight() (height uint32)
- func (e *ECBlockHeader) GetECChainID() (rval interfaces.IHash)
- func (e *ECBlockHeader) GetHeaderExpansionArea() (area []byte)
- func (e *ECBlockHeader) GetObjectCount() uint64
- func (e *ECBlockHeader) GetPrevFullHash() (rval interfaces.IHash)
- func (e *ECBlockHeader) GetPrevHeaderHash() (rval interfaces.IHash)
- func (e *ECBlockHeader) Init()
- func (e *ECBlockHeader) IsSameAs(b interfaces.IECBlockHeader) bool
- func (e *ECBlockHeader) JSONByte() ([]byte, error)
- func (e *ECBlockHeader) JSONString() (string, error)
- func (e *ECBlockHeader) MarshalBinary() (rval []byte, err error)
- func (e ECBlockHeader) MarshalJSON() ([]byte, error)
- func (e *ECBlockHeader) SetBodyHash(hash interfaces.IHash)
- func (e *ECBlockHeader) SetBodySize(cnt uint64)
- func (e *ECBlockHeader) SetDBHeight(height uint32)
- func (e *ECBlockHeader) SetHeaderExpansionArea(area []byte)
- func (e *ECBlockHeader) SetObjectCount(cnt uint64)
- func (e *ECBlockHeader) SetPrevFullHash(prev interfaces.IHash)
- func (e *ECBlockHeader) SetPrevHeaderHash(prev interfaces.IHash)
- func (e *ECBlockHeader) String() string
- func (e *ECBlockHeader) UnmarshalBinary(data []byte) error
- func (e *ECBlockHeader) UnmarshalBinaryData(data []byte) ([]byte, error)
- type ExpandedECBlockHeader
- type IncreaseBalance
- func (e *IncreaseBalance) ECID() byte
- func (e *IncreaseBalance) GetEntryHash() (rval interfaces.IHash)
- func (e *IncreaseBalance) GetHash() (rval interfaces.IHash)
- func (e *IncreaseBalance) GetSigHash() (rval interfaces.IHash)
- func (e *IncreaseBalance) GetTimestamp() interfaces.Timestamp
- func (e *IncreaseBalance) Hash() (rval interfaces.IHash)
- func (e *IncreaseBalance) Init()
- func (e *IncreaseBalance) Interpret() string
- func (e *IncreaseBalance) IsInterpretable() bool
- func (e *IncreaseBalance) IsSameAs(b interfaces.IECBlockEntry) bool
- func (e *IncreaseBalance) JSONByte() ([]byte, error)
- func (e *IncreaseBalance) JSONString() (string, error)
- func (e *IncreaseBalance) MarshalBinary() (rval []byte, err error)
- func (e *IncreaseBalance) String() string
- func (e *IncreaseBalance) UnmarshalBinary(data []byte) (err error)
- func (e *IncreaseBalance) UnmarshalBinaryData(data []byte) ([]byte, error)
- type MinuteNumber
- func (e *MinuteNumber) ECID() byte
- func (e *MinuteNumber) GetEntryHash() (rval interfaces.IHash)
- func (e *MinuteNumber) GetHash() (rval interfaces.IHash)
- func (e *MinuteNumber) GetSigHash() (rval interfaces.IHash)
- func (e *MinuteNumber) GetTimestamp() interfaces.Timestamp
- func (e *MinuteNumber) Hash() (rval interfaces.IHash)
- func (e *MinuteNumber) Interpret() string
- func (e *MinuteNumber) IsInterpretable() bool
- func (e *MinuteNumber) IsSameAs(b interfaces.IECBlockEntry) bool
- func (e *MinuteNumber) JSONByte() ([]byte, error)
- func (e *MinuteNumber) JSONString() (string, error)
- func (e *MinuteNumber) MarshalBinary() (rval []byte, err error)
- func (e *MinuteNumber) String() string
- func (e *MinuteNumber) UnmarshalBinary(data []byte) (err error)
- func (e *MinuteNumber) UnmarshalBinaryData(data []byte) ([]byte, error)
- type ServerIndexNumber
- func (e *ServerIndexNumber) ECID() byte
- func (e *ServerIndexNumber) GetEntryHash() (rval interfaces.IHash)
- func (e *ServerIndexNumber) GetHash() (rval interfaces.IHash)
- func (e *ServerIndexNumber) GetSigHash() (rval interfaces.IHash)
- func (e *ServerIndexNumber) GetTimestamp() interfaces.Timestamp
- func (e *ServerIndexNumber) Hash() (rval interfaces.IHash)
- func (e *ServerIndexNumber) Interpret() string
- func (e *ServerIndexNumber) IsInterpretable() bool
- func (e *ServerIndexNumber) IsSameAs(b interfaces.IECBlockEntry) bool
- func (e *ServerIndexNumber) JSONByte() ([]byte, error)
- func (e *ServerIndexNumber) JSONString() (string, error)
- func (e *ServerIndexNumber) MarshalBinary() (rval []byte, err error)
- func (e *ServerIndexNumber) String() string
- func (e *ServerIndexNumber) UnmarshalBinary(data []byte) (err error)
- func (e *ServerIndexNumber) UnmarshalBinaryData(data []byte) ([]byte, error)
Constants ¶
const ( // CommitChainSize = 1+6+32+32+32+1+32+64 // These are the sizes of the members of the data structure below CommitChainSize int = 200 )
const ( // CommitEntrySize = 1 + 6 + 32 + 1 + 32 + 64 // These are the sizes of the members of the data structure below CommitEntrySize int = 136 )
const (
// MinuteNumberSize is the size of the object below (1 uint8 member)
MinuteNumberSize = 1
)
const (
// ServerIndexNumberSize is the size of the object below (1 uint8 member)
ServerIndexNumberSize = 1
)
Variables ¶
This section is empty.
Functions ¶
func CheckBlockPairIntegrity ¶
func CheckBlockPairIntegrity(block interfaces.IEntryCreditBlock, prev interfaces.IEntryCreditBlock) error
CheckBlockPairIntegrity checks that the input block is derived from the previous block via their header information
func NewECBlock ¶
func NewECBlock() interfaces.IEntryCreditBlock
NewECBlock creates a new empty EC block
func NewECBlockBody ¶
func NewECBlockBody() interfaces.IECBlockBody
NewECBlockBody creates a new, empty EC block body
func NextECBlock ¶
func NextECBlock(prev interfaces.IEntryCreditBlock) (interfaces.IEntryCreditBlock, error)
NextECBlock creates a new EC block with header information filled in from the input previous block information
func UnmarshalECBlock ¶
func UnmarshalECBlock(data []byte) (interfaces.IEntryCreditBlock, error)
UnmarshalECBlock unmarshals the input data into a new EC block
Types ¶
type CommitChain ¶
type CommitChain struct { Version uint8 `json:"version"` // The version of the CommitChain, currently 0 MilliTime *primitives.ByteSlice6 `json:"millitime"` // The millisecond time stamp (0~=1970) this commit is created ChainIDHash interfaces.IHash `json:"chainidhash"` // The chain id hash is the double hash of the chain id Weld interfaces.IHash `json:"weld"` // The double hash of the concatonated (entry hash | chain id) EntryHash interfaces.IHash `json:"entryhash"` // SHA512+256 descriptor of the Entry to be the first in the Chain Credits uint8 `json:"credits"` // number of entry credits to deduct for this entry, must be 10 < Credits <= 20 ECPubKey *primitives.ByteSlice32 `json:"ecpubkey"` // EC public key that will have balanced reduced Sig *primitives.ByteSlice64 `json:"sig"` // signature of the chain commit by the public key }
CommitChain is a data structure which affects EC balances when committing a new user chain into the Factom blockchain see https://github.com/FactomProject/FactomDocs/blob/master/factomDataStructureDetails.md#entry_commit
func NewCommitChain ¶
func NewCommitChain() *CommitChain
NewCommitChain creates a newly initialized commit chain
func (*CommitChain) CommitMsg ¶
func (c *CommitChain) CommitMsg() []byte
CommitMsg returns the binary marshalled message section of the CommitEntry that is covered by the CommitEntry.Sig.
func (*CommitChain) ECID ¶
func (c *CommitChain) ECID() byte
ECID returns the hard coded type ECIDChainCommit
func (*CommitChain) GetEntryHash ¶
func (c *CommitChain) GetEntryHash() (rval interfaces.IHash)
GetEntryHash returns the entry hash
func (*CommitChain) GetHash ¶
func (c *CommitChain) GetHash() (rval interfaces.IHash)
GetHash marshals the entire object and computes the sha
func (*CommitChain) GetSigHash ¶
func (c *CommitChain) GetSigHash() (rval interfaces.IHash)
GetSigHash marshals the object covered by the signature, and computes its sha (version through entry credits hashed)
func (*CommitChain) GetTimestamp ¶
func (c *CommitChain) GetTimestamp() interfaces.Timestamp
GetTimestamp returns the timestamp in milliseconds
func (*CommitChain) Hash ¶
func (c *CommitChain) Hash() (rval interfaces.IHash)
Hash marshals the object and computes the sha
func (*CommitChain) Init ¶
func (c *CommitChain) Init()
Init initializes all nil objects to their starting values/objects
func (*CommitChain) Interpret ¶
func (c *CommitChain) Interpret() string
Interpret always returns the empty string ""
func (*CommitChain) IsInterpretable ¶
func (c *CommitChain) IsInterpretable() bool
IsInterpretable always returns false
func (*CommitChain) IsSameAs ¶
func (c *CommitChain) IsSameAs(b interfaces.IECBlockEntry) bool
IsSameAs only checks if everything in the item is identical. It does not catch if the private key holder has created a malleated version which is functionally identical in come cases from the protocol perspective, but would fail comparison here
func (*CommitChain) IsValid ¶
func (c *CommitChain) IsValid() bool
IsValid checks that the commit chain is valid: 11 < Credits <= 20, version==0, and valid signature
func (*CommitChain) JSONByte ¶
func (c *CommitChain) JSONByte() ([]byte, error)
JSONByte returns the json encoded byte array
func (*CommitChain) JSONString ¶
func (c *CommitChain) JSONString() (string, error)
JSONString returns the json encoded string
func (*CommitChain) MarshalBinary ¶
func (c *CommitChain) MarshalBinary() (rval []byte, err error)
MarshalBinary marshals the entire object
func (*CommitChain) MarshalBinarySig ¶
func (c *CommitChain) MarshalBinarySig() (rval []byte, err error)
MarshalBinarySig marshals the object covered by the signature (version through entry credits marshalled) If this serialized data is hashed, it becomes the transaction hash of chain commit. (version through entry credits)
func (*CommitChain) MarshalBinaryTransaction ¶
func (c *CommitChain) MarshalBinaryTransaction() (rval []byte, err error)
MarshalBinaryTransaction partially marshals the object (version through pub key) NOTE: Contrary to what the name implies, this is not used to get a transaction hash, that seems to be done with the MarshalBinarySig function. Its unclear the origin of this function here.
func (*CommitChain) Sign ¶
func (c *CommitChain) Sign(privateKey []byte) error
Sign signs the object with the input private key
func (*CommitChain) String ¶
func (c *CommitChain) String() string
String returns this object as a string
func (*CommitChain) UnmarshalBinary ¶
func (c *CommitChain) UnmarshalBinary(data []byte) (err error)
UnmarshalBinary unmarshals the input data into this object
func (*CommitChain) UnmarshalBinaryData ¶
func (c *CommitChain) UnmarshalBinaryData(data []byte) ([]byte, error)
UnmarshalBinaryData unmarshals the input data into this object
func (*CommitChain) ValidateSignatures ¶
func (c *CommitChain) ValidateSignatures() error
ValidateSignatures validates that the object is properly signed
type CommitEntry ¶
type CommitEntry struct { Version uint8 `json:"version"` // Version, must be 0 MilliTime *primitives.ByteSlice6 `json:"millitime"` // Millisecond time stamp for this entry's creation (0~=1970) EntryHash interfaces.IHash `json:"entryhash"` // SHA512+256 descriptor of the Entry to be paid for Credits uint8 `json:"credits"` // number of entry credits to deduct for this entry, must be 0 < Credits <= 10 ECPubKey *primitives.ByteSlice32 `json:"ecpubkey"` // EC public key that will have balanced reduced Sig *primitives.ByteSlice64 `json:"sig"` // signature of the entry commit by the public key }
CommitEntry is a type of EC block entry which handles commits to the block chain. Related to the EC block because you must pay EC to commit something to the chain
func (*CommitEntry) CommitMsg ¶
func (e *CommitEntry) CommitMsg() []byte
CommitMsg returns the binary marshalled message section of the CommitEntry that is covered by the CommitEntry.Sig.
func (*CommitEntry) ECID ¶
func (e *CommitEntry) ECID() byte
ECID returns the entry credit id ECIDEntryCommit
func (*CommitEntry) GetEntryHash ¶
func (e *CommitEntry) GetEntryHash() (rval interfaces.IHash)
GetEntryHash returns the entry's hash
func (*CommitEntry) GetHash ¶
func (e *CommitEntry) GetHash() (rval interfaces.IHash)
GetHash marshals the object and computes the sha of the data
func (*CommitEntry) GetSigHash ¶
func (e *CommitEntry) GetSigHash() (rval interfaces.IHash)
GetSigHash computes the hash of the partially marshalled object: (version through entry credits hashed)
func (*CommitEntry) GetTimestamp ¶
func (e *CommitEntry) GetTimestamp() interfaces.Timestamp
GetTimestamp returns the timestamp in milliseconds
func (*CommitEntry) Hash ¶
func (e *CommitEntry) Hash() (rval interfaces.IHash)
Hash marshals the object and computes the sha
func (*CommitEntry) Interpret ¶
func (e *CommitEntry) Interpret() string
Interpret always returns the empty string ""
func (*CommitEntry) IsInterpretable ¶
func (e *CommitEntry) IsInterpretable() bool
IsInterpretable always returns false
func (*CommitEntry) IsSameAs ¶
func (e *CommitEntry) IsSameAs(b interfaces.IECBlockEntry) bool
IsSameAs only checks if everything in the item is identical. It does not catch if the private key holder has created a malleated version which is functionally identical in come cases from the protocol perspective, but would fail comparison here
func (*CommitEntry) IsValid ¶
func (e *CommitEntry) IsValid() bool
IsValid checks if the commit entry is valid: 0 < Credits <= 10, version==0, and valid signature
func (*CommitEntry) JSONByte ¶
func (e *CommitEntry) JSONByte() ([]byte, error)
JSONByte returns the json encoded byte array
func (*CommitEntry) JSONString ¶
func (e *CommitEntry) JSONString() (string, error)
JSONString returns this object as a json encoded string
func (*CommitEntry) MarshalBinary ¶
func (e *CommitEntry) MarshalBinary() (rval []byte, err error)
MarshalBinary marshals the entire object
func (*CommitEntry) MarshalBinarySig ¶
func (e *CommitEntry) MarshalBinarySig() (rval []byte, err error)
MarshalBinarySig marshals the object covered by the signature (version through entry credits) If this serialized data is hashed, it becomes the transaction hash of entry commit. (version through entry credits)
func (*CommitEntry) Sign ¶
func (e *CommitEntry) Sign(privateKey []byte) error
Sign signs the object with the input private key
func (*CommitEntry) String ¶
func (e *CommitEntry) String() string
String returns this object as a string
func (*CommitEntry) UnmarshalBinary ¶
func (e *CommitEntry) UnmarshalBinary(data []byte) (err error)
UnmarshalBinary unmarshals the input data into this object
func (*CommitEntry) UnmarshalBinaryData ¶
func (e *CommitEntry) UnmarshalBinaryData(data []byte) ([]byte, error)
UnmarshalBinaryData unmarshals the input data into this object
func (*CommitEntry) ValidateSignatures ¶
func (e *CommitEntry) ValidateSignatures() error
ValidateSignatures validates the object's signature
type ECBlock ¶
type ECBlock struct { Header interfaces.IECBlockHeader `json:"header"` // The entry credit block header Body interfaces.IECBlockBody `json:"body"` // The entry credit block body }
ECBlock is an Entry Credit Block and consists of a header and a body. The body is composed of primarily Commits and Balance Increases with Minute Markers and Server Markers distributed throughout.
func (*ECBlock) AddEntry ¶
func (e *ECBlock) AddEntry(entries ...interfaces.IECBlockEntry)
AddEntry appends the input entries into the EC block
func (*ECBlock) BuildHeader ¶
BuildHeader sets all relevant header values based on the current body contents
func (*ECBlock) DatabasePrimaryIndex ¶
func (e *ECBlock) DatabasePrimaryIndex() (rval interfaces.IHash)
DatabasePrimaryIndex returns the hash of the header
func (*ECBlock) DatabaseSecondaryIndex ¶
func (e *ECBlock) DatabaseSecondaryIndex() (rval interfaces.IHash)
DatabaseSecondaryIndex returns the full hash (header and body) of the object
func (*ECBlock) GetBody ¶
func (e *ECBlock) GetBody() interfaces.IECBlockBody
GetBody returns the EC block body
func (*ECBlock) GetChainID ¶
func (e *ECBlock) GetChainID() (rval interfaces.IHash)
GetChainID returns the chain id of this EC block
func (*ECBlock) GetDatabaseHeight ¶
GetDatabaseHeight returns the directory block height this EC block is part of
func (*ECBlock) GetEntries ¶
func (e *ECBlock) GetEntries() []interfaces.IECBlockEntry
GetEntries returns the entries in this block
func (*ECBlock) GetEntryByHash ¶
func (e *ECBlock) GetEntryByHash(hash interfaces.IHash) interfaces.IECBlockEntry
GetEntryByHash returns the entry whose hash matches the input hash, or whose signature hash matches the input hash. If no hash is found, returns nil
func (*ECBlock) GetEntryHashes ¶
func (e *ECBlock) GetEntryHashes() []interfaces.IHash
GetEntryHashes returns a list of hashes for each entry in the ECBlock that is either a balance increase, chain commit, or entry commit
func (*ECBlock) GetEntrySigHashes ¶
func (e *ECBlock) GetEntrySigHashes() []interfaces.IHash
GetEntrySigHashes returns a list of signature hashes for each entry in the ECBlock that is either a balance increase, chain commit, or entry commit
func (*ECBlock) GetFullHash ¶
func (e *ECBlock) GetFullHash() (interfaces.IHash, error)
GetFullHash returns the full hash (header and body) of the object
func (*ECBlock) GetHash ¶
func (e *ECBlock) GetHash() (rval interfaces.IHash)
GetHash returns the full hash (header and body) of the object
func (*ECBlock) GetHeader ¶
func (e *ECBlock) GetHeader() interfaces.IECBlockHeader
GetHeader returns the EC block header
func (*ECBlock) HeaderHash ¶
func (e *ECBlock) HeaderHash() (interfaces.IHash, error)
HeaderHash returns the hash of the header
func (*ECBlock) Init ¶
func (e *ECBlock) Init()
Init initializes the header and body to new objects if they are nil
func (*ECBlock) IsSameAs ¶
func (e *ECBlock) IsSameAs(b interfaces.IEntryCreditBlock) bool
IsSameAs returns true iff the input block is the same as this object
func (*ECBlock) JSONString ¶
JSONString returns the json encoded string
func (*ECBlock) MarshalBinary ¶
MarshalBinary marshals the object (header and body)
func (*ECBlock) New ¶
func (e *ECBlock) New() interfaces.BinaryMarshallableAndCopyable
New returns a new EC block
func (*ECBlock) UnmarshalBinary ¶
UnmarshalBinary unmarshals the input data into this EC block
func (*ECBlock) UnmarshalBinaryData ¶
UnmarshalBinaryData unmarshals the input data into this EC block
func (*ECBlock) UpdateState ¶
func (e *ECBlock) UpdateState(state interfaces.IState) error
UpdateState executes the EC transactions
type ECBlockBody ¶
type ECBlockBody struct {
Entries []interfaces.IECBlockEntry `json:"entries"` // The EC block entries
}
ECBlockBody contains all the entry information for the EC block. The entries will be one of 5 types: CommitChain, CommitEntry, IncreaseBalance, MinuteNumber, or ServerIndexNumber
func (*ECBlockBody) AddEntry ¶
func (e *ECBlockBody) AddEntry(entry interfaces.IECBlockEntry)
AddEntry appends the input entry to the internal list of entries
func (*ECBlockBody) GetEntries ¶
func (e *ECBlockBody) GetEntries() []interfaces.IECBlockEntry
GetEntries returns the list of entries
func (*ECBlockBody) IsSameAs ¶
func (e *ECBlockBody) IsSameAs(b interfaces.IECBlockBody) bool
IsSameAs returns true iff the input object is the identical to this object
func (*ECBlockBody) JSONByte ¶
func (e *ECBlockBody) JSONByte() ([]byte, error)
JSONByte returns the json encoded byte array
func (*ECBlockBody) JSONString ¶
func (e *ECBlockBody) JSONString() (string, error)
JSONString returns the json encoded string
func (*ECBlockBody) SetEntries ¶
func (e *ECBlockBody) SetEntries(entries []interfaces.IECBlockEntry)
SetEntries sets the internal entry list to the input list
func (*ECBlockBody) String ¶
func (e *ECBlockBody) String() string
String returns this object as a string
type ECBlockHeader ¶
type ECBlockHeader struct { BodyHash interfaces.IHash `json:"bodyhash"` // The hash of the EC block's body PrevHeaderHash interfaces.IHash `json:"prevheaderhash"` // The hash of the previous EC block's header PrevFullHash interfaces.IHash `json:"prevfullhash"` // The full hash of the previous EC block DBHeight uint32 `json:"dbheight"` // The directory block height this EC block is in HeaderExpansionArea []byte `json:"headerexpansionarea"` // Future expansion area for data ObjectCount uint64 `json:"objectcount"` // The number of entries in the EC block BodySize uint64 `json:"bodysize"` // The length of the marshalled body }
ECBlockHeader contains information related to this EC block as well as the previous EC block
func NewECBlockHeader ¶
func NewECBlockHeader() *ECBlockHeader
NewECBlockHeader creates a new initialized EC block header
func (*ECBlockHeader) GetBodyHash ¶
func (e *ECBlockHeader) GetBodyHash() (rval interfaces.IHash)
GetBodyHash returns the body hash
func (*ECBlockHeader) GetBodySize ¶
func (e *ECBlockHeader) GetBodySize() uint64
GetBodySize returns the body size
func (*ECBlockHeader) GetDBHeight ¶
func (e *ECBlockHeader) GetDBHeight() (height uint32)
GetDBHeight returns the directory block height for this EC block
func (*ECBlockHeader) GetECChainID ¶
func (e *ECBlockHeader) GetECChainID() (rval interfaces.IHash)
GetECChainID returns the EC chain id (see constants.EC_CHAINID)
func (*ECBlockHeader) GetHeaderExpansionArea ¶
func (e *ECBlockHeader) GetHeaderExpansionArea() (area []byte)
GetHeaderExpansionArea returns the header expansion area array
func (*ECBlockHeader) GetObjectCount ¶
func (e *ECBlockHeader) GetObjectCount() uint64
GetObjectCount returns the object count
func (*ECBlockHeader) GetPrevFullHash ¶
func (e *ECBlockHeader) GetPrevFullHash() (rval interfaces.IHash)
GetPrevFullHash returns the previous full hash
func (*ECBlockHeader) GetPrevHeaderHash ¶
func (e *ECBlockHeader) GetPrevHeaderHash() (rval interfaces.IHash)
GetPrevHeaderHash returns the previous header hash
func (*ECBlockHeader) Init ¶
func (e *ECBlockHeader) Init()
Init initializes all nil hashes to the zero hash
func (*ECBlockHeader) IsSameAs ¶
func (e *ECBlockHeader) IsSameAs(b interfaces.IECBlockHeader) bool
IsSameAs returns true iff the input object is identical to this object
func (*ECBlockHeader) JSONByte ¶
func (e *ECBlockHeader) JSONByte() ([]byte, error)
JSONByte returns the json encoded byte array
func (*ECBlockHeader) JSONString ¶
func (e *ECBlockHeader) JSONString() (string, error)
JSONString returns the json encoded string
func (*ECBlockHeader) MarshalBinary ¶
func (e *ECBlockHeader) MarshalBinary() (rval []byte, err error)
MarshalBinary marshals the object
func (ECBlockHeader) MarshalJSON ¶
func (e ECBlockHeader) MarshalJSON() ([]byte, error)
MarshalJSON marshals the object into an expansed ec block header
func (*ECBlockHeader) SetBodyHash ¶
func (e *ECBlockHeader) SetBodyHash(hash interfaces.IHash)
SetBodyHash sets the body hash to the input value
func (*ECBlockHeader) SetBodySize ¶
func (e *ECBlockHeader) SetBodySize(cnt uint64)
SetBodySize sets the body size to the input
func (*ECBlockHeader) SetDBHeight ¶
func (e *ECBlockHeader) SetDBHeight(height uint32)
SetDBHeight sets the directory block height for this EC block to the input value
func (*ECBlockHeader) SetHeaderExpansionArea ¶
func (e *ECBlockHeader) SetHeaderExpansionArea(area []byte)
SetHeaderExpansionArea sets the header expansion area to the input array
func (*ECBlockHeader) SetObjectCount ¶
func (e *ECBlockHeader) SetObjectCount(cnt uint64)
SetObjectCount sets the object count to the input
func (*ECBlockHeader) SetPrevFullHash ¶
func (e *ECBlockHeader) SetPrevFullHash(prev interfaces.IHash)
SetPrevFullHash sets the previous full hash to the input
func (*ECBlockHeader) SetPrevHeaderHash ¶
func (e *ECBlockHeader) SetPrevHeaderHash(prev interfaces.IHash)
SetPrevHeaderHash sets the previous header hash to the input value
func (*ECBlockHeader) String ¶
func (e *ECBlockHeader) String() string
String returns this object as a string
func (*ECBlockHeader) UnmarshalBinary ¶
func (e *ECBlockHeader) UnmarshalBinary(data []byte) error
UnmarshalBinary unmarshals the input data into this object
func (*ECBlockHeader) UnmarshalBinaryData ¶
func (e *ECBlockHeader) UnmarshalBinaryData(data []byte) ([]byte, error)
UnmarshalBinaryData unmarshals the input data into this object
type ExpandedECBlockHeader ¶
type ExpandedECBlockHeader ECBlockHeader
ExpandedECBlockHeader is used to help in the function below
type IncreaseBalance ¶
type IncreaseBalance struct { ECPubKey *primitives.ByteSlice32 `json:"ecpubkey"` // EC public key that will have balanced increased TXID interfaces.IHash `json:"txid"` // The transaction id associated with this balance increase Index uint64 `json:"index"` // The index into the transaction's purchase field for this balance increase NumEC uint64 `json:"numec"` // The number of entry credits added to the address (based on current exchange rate) }
IncreaseBalance is an entry credit block entry type which increases the entry credit balance at an address
func NewIncreaseBalance ¶
func NewIncreaseBalance() *IncreaseBalance
NewIncreaseBalance creates a newly initialized object
func (*IncreaseBalance) ECID ¶
func (e *IncreaseBalance) ECID() byte
ECID returns the hard coded entry credit id ECIDBalanceIncrease
func (*IncreaseBalance) GetEntryHash ¶
func (e *IncreaseBalance) GetEntryHash() (rval interfaces.IHash)
GetEntryHash always returns nil
func (*IncreaseBalance) GetHash ¶
func (e *IncreaseBalance) GetHash() (rval interfaces.IHash)
GetHash marshals the object and computes its sha
func (*IncreaseBalance) GetSigHash ¶
func (e *IncreaseBalance) GetSigHash() (rval interfaces.IHash)
GetSigHash always returns nil
func (*IncreaseBalance) GetTimestamp ¶
func (e *IncreaseBalance) GetTimestamp() interfaces.Timestamp
GetTimestamp always returns nil
func (*IncreaseBalance) Hash ¶
func (e *IncreaseBalance) Hash() (rval interfaces.IHash)
Hash marshals the object and computes its sha
func (*IncreaseBalance) Interpret ¶
func (e *IncreaseBalance) Interpret() string
Interpret always returns the empty string ""
func (*IncreaseBalance) IsInterpretable ¶
func (e *IncreaseBalance) IsInterpretable() bool
IsInterpretable always returns false
func (*IncreaseBalance) IsSameAs ¶
func (e *IncreaseBalance) IsSameAs(b interfaces.IECBlockEntry) bool
IsSameAs returns true iff the input object is identical to this object
func (*IncreaseBalance) JSONByte ¶
func (e *IncreaseBalance) JSONByte() ([]byte, error)
JSONByte returns the json encoded byte array
func (*IncreaseBalance) JSONString ¶
func (e *IncreaseBalance) JSONString() (string, error)
JSONString returns the json encoded string
func (*IncreaseBalance) MarshalBinary ¶
func (e *IncreaseBalance) MarshalBinary() (rval []byte, err error)
MarshalBinary marshals this object
func (*IncreaseBalance) String ¶
func (e *IncreaseBalance) String() string
String returns this object as a string
func (*IncreaseBalance) UnmarshalBinary ¶
func (e *IncreaseBalance) UnmarshalBinary(data []byte) (err error)
UnmarshalBinary unmarshals the input data into this object
func (*IncreaseBalance) UnmarshalBinaryData ¶
func (e *IncreaseBalance) UnmarshalBinaryData(data []byte) ([]byte, error)
UnmarshalBinaryData unmarshals the input data into this object
type MinuteNumber ¶
type MinuteNumber struct {
Number uint8 `json:"number"` // The minute number
}
MinuteNumber is an entry credit block entry type. Data preceding this type of entry was acknowledged before the stored minute number
func NewMinuteNumber ¶
func NewMinuteNumber(number uint8) *MinuteNumber
NewMinuteNumber returns a new minute number object with the input number stored as the minute
func (*MinuteNumber) ECID ¶
func (e *MinuteNumber) ECID() byte
ECID returns the entry credit id ECIDMinuteNumber
func (*MinuteNumber) GetEntryHash ¶
func (e *MinuteNumber) GetEntryHash() (rval interfaces.IHash)
GetEntryHash always returns nil
func (*MinuteNumber) GetHash ¶
func (e *MinuteNumber) GetHash() (rval interfaces.IHash)
GetHash marshals this object and computes its hash
func (*MinuteNumber) GetSigHash ¶
func (e *MinuteNumber) GetSigHash() (rval interfaces.IHash)
GetSigHash always returns nil
func (*MinuteNumber) GetTimestamp ¶
func (e *MinuteNumber) GetTimestamp() interfaces.Timestamp
GetTimestamp always returns nil
func (*MinuteNumber) Hash ¶
func (e *MinuteNumber) Hash() (rval interfaces.IHash)
Hash marshals this object and computes its sha
func (*MinuteNumber) Interpret ¶
func (e *MinuteNumber) Interpret() string
Interpret returns the minute number as a string
func (*MinuteNumber) IsInterpretable ¶
func (e *MinuteNumber) IsInterpretable() bool
IsInterpretable always returns true
func (*MinuteNumber) IsSameAs ¶
func (e *MinuteNumber) IsSameAs(b interfaces.IECBlockEntry) bool
IsSameAs checks that the input object is identical to this object
func (*MinuteNumber) JSONByte ¶
func (e *MinuteNumber) JSONByte() ([]byte, error)
JSONByte returns the json encoded byte array
func (*MinuteNumber) JSONString ¶
func (e *MinuteNumber) JSONString() (string, error)
JSONString returns the json encoded string
func (*MinuteNumber) MarshalBinary ¶
func (e *MinuteNumber) MarshalBinary() (rval []byte, err error)
MarshalBinary marshals this object
func (*MinuteNumber) String ¶
func (e *MinuteNumber) String() string
String returns this object as a string
func (*MinuteNumber) UnmarshalBinary ¶
func (e *MinuteNumber) UnmarshalBinary(data []byte) (err error)
UnmarshalBinary unmarshals the input data into this object
func (*MinuteNumber) UnmarshalBinaryData ¶
func (e *MinuteNumber) UnmarshalBinaryData(data []byte) ([]byte, error)
UnmarshalBinaryData unmarshals the input data into this object
type ServerIndexNumber ¶
type ServerIndexNumber struct {
ServerIndexNumber uint8 `json:"serverindexnumber"` // the server index number
}
ServerIndexNumber is an entry credit block entry. Data after this type of entry was acknowledged by the server with the stored index
func NewServerIndexNumber ¶
func NewServerIndexNumber() *ServerIndexNumber
NewServerIndexNumber creates a new server index number object
func NewServerIndexNumber2 ¶
func NewServerIndexNumber2(number uint8) *ServerIndexNumber
NewServerIndexNumber2 creates a new server index number object, with the ServerIndexNumber set to the input
func (*ServerIndexNumber) ECID ¶
func (e *ServerIndexNumber) ECID() byte
ECID returns the entry credit id ECIDServerIndexNumber
func (*ServerIndexNumber) GetEntryHash ¶
func (e *ServerIndexNumber) GetEntryHash() (rval interfaces.IHash)
GetEntryHash always returns nil
func (*ServerIndexNumber) GetHash ¶
func (e *ServerIndexNumber) GetHash() (rval interfaces.IHash)
GetHash returns the hash of this object
func (*ServerIndexNumber) GetSigHash ¶
func (e *ServerIndexNumber) GetSigHash() (rval interfaces.IHash)
GetSigHash always returns nil
func (*ServerIndexNumber) GetTimestamp ¶
func (e *ServerIndexNumber) GetTimestamp() interfaces.Timestamp
GetTimestamp always returns nil
func (*ServerIndexNumber) Hash ¶
func (e *ServerIndexNumber) Hash() (rval interfaces.IHash)
Hash marshals this object and computes its sha
func (*ServerIndexNumber) Interpret ¶
func (e *ServerIndexNumber) Interpret() string
Interpret returns the ServerIndexNumber as a string
func (*ServerIndexNumber) IsInterpretable ¶
func (e *ServerIndexNumber) IsInterpretable() bool
IsInterpretable always returns true
func (*ServerIndexNumber) IsSameAs ¶
func (e *ServerIndexNumber) IsSameAs(b interfaces.IECBlockEntry) bool
IsSameAs checks that the input object is identical to this object
func (*ServerIndexNumber) JSONByte ¶
func (e *ServerIndexNumber) JSONByte() ([]byte, error)
JSONByte returns the json encoded byte array
func (*ServerIndexNumber) JSONString ¶
func (e *ServerIndexNumber) JSONString() (string, error)
JSONString returns the json encoded string
func (*ServerIndexNumber) MarshalBinary ¶
func (e *ServerIndexNumber) MarshalBinary() (rval []byte, err error)
MarshalBinary marshals this object
func (*ServerIndexNumber) String ¶
func (e *ServerIndexNumber) String() string
String returns this object as a string
func (*ServerIndexNumber) UnmarshalBinary ¶
func (e *ServerIndexNumber) UnmarshalBinary(data []byte) (err error)
UnmarshalBinary unmarshals the input data into this object
func (*ServerIndexNumber) UnmarshalBinaryData ¶
func (e *ServerIndexNumber) UnmarshalBinaryData(data []byte) ([]byte, error)
UnmarshalBinaryData unmarshals the input data into this object