Documentation ¶
Index ¶
- Constants
- func NewEmptyVotes(questions, options int) [][]*types.BigInt
- type BlockMetadata
- type CountStore
- type Entity
- type EnvelopeMetadata
- type EnvelopePackage
- type Process
- type Results
- type ScrutinizerOnProcessData
- type TxMetadata
- type TxPackage
- type TxReference
- type VotePackage
- type VoteReference
Constants ¶
const ( // MaxQuestions is the maximum number of questions allowed in a VotePackage MaxQuestions = 64 // MaxOptions is the maximum number of options allowed in a VotePackage question MaxOptions = 128 )
const ( // CountStoreEntities is the key for the entity count db reference CountStoreEntities = uint8(iota) // CountStoreProcesses is the key for the process count db reference CountStoreProcesses // CountStoreEnvelopes is the key for the envelope count db reference CountStoreEnvelopes // CountStoreTransactions is the key for the transaction count db reference CountStoreTransactions )
Variables ¶
This section is empty.
Functions ¶
func NewEmptyVotes ¶
NewEmptyVotes creates a new results struct with the given number of questions and options
Types ¶
type BlockMetadata ¶
type BlockMetadata struct { Height uint32 `json:"height,omitempty"` Timestamp time.Time `json:"timestamp"` Hash types.HexBytes `json:"hash,omitempty"` NumTxs uint64 `json:"num_txs"` LastBlockHash types.HexBytes `json:"last_block_hash"` ProposerAddress types.HexBytes `json:"proposer_address"` }
BlockMetadata contains the metadata for a single tendermint block
func (*BlockMetadata) String ¶
func (b *BlockMetadata) String() string
String prints the BlockMetadata in a human-readable format
type CountStore ¶
CountStore holds the count of envelopes, processes, entities, or transactions
type Entity ¶
type Entity struct { ID types.HexBytes `badgerholdKey:"ID"` ProcessCount uint32 CreationTime time.Time }
Entity holds the db reference for an entity
type EnvelopeMetadata ¶
type EnvelopeMetadata struct { ProcessId types.HexBytes `json:"process_id"` Nullifier types.HexBytes `json:"nullifier"` VoterID types.HexBytes `json:"voter_id"` TxIndex int32 `json:"tx_index"` Height uint32 `json:"height"` TxHash types.HexBytes `json:"tx_hash"` }
EnvelopeMetadata contains vote information for the EnvelopeList api
type EnvelopePackage ¶
type EnvelopePackage struct { EncryptionKeyIndexes []uint32 `json:"encryption_key_indexes"` Meta EnvelopeMetadata `json:"meta"` Nonce types.HexBytes `json:"nonce"` Signature types.HexBytes `json:"signature"` VotePackage []byte `json:"vote_package"` Weight string `json:"weight"` }
EnvelopePackage contains a VoteEnvelope and auxiliary information for the Envelope api
type Process ¶
type Process struct { ID types.HexBytes `badgerholdKey:"ID" json:"processId"` EntityID types.HexBytes `badgerholdIndex:"EntityID" json:"entityId"` EntityIndex uint32 `json:"entityIndex"` StartBlock uint32 `json:"startBlock"` EndBlock uint32 `badgerholdIndex:"EndBlock" json:"endBlock"` Rheight uint32 `badgerholdIndex:"Rheight" json:"-"` CensusRoot types.HexBytes `json:"censusRoot"` RollingCensusRoot types.HexBytes `json:"rollingCensusRoot"` CensusURI string `json:"censusURI"` Metadata string `json:"metadata"` CensusOrigin int32 `json:"censusOrigin"` Status int32 `badgerholdIndex:"Status" json:"status"` Namespace uint32 `badgerholdIndex:"Namespace" json:"namespace"` Envelope *models.EnvelopeType `json:"envelopeType"` Mode *models.ProcessMode `json:"processMode"` VoteOpts *models.ProcessVoteOptions `json:"voteOptions"` PrivateKeys []string `json:"-"` PublicKeys []string `json:"-"` QuestionIndex uint32 `json:"questionIndex"` CreationTime time.Time `json:"creationTime"` HaveResults bool `json:"haveResults"` FinalResults bool `json:"finalResults"` SourceBlockHeight uint64 `json:"sourceBlockHeight"` SourceNetworkId string `badgerholdIndex:"SourceNetworkId" json:"sourceNetworkId"` MaxCensusSize uint64 `json:"maxCensusSize"` RollingCensusSize uint64 `json:"rollingCensusSize"` }
Process represents an election process handled by the Vochain. The scrutinizer Process data type is different from the vochain state data type since it is optimized for querying purposes and not for keeping a shared consensus state.
func ProcessFromDB ¶ added in v1.3.0
func ProcessFromDB(dbproc *scrutinizerdb.Process) *Process
type Results ¶
type Results struct { ProcessID types.HexBytes `badgerholdKey:"ProcessID" json:"processId"` Votes [][]*types.BigInt `json:"votes"` Weight *types.BigInt `json:"weight"` EnvelopeHeight uint64 `json:"envelopeHeight"` EnvelopeType *models.EnvelopeType `json:"envelopeType"` VoteOpts *models.ProcessVoteOptions `json:"voteOptions"` Signatures []types.HexBytes `json:"signatures"` Final bool `json:"final"` BlockHeight uint32 `json:"blockHeight"` }
Results holds the final results and relevant process info for a vochain process
func ResultsFromDB ¶ added in v1.3.0
func ResultsFromDB(dbproc *scrutinizerdb.Process) *Results
func (*Results) Add ¶
Add adds the total weight and votes from the given Results to the containing Results making the method call.
type ScrutinizerOnProcessData ¶
ScrutinizerOnProcessData holds the required data for callbacks when a new process is added into the vochain.
type TxMetadata ¶
type TxMetadata struct { Type string `json:"type"` BlockHeight uint32 `json:"block_height,omitempty"` Index int32 `json:"index"` Hash types.HexBytes `json:"hash"` }
TxMetadata contains tx information for the TransactionList api
type TxPackage ¶
type TxPackage struct { Tx []byte `json:"tx"` ID uint32 `json:"id,omitempty"` BlockHeight uint32 `json:"block_height,omitempty"` Index *int32 `json:"index,omitempty"` Hash types.HexBytes `json:"hash"` Signature types.HexBytes `json:"signature"` }
TxPackage contains a SignedTx and auxiliary information for the Transaction api
type TxReference ¶
type TxReference struct { Index uint64 `badgerholdKey:"Index"` Hash types.HexBytes `badgerholdIndex:"Hash"` BlockHeight uint32 TxBlockIndex int32 }
TxReference holds the db reference for a single transaction
type VotePackage ¶
VotePackage represents the payload of a vote (usually base64 encoded)
type VoteReference ¶
type VoteReference struct { Nullifier types.HexBytes `badgerholdKey:"Nullifier"` ProcessID types.HexBytes `badgerholdIndex:"ProcessID"` VoterID types.VoterID Height uint32 Weight *types.BigInt TxIndex int32 CreationTime time.Time }
VoteReference holds the db reference for a single vote
func VoteReferenceFromDB ¶ added in v1.3.0
func VoteReferenceFromDB(dbvote *scrutinizerdb.VoteReference) *VoteReference