PeaceFounder.Model

Primitives

PeaceFounder.Model.AckConsistencyType
struct AckConsistency{T}
    proof::ConsistencyProof
    commit::Commit{T}
end

Represents an ackknowledgment from the issuer that a root is permanetly included in the ledger. This acknowledgemnt assures that ledger up to index(ack) is included in the current ledger which has has index index(commit(ack)). This is useful in a combination with AckInclusion to privatelly update it's validity rather than asking an explicit element. Also ensures that other elements in the ledger are not being tampered with.

Interface: root, id, issuer, commit, index, verify

source
PeaceFounder.Model.AckInclusionType
struct AckInclusion{T}
    proof::InclusionProof
    commit::Commit{T}
end

Represents an acknowldgment from the issuer that a leaf is permanently included in the ledger. In case the ledger is tampered with this acknowledgement acts as sufficient proof to blame the issuer.

Interface: leaf, id, issuer, commit, index, verify

source
PeaceFounder.Model.CryptoSpecType
struct CryptoSpec
    hasher::Hash
    group::Spec
    generator::Generator
end

Specification of cryptographic parameters which are used for public key cryptography, message hashing and authetification codes.

source
PeaceFounder.Model.GeneratorType
struct Generator
    data::Vector{UInt8}
end

Datatype which stores cryptogrpahic group point in standart octet form intended to be used as a base. See also Pseudonym.

source
PeaceFounder.Model.SignerType
struct Signer
    spec::CryptoSpec
    pbkey::Pseudonym
    key::BigInt
end

A signer type. See a method generate(Signer, spec) for initialization.

Interface: pseudonym, id, sign, seal, approve

source
HistoryTrees.leafMethod
leaf(ack::AckInclusion)

Access a leaf diggest for which the acknowledgment is made.

source
HistoryTrees.rootMethod
root(x::AckConsistency)

Access a root diggest for which the acknowledgment is made.

source
PeaceFounder.Model.digestMethod
digest(message::Vector{UInt8}, hasher::Hash)::Digest
digest(document, spec) = digest(canonicalize(message)::Vector{UInt8}, hasher(spec)::Hash)

Return a resulting digest applying hasher on the given message. When message is not octet string a canonicalize method is applied first.

source
PeaceFounder.Model.digestMethod
digest(bytes::Vector{UInt8}, hasher::Hash)::Digest
digest(x, spec) = digest(canonicalize(x)::Vector{UInt8}, hasher(spec)::Hash)

Compute a hash digest. When input is not in bytes the canonicalize method is applied first.

source
PeaceFounder.Model.indexMethod
index(ack::AckConsistency)

Return an index for a root at which the consistency proof is made. To obtain the current ledger index use index(commit(ack)).

source
PeaceFounder.Model.indexMethod
index(ack::AckInclusion)::Int

Return an index at which the leaf is recorded in the ledger. To obtain the current ledger index use index(commit(ack)).

source
PeaceFounder.Model.isbindingMethod
isbinding(x, y, spec::Hash)::Bool
isbinding(x, y, spec) = isbinding(x, y, hasher(spec)::Hash)

Check binding of two objects x and y. Some general examples:

  • Check that a document is bound to it's signature.
  • Check that a record is included in the ledger.
  • Check that a given object is consistent with a ledger.
source
PeaceFounder.Model.sealMethod
seal(message::Vector{UInt8}[, generator::Generator], signer::Signer)::Seal

Sign a bytestring message with signer's private key and specification and return a signature as a Seal. When generator is provided it is used as a base for the signature. See also sign.

source
PeaceFounder.Model.signMethod
sign(digest::Digest[, generator::Generator], signer::Signer)::Signature

Sign a digest as an integer with signer's private key and specification. This method avoids running hashing twice when that is done externally. When generator is provided it is used as a base for the signature.

source
PeaceFounder.Model.signMethod
sign(message::Vector{UInt8}[, generator::Generator], signer::Signer)::Signature

Sign a bytestring message with signer's private key and specification. When generator is provided it is used as a base for the signature.

source
PeaceFounder.Model.canonicalizeFunction

ToDo: a well specified encoding is essential here. Binary tree encoding may suffice here. More fancy approach would be to use a DER encoding. Meanwhile JSON shall be used.

source
PeaceFounder.Model.pseudonymFunction
pseudonym(signer::Signer, [generator])::Pseudonym

Return a pseudonym of a signer at a given relative generator. If generator is not passed returns identity pseudonym. (See also id)


pseudonym(seal::Seal)::Pseudonym

Return a pseudonym of a seal. Note that it is not equal to identity when the signature is issued on a relative generator.


pseudonym(vote::Vote)::Pseudonym

Return a pseudonym used to seal the vote.

source
PeaceFounder.Model.idFunction
id(document)::Pseudonym

Return identity pseudonym of a document issuer.


id(signer)::Pseudonym

Return identity pseudonym of a signer.

source
PeaceFounder.Model.verifyFunction
verify(message, seal::Seal, [generator::Generator], crypto::CryptoSpec)::Bool
verify(message, pk::Pseudonym, sig::Signature, [generator::Generator], crypto::CryptoSpec)::Bool

Verify the cryptographic signature of the message returning true if valid. An optional generator can be given when signature is issued on a relative generator differing from a base specification crypto.


verify(document[, generator::Generator], crypto::CryptoSpec)::Bool

Verify a cryptographic signature of the document returning true if valid.


verify(braidwork::BraidWork, crypto::CryptoSpec)::Bool

Verify a braider issued cryptographic signature for the braidwork and a zero knowledge proofs. Returns true if both checks succeed.

source

Admission

PeaceFounder.Model.TicketType
mutable struct Ticket
    const ticketid::TicketID
    timestamp::DateTime
    salt::Vector{UInt8}
    auth_code::Digest
    token::Digest
    admission::Union{Admission, Nothing}
end

Represents a ticket state for ticket with ticketid. timestamp represents time when the ticket have been issued by a recruiter client in authorization system of choice, for instance, Recruiters.jl; salt contains a random bytestring generated by the server from which the reccruiter client can derive a token as token(ticketid, salt, hmac). auth_code is a server generated authetification code for a given salt and current metadata. Lastly admission contains a certified member pseudonym which was authetificated by the user with token.

source
PeaceFounder.Model.TicketIDType
struct TicketID
    id::Vector{UInt8}
end

Represents a unique identifier for which a recruit tooken is issued. In case of necessity id can contain a full document, for instance, registration form, proof of identity and etc. In case a privacy is an issue the id can contain a unique identifier which can be matched to an identity in an external database.

source
PeaceFounder.Model.TokenRecruiterType
struct TokenRecruiter
    metadata::Ref{Vector{UInt8}} 
    tickets::Vector{Ticket}
    signer::Signer
    hmac::HMAC
end

Represents a state for token recruiter service. To initialize the service it's necessary to create a signer who can issue a valid admisssion certificates and a secret key with which a recruit client can exchange authorized messages. See also method generate(TokenRecruiter, spec).

Metadata is used as means to securelly deliver to the client most recent server specification.

Interface: select, hmac, hasher, key, id, tickets, in, set_metadata!, enlist!, admit!, isadmitted, ticket_status

source
Base.inMethod
in(ticketid::TicketID, recruiter::TokenRecruiter)::Bool

Return true if there already is a ticket with ticketid.

source
PeaceFounder.Model.admit!Method
admit!(recruiter::TokenRecruiter, id::Pseudonym, ticketid::TicketID, auth_code::Digest)::Admission

Attempt to admit an identity pseudonym id for ticket ticketid with provided authorization code. This function retrieves a ticket with given ticketid and uses it's recorded token to check whether the request is binding. In the case of success an admnission certificate is formed with provided indenty pseudonym id and is signed by the recruter's private key. Otherwise when either of checks fail an error is raised. In the case ticket is already addmitted, returns previously stored admission.

source
PeaceFounder.Model.approveMethod
approve(x::T, signer::Signer)::T

Cryptographically sign a document x::T and returns a signed document with the same type. To check whether a document is signed see issuer method.

source
PeaceFounder.Model.authMethod
auth(id::Pseudonym, hmac::HMAC)::Digest
auth(id::Pseudonym, token::Digest, hasher::Hash) = auth(id, HMAC(bytes(token), hasher))

Compute a hash authorization code for identity pseudonym using token as a key.

source
PeaceFounder.Model.authMethod
auth(ticketid::TicketID, time::DateTime, hmac::HMAC)::Digest

Compute a hash authorization code for ticketid at given time. The message needs to reach token recruiter within a 60 second window before it is obseleted.

source
PeaceFounder.Model.authMethod
auth(metadata::Vector{UInt8}, ticketid::TicketID, salt::Vector{UInt8}, hmac::HMAC)::Digest

Compute a hash authorization code for a metadata, salt from which a token is derived. Metadata can be configured to contain most recent server specification DemeSpec; ticketid takes session identifier role.

source
PeaceFounder.Model.enlist!Method
enlist!(recruiter::TokenRecruiter, ticketid::TicketID, timestamp::DateTime, ticket_auth_code::Digest)::Tuple{Vector{UInt8}, Vector{UInt8}, Digest}

Attempt to enlist a ticket with given ticketid authetificated by a recruit client at timestmap. This function checks the age of the request which need to be less than 60 seconds to be considered. Then the hash authorization code is checked after which a triplet of metadata, salt and reply_auth_code is returned. If either of theses checks fail an error is raised and needs to be dealt by the user. See a token method on how the token is derived.

source
PeaceFounder.Model.isadmittedMethod
isadmitted(ticketid::TicketID, recruiter::TokenRecruiter)

Check whether a ticket is already admitted. Returns false when either ticket is nonexistent or it's admission is nothing.

source
PeaceFounder.Model.isbindingMethod
isbinding(id::Pseudonym, auth_code::Digest, token::Digest, hasher::Hash)

Check whether a request for a new identity pseudonym admission is authetificated. The token is delivered to a user by recruit client.

source
PeaceFounder.Model.isbindingMethod
isbinding(ticketid::TicketID, timestamp::DateTime, auth_code::Digest, hmac::HMAC)

Check whether request for a new ticketid is authorized by recruit client. Note that freshness of the request is not considered within this method.

source
PeaceFounder.Model.isbindingMethod
isbinding(metadata::Vector{UInt8}, ticketid::TicketID, salt::Vector{UInt8}, auth_code::Digest, hmac::HMAC)

Check whether a reply for a new ticketid is authorized by the recruit server.

source
PeaceFounder.Model.selectMethod
select(Admission, ticketid::TicketID, recruiter::TokenRecruiter)::Union{Admission, Nothing}

Return admission for a ticket with given a given identity pseudonym from recruiter. If no ticket with given id is found OR ticket is not yet admitted returns nothing.

source
PeaceFounder.Model.selectMethod
select(Admission, ticketid::TicketID, recruiter::TokenRecruiter)::Union{Admission, Nothing}

Return admission for a ticket with given ticketid from recruiter. If no ticket with given ticketid is found OR ticket is not yet admitted returns nothing.

source
PeaceFounder.Model.selectMethod
select(T, predicate::Function, recruiter::TokenRecruiter)::Union{T, Nothing}

From a list of all recruiter tickets return T <: Union{Ticket, Admission} for which predicate is true. If none succeds returns nothing.

source
PeaceFounder.Model.set_metadata!Method
set_metadata!(recruiter::TokenRecruiter, metadata::Vector{UInt8})

Replace metadata for a recruiter. Note when data is replaced all unfinalized tokens need to be flushed.

source
PeaceFounder.Model.ticket_statusMethod
ticket_status(ticketid::TicketID, recruiter::TokenRecruiter)::Union{TicketStatus, Nothing}

Return a ticket status for a ticketid. In case ticket is not found return nothing.

source
PeaceFounder.Model.tokenMethod
token(ticketid::TicketID, salt::Vector{UInt8}, hmac::HMAC)

Compute a recruit token for a given ticket with provided salt.

source

BraidChain

PeaceFounder.Model.BraidChainType
struct BraidChain
    members::Set{Pseudonym}
    ledger::Vector{Transaction}
    spec::DemeSpec
    generator::Generator
    tree::HistoryTree
    commit::Union{Commit{ChainState}, Nothing}
end

Represents a braidchain ledger with it's associated state. Can be instantitated with a demespec file using BraidChain(::DemeSpec) method.

Interface: push!, record!, state, length, list, select, roll, constituents, generator, commit, commit_index, ledger, leaf, root, ack_leaf, ack_root, members, commit!

source
PeaceFounder.Model.DemeSpecType
struct DemeSpec <: Transaction
    uuid::UUID
    title::String
    crypto::CryptoSpec
    guardian::Pseudonym
    recorder::Pseudonym
    recruiter::Pseudonym
    braider::Pseudonym
    proposer::Pseudonym 
    collector::Pseudonym
    timestamp::Union{DateTime, Nothing} = nothing
    signature::Union{Signature, Nothing} = nothing
end

Represents a deme configuration parameters issued by the guardian.

  • uuid::UUID an unique random generated community identifier;
  • title::String a community name with which deme is represented;
  • crypto::CryptoSpec cryptographic parameters for the deme;
  • guardian::Pseudonym an issuer for this demespec file. Has authorithy to set a roster:
    • recorder::Pseudonym an authorithy which has rights to add new transactions and is responsable for braidchain's ledger integrity. Issues Commit{ChainState};
    • recruiter::Pseudonym an authorithy which has rights to authorize new admissions to the deme. See Admission and Member;
    • braider::Pseudonym an authorithy which can do a legitimate braid jobs for other demes. See BraidWork;
    • proposer::Pseudonym an authorithy which has rights to issue a proposals for the braidchain. See Proposal;
    • collector::Pseudonym an authorithy which is repsonsable for collecting votes for proposals. This is also recorded in the proposal itself.
  • timestamp::Union{DateTime, Nothing} time when signature is being issued;
  • signature::Union{Signature, Nothing} a guardian issued signature.
source
PeaceFounder.Model.MemberType
struct Member <: Transaction
    admission::Admission
    generator::Generator
    pseudonym::Pseudonym
    approval::Union{Signature, Nothing} 
end

A new member certificate which rolls in (anouances) it's pseudonym at current generator signed with identity pseudonym certified with admission certificate issued by registrar. This two step process is necessary as a checkpoint in situations when braidchain ledger get's locked during a new member resgistration procedure.

source
Base.push!Method
push!(ledger::BraidChain, t::Transaction)

Add an element to the BraidChain bypassing transaction verification with the chain. This should only be used when the ledger is loaded from a trusted source like a local disk or when final root hash is validated with a trusted source.

source
HistoryTrees.leafMethod
leaf(ledger::BraidChain, N::Int)::Digest

Return a ledger's element digest at given index.

source
HistoryTrees.rootMethod
root(ledger::BraidChain[, N::Int])::Digest

Return a ledger root digest. In case when index is not given a current index is used.

source
PeaceFounder.Model.ack_leafMethod
ack_leaf(ledger::BraidChain, index::Int)::AckInclusion

Return a proof for record inclusion with respect to a current braidchain ledger history tree root.

source
PeaceFounder.Model.ack_rootMethod
ack_root(ledger::BraidChain, index::Int)

Return a proof for the ledger root at given index with respect to the current braidchain ledger history tree root.

source
PeaceFounder.Model.commit!Method
commit!(ledger::BraidChain, signer::Signer)

Commit a current braidchain ledger state with a signer's issued cryptographic signature.

source
PeaceFounder.Model.generatorMethod
generator(ledger[, index])

Return a generator at braidchain ledger row index. If index is omitted return the current state value.

source
PeaceFounder.Model.isbindingMethod
isbinding(record::Transaction, ack::AckInclusion{ChainState}, crypto::CryptoSpec)

A generic method checking whether transaction is included in the braidchain.

source
PeaceFounder.Model.listMethod
list(T, ledger::BraidChain)::Vector{Tuple{Int, T}}

List braidchain elements with a given type together with their index.

source
PeaceFounder.Model.membersMethod
members(ledger::BraidChain[, index::Int])::Set{Pseudonym}

Return a set of member pseudonyms at relative generator at braidchain ledger row index. If index is omitted return a current state value.

source
PeaceFounder.Model.selectMethod
select(T, predicate::Function, ledger::BraidChain)::Union{T, Nothing}

Return a first element from a ledger with a type T which satisfies a predicate.

source
PeaceFounder.Model.BraidWorkType
struct BraidWork <: Transaction
    braid::Simulator
    consumer::DemeSpec
    producer::DemeSpec
    approval::Union{Seal, Nothing}
end

Represents a braider's computation which is supported with zero knowledge proof of shuffle and decryption assuring it's corectness stored in a braid field; consumer denotes a deme for which the braid is intended and producer denotes a deme where the braid is made. To assert latter the the braider signs the braidwork and stores that in the aproval field. See a braid method.

Interface: approve, verify, input_generator, input_members, output_generator, output_members

source
PeaceFounder.Model.approveMethod
approve(braid::BraidWork, braider::Signer)

Sign a braidwork with a braider. Throws an error if braider is not in the producer demespec.

source
PeaceFounder.Model.braidMethod
braid(generator::Generator, members::Union{Vector{Pseudonym}, Set{Pseudonym}}, consumer::DemeSpec, producer::DemeSpec; verifier = (g) -> ProtocolSpec(; g))

Selects a private exponent x at random and computes a new generator $g' = g^x$ and $member_i'=member_i^x$ returns the latter in a sorted order and provides a zero knowledge proof that all operations have been performed honestly. In partucular, not including/droping new member pseudonyms in the process. consumer attributes are necessary to interepret generator and pseudonym group elements with which the computation is performed.

By default a Verificatum compatable verifier is used for performing reencryption proof of shuffle

A verifier can be configured with a keyword argument. By default a Verificatum compatable verifier for a proof of shuffle is used.

source
PeaceFounder.Model.verifyMethod
verify(braid::BraidWork, crypto::CryptoSpec)

Verifies a braid approval and then it's zero knowledge proofs. A crypto argument is provided to avoid downgrading attacks.

source

Ballot Box

PeaceFounder.Model.BallotBoxType
mutable struct BallotBox
    proposal::Proposal
    voters::Set{Pseudonym} # better than members
    collector::Pseudonym
    seed::Union{Digest, Nothing}
    crypto::CryptoSpec # on the other hand the inclusion of a vote should be binding enough as it includes proposal hash.
    queue::Vector{Vote}
    ledger::Vector{CastRecord}
    tree::HistoryTree
    commit::Union{Commit{BallotBoxState}, Nothing}
end

Represents a ballot box for a proposal. Contains proposal, a set of eligiable voters a collector who collects the votes and a seed which is selected at random when the voting starts. queue contains a list of valid votes which yet to be comitted to a ledger. A history tree is built on leafs of ledger's receipts (see a receipt method). A commit contains a collector seal on the current ballotbox state.

Interface: reset_tree!, generator, uuid, members, ledger, spine, index, seed, leaf, root, record, receipt, commit, tally, set_seed!, ack_leaf, ack_root, ack_cast, commit_index, commit_state, push!, state, validate, record!, commit!

source
PeaceFounder.Model.BallotBoxStateType
struct BallotBoxState
    proposal::Digest
    seed::Digest
    index::Int
    root::Digest
    tally::Union{Nothing, Tally} 
    view::Union{Nothing, BitVector} # 
end

Represents a public ballot box state. Contains an immutable proposal and seed digest; a current ledger index, history tree root. When ellections end a tally is included in the state and a view is added listing all counted votes. Note that the view attribute is important for a client to know whether it's key have leaked and somone lese havbe superseeded it's vote by revoting.

source
PeaceFounder.Model.CastAckType
struct CastAck
    receipt::CastReceipt
    ack::AckInclusion{BallotBoxState}
end

Represents a reply to a voter when a vote have been included in the ballotbox ledger. Contains a receipt and inlcusion acknowledgment. In future would also include a blind signature in the reply for a proof of participation. To receive this reply (with a blind signature in the future) a voter needs to send a vote which is concealed during ellections and thus tagging votes with blind signatures from reply to monitor revoting would be as hard as monitoring the submitted votes.

source
PeaceFounder.Model.CastReceiptType
struct CastReceipt
    vote::Digest
    timestamp::DateTime
end

Represents a ballotbox ledger receipt which is hashed for a history tree. It's sole purpose is to assure voters that their vote is included in the ledger while also adding additional metadata as timestamp and. In contrast to CastRecord it does not reveal how voter have voted thus can be published during ellections without violating fairness property. For some situations it may be useful to extend the time until the votes are published as that can disincentivice coercers and bribers as they would not know whether their coerced vote have been superseeded in revoting. See receipt method for it's construction from a CastRecord.

Note that a blind signature could be commited as H(signature|H(vote)) to avoid tagging the use of pseudonym during ellections while collector could issue only a one blind signature for a voter. Note that members whoose private key could have been stolen could not obtain a valid signature for participation and that could be a good thing!

source
PeaceFounder.Model.CastRecordType
struct CastRecord
    vote::Vote
    timestamp::DateTime
end

Represents a ballotbox ledger record. Adds a timestamp when the vote have been recorded. In future, the record will also contain a blind signature with which members could prove to everyone that they had cast their vote without revealing the link to the vote.

source
PeaceFounder.Model.ProposalType
struct Proposal <: Transaction 
    uuid::UUID
    summary::String
    description::String
    ballot::Ballot
    open::DateTime
    closed::DateTime
    collector::Union{Pseudonym, Nothing} # 
    anchor::Union{ChainState, Nothing}
    approval::Union{Seal, Nothing} 
end

Represents a proposal for a ballot specyfing voting window, unique identifier, summary, description. Set's the collector identity which collects votes and issues vote inclusion receipts and is responsable for maintaining the ledger's integrity. The proposal also includes an anchor which sets a relative generator with which members vote anonymously. To be considered valid is signed by proposer authorizing vote to take place.

source
PeaceFounder.Model.TallyType
struct Tally
    data::Vector{Int}
end

Represent a tally for Ballot form obtained aftert counting multiple voter's Selection forms.

source
PeaceFounder.Model.VoteType
struct Vote
    proposal::Digest
    seed::Digest
    selection::Selection
    seq::Int
    approval::Union{Seal, Nothing} 
end

Represents a vote for a proposal issued by a member. The proposal is stored as hash digest ensuring that member have voted on an untampered proposal. seed contains a randon string issued by collector at the moment when a vote starts to eliminate early voting / shortening a time at which coercers could act uppon. selection contians voter's preference;

seq is a serquence number counting a number of votes at which vote have been approved for a given proposal. It starts at 1 and is increased by one for every single signature made on the proposal. This is an important measure which allows to detect possible leakage of a member's private key. Also provides means for revoting ensuring that latest vote get's counted.

The vote is considered valid when it is sealed by a member's private key at a relative generator stored in the proposal.

source
Base.lengthMethod
length(ledger::BallotBox)

Return a total length of the ledger including uncommited records in the queue.

source
Base.push!Method
push!(ledger::BallotBox, record::CastRecord)

Push a record to the ledger bypassing integrity checks. Used when loading the ledger from a trusted source such as local disk or an archive with a signed root cheksum.

source
HistoryTrees.leafMethod
leaf(ledger::BallotBox, N::Int)::Digest

Return a record digest used to form a history tree.

source
HistoryTrees.rootMethod
root(ledger::BallotBox[, N::Int])::Digest

Calculate a root for history tree at given index N. If index is not specified returns the current value.

source
HistoryTrees.rootMethod
root(state::BallotBoxState)

Return a history tree root for a current ballotbox ledger state.

source
PeaceFounder.Model.ack_castMethod
ack_cast(station::PollingStation, uuid::UUID, N::Int)::CastAck

Return inclusion proof with receipt and current tree commit for a leaf at index N and ballotbox with uuid.

source
PeaceFounder.Model.ack_leafMethod
ack_leaf(ledger::BallotBox, index::Int)::AckInclusion

Compute an inclusion proof ::AckInclusion for record element at given index.

source
PeaceFounder.Model.ack_leafMethod
ack_leaf(station::PollingStation, uuid::UUID, N::Int)::AckInclusion

Return history tree inclusion proof for a tree leaf at index N in ballotbox with uuid.

source
PeaceFounder.Model.ack_rootMethod
ack_root(station::PollingStation, uuid::UUID, N::Int)::AckConsistency

Return history tree consitency proof tree root at index N in ballotbox with uuid.

source
PeaceFounder.Model.add!Method
add!(station::PollingStation, proposal::Proposal, voters::Set{Pseudonym}[, collector::Pseudonym])

Creates a new ballotbox for given proposal with provided member pseudonyms at a relative generator anchored in the proposal. A collector is optional and provided only when it differs from one specified in the proposal.

source
PeaceFounder.Model.ballotboxMethod
ballotbox(station::PollingStation, uuid::UUID)::BallotBox

Return a ballotbox ledger with a provided UUID. If none is found throws an error.

source
PeaceFounder.Model.commit!Method
commit!(ledger::BallotBox[, timestamp::DataTime], signer::Signer; with_tally=nothing)

Flushes ballotbox ledger's queue and creates a commit for a current ballotbox ledger state with provided timestamp and signer. A keyword argument with_tally has three values true|false to include or exclude a tally from a commited state and nothing which uses a previous commit preference.

source
PeaceFounder.Model.commit!Method
commit!(station::PollingStation, uuid::UUID, collector::Signer; with_tally = nothing)

Select a ballotbox with provided uuid and commit it's state with collector.

source
PeaceFounder.Model.isbindingMethod
isbinding(ack::CastAck, proposal::Proposal, hasher::Hash)::Bool

Check that acknowledgment is legitimate meaning that it is issued by a collector listed in the proposal.

source
PeaceFounder.Model.isbindingMethod
isbinding(receipt::CastReceipt, ack::AckInclusion, hasher::Hash)::Bool

Check that cast receipt is binding to received inclusion acknowledgment.

source
PeaceFounder.Model.isconsistentMethod
isconsistent(selection::Selection, ballot::Ballot)

Verifies that voter's selection is consistent with ballot form. For instance, whether selection is withing the range of ballot options.

source
PeaceFounder.Model.ledgerMethod
ledger(station::PollingStation, uuid::UUID)::Vector{CastRecord}

Return a vector of records from a ballotbox with uuid.

source
PeaceFounder.Model.receiptMethod
receipt(record::CastRecord, hasher::Hash)::CastReceipt

Construct a CastReceipt from a CastRecord with a provided hasher function.

source
PeaceFounder.Model.receiptMethod
receipt(station::PollingStation, uuid::UUID, N::Int)::CastReceipt

Return a receipt for a record with index N at ballotbox with uuid.

source
PeaceFounder.Model.record!Method
record!(ledger::BallotBox, record::CastRecord)

Check the vote in the record for validity and include that in the ledger directly bypassing queue. This method is useful for replaying and debugging ballotbox ledger state changes. See also record!

source
PeaceFounder.Model.record!Method
record!(ledger::BallotBox, vote::Vote)

Check the vote for validity and pushes it to the queue. Returns an index N at which the vote will be recorded in the ledger. See also push!

source
PeaceFounder.Model.record!Method
record!(station::PollingStation, uuid::UUID, vote::Vote)::Int

Records a vote in a ballotbox with provided proposal UUID. Throws an error if a ballotbox can't be found.

source
PeaceFounder.Model.record!Method
record!(station::PollingStation, uuid::UUID, vote::Vote)::Int

Record a vote in a ballotbox found by proposal diggest stored in the vote. Throws an error if a ballotbox can't be found.

source
PeaceFounder.Model.recordMethod
record(station::PollingStation, uuid::UUID, N::Int)::CastRecord

Return a record with an index N at ballotbox with uuid.

source
PeaceFounder.Model.reset_tree!Method
reset_tree!(ledger::BallotBox)

Recompute history tree root and cache from the elements in the ledger. This is a useful for loading the ledger all at once.

source
PeaceFounder.Model.spineMethod
spine(station::PollingStation, uuid::UUID)::Vector{Digest}

Return a leaf vector for a ballotbox with proposal uuid.

source
PeaceFounder.Model.stateMethod
state(ledger::BallotBox; with_tally::Union{Nothing, Bool} = nothing)::BallotBoxState

Return a state metadata for ballotbox ledger.

source
PeaceFounder.Model.stateMethod
state(proposal::Proposal)::ChainState

A braidchain ledger state which is used to anchor a relative generator for members.

source
PeaceFounder.Model.tallyMethod
tally(ballot::Ballot, ballots::AbstractVector{Selection})::Tally

Count ballots, check that they are filled consistently and return a final tally.

source
PeaceFounder.Model.uuidMethod
uuid(proposal::Proposal)::UUID

UUID for a proposal. Issued by proposer and it's purpose is to croslink to an external system durring the proposal dreafting stage.

source
PeaceFounder.Model.validateMethod
validate(ledger::BallotBox, vote::Vote)

Check that vote can be included in the ballotbox. Is well formed, signed by a member pseudonym and cryptographic signature is valid. Raises error if either of checks fail.

source
PeaceFounder.Model.voteMethod
vote(proposal::Proposal, seed::Digest, selection::Selection, member::Signer; seq = 1)

Issue a vote on a proposal and provided collector seed for a member's selection.

source