Documentation ¶
Index ¶
- Constants
- Variables
- func BoolBytes(b bool) []byte
- func BytesBool(data []byte) (f bool, newData []byte)
- func BytesUint16(data []byte) (uint16, []byte)
- func BytesUint32(data []byte) (uint32, []byte)
- func BytesUint64(data []byte) (uint64, []byte)
- func DecodeVarInt(data []byte) (uint64, []byte)
- func DecodeVarIntGo(data []byte) (uint64, []byte)
- func EncodeVarInt(out *bytes.Buffer, v uint64) error
- func EncodeVarIntGo(out *bytes.Buffer, v uint64) error
- func EncodeVarIntGoBytes(v uint64) (data []byte)
- func GetHomeDir() string
- func Uint16Bytes(i uint16) []byte
- func Uint32Bytes(i uint32) []byte
- func Uint64Bytes(i uint64) []byte
- func VarIntLength(v uint64) uint64
- type Address
- type BlockHeight
- type DataField
- type Hash
- type PrivateKey
- type Sequence
- type Signature
- type TimeStamp
- type VersionField
Constants ¶
const ( Version = VersionField(0) // Version of ValAcc NodeFirst = "first node" // Key: node.ChainID Value: First node hash with this chainID NodeNext = "next node" // Key: node.GetHash() Value: next node in sequence with this chainID NodeHead = "node head" // Key: node.ChainID Value: last node hash for this chainID Entry = "entry" // Key: entry.GetHash() Value: Entry EntryNode = "entry Node" // Key: entry.GetHash() Value: node where this entry is recorded DirectoryBlockHeight = "directory block height" // Key: node.BHeight Value: Directory Block node Node = "node" // Key: node.GetHash() Value: nodeHash )
======================= Database Support ======================================= Bucket Names used by the accumulator and validator
Variables ¶
var StartApp time.Time
Functions ¶
func BytesUint16 ¶
BytesUint16 Unmarshal a uint32 (big endian)
func BytesUint32 ¶
BytesUint32 Unmarshal a uint32 (big endian)
func BytesUint64 ¶
BytesUint64 Unmarshal a uint64 (big endian)
func DecodeVarInt ¶
DecodeVarInt decodes a variable integer from the given data buffer. We use the algorithm used by Go, only BigEndian.
func DecodeVarIntGo ¶
DecodeVarIntGo decodes a variable integer from the given data buffer. We use the algorithm used by Go, only BigEndian.
func EncodeVarInt ¶
EncodeVarInt encodes an integer as a variable int into the given data buffer.
func EncodeVarIntGo ¶
EncodeVarIntGo encodes an integer as a variable int into the given data buffer.
func EncodeVarIntGoBytes ¶
EncodeVarIntGoBytes Returns a byte slice that encodes the given integer.
func GetHomeDir ¶
func GetHomeDir() string
GetHomeDir Used to find the Home Directory from which the configuration directory for the ValAcc application to use for its database. This is not a terribly refined way of configuring the ValAcc and may be refined in the future.
func VarIntLength ¶
VarIntLength returns the length of the variable integer when encoded as a var int
Types ¶
type Address ¶
type Address [32]byte // An Address is the hash of a public key
Address ===========================================================================
type BlockHeight ¶
type BlockHeight uint32 // We are typing certain things in the protocol
func (BlockHeight) Bytes ¶
func (bh BlockHeight) Bytes() []byte
func (*BlockHeight) Extract ¶
func (bh *BlockHeight) Extract(data []byte) []byte
type DataField ¶
type DataField []byte // Typing the Data Fields to allow flexibility in representation in the future
type Hash ¶
type Hash [32]byte // We are currently using sha256 hashes
Hash ===========================================================================
func GetChainID ¶
GetChainID All the chainIDs under an Accumulator are unique to a DID in Factom, and unique from all chainIDs in other Accumulators and Factom itself.
A Factom ChainID is H( H(subChainID[0] + H(subChainID[1] + .. + H(subChainID[n]) where the ChainID has n subChainIDs.
An Accumulator ChainID is H (AccumulatorDID + 0x00 + H( H(subChainID[0] + H(subChainID[1] + .. + H(subChainID[n])) One cannot construct such a ChainID in Factom, nor on another AccumulatorDID.
type PrivateKey ¶
type PrivateKey [64]byte
Private Key ============================================================================
func (*PrivateKey) GetPublicKey ¶
func (p *PrivateKey) GetPublicKey() (publicKey []byte)
The public key is the last 32 bytes of the PrivateKey
type Signature ¶
Signature =============================================================================
type TimeStamp ¶
type TimeStamp int64
func GetCurrentTimeStamp ¶
func GetCurrentTimeStamp() TimeStamp
type VersionField ¶
type VersionField uint8 // We are typing certain things in the protocol
func (VersionField) Bytes ¶
func (v VersionField) Bytes() []byte
func (*VersionField) Extract ¶
func (v *VersionField) Extract(data []byte) []byte