Documentation ¶
Index ¶
- func DeterministicEntry(i int) interfaces.IEBEntry
- func ExternalIDsToChainID(extIDs [][]byte) interfaces.IHash
- func MarshalEntryList(list []interfaces.IEBEntry) ([]byte, error)
- func NewChainID(e interfaces.IEBEntry) interfaces.IHash
- func RandomEntry() interfaces.IEBEntry
- func UnmarshalEBlock(data []byte) (interfaces.IEntryBlock, error)
- func UnmarshalEBlockData(data []byte) (interfaces.IEntryBlock, []byte, error)
- func UnmarshalEntry(data []byte) (interfaces.IEBEntry, error)
- func UnmarshalEntryList(data []byte) ([]interfaces.IEBEntry, []byte, error)
- type EBlock
- func (e *EBlock) AddEBEntry(entry interfaces.IEBEntry) error
- func (e *EBlock) AddEndOfMinuteMarker(m byte) error
- func (e *EBlock) BodyKeyMR() (rval interfaces.IHash)
- func (e *EBlock) BuildHeader() error
- func (c *EBlock) DatabasePrimaryIndex() (rval interfaces.IHash)
- func (c *EBlock) DatabaseSecondaryIndex() (rval interfaces.IHash)
- func (c *EBlock) GetBody() interfaces.IEBlockBody
- func (c *EBlock) GetChainID() (rval interfaces.IHash)
- func (c *EBlock) GetDatabaseHeight() uint32
- func (c *EBlock) GetEntryHashes() []interfaces.IHash
- func (c *EBlock) GetEntrySigHashes() []interfaces.IHash
- func (e *EBlock) GetHash() (rval interfaces.IHash)
- func (c *EBlock) GetHashOfChainID() []byte
- func (c *EBlock) GetHashOfChainIDHash() (rval interfaces.IHash)
- func (c *EBlock) GetHeader() interfaces.IEntryBlockHeader
- func (e *EBlock) Hash() (interfaces.IHash, error)
- func (e *EBlock) HeaderHash() (interfaces.IHash, error)
- func (c *EBlock) Init()
- func (a *EBlock) IsSameAs(b interfaces.IEntryBlock) bool
- func (e *EBlock) JSONByte() ([]byte, error)
- func (e *EBlock) JSONString() (string, error)
- func (e *EBlock) KeyMR() (interfaces.IHash, error)
- func (e *EBlock) MarshalBinary() (rval []byte, err error)
- func (c *EBlock) New() interfaces.BinaryMarshallableAndCopyable
- func (e *EBlock) String() string
- func (e *EBlock) UnmarshalBinary(data []byte) (err error)
- func (e *EBlock) UnmarshalBinaryData(data []byte) (newData []byte, err error)
- type EBlockBody
- func (e *EBlockBody) AddEBEntry(entry interfaces.IHash)
- func (e *EBlockBody) AddEndOfMinuteMarker(m byte)
- func (e *EBlockBody) GetEBEntries() []interfaces.IHash
- func (a *EBlockBody) IsSameAs(b interfaces.IEBlockBody) bool
- func (e *EBlockBody) JSONByte() ([]byte, error)
- func (e *EBlockBody) JSONString() (string, error)
- func (e *EBlockBody) MR() (rval interfaces.IHash)
- func (e *EBlockBody) String() string
- type EBlockHeader
- func (c *EBlockHeader) GetBodyMR() (rval interfaces.IHash)
- func (c *EBlockHeader) GetChainID() (rval interfaces.IHash)
- func (c *EBlockHeader) GetDBHeight() uint32
- func (c *EBlockHeader) GetEBSequence() uint32
- func (c *EBlockHeader) GetEntryCount() uint32
- func (c *EBlockHeader) GetPrevFullHash() (rval interfaces.IHash)
- func (c *EBlockHeader) GetPrevKeyMR() (rval interfaces.IHash)
- func (e *EBlockHeader) Init()
- func (a *EBlockHeader) IsSameAs(b interfaces.IEntryBlockHeader) bool
- func (e *EBlockHeader) JSONByte() ([]byte, error)
- func (e *EBlockHeader) JSONString() (string, error)
- func (e *EBlockHeader) MarshalBinary() (rval []byte, err error)
- func (c *EBlockHeader) SetBodyMR(bodyMR interfaces.IHash)
- func (c *EBlockHeader) SetChainID(chainID interfaces.IHash)
- func (c *EBlockHeader) SetDBHeight(dbHeight uint32)
- func (c *EBlockHeader) SetEBSequence(sequence uint32)
- func (c *EBlockHeader) SetEntryCount(entryCount uint32)
- func (c *EBlockHeader) SetPrevFullHash(prevFullHash interfaces.IHash)
- func (c *EBlockHeader) SetPrevKeyMR(prevKeyMR interfaces.IHash)
- func (e *EBlockHeader) String() string
- func (e *EBlockHeader) UnmarshalBinary(data []byte) (err error)
- func (e *EBlockHeader) UnmarshalBinaryData(data []byte) ([]byte, error)
- type Entry
- func (c *Entry) DatabasePrimaryIndex() (rval interfaces.IHash)
- func (c *Entry) DatabaseSecondaryIndex() (rval interfaces.IHash)
- func (e *Entry) ExternalIDs() [][]byte
- func (c *Entry) GetChainID() (rval interfaces.IHash)
- func (e *Entry) GetChainIDHash() (rval interfaces.IHash)
- func (e *Entry) GetContent() []byte
- func (c *Entry) GetDatabaseHeight() uint32
- func (e *Entry) GetHash() (rval interfaces.IHash)
- func (e *Entry) GetWeld() []byte
- func (e *Entry) GetWeldHash() (rval interfaces.IHash)
- func (c *Entry) IsSameAs(b interfaces.IEBEntry) bool
- func (e *Entry) IsValid() bool
- func (e *Entry) JSONByte() ([]byte, error)
- func (e *Entry) JSONString() (string, error)
- func (c *Entry) KSize() int
- func (e *Entry) MarshalBinary() (rval []byte, err error)
- func (e *Entry) MarshalExtIDsBinary() (rval []byte, err error)
- func (c *Entry) New() interfaces.BinaryMarshallableAndCopyable
- func (e *Entry) String() string
- func (e *Entry) UnmarshalBinary(data []byte) (err error)
- func (e *Entry) UnmarshalBinaryData(data []byte) (_ []byte, err error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DeterministicEntry ¶
func DeterministicEntry(i int) interfaces.IEBEntry
func ExternalIDsToChainID ¶
func ExternalIDsToChainID(extIDs [][]byte) interfaces.IHash
func MarshalEntryList ¶
func MarshalEntryList(list []interfaces.IEBEntry) ([]byte, error)
func NewChainID ¶
func NewChainID(e interfaces.IEBEntry) interfaces.IHash
NewChainID generates a ChainID from an entry. ChainID = primitives.Sha(Sha(ExtIDs[0]) + Sha(ExtIDs[1] + ... + Sha(ExtIDs[n]))
func RandomEntry ¶
func RandomEntry() interfaces.IEBEntry
func UnmarshalEBlock ¶
func UnmarshalEBlock(data []byte) (interfaces.IEntryBlock, error)
func UnmarshalEBlockData ¶
func UnmarshalEBlockData(data []byte) (interfaces.IEntryBlock, []byte, error)
func UnmarshalEntry ¶
func UnmarshalEntry(data []byte) (interfaces.IEBEntry, error)
func UnmarshalEntryList ¶
func UnmarshalEntryList(data []byte) ([]interfaces.IEBEntry, []byte, error)
Types ¶
type EBlock ¶
type EBlock struct { Header interfaces.IEntryBlockHeader `json:"header"` Body *EBlockBody `json:"body"` }
EBlock is the Entry Block. It holds the hashes of the Entries and its Merkle Root is written into the Directory Blocks. Each Entry Block represents all of the entries for a particular Chain during a 10 minute period.
func NewEBlock ¶
func NewEBlock() *EBlock
NewEBlock returns a blank initialized Entry Block with all fields zeroed.
func (*EBlock) AddEBEntry ¶
func (e *EBlock) AddEBEntry(entry interfaces.IEBEntry) error
AddEBEntry creates a new Entry Block Entry from the provided Factom Entry and adds it to the Entry Block Body.
func (*EBlock) AddEndOfMinuteMarker ¶
AddEndOfMinuteMarker adds the End of Minute to the Entry Block. The End of Minut byte becomes the last byte in a 32 byte slice that is added to the Entry Block Body as an Entry Block Entry.
func (*EBlock) BodyKeyMR ¶
func (e *EBlock) BodyKeyMR() (rval interfaces.IHash)
func (*EBlock) BuildHeader ¶
BuildHeader updates the Entry Block Header to include information about the Entry Block Body. BuildHeader should be run after the Entry Block Body has included all of its EntryEntries.
func (*EBlock) DatabasePrimaryIndex ¶
func (c *EBlock) DatabasePrimaryIndex() (rval interfaces.IHash)
func (*EBlock) DatabaseSecondaryIndex ¶
func (c *EBlock) DatabaseSecondaryIndex() (rval interfaces.IHash)
func (*EBlock) GetBody ¶
func (c *EBlock) GetBody() interfaces.IEBlockBody
func (*EBlock) GetChainID ¶
func (c *EBlock) GetChainID() (rval interfaces.IHash)
func (*EBlock) GetDatabaseHeight ¶
func (*EBlock) GetEntryHashes ¶
func (c *EBlock) GetEntryHashes() []interfaces.IHash
func (*EBlock) GetEntrySigHashes ¶
func (c *EBlock) GetEntrySigHashes() []interfaces.IHash
func (*EBlock) GetHash ¶
func (e *EBlock) GetHash() (rval interfaces.IHash)
func (*EBlock) GetHashOfChainID ¶
func (*EBlock) GetHashOfChainIDHash ¶
func (c *EBlock) GetHashOfChainIDHash() (rval interfaces.IHash)
func (*EBlock) GetHeader ¶
func (c *EBlock) GetHeader() interfaces.IEntryBlockHeader
func (*EBlock) Hash ¶
func (e *EBlock) Hash() (interfaces.IHash, error)
Hash returns the simple Sha256 hash of the serialized Entry Block. Hash is used to provide the PrevFullHash to the next Entry Block in a Chain.
func (*EBlock) HeaderHash ¶
func (e *EBlock) HeaderHash() (interfaces.IHash, error)
func (*EBlock) IsSameAs ¶
func (a *EBlock) IsSameAs(b interfaces.IEntryBlock) bool
func (*EBlock) JSONString ¶
func (*EBlock) KeyMR ¶
func (e *EBlock) KeyMR() (interfaces.IHash, error)
KeyMR returns the hash of the hash of the Entry Block Header concatenated with the Merkle Root of the Entry Block Body. The Body Merkle Root is calculated by the func (e *EBlockBody) MR() which is called by the func (e *EBlock) BuildHeader().
func (*EBlock) MarshalBinary ¶
MarshalBinary returns the serialized binary form of the Entry Block.
func (*EBlock) New ¶
func (c *EBlock) New() interfaces.BinaryMarshallableAndCopyable
func (*EBlock) UnmarshalBinary ¶
type EBlockBody ¶
type EBlockBody struct {
EBEntries []interfaces.IHash `json:"ebentries"`
}
EBlockBody is the series of Hashes that form the Entry Block Body.
func NewEBlockBody ¶
func NewEBlockBody() *EBlockBody
NewEBlockBody initializes an empty Entry Block Body.
func (*EBlockBody) AddEBEntry ¶
func (e *EBlockBody) AddEBEntry(entry interfaces.IHash)
AddEBEntry creates a new Entry Block Entry from the provided Factom Entry and adds it to the Entry Block Body.
func (*EBlockBody) AddEndOfMinuteMarker ¶
func (e *EBlockBody) AddEndOfMinuteMarker(m byte)
AddEndOfMinuteMarker adds the End of Minute to the Entry Block. The End of Minut byte becomes the last byte in a 32 byte slice that is added to the Entry Block Body as an Entry Block Entry.
func (*EBlockBody) GetEBEntries ¶
func (e *EBlockBody) GetEBEntries() []interfaces.IHash
func (*EBlockBody) IsSameAs ¶
func (a *EBlockBody) IsSameAs(b interfaces.IEBlockBody) bool
func (*EBlockBody) JSONByte ¶
func (e *EBlockBody) JSONByte() ([]byte, error)
func (*EBlockBody) JSONString ¶
func (e *EBlockBody) JSONString() (string, error)
func (*EBlockBody) MR ¶
func (e *EBlockBody) MR() (rval interfaces.IHash)
MR calculates the Merkle Root of the Entry Block Body. See func primitives.BuildMerkleTreeStore(hashes []interfaces.IHash) (merkles []interfaces.IHash) in common/merkle.go.
func (*EBlockBody) String ¶
func (e *EBlockBody) String() string
type EBlockHeader ¶
type EBlockHeader struct { ChainID interfaces.IHash `json:"chainid"` BodyMR interfaces.IHash `json:"bodymr"` PrevKeyMR interfaces.IHash `json:"prevkeymr"` PrevFullHash interfaces.IHash `json:"prevfullhash"` EBSequence uint32 `json:"ebsequence"` DBHeight uint32 `json:"dbheight"` EntryCount uint32 `json:"entrycount"` }
EBlockHeader holds relevant metadata about the Entry Block and the data nessisary to verify the previous block in the Entry Block Chain.
func NewEBlockHeader ¶
func NewEBlockHeader() *EBlockHeader
NewEBlockHeader initializes a new empty Entry Block Header.
func (*EBlockHeader) GetBodyMR ¶
func (c *EBlockHeader) GetBodyMR() (rval interfaces.IHash)
func (*EBlockHeader) GetChainID ¶
func (c *EBlockHeader) GetChainID() (rval interfaces.IHash)
func (*EBlockHeader) GetDBHeight ¶
func (c *EBlockHeader) GetDBHeight() uint32
func (*EBlockHeader) GetEBSequence ¶
func (c *EBlockHeader) GetEBSequence() uint32
func (*EBlockHeader) GetEntryCount ¶
func (c *EBlockHeader) GetEntryCount() uint32
func (*EBlockHeader) GetPrevFullHash ¶
func (c *EBlockHeader) GetPrevFullHash() (rval interfaces.IHash)
func (*EBlockHeader) GetPrevKeyMR ¶
func (c *EBlockHeader) GetPrevKeyMR() (rval interfaces.IHash)
func (*EBlockHeader) Init ¶
func (e *EBlockHeader) Init()
func (*EBlockHeader) IsSameAs ¶
func (a *EBlockHeader) IsSameAs(b interfaces.IEntryBlockHeader) bool
func (*EBlockHeader) JSONByte ¶
func (e *EBlockHeader) JSONByte() ([]byte, error)
func (*EBlockHeader) JSONString ¶
func (e *EBlockHeader) JSONString() (string, error)
func (*EBlockHeader) MarshalBinary ¶
func (e *EBlockHeader) MarshalBinary() (rval []byte, err error)
marshalHeaderBinary returns a serialized binary Entry Block Header
func (*EBlockHeader) SetBodyMR ¶
func (c *EBlockHeader) SetBodyMR(bodyMR interfaces.IHash)
func (*EBlockHeader) SetChainID ¶
func (c *EBlockHeader) SetChainID(chainID interfaces.IHash)
func (*EBlockHeader) SetDBHeight ¶
func (c *EBlockHeader) SetDBHeight(dbHeight uint32)
func (*EBlockHeader) SetEBSequence ¶
func (c *EBlockHeader) SetEBSequence(sequence uint32)
func (*EBlockHeader) SetEntryCount ¶
func (c *EBlockHeader) SetEntryCount(entryCount uint32)
func (*EBlockHeader) SetPrevFullHash ¶
func (c *EBlockHeader) SetPrevFullHash(prevFullHash interfaces.IHash)
func (*EBlockHeader) SetPrevKeyMR ¶
func (c *EBlockHeader) SetPrevKeyMR(prevKeyMR interfaces.IHash)
func (*EBlockHeader) String ¶
func (e *EBlockHeader) String() string
func (*EBlockHeader) UnmarshalBinary ¶
func (e *EBlockHeader) UnmarshalBinary(data []byte) (err error)
func (*EBlockHeader) UnmarshalBinaryData ¶
func (e *EBlockHeader) UnmarshalBinaryData(data []byte) ([]byte, error)
unmarshalHeaderBinary builds the Entry Block Header from the serialized binary.
type Entry ¶
type Entry struct { Version uint8 `json:"version"` ChainID interfaces.IHash `json:"chainid"` ExtIDs []primitives.ByteSlice `json:"extids"` Content primitives.ByteSlice `json:"content"` // contains filtered or unexported fields }
An Entry is the element which carries user data https://github.com/FactomProject/FactomDocs/blob/master/factomDataStructureDetails.md#entry
func (*Entry) DatabasePrimaryIndex ¶
func (c *Entry) DatabasePrimaryIndex() (rval interfaces.IHash)
func (*Entry) DatabaseSecondaryIndex ¶
func (c *Entry) DatabaseSecondaryIndex() (rval interfaces.IHash)
func (*Entry) ExternalIDs ¶
func (*Entry) GetChainID ¶
func (c *Entry) GetChainID() (rval interfaces.IHash)
func (*Entry) GetChainIDHash ¶
func (e *Entry) GetChainIDHash() (rval interfaces.IHash)
func (*Entry) GetContent ¶
func (*Entry) GetDatabaseHeight ¶
func (*Entry) GetHash ¶
func (e *Entry) GetHash() (rval interfaces.IHash)
func (*Entry) GetWeldHash ¶
func (e *Entry) GetWeldHash() (rval interfaces.IHash)
func (*Entry) JSONString ¶
func (*Entry) KSize ¶
Returns the size of the entry subject to payment in K. So anything up to 1K returns 1, everything up to and including 2K returns 2, etc. An error returns 100 (an invalid size)
func (*Entry) MarshalBinary ¶
func (*Entry) MarshalExtIDsBinary ¶
MarshalExtIDsBinary marshals the ExtIDs into a []byte containing a series of 2 byte size of each ExtID followed by the ExtID.
func (*Entry) New ¶
func (c *Entry) New() interfaces.BinaryMarshallableAndCopyable