Documentation ¶
Index ¶
- Constants
- Variables
- func AltBlockEncoder(scratch [64]byte, r gocoding.Renderer, v reflect.Value)
- func DecodeBinary(bytes *string) ([]byte, error)
- func DecodeJSON(data []byte, v interface{}) error
- func DecodeJSONString(data string, v interface{}) error
- func DecodeVarInt(data []byte) (uint64, []byte)
- func DoubleSha(data []byte) []byte
- func EncodeBinary(bytes *[]byte) string
- func EncodeJSON(data interface{}) ([]byte, error)
- func EncodeJSONString(data interface{}) (string, error)
- func EncodeJSONToBuffer(data interface{}, b *bytes.Buffer) error
- func EncodeVarInt(out *bytes.Buffer, v uint64) error
- func NewDecoding(decoding gocoding.Decoding) gocoding.Decoding
- func NewJSONUnmarshaller() gocoding.Unmarshaller
- func NewUnmarshaller(decoding gocoding.Decoding) gocoding.Unmarshaller
- func Spew(data interface{}) string
- func StartDynamic(path string, readEH func(err error)) error
- func StartStatic(path string) (err error)
- func UnmarshalJSON(reader gocoding.SliceableRuneReader, obj interface{}) error
- func VarIntLength(v uint64) uint64
- func Verify(publicKey *[ed25519.PublicKeySize]byte, message []byte, ...) bool
- func VerifySlice(p []byte, message []byte, s []byte) bool
- type ABEntry
- type ABlockHeader
- func (e *ABlockHeader) JSONBuffer(b *bytes.Buffer) error
- func (e *ABlockHeader) JSONByte() ([]byte, error)
- func (e *ABlockHeader) JSONString() (string, error)
- func (b *ABlockHeader) MarshalBinary() (data []byte, err error)
- func (b *ABlockHeader) MarshalledSize() uint64
- func (e *ABlockHeader) Spew() string
- func (b *ABlockHeader) UnmarshalBinary(data []byte) (err error)
- func (b *ABlockHeader) UnmarshalBinaryData(data []byte) (newData []byte, err error)
- type AdminBlock
- func (b *AdminBlock) AddABEntry(e ABEntry) (err error)
- func (b *AdminBlock) AddEndOfMinuteMarker(eomType byte) (err error)
- func (b *AdminBlock) GetDBSignature() ABEntry
- func (e *AdminBlock) JSONBuffer(b *bytes.Buffer) error
- func (e *AdminBlock) JSONByte() ([]byte, error)
- func (e *AdminBlock) JSONString() (string, error)
- func (ab *AdminBlock) LedgerKeyMR() (*Hash, error)
- func (b *AdminBlock) MarshalBinary() (data []byte, err error)
- func (b *AdminBlock) MarshalledSize() uint64
- func (ab *AdminBlock) PartialHash() (*Hash, error)
- func (e *AdminBlock) Spew() string
- func (b *AdminBlock) UnmarshalBinary(data []byte) (err error)
- func (b *AdminBlock) UnmarshalBinaryData(data []byte) (newData []byte, err error)
- type AdminChain
- type BinaryMarshallable
- type ByteArray
- func (ba ByteArray) Bytes() []byte
- func (ba ByteArray) MarshalBinary() ([]byte, error)
- func (ba ByteArray) MarshalledSize() uint64
- func (ba ByteArray) SetBytes(newArray []byte) error
- func (ba ByteArray) UnmarshalBinary(data []byte) (err error)
- func (ba ByteArray) UnmarshalBinaryData(data []byte) (newData []byte, err error)
- type CommitChain
- func (c *CommitChain) CommitMsg() []byte
- func (c *CommitChain) ECID() byte
- func (c *CommitChain) GetHash() *Hash
- func (c *CommitChain) GetMilliTime() int64
- func (c *CommitChain) GetSigHash() *Hash
- func (e *CommitChain) Hash() *Hash
- func (c *CommitChain) InTime() bool
- func (b *CommitChain) Interpret() string
- func (b *CommitChain) IsInterpretable() bool
- func (c *CommitChain) IsValid() bool
- func (e *CommitChain) JSONBuffer(b *bytes.Buffer) error
- func (e *CommitChain) JSONByte() ([]byte, error)
- func (e *CommitChain) JSONString() (string, error)
- func (c *CommitChain) MarshalBinary() ([]byte, error)
- func (c *CommitChain) MarshalledSize() uint64
- func (e *CommitChain) Spew() string
- func (c *CommitChain) UnmarshalBinary(data []byte) (err error)
- func (c *CommitChain) UnmarshalBinaryData(data []byte) (newData []byte, err error)
- type CommitEntry
- func (c *CommitEntry) CommitMsg() []byte
- func (c *CommitEntry) ECID() byte
- func (c *CommitEntry) GetHash() *Hash
- func (c *CommitEntry) GetMilliTime() int64
- func (c *CommitEntry) GetSigHash() *Hash
- func (e *CommitEntry) Hash() *Hash
- func (c *CommitEntry) InTime() bool
- func (b *CommitEntry) Interpret() string
- func (b *CommitEntry) IsInterpretable() bool
- func (c *CommitEntry) IsValid() bool
- func (e *CommitEntry) JSONBuffer(b *bytes.Buffer) error
- func (e *CommitEntry) JSONByte() ([]byte, error)
- func (e *CommitEntry) JSONString() (string, error)
- func (c *CommitEntry) MarshalBinary() ([]byte, error)
- func (c *CommitEntry) MarshalledSize() uint64
- func (e *CommitEntry) Spew() string
- func (c *CommitEntry) UnmarshalBinary(data []byte) (err error)
- func (c *CommitEntry) UnmarshalBinaryData(data []byte) (newData []byte, err error)
- type DBEntry
- func (e *DBEntry) JSONBuffer(b *bytes.Buffer) error
- func (e *DBEntry) JSONByte() ([]byte, error)
- func (e *DBEntry) JSONString() (string, error)
- func (e *DBEntry) MarshalBinary() (data []byte, err error)
- func (c *DBEntry) MarshalledSize() uint64
- func (e *DBEntry) ShaHash() *Hash
- func (e *DBEntry) Spew() string
- func (e *DBEntry) UnmarshalBinary(data []byte) (err error)
- func (e *DBEntry) UnmarshalBinaryData(data []byte) (newData []byte, err error)
- type DBSignatureEntry
- func (e *DBSignatureEntry) Hash() *Hash
- func (e *DBSignatureEntry) Interpret() string
- func (e *DBSignatureEntry) IsInterpretable() bool
- func (e *DBSignatureEntry) JSONBuffer(b *bytes.Buffer) error
- func (e *DBSignatureEntry) JSONByte() ([]byte, error)
- func (e *DBSignatureEntry) JSONString() (string, error)
- func (e *DBSignatureEntry) MarshalBinary() (data []byte, err error)
- func (e *DBSignatureEntry) MarshalledSize() uint64
- func (e *DBSignatureEntry) Spew() string
- func (e *DBSignatureEntry) Type() byte
- func (e *DBSignatureEntry) UnmarshalBinary(data []byte) (err error)
- func (e *DBSignatureEntry) UnmarshalBinaryData(data []byte) (newData []byte, err error)
- type DBlockHeader
- func (b *DBlockHeader) EncodableFields() map[string]reflect.Value
- func (e *DBlockHeader) JSONBuffer(b *bytes.Buffer) error
- func (e *DBlockHeader) JSONByte() ([]byte, error)
- func (e *DBlockHeader) JSONString() (string, error)
- func (b *DBlockHeader) MarshalBinary() (data []byte, err error)
- func (b *DBlockHeader) MarshalledSize() uint64
- func (e *DBlockHeader) Spew() string
- func (b *DBlockHeader) UnmarshalBinary(data []byte) (err error)
- func (b *DBlockHeader) UnmarshalBinaryData(data []byte) (newData []byte, err error)
- type DChain
- func (c *DChain) AddABlockToDBEntry(b *AdminBlock) (err error)
- func (c *DChain) AddDBEntry(dbEntry *DBEntry) (err error)
- func (c *DChain) AddDBlockToDChain(b *DirectoryBlock) (err error)
- func (c *DChain) AddEBlockToDBEntry(eb *EBlock) (err error)
- func (c *DChain) AddECBlockToDBEntry(ecb *ECBlock) (err error)
- func (c *DChain) AddFBlockToDBEntry(b block.IFBlock) (err error)
- func (c *DChain) IsBlockExisting(height uint32) bool
- type DetachedPublicKey
- type DetachedSignature
- type DirBlockInfo
- func (e *DirBlockInfo) JSONBuffer(b *bytes.Buffer) error
- func (e *DirBlockInfo) JSONByte() ([]byte, error)
- func (e *DirBlockInfo) JSONString() (string, error)
- func (b *DirBlockInfo) MarshalBinary() (data []byte, err error)
- func (e *DirBlockInfo) Spew() string
- func (b *DirBlockInfo) UnmarshalBinary(data []byte) (err error)
- func (b *DirBlockInfo) UnmarshalBinaryData(data []byte) (newData []byte, err error)
- type DirectoryBlock
- func (b *DirectoryBlock) BuildBodyMR() (mr *Hash, err error)
- func (b *DirectoryBlock) BuildKeyMerkleRoot() (err error)
- func (b *DirectoryBlock) EncodableFields() map[string]reflect.Value
- func (e *DirectoryBlock) JSONBuffer(b *bytes.Buffer) error
- func (e *DirectoryBlock) JSONByte() ([]byte, error)
- func (e *DirectoryBlock) JSONString() (string, error)
- func (b *DirectoryBlock) MarshalBinary() (data []byte, err error)
- func (c *DirectoryBlock) MarshalledSize() uint64
- func (e *DirectoryBlock) Spew() string
- func (b *DirectoryBlock) UnmarshalBinary(data []byte) (err error)
- func (b *DirectoryBlock) UnmarshalBinaryData(data []byte) (newData []byte, err error)
- type EBlock
- func (e *EBlock) AddEBEntry(entry *Entry) error
- func (e *EBlock) AddEndOfMinuteMarker(m byte)
- func (e *EBlock) BuildHeader() error
- func (e *EBlock) Hash() (*Hash, error)
- func (e *EBlock) JSONBuffer(b *bytes.Buffer) error
- func (e *EBlock) JSONByte() ([]byte, error)
- func (e *EBlock) JSONString() (string, error)
- func (e *EBlock) KeyMR() (*Hash, error)
- func (e *EBlock) MarshalBinary() ([]byte, error)
- func (c *EBlock) MarshalledSize() uint64
- func (e *EBlock) Spew() string
- func (e *EBlock) UnmarshalBinary(data []byte) (err error)
- func (e *EBlock) UnmarshalBinaryData(data []byte) (newData []byte, err error)
- type EBlockBody
- type EBlockHeader
- type ECBlock
- func (e *ECBlock) AddEntry(entries ...ECBlockEntry)
- func (e *ECBlock) BuildHeader() error
- func (e *ECBlock) Hash() (*Hash, error)
- func (e *ECBlock) HeaderHash() (*Hash, error)
- func (e *ECBlock) JSONBuffer(b *bytes.Buffer) error
- func (e *ECBlock) JSONByte() ([]byte, error)
- func (e *ECBlock) JSONString() (string, error)
- func (e *ECBlock) MarshalBinary() ([]byte, error)
- func (c *ECBlock) MarshalledSize() uint64
- func (e *ECBlock) Spew() string
- func (e *ECBlock) UnmarshalBinary(data []byte) (err error)
- func (e *ECBlock) UnmarshalBinaryData(data []byte) (newData []byte, err error)
- type ECBlockBody
- type ECBlockEntry
- type ECBlockHeader
- type ECChain
- type EChain
- type EndOfMinuteEntry
- func (e *EndOfMinuteEntry) Hash() *Hash
- func (e *EndOfMinuteEntry) Interpret() string
- func (e *EndOfMinuteEntry) IsInterpretable() bool
- func (e *EndOfMinuteEntry) JSONBuffer(b *bytes.Buffer) error
- func (e *EndOfMinuteEntry) JSONByte() ([]byte, error)
- func (e *EndOfMinuteEntry) JSONString() (string, error)
- func (e *EndOfMinuteEntry) MarshalBinary() (data []byte, err error)
- func (e *EndOfMinuteEntry) MarshalledSize() uint64
- func (e *EndOfMinuteEntry) Spew() string
- func (m *EndOfMinuteEntry) Type() byte
- func (e *EndOfMinuteEntry) UnmarshalBinary(data []byte) (err error)
- func (e *EndOfMinuteEntry) UnmarshalBinaryData(data []byte) (newData []byte, err error)
- type Entry
- func (e *Entry) Hash() *Hash
- func (e *Entry) IsValid() bool
- func (e *Entry) JSONBuffer(b *bytes.Buffer) error
- func (e *Entry) JSONByte() ([]byte, error)
- func (e *Entry) JSONString() (string, error)
- func (e *Entry) MarshalBinary() ([]byte, error)
- func (e *Entry) MarshalExtIDsBinary() ([]byte, error)
- func (c *Entry) MarshalledSize() uint64
- func (e *Entry) Spew() string
- func (e *Entry) UnmarshalBinary(data []byte) (err error)
- func (e *Entry) UnmarshalBinaryData(data []byte) (newData []byte, err error)
- type Error
- type FctChain
- type Hash
- func BuildMerkleTreeStore(hashes []*Hash) (merkles []*Hash)
- func CreateHash(entities ...BinaryMarshallable) (h *Hash, err error)
- func HexToHash(hexStr string) (h *Hash, err error)
- func NewChainID(e *Entry) *Hash
- func NewHash() *Hash
- func NewShaHash(newHash []byte) (*Hash, error)
- func Sha(p []byte) (h *Hash)
- func Sha512Half(p []byte) (h *Hash)
- func (h *Hash) BTCString() string
- func (h *Hash) ByteString() string
- func (h *Hash) Bytes() []byte
- func (h *Hash) GetBytes() []byte
- func (h *Hash) IsMinuteMarker() bool
- func (a *Hash) IsSameAs(b *Hash) bool
- func (e *Hash) JSONBuffer(b *bytes.Buffer) error
- func (e *Hash) JSONByte() ([]byte, error)
- func (e *Hash) JSONString() (string, error)
- func (h *Hash) MarshalBinary() ([]byte, error)
- func (h *Hash) MarshalText() ([]byte, error)
- func (c *Hash) MarshalledSize() uint64
- func (hash *Hash) SetBytes(newHash []byte) error
- func (e *Hash) Spew() string
- func (h *Hash) String() string
- func (h *Hash) UnmarshalBinary(p []byte) (err error)
- func (h *Hash) UnmarshalBinaryData(p []byte) (newData []byte, err error)
- func (h *Hash) UnmarshalText(b []byte) error
- type IncreaseBalance
- func (b *IncreaseBalance) ECID() byte
- func (e *IncreaseBalance) Hash() *Hash
- func (b *IncreaseBalance) Interpret() string
- func (b *IncreaseBalance) IsInterpretable() bool
- func (e *IncreaseBalance) JSONBuffer(b *bytes.Buffer) error
- func (e *IncreaseBalance) JSONByte() ([]byte, error)
- func (e *IncreaseBalance) JSONString() (string, error)
- func (b *IncreaseBalance) MarshalBinary() ([]byte, error)
- func (e *IncreaseBalance) Spew() string
- func (b *IncreaseBalance) UnmarshalBinary(data []byte) (err error)
- func (b *IncreaseBalance) UnmarshalBinaryData(data []byte) (newData []byte, err error)
- type JSONable
- type MinuteNumber
- func (m *MinuteNumber) ECID() byte
- func (e *MinuteNumber) Hash() *Hash
- func (b *MinuteNumber) Interpret() string
- func (b *MinuteNumber) IsInterpretable() bool
- func (e *MinuteNumber) JSONBuffer(b *bytes.Buffer) error
- func (e *MinuteNumber) JSONByte() ([]byte, error)
- func (e *MinuteNumber) JSONString() (string, error)
- func (m *MinuteNumber) MarshalBinary() ([]byte, error)
- func (c *MinuteNumber) MarshalledSize() uint64
- func (e *MinuteNumber) Spew() string
- func (m *MinuteNumber) UnmarshalBinary(data []byte) (err error)
- func (m *MinuteNumber) UnmarshalBinaryData(data []byte) (newData []byte, err error)
- type Printable
- type PrivateKey
- type Properties
- type PublicKey
- type ServerIndexNumber
- func (s *ServerIndexNumber) ECID() byte
- func (e *ServerIndexNumber) Hash() *Hash
- func (b *ServerIndexNumber) Interpret() string
- func (b *ServerIndexNumber) IsInterpretable() bool
- func (e *ServerIndexNumber) JSONBuffer(b *bytes.Buffer) error
- func (e *ServerIndexNumber) JSONByte() ([]byte, error)
- func (e *ServerIndexNumber) JSONString() (string, error)
- func (s *ServerIndexNumber) MarshalBinary() ([]byte, error)
- func (c *ServerIndexNumber) MarshalledSize() uint64
- func (e *ServerIndexNumber) Spew() string
- func (s *ServerIndexNumber) UnmarshalBinary(data []byte) (err error)
- func (s *ServerIndexNumber) UnmarshalBinaryData(data []byte) (newData []byte, err error)
- type ShortInterpretable
- type Sig
- type Signature
- type Signer
- type SimpleData
- type Spewable
- type Verifyer
Constants ¶
const ( //Entry Credit Blocks (For now, everyone gets the same cap) EC_CAP = 5 //Number of ECBlocks we start with. AB_CAP = EC_CAP //Administrative Block Cap for AB messages //Limits and Sizes MAX_ENTRY_SIZE = uint16(10240) //Maximum size for Entry External IDs and the Data HASH_LENGTH = int(32) //Length of a Hash SIG_LENGTH = int(64) //Length of a signature MAX_ORPHAN_SIZE = int(5000) //Prphan mem pool size MAX_TX_POOL_SIZE = int(50000) //Transaction mem pool size MAX_BLK_POOL_SIZE = int(500000) //Block mem bool size MAX_PLIST_SIZE = int(150000) //MY Process List size MAX_ENTRY_CREDITS = uint8(10) //Max number of entry credits per entry MAX_CHAIN_CREDITS = uint8(20) //Max number of entry credits per chain COMMIT_TIME_WINDOW = time.Duration(12) //Time windows for commit chain and commit entry +/- 12 hours // maxProtocolVersion is the max protocol version the peer supports. //Common constants VERSION_0 = byte(0) FACTOMD_VERSION = 3001 //version starts from 1000 for Factom NETWORK_ID_DB = uint32(4203931041) //0xFA92E5A1 NETWORK_ID_EB = uint32(4203931042) //0xFA92E5A2 NETWORK_ID_CB = uint32(4203931043) //0xFA92E5A3 //For Factom TestNet NETWORK_ID_TEST = uint32(0) //0x0 //Server running mode FULL_NODE = "FULL" SERVER_NODE = "SERVER" LIGHT_NODE = "LIGHT" //Server public key for milestone 1 SERVER_PUB_KEY = "0426a802617848d4d16d87830fc521f4d136bb2d0c352850919c2679f189613a" //Genesis directory block timestamp in RFC3339 format GENESIS_BLK_TIMESTAMP = "2015-09-01T20:00:00+00:00" //Genesis directory block hash GENESIS_DIR_BLOCK_HASH = "cbd3d09db6defdc25dfc7d57f3479b339a077183cd67022e6d1ef6c041522b40" )
const ( TYPE_MINUTE_NUM uint8 = iota TYPE_DB_SIGNATURE TYPE_REVEAL_MATRYOSHKA TYPE_ADD_MATRYOSHKA TYPE_ADD_SERVER_COUNT TYPE_ADD_FED_SERVER TYPE_REMOVE_FED_SERVER TYPE_ADD_FED_SERVER_KEY TYPE_ADD_BTC_ANCHOR_KEY //8 )
--------------------------------------------------------------- Types of entries (transactions) for Admin Block https://github.com/FactomProject/FactomDocs/blob/master/factomDataStructureDetails.md#adminid-bytes ---------------------------------------------------------------
const ( ECIDServerIndexNumber byte = iota ECIDMinuteNumber ECIDChainCommit ECIDEntryCommit ECIDBalanceIncrease )
const ( ErrorBadMethod = 0 ErrorNotAcceptable = 1 ErrorMissingVersionSpec = 2 ErrorMalformedVersionSpec = 3 ErrorBadVersionSpec = 4 ErrorEmptyRequest = 5 ErrorBadElementSpec = 6 ErrorBadIdentifier = 7 ErrorBlockNotFound = 8 ErrorEntryNotFound = 9 ErrorInternal = 10 ErrorJSONMarshal = 11 ErrorXMLMarshal = 12 ErrorUnsupportedMarshal = 13 ErrorJSONUnmarshal = 14 ErrorXMLUnmarshal = 15 ErrorUnsupportedUnmarshal = 16 ErrorBadPOSTData = 17 ErrorTemplateError = 18 ErrorHTTPNewRequestFailure = 19 ErrorHTTPDoRequestFailure = 20 ErrorHTMLMarshal = 21 ErrorVerifySignature = 22 )
const ( // CommitChainSize = 1+6+32+32+32+1+32+64 CommitChainSize int = 200 )
const ( // CommitEntrySize = 1 + 6 + 32 + 1 + 32 + 64 CommitEntrySize int = 136 )
const DBlockVersion = 0
const (
EBHeaderSize = 140 // 32+32+32+32+4+4+4
)
const (
MinuteNumberSize = 1
)
const (
ServerIndexNumberSize = 1
)
Variables ¶
var ADMIN_CHAINID = []byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x0a}
Directory Chain
var D_CHAINID = []byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x0d}
Directory Chain
var EC_CHAINID = []byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x0c}
Chain Values. Not exactly constants, but nice to have. Entry Credit Chain
var FACTOID_CHAINID = []byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x0f}
Factoid chain
var FactoidState state.IFactoidState
var M = struct{ Main, Alt gocoding.Marshaller }{ json.NewMarshaller(), json.NewMarshaller(), }
var ZERO_HASH = []byte{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
Functions ¶
func DecodeBinary ¶
func DecodeJSON ¶
func DecodeJSONString ¶
func DecodeVarInt ¶
Decode a varaible integer from the given data buffer. We use the algorithm used by Go, only BigEndian.
func EncodeBinary ¶
func EncodeJSON ¶
func EncodeJSONString ¶
func EncodeJSONToBuffer ¶
func EncodeVarInt ¶
Encode an integer as a variable int into the given data buffer.
func NewJSONUnmarshaller ¶
func NewJSONUnmarshaller() gocoding.Unmarshaller
func NewUnmarshaller ¶
func NewUnmarshaller(decoding gocoding.Decoding) gocoding.Unmarshaller
func StartDynamic ¶
func StartStatic ¶
func UnmarshalJSON ¶
func UnmarshalJSON(reader gocoding.SliceableRuneReader, obj interface{}) error
func VarIntLength ¶
func Verify ¶
func Verify(publicKey *[ed25519.PublicKeySize]byte, message []byte, sig *[ed25519.SignatureSize]byte) bool
Verify returns true iff sig is a valid signature of message by publicKey.
Types ¶
type ABEntry ¶
type ABEntry interface { Printable BinaryMarshallable ShortInterpretable Type() byte Hash() *Hash }
Generic admin block entry type
type ABlockHeader ¶
type ABlockHeader struct { AdminChainID *Hash PrevLedgerKeyMR *Hash DBHeight uint32 HeaderExpansionSize uint64 HeaderExpansionArea []byte MessageCount uint32 BodySize uint32 }
Admin Block Header
func (*ABlockHeader) JSONBuffer ¶
func (e *ABlockHeader) JSONBuffer(b *bytes.Buffer) error
func (*ABlockHeader) JSONByte ¶
func (e *ABlockHeader) JSONByte() ([]byte, error)
func (*ABlockHeader) JSONString ¶
func (e *ABlockHeader) JSONString() (string, error)
func (*ABlockHeader) MarshalBinary ¶
func (b *ABlockHeader) MarshalBinary() (data []byte, err error)
Write out the ABlockHeader to binary.
func (*ABlockHeader) MarshalledSize ¶
func (b *ABlockHeader) MarshalledSize() uint64
func (*ABlockHeader) Spew ¶
func (e *ABlockHeader) Spew() string
func (*ABlockHeader) UnmarshalBinary ¶
func (b *ABlockHeader) UnmarshalBinary(data []byte) (err error)
Read in the binary into the ABlockHeader.
func (*ABlockHeader) UnmarshalBinaryData ¶
func (b *ABlockHeader) UnmarshalBinaryData(data []byte) (newData []byte, err error)
type AdminBlock ¶
type AdminBlock struct { //Marshalized Header *ABlockHeader ABEntries []ABEntry //Interface // contains filtered or unexported fields }
Administrative Block This is a special block which accompanies this Directory Block. It contains the signatures and organizational data needed to validate previous and future Directory Blocks. This block is included in the DB body. It appears there with a pair of the Admin AdminChainID:SHA256 of the block. For more details, please go to: https://github.com/FactomProject/FactomDocs/blob/master/factomDataStructureDetails.md#administrative-block
func CreateAdminBlock ¶
func CreateAdminBlock(chain *AdminChain, prev *AdminBlock, cap uint) (b *AdminBlock, err error)
Create an empty Admin Block
func (*AdminBlock) AddABEntry ¶
func (b *AdminBlock) AddABEntry(e ABEntry) (err error)
Add an Admin Block entry to the block
func (*AdminBlock) AddEndOfMinuteMarker ¶
func (b *AdminBlock) AddEndOfMinuteMarker(eomType byte) (err error)
Add the end-of-minute marker into the admin block
func (*AdminBlock) GetDBSignature ¶
func (b *AdminBlock) GetDBSignature() ABEntry
Read in the binary into the Admin block.
func (*AdminBlock) JSONBuffer ¶
func (e *AdminBlock) JSONBuffer(b *bytes.Buffer) error
func (*AdminBlock) JSONByte ¶
func (e *AdminBlock) JSONByte() ([]byte, error)
func (*AdminBlock) JSONString ¶
func (e *AdminBlock) JSONString() (string, error)
func (*AdminBlock) LedgerKeyMR ¶
func (ab *AdminBlock) LedgerKeyMR() (*Hash, error)
func (*AdminBlock) MarshalBinary ¶
func (b *AdminBlock) MarshalBinary() (data []byte, err error)
Write out the AdminBlock to binary.
func (*AdminBlock) PartialHash ¶
func (ab *AdminBlock) PartialHash() (*Hash, error)
func (*AdminBlock) Spew ¶
func (e *AdminBlock) Spew() string
func (*AdminBlock) UnmarshalBinary ¶
func (b *AdminBlock) UnmarshalBinary(data []byte) (err error)
Read in the binary into the Admin block.
func (*AdminBlock) UnmarshalBinaryData ¶
func (b *AdminBlock) UnmarshalBinaryData(data []byte) (newData []byte, err error)
type AdminChain ¶
type AdminChain struct { ChainID *Hash Name [][]byte NextBlock *AdminBlock NextBlockHeight uint32 BlockMutex sync.Mutex }
Administrative Chain
type BinaryMarshallable ¶
type BinaryMarshallable interface { encoding.BinaryMarshaler encoding.BinaryUnmarshaler UnmarshalBinaryData([]byte) ([]byte, error) MarshalledSize() uint64 }
type ByteArray ¶
type ByteArray []byte
func NewByteArray ¶
func (ByteArray) MarshalBinary ¶
func (ByteArray) MarshalledSize ¶
func (ByteArray) UnmarshalBinary ¶
type CommitChain ¶
type CommitChain struct { Version uint8 MilliTime *[6]byte ChainIDHash *Hash Weld *Hash EntryHash *Hash Credits uint8 ECPubKey *[32]byte Sig *[64]byte }
func NewCommitChain ¶
func NewCommitChain() *CommitChain
func (*CommitChain) CommitMsg ¶
func (c *CommitChain) CommitMsg() []byte
CommitMsg returns the binary marshaled message section of the CommitEntry that is covered by the CommitEntry.Sig.
func (*CommitChain) ECID ¶
func (c *CommitChain) ECID() byte
func (*CommitChain) GetHash ¶
func (c *CommitChain) GetHash() *Hash
func (*CommitChain) GetMilliTime ¶
func (c *CommitChain) GetMilliTime() int64
Return the timestamp in milliseconds.
func (*CommitChain) GetSigHash ¶
func (c *CommitChain) GetSigHash() *Hash
func (*CommitChain) Hash ¶
func (e *CommitChain) Hash() *Hash
func (*CommitChain) InTime ¶
func (c *CommitChain) InTime() bool
InTime checks the CommitEntry.MilliTime and returns true if the timestamp is whitin +/- 12 hours of the current time. TODO
func (*CommitChain) Interpret ¶
func (b *CommitChain) Interpret() string
func (*CommitChain) IsInterpretable ¶
func (b *CommitChain) IsInterpretable() bool
func (*CommitChain) IsValid ¶
func (c *CommitChain) IsValid() bool
func (*CommitChain) JSONBuffer ¶
func (e *CommitChain) JSONBuffer(b *bytes.Buffer) error
func (*CommitChain) JSONByte ¶
func (e *CommitChain) JSONByte() ([]byte, error)
func (*CommitChain) JSONString ¶
func (e *CommitChain) JSONString() (string, error)
func (*CommitChain) MarshalBinary ¶
func (c *CommitChain) MarshalBinary() ([]byte, error)
func (*CommitChain) MarshalledSize ¶
func (c *CommitChain) MarshalledSize() uint64
func (*CommitChain) Spew ¶
func (e *CommitChain) Spew() string
func (*CommitChain) UnmarshalBinary ¶
func (c *CommitChain) UnmarshalBinary(data []byte) (err error)
func (*CommitChain) UnmarshalBinaryData ¶
func (c *CommitChain) UnmarshalBinaryData(data []byte) (newData []byte, err error)
type CommitEntry ¶
type CommitEntry struct { Version uint8 MilliTime *[6]byte EntryHash *Hash Credits uint8 ECPubKey *[32]byte Sig *[64]byte }
func NewCommitEntry ¶
func NewCommitEntry() *CommitEntry
func (*CommitEntry) CommitMsg ¶
func (c *CommitEntry) CommitMsg() []byte
CommitMsg returns the binary marshaled message section of the CommitEntry that is covered by the CommitEntry.Sig.
func (*CommitEntry) ECID ¶
func (c *CommitEntry) ECID() byte
func (*CommitEntry) GetHash ¶
func (c *CommitEntry) GetHash() *Hash
func (*CommitEntry) GetMilliTime ¶
func (c *CommitEntry) GetMilliTime() int64
Return the timestamp in milliseconds.
func (*CommitEntry) GetSigHash ¶
func (c *CommitEntry) GetSigHash() *Hash
func (*CommitEntry) Hash ¶
func (e *CommitEntry) Hash() *Hash
func (*CommitEntry) InTime ¶
func (c *CommitEntry) InTime() bool
InTime checks the CommitEntry.MilliTime and returns true if the timestamp is whitin +/- 12 hours of the current time.
func (*CommitEntry) Interpret ¶
func (b *CommitEntry) Interpret() string
func (*CommitEntry) IsInterpretable ¶
func (b *CommitEntry) IsInterpretable() bool
func (*CommitEntry) IsValid ¶
func (c *CommitEntry) IsValid() bool
func (*CommitEntry) JSONBuffer ¶
func (e *CommitEntry) JSONBuffer(b *bytes.Buffer) error
func (*CommitEntry) JSONByte ¶
func (e *CommitEntry) JSONByte() ([]byte, error)
func (*CommitEntry) JSONString ¶
func (e *CommitEntry) JSONString() (string, error)
func (*CommitEntry) MarshalBinary ¶
func (c *CommitEntry) MarshalBinary() ([]byte, error)
func (*CommitEntry) MarshalledSize ¶
func (c *CommitEntry) MarshalledSize() uint64
func (*CommitEntry) Spew ¶
func (e *CommitEntry) Spew() string
func (*CommitEntry) UnmarshalBinary ¶
func (c *CommitEntry) UnmarshalBinary(data []byte) (err error)
func (*CommitEntry) UnmarshalBinaryData ¶
func (c *CommitEntry) UnmarshalBinaryData(data []byte) (newData []byte, err error)
type DBEntry ¶
func NewDBEntry ¶
func NewDBEntryFromABlock ¶
func NewDBEntryFromABlock(b *AdminBlock) *DBEntry
func NewDBEntryFromECBlock ¶
func (*DBEntry) JSONString ¶
func (*DBEntry) MarshalBinary ¶
func (*DBEntry) MarshalledSize ¶
func (*DBEntry) UnmarshalBinary ¶
type DBSignatureEntry ¶
type DBSignatureEntry struct { IdentityAdminChainID *Hash PubKey PublicKey PrevDBSig *Sig // contains filtered or unexported fields }
DB Signature Entry -------------------------
func NewDBSignatureEntry ¶
func NewDBSignatureEntry(identityAdminChainID *Hash, sig Signature) (e *DBSignatureEntry)
Create a new DB Signature Entry
func (*DBSignatureEntry) Hash ¶
func (e *DBSignatureEntry) Hash() *Hash
func (*DBSignatureEntry) Interpret ¶
func (e *DBSignatureEntry) Interpret() string
func (*DBSignatureEntry) IsInterpretable ¶
func (e *DBSignatureEntry) IsInterpretable() bool
func (*DBSignatureEntry) JSONBuffer ¶
func (e *DBSignatureEntry) JSONBuffer(b *bytes.Buffer) error
func (*DBSignatureEntry) JSONByte ¶
func (e *DBSignatureEntry) JSONByte() ([]byte, error)
func (*DBSignatureEntry) JSONString ¶
func (e *DBSignatureEntry) JSONString() (string, error)
func (*DBSignatureEntry) MarshalBinary ¶
func (e *DBSignatureEntry) MarshalBinary() (data []byte, err error)
func (*DBSignatureEntry) MarshalledSize ¶
func (e *DBSignatureEntry) MarshalledSize() uint64
func (*DBSignatureEntry) Spew ¶
func (e *DBSignatureEntry) Spew() string
func (*DBSignatureEntry) Type ¶
func (e *DBSignatureEntry) Type() byte
func (*DBSignatureEntry) UnmarshalBinary ¶
func (e *DBSignatureEntry) UnmarshalBinary(data []byte) (err error)
func (*DBSignatureEntry) UnmarshalBinaryData ¶
func (e *DBSignatureEntry) UnmarshalBinaryData(data []byte) (newData []byte, err error)
type DBlockHeader ¶
type DBlockHeader struct { Version byte NetworkID uint32 BodyMR *Hash PrevKeyMR *Hash PrevLedgerKeyMR *Hash Timestamp uint32 DBHeight uint32 BlockCount uint32 }
func NewDBlockHeader ¶
func NewDBlockHeader() *DBlockHeader
func (*DBlockHeader) EncodableFields ¶
func (b *DBlockHeader) EncodableFields() map[string]reflect.Value
func (*DBlockHeader) JSONBuffer ¶
func (e *DBlockHeader) JSONBuffer(b *bytes.Buffer) error
func (*DBlockHeader) JSONByte ¶
func (e *DBlockHeader) JSONByte() ([]byte, error)
func (*DBlockHeader) JSONString ¶
func (e *DBlockHeader) JSONString() (string, error)
func (*DBlockHeader) MarshalBinary ¶
func (b *DBlockHeader) MarshalBinary() (data []byte, err error)
func (*DBlockHeader) MarshalledSize ¶
func (b *DBlockHeader) MarshalledSize() uint64
func (*DBlockHeader) Spew ¶
func (e *DBlockHeader) Spew() string
func (*DBlockHeader) UnmarshalBinary ¶
func (b *DBlockHeader) UnmarshalBinary(data []byte) (err error)
func (*DBlockHeader) UnmarshalBinaryData ¶
func (b *DBlockHeader) UnmarshalBinaryData(data []byte) (newData []byte, err error)
type DChain ¶
type DChain struct { ChainID *Hash Blocks []*DirectoryBlock BlockMutex sync.Mutex NextBlock *DirectoryBlock NextDBHeight uint32 IsValidated bool }
func (*DChain) AddABlockToDBEntry ¶
func (c *DChain) AddABlockToDBEntry(b *AdminBlock) (err error)
Add DBEntry from an Admin Block
func (*DChain) AddDBlockToDChain ¶
func (c *DChain) AddDBlockToDChain(b *DirectoryBlock) (err error)
// Add DBEntry from a Factoid Block func (c *DChain) AddFBlockMRToDBEntry(dbEntry *DBEntry) (err error) {
fmt.Println("AddFDBlock >>>>>") if len(c.NextBlock.DBEntries) < 3 { panic("4 DBEntries not initialized properly for block: " + string(c.NextDBHeight)) } c.BlockMutex.Lock() // Factoid entry is alwasy at the same position // First three entries are ABlock, CBlock, FBlock //c.NextBlock.DBEntries[2] = dbEntry c.BlockMutex.Unlock() return nil }
Add DBlock to the chain in memory
func (*DChain) AddEBlockToDBEntry ¶
Add DBEntry from an Entry Block
func (*DChain) AddECBlockToDBEntry ¶
Add DBEntry from an Entry Credit Block
func (*DChain) AddFBlockToDBEntry ¶
Add DBEntry from an SC Block
func (*DChain) IsBlockExisting ¶
Check if the block with the input block height is existing in chain
type DetachedPublicKey ¶
type DetachedPublicKey [ed25519.PublicKeySize]byte
type DetachedSignature ¶
type DetachedSignature [ed25519.SignatureSize]byte
func (*DetachedSignature) String ¶
func (ds *DetachedSignature) String() string
type DirBlockInfo ¶
type DirBlockInfo struct { // Serial hash for the directory block DBHash *Hash DBHeight uint32 //directory block height Timestamp int64 // time of this dir block info being created // BTCTxHash is the Tx hash returned from rpcclient.SendRawTransaction BTCTxHash *Hash // use string or *btcwire.ShaHash ??? // BTCTxOffset is the index of the TX in this BTC block BTCTxOffset int32 // BTCBlockHeight is the height of the block where this TX is stored in BTC BTCBlockHeight int32 //BTCBlockHash is the hash of the block where this TX is stored in BTC BTCBlockHash *Hash // use string or *btcwire.ShaHash ??? // DBMerkleRoot is the merkle root of the Directory Block // and is written into BTC as OP_RETURN data DBMerkleRoot *Hash // A flag to to show BTC anchor confirmation BTCConfirmed bool }
func NewDirBlockInfoFromDBlock ¶
func NewDirBlockInfoFromDBlock(b *DirectoryBlock) *DirBlockInfo
func (*DirBlockInfo) JSONBuffer ¶
func (e *DirBlockInfo) JSONBuffer(b *bytes.Buffer) error
func (*DirBlockInfo) JSONByte ¶
func (e *DirBlockInfo) JSONByte() ([]byte, error)
func (*DirBlockInfo) JSONString ¶
func (e *DirBlockInfo) JSONString() (string, error)
func (*DirBlockInfo) MarshalBinary ¶
func (b *DirBlockInfo) MarshalBinary() (data []byte, err error)
func (*DirBlockInfo) Spew ¶
func (e *DirBlockInfo) Spew() string
func (*DirBlockInfo) UnmarshalBinary ¶
func (b *DirBlockInfo) UnmarshalBinary(data []byte) (err error)
func (*DirBlockInfo) UnmarshalBinaryData ¶
func (b *DirBlockInfo) UnmarshalBinaryData(data []byte) (newData []byte, err error)
type DirectoryBlock ¶
type DirectoryBlock struct { //Marshalized Header *DBlockHeader DBEntries []*DBEntry //Not Marshalized Chain *DChain IsSealed bool DBHash *Hash KeyMR *Hash IsSavedInDB bool IsValidated bool }
func CreateDBlock ¶
func CreateDBlock(chain *DChain, prev *DirectoryBlock, cap uint) (b *DirectoryBlock, err error)
func NewDBlock ¶
func NewDBlock() *DirectoryBlock
func NewDirectoryBlock ¶
func NewDirectoryBlock() *DirectoryBlock
func (*DirectoryBlock) BuildBodyMR ¶
func (b *DirectoryBlock) BuildBodyMR() (mr *Hash, err error)
func (*DirectoryBlock) BuildKeyMerkleRoot ¶
func (b *DirectoryBlock) BuildKeyMerkleRoot() (err error)
func (*DirectoryBlock) EncodableFields ¶
func (b *DirectoryBlock) EncodableFields() map[string]reflect.Value
func (*DirectoryBlock) JSONBuffer ¶
func (e *DirectoryBlock) JSONBuffer(b *bytes.Buffer) error
func (*DirectoryBlock) JSONByte ¶
func (e *DirectoryBlock) JSONByte() ([]byte, error)
func (*DirectoryBlock) JSONString ¶
func (e *DirectoryBlock) JSONString() (string, error)
func (*DirectoryBlock) MarshalBinary ¶
func (b *DirectoryBlock) MarshalBinary() (data []byte, err error)
func (*DirectoryBlock) MarshalledSize ¶
func (c *DirectoryBlock) MarshalledSize() uint64
func (*DirectoryBlock) Spew ¶
func (e *DirectoryBlock) Spew() string
func (*DirectoryBlock) UnmarshalBinary ¶
func (b *DirectoryBlock) UnmarshalBinary(data []byte) (err error)
func (*DirectoryBlock) UnmarshalBinaryData ¶
func (b *DirectoryBlock) UnmarshalBinaryData(data []byte) (newData []byte, err error)
type EBlock ¶
type EBlock struct { Header *EBlockHeader Body *EBlockBody }
EBlock is the Entry Block. It holds the hashes of the Entries and its Merkel Root is written into the Directory Blocks. Each Entry Block represents all of the entries for a paticular Chain during a 10 minute period.
func MakeEBlock ¶
MakeEBlock creates a new Entry Block belonging to the provieded Entry Chain. Its PrevKeyMR and PrevLedgerKeyMR are populated by the provided previous Entry Block. If The previous Entry Block is nil (the new Entry Block is first in the Chain) the relevent Entry Block Header fields will contain zeroed Hashes.
func NewEBlock ¶
func NewEBlock() *EBlock
NewEBlock returns a blank initialized Entry Block with all of its fields zeroed.
func (*EBlock) AddEBEntry ¶
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) 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) Hash ¶
Hash returns the simple Sha256 hash of the serialized Entry Block. Hash is used to provide the PrevLedgerKeyMR to the next Entry Block in a Chain.
func (*EBlock) JSONString ¶
func (*EBlock) KeyMR ¶
KeyMR returns the hash of the hash of the Entry Block Header concatinated 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) MarshalledSize ¶
func (*EBlock) UnmarshalBinary ¶
type EBlockBody ¶
type EBlockBody struct {
EBEntries []*Hash
}
EBlockBody is the series of Hashes that form the Entry Block Body.
func NewEBlockBody ¶
func NewEBlockBody() *EBlockBody
NewEBlockBody initalizes an empty Entry Block Body.
func (*EBlockBody) JSONBuffer ¶
func (e *EBlockBody) JSONBuffer(b *bytes.Buffer) error
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() *Hash
MR calculates the Merkle Root of the Entry Block Body. See func BuildMerkleTreeStore(hashes []*Hash) (merkles []*Hash) in common/merkle.go.
func (*EBlockBody) Spew ¶
func (e *EBlockBody) Spew() string
type EBlockHeader ¶
type EBlockHeader struct { ChainID *Hash BodyMR *Hash PrevKeyMR *Hash PrevLedgerKeyMR *Hash EBSequence uint32 DBHeight uint32 EntryCount uint32 }
EBlockHeader holds relevent 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) JSONBuffer ¶
func (e *EBlockHeader) JSONBuffer(b *bytes.Buffer) error
func (*EBlockHeader) JSONByte ¶
func (e *EBlockHeader) JSONByte() ([]byte, error)
func (*EBlockHeader) JSONString ¶
func (e *EBlockHeader) JSONString() (string, error)
func (*EBlockHeader) Spew ¶
func (e *EBlockHeader) Spew() string
type ECBlock ¶
type ECBlock struct { Header *ECBlockHeader Body *ECBlockBody }
The Entry Credit Block 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 NewECBlock ¶
func NewECBlock() *ECBlock
func NextECBlock ¶
func (*ECBlock) AddEntry ¶
func (e *ECBlock) AddEntry(entries ...ECBlockEntry)
func (*ECBlock) BuildHeader ¶
func (*ECBlock) HeaderHash ¶
func (*ECBlock) JSONString ¶
func (*ECBlock) MarshalBinary ¶
func (*ECBlock) MarshalledSize ¶
func (*ECBlock) UnmarshalBinary ¶
type ECBlockBody ¶
type ECBlockBody struct {
Entries []ECBlockEntry
}
func NewECBlockBody ¶
func NewECBlockBody() *ECBlockBody
func (*ECBlockBody) JSONBuffer ¶
func (e *ECBlockBody) JSONBuffer(b *bytes.Buffer) error
func (*ECBlockBody) JSONByte ¶
func (e *ECBlockBody) JSONByte() ([]byte, error)
func (*ECBlockBody) JSONString ¶
func (e *ECBlockBody) JSONString() (string, error)
func (*ECBlockBody) Spew ¶
func (e *ECBlockBody) Spew() string
type ECBlockEntry ¶
type ECBlockHeader ¶
type ECBlockHeader struct { ECChainID *Hash BodyHash *Hash PrevHeaderHash *Hash PrevLedgerKeyMR *Hash DBHeight uint32 HeaderExpansionArea []byte ObjectCount uint64 BodySize uint64 }
func NewECBlockHeader ¶
func NewECBlockHeader() *ECBlockHeader
func (*ECBlockHeader) JSONBuffer ¶
func (e *ECBlockHeader) JSONBuffer(b *bytes.Buffer) error
func (*ECBlockHeader) JSONByte ¶
func (e *ECBlockHeader) JSONByte() ([]byte, error)
func (*ECBlockHeader) JSONString ¶
func (e *ECBlockHeader) JSONString() (string, error)
func (*ECBlockHeader) Spew ¶
func (e *ECBlockHeader) Spew() string
type ECChain ¶
type ECChain struct { ChainID *Hash Name [][]byte NextBlock *ECBlock NextBlockHeight uint32 BlockMutex sync.Mutex }
func NewECChain ¶
func NewECChain() *ECChain
func (*ECChain) MarshalBinary ¶
func (*ECChain) UnmarshalBinary ¶
type EChain ¶
type EChain struct { ChainID *Hash FirstEntry *Entry NextBlock *EBlock NextBlockHeight uint32 BlockMutex sync.Mutex }
func (*EChain) MarshalBinary ¶
func (*EChain) MarshalledSize ¶
func (*EChain) UnmarshalBinary ¶
type EndOfMinuteEntry ¶
type EndOfMinuteEntry struct { EOM_Type byte // contains filtered or unexported fields }
func (*EndOfMinuteEntry) Hash ¶
func (e *EndOfMinuteEntry) Hash() *Hash
func (*EndOfMinuteEntry) Interpret ¶
func (e *EndOfMinuteEntry) Interpret() string
func (*EndOfMinuteEntry) IsInterpretable ¶
func (e *EndOfMinuteEntry) IsInterpretable() bool
func (*EndOfMinuteEntry) JSONBuffer ¶
func (e *EndOfMinuteEntry) JSONBuffer(b *bytes.Buffer) error
func (*EndOfMinuteEntry) JSONByte ¶
func (e *EndOfMinuteEntry) JSONByte() ([]byte, error)
func (*EndOfMinuteEntry) JSONString ¶
func (e *EndOfMinuteEntry) JSONString() (string, error)
func (*EndOfMinuteEntry) MarshalBinary ¶
func (e *EndOfMinuteEntry) MarshalBinary() (data []byte, err error)
func (*EndOfMinuteEntry) MarshalledSize ¶
func (e *EndOfMinuteEntry) MarshalledSize() uint64
func (*EndOfMinuteEntry) Spew ¶
func (e *EndOfMinuteEntry) Spew() string
func (*EndOfMinuteEntry) Type ¶
func (m *EndOfMinuteEntry) Type() byte
func (*EndOfMinuteEntry) UnmarshalBinary ¶
func (e *EndOfMinuteEntry) UnmarshalBinary(data []byte) (err error)
func (*EndOfMinuteEntry) UnmarshalBinaryData ¶
func (e *EndOfMinuteEntry) UnmarshalBinaryData(data []byte) (newData []byte, err error)
type Entry ¶
An Entry is the element which carries user data https://github.com/FactomProject/FactomDocs/blob/master/factomDataStructureDetails.md#entry
func (*Entry) JSONString ¶
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) MarshalledSize ¶
func (*Entry) UnmarshalBinary ¶
type Error ¶
type Error struct { APICode uint HTTPCode int Name string Description string SupportURL string Message string }
func CreateError ¶
type FctChain ¶
type FctChain struct { ChainID *Hash NextBlock block.IFBlock NextBlockHeight uint32 BlockMutex sync.Mutex }
factoid Chain
func (*FctChain) JSONString ¶
type Hash ¶
type Hash struct {
// contains filtered or unexported fields
}
func BuildMerkleTreeStore ¶
func CreateHash ¶
func CreateHash(entities ...BinaryMarshallable) (h *Hash, err error)
func NewChainID ¶
NewChainID generates a ChainID from an entry. ChainID = Sha(Sha(ExtIDs[0]) + Sha(ExtIDs[1] + ... + Sha(ExtIDs[n]))
func NewShaHash ¶
NewShaHash returns a new ShaHash from a byte slice. An error is returned if the number of bytes passed in is not HASH_LENGTH.
func (*Hash) ByteString ¶
func (*Hash) IsMinuteMarker ¶
Is the hash a minute marker (the last byte indicates the minute number)
func (*Hash) JSONString ¶
func (*Hash) MarshalBinary ¶
func (*Hash) MarshalText ¶
func (*Hash) MarshalledSize ¶
func (*Hash) SetBytes ¶
SetBytes sets the bytes which represent the hash. An error is returned if the number of bytes passed in is not HASH_LENGTH.
func (*Hash) UnmarshalBinary ¶
func (*Hash) UnmarshalBinaryData ¶
func (*Hash) UnmarshalText ¶
type IncreaseBalance ¶
func NewIncreaseBalance ¶
func NewIncreaseBalance() *IncreaseBalance
func (*IncreaseBalance) ECID ¶
func (b *IncreaseBalance) ECID() byte
func (*IncreaseBalance) Hash ¶
func (e *IncreaseBalance) Hash() *Hash
func (*IncreaseBalance) Interpret ¶
func (b *IncreaseBalance) Interpret() string
func (*IncreaseBalance) IsInterpretable ¶
func (b *IncreaseBalance) IsInterpretable() bool
func (*IncreaseBalance) JSONBuffer ¶
func (e *IncreaseBalance) JSONBuffer(b *bytes.Buffer) error
func (*IncreaseBalance) JSONByte ¶
func (e *IncreaseBalance) JSONByte() ([]byte, error)
func (*IncreaseBalance) JSONString ¶
func (e *IncreaseBalance) JSONString() (string, error)
func (*IncreaseBalance) MarshalBinary ¶
func (b *IncreaseBalance) MarshalBinary() ([]byte, error)
func (*IncreaseBalance) Spew ¶
func (e *IncreaseBalance) Spew() string
func (*IncreaseBalance) UnmarshalBinary ¶
func (b *IncreaseBalance) UnmarshalBinary(data []byte) (err error)
func (*IncreaseBalance) UnmarshalBinaryData ¶
func (b *IncreaseBalance) UnmarshalBinaryData(data []byte) (newData []byte, err error)
type JSONable ¶
type JSONable interface { JSONByte() ([]byte, error) JSONString() (string, error) JSONBuffer(b *bytes.Buffer) error }
Interface for printing structures into JSON
type MinuteNumber ¶
type MinuteNumber struct {
Number uint8
}
func NewMinuteNumber ¶
func NewMinuteNumber() *MinuteNumber
func (*MinuteNumber) ECID ¶
func (m *MinuteNumber) ECID() byte
func (*MinuteNumber) Hash ¶
func (e *MinuteNumber) Hash() *Hash
func (*MinuteNumber) Interpret ¶
func (b *MinuteNumber) Interpret() string
func (*MinuteNumber) IsInterpretable ¶
func (b *MinuteNumber) IsInterpretable() bool
func (*MinuteNumber) JSONBuffer ¶
func (e *MinuteNumber) JSONBuffer(b *bytes.Buffer) error
func (*MinuteNumber) JSONByte ¶
func (e *MinuteNumber) JSONByte() ([]byte, error)
func (*MinuteNumber) JSONString ¶
func (e *MinuteNumber) JSONString() (string, error)
func (*MinuteNumber) MarshalBinary ¶
func (m *MinuteNumber) MarshalBinary() ([]byte, error)
func (*MinuteNumber) MarshalledSize ¶
func (c *MinuteNumber) MarshalledSize() uint64
func (*MinuteNumber) Spew ¶
func (e *MinuteNumber) Spew() string
func (*MinuteNumber) UnmarshalBinary ¶
func (m *MinuteNumber) UnmarshalBinary(data []byte) (err error)
func (*MinuteNumber) UnmarshalBinaryData ¶
func (m *MinuteNumber) UnmarshalBinaryData(data []byte) (newData []byte, err error)
type PrivateKey ¶
type PrivateKey struct { Key *[ed25519.PrivateKeySize]byte Pub PublicKey }
PrivateKey contains Public/Private key pair
func NewPrivateKeyFromHex ¶
func NewPrivateKeyFromHex(s string) (pk PrivateKey, err error)
Create a new private key from a hex string
func (*PrivateKey) AllocateNew ¶
func (pk *PrivateKey) AllocateNew()
func (*PrivateKey) GenerateKey ¶
func (pk *PrivateKey) GenerateKey() (err error)
Generate creates new PrivateKey / PublciKey pair or returns error
func (PrivateKey) MarshalSign ¶
func (pk PrivateKey) MarshalSign(msg BinaryMarshallable) (sig Signature)
Sign signs msg with PrivateKey and return Signature
func (PrivateKey) Public ¶
func (pk PrivateKey) Public() []byte
func (PrivateKey) Sign ¶
func (pk PrivateKey) Sign(msg []byte) (sig Signature)
Sign signs msg with PrivateKey and return Signature
type Properties ¶
Structure for reporting properties (used by the web API
type PublicKey ¶
type PublicKey struct {
Key *[ed25519.PublicKeySize]byte
}
PublicKey contains only Public part of Public/Private key pair
func PubKeyFromString ¶
func (*PublicKey) MarshalText ¶
func (*PublicKey) UnmarshalText ¶
type ServerIndexNumber ¶
type ServerIndexNumber struct {
Number uint8
}
func NewServerIndexNumber ¶
func NewServerIndexNumber() *ServerIndexNumber
func (*ServerIndexNumber) ECID ¶
func (s *ServerIndexNumber) ECID() byte
func (*ServerIndexNumber) Hash ¶
func (e *ServerIndexNumber) Hash() *Hash
func (*ServerIndexNumber) Interpret ¶
func (b *ServerIndexNumber) Interpret() string
func (*ServerIndexNumber) IsInterpretable ¶
func (b *ServerIndexNumber) IsInterpretable() bool
func (*ServerIndexNumber) JSONBuffer ¶
func (e *ServerIndexNumber) JSONBuffer(b *bytes.Buffer) error
func (*ServerIndexNumber) JSONByte ¶
func (e *ServerIndexNumber) JSONByte() ([]byte, error)
func (*ServerIndexNumber) JSONString ¶
func (e *ServerIndexNumber) JSONString() (string, error)
func (*ServerIndexNumber) MarshalBinary ¶
func (s *ServerIndexNumber) MarshalBinary() ([]byte, error)
func (*ServerIndexNumber) MarshalledSize ¶
func (c *ServerIndexNumber) MarshalledSize() uint64
func (*ServerIndexNumber) Spew ¶
func (e *ServerIndexNumber) Spew() string
func (*ServerIndexNumber) UnmarshalBinary ¶
func (s *ServerIndexNumber) UnmarshalBinary(data []byte) (err error)
func (*ServerIndexNumber) UnmarshalBinaryData ¶
func (s *ServerIndexNumber) UnmarshalBinaryData(data []byte) (newData []byte, err error)
type ShortInterpretable ¶
type ShortInterpretable interface { IsInterpretable() bool //Whether the structure can interpret itself Interpret() string //Turns the data encoded int he structure into human-friendly string }
Interface for short, reoccuring data structures to interpret themselves into human-friendly form
type Signature ¶
type Signature struct { Pub PublicKey Sig *[ed25519.SignatureSize]byte }
Signature has signed data and its corresponsing PublicKey
func (*Signature) DetachSig ¶
func (sig *Signature) DetachSig() *DetachedSignature
type SimpleData ¶
type SimpleData struct {
Data []byte
}
func (*SimpleData) MarshalBinary ¶
func (d *SimpleData) MarshalBinary() ([]byte, error)
func (*SimpleData) MarshalledSize ¶
func (d *SimpleData) MarshalledSize() uint64
func (*SimpleData) UnmarshalBinary ¶
func (d *SimpleData) UnmarshalBinary([]byte) error
Source Files ¶
- adminBlock.go
- binary.go
- coding.go
- commitchain.go
- commitentry.go
- constants.go
- directoryBlock.go
- eblock.go
- ecblock.go
- ecchain.go
- echain.go
- entry.go
- error.go
- ftcblock.go
- hash.go
- increasebalance.go
- key.go
- marshal.go
- merkle.go
- minutenumber.go
- serverindexnumber.go
- signature.go
- stringInterfaces.go
- varint.go