PeaceFounder.Core.Model
Primitives
PeaceFounder.Core.Model.Commit — TypeCommit{T}
state::T
seal::Seal
endRepresents a commited ledger state to which issuer can be held accountable for integrity. It is assumed that T implements index and root necessaary to fix a ledger state.
PeaceFounder.Core.Model.CryptoSpec — Typestruct CryptoSpec
hasher::HashSpec
group::GroupSpec
generator::Generator
endSpecification of cryptographic parameters which are used for public key cryptography, message hashing and authetification codes.
PeaceFounder.Core.Model.Digest — Typestruct Digest
data::Vector{UInt8}
endA message digest obtained applying a hash function on a message or a document. See method digest.
PeaceFounder.Core.Model.Generator — Typestruct Generator
data::Vector{UInt8}
endDatatype which stores cryptogrpahic group point in standart octet form intended to be used as a base. See also Pseudonym.
PeaceFounder.Core.Model.HMAC — Typestruct HMAC
key::Vector{UInt8}
hasher::HashSpec
endRepresent a hash message authetification code authorizer.
PeaceFounder.Core.Model.Pseudonym — Typestruct Pseudonym
pk::Vector{UInt8}
endA datatype which stores public key in canonical standart octet form.
PeaceFounder.Core.Model.Seal — Typestruct Seal
pbkey::Pseudonym
sig::Signature
endA wrapper type for a signature which adds a public key of signature issuer. See seal method.
PeaceFounder.Core.Model.Signer — Typestruct Signer
spec::CryptoSpec
pbkey::Pseudonym
key::BigInt
endA signer type. See a method generate(Signer, spec) for initialization.
Interface: pseudonym, id, sign, seal, approve
HistoryTrees.root — Methodroot(x)::DigestReturn a ledger root hash.
PeaceFounder.Core.Model.digest — Methoddigest(message::Vector{UInt8}, hasher::HashSpec)::Digest
digest(document, spec) = digest(canonicalize(message)::Vector{UInt8}, hasher(spec)::HashSpec)Return a resulting digest applying hasher on the given message. When message is not octet string a canonicalize method is applied first.
PeaceFounder.Core.Model.digest — Methoddigest(bytes::Vector{UInt8}, hasher::HashSpec)::Digest
digest(x, spec) = digest(canonicalize(x)::Vector{UInt8}, hasher(spec)::HashSpec)Compute a hash digest. When input is not in bytes the canonicalize method is applied first.
PeaceFounder.Core.Model.generate — Methodgenerate(Signer, spec::CryptoSpec)::SignerGenerate a unique private key and return a Signer object.
PeaceFounder.Core.Model.generator — Methodgenerator(crypto::CryptoSpec)::GeneratorReturn a generator of the specification.
PeaceFounder.Core.Model.generator — Methodgenerator(spec::Spec)::GeneratorReturn a generator of spec.
PeaceFounder.Core.Model.hasher — Methodhasher(spec)::HashSpecAccess a hasher function from a given specification.
PeaceFounder.Core.Model.index — Methodindex(x)::IntReturn an index of a ledger state.
PeaceFounder.Core.Model.issuer — Methodissuer(x)In case an object x is cryptographically signed return an issuer of who have issued the signature. See also id.
PeaceFounder.Core.Model.key — Methodkey(x)Access a secret key of an object x.
PeaceFounder.Core.Model.seal — Methodseal(message::Vector{UInt8}[, generator::Generator], signer::Signer)::SealSign 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.
PeaceFounder.Core.Model.sign — Methodsign(digest::Digest[, generator::Generator], signer::Signer)::SignatureSign 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.
PeaceFounder.Core.Model.sign — Methodsign(message::Vector{UInt8}[, generator::Generator], signer::Signer)::SignatureSign a bytestring message with signer's private key and specification. When generator is provided it is used as a base for the signature.
PeaceFounder.Core.Model.state — Methodstate(commit::Commit{T})::TReturn a ledger state. T implements index and root.
PeaceFounder.Core.Model.canonicalize — FunctionToDo: 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.
PeaceFounder.Core.Model.pseudonym — Functionpseudonym(signer::Signer, [generator])::PseudonymReturn a pseudonym of a signer at a given relative generator. If generator is not passed returns identity pseudonym. (See also id)
pseudonym(seal::Seal)::PseudonymReturn 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)::PseudonymReturn a pseudonym used to seal the vote.
PeaceFounder.Core.Model.id — Functionid(document)::PseudonymReturn identity pseudonym of a document issuer.
id(signer)::PseudonymReturn identity pseudonym of a signer.
PeaceFounder.Core.Model.verify — Functionverify(message, seal::Seal, [generator::Generator], crypto::CryptoSpec)::Bool
verify(message, pk::Pseudonym, sig::Signature, [generator::Generator], crypto::CryptoSpec)::BoolVerify 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)::BoolVerify a cryptographic signature of the document returning true if valid.
verify(braidwork::BraidReceipt, crypto::CryptoSpec)::BoolVerify a braider issued cryptographic signature for the braidwork and a zero knowledge proofs. Returns true if both checks succeed.
BraidChain
PeaceFounder.Core.Model.Admission — Typestruct Admission
ticketid::TicketID
id::Pseudonym
timestamp::DateTime
approval::Union{Seal, Nothing}
endRepresents an admission certificate for a pseudonym id.
PeaceFounder.Core.Model.ChainState — Typestruct ChainState
index::Int
root::Digest
generator::Generator
member_count::Int
termination_bitmask::BitMask
endRepresents a chain state metadata which is sufficient for integrity checks.
PeaceFounder.Core.Model.DemeSpec — Typestruct DemeSpec <: Transaction
uuid::UUID
title::String
crypto::CryptoSpec
guardian::Pseudonym
recorder::Pseudonym
registrar::Pseudonym
braider::Pseudonym
proposer::Pseudonym
collector::Pseudonym
timestamp::Union{DateTime, Nothing} = nothing
signature::Union{Signature, Nothing} = nothing
endRepresents a deme configuration parameters issued by the guardian.
uuid::UUIDan unique random generated community identifier;title::Stringa community name with which deme is represented;crypto::CryptoSpeccryptographic parameters for the deme;guardian::Pseudonyman issuer for this demespec file. Has authorithy to set a roster:recorder::Pseudonyman authorithy which has rights to add new transactions and is responsable for braidchain's ledger integrity. IssuesCommit{ChainState};registrar::Pseudonyman authorithy which has rights to authorize new admissions to the deme. SeeAdmissionandMembership;braider::Pseudonyman authorithy which can do a legitimate braid jobs for other demes. SeeBraidReceipt;proposer::Pseudonyman authorithy which has rights to issue a proposals for the braidchain. SeeProposal;collector::Pseudonyman 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.
PeaceFounder.Core.Model.Membership — Typestruct Membership <: Transaction
admission::Admission
generator::Generator
pseudonym::Pseudonym
approval::Union{Signature, Nothing}
endA 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.
PeaceFounder.Core.Model.TicketID — Typestruct TicketID
id::Vector{UInt8}
endRepresents 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.
PeaceFounder.Core.Model.Transaction — TypeTransactionRepresents an abstract record type which can be stored in the braidchain ledger.
PeaceFounder.Core.Model.approve — Methodapprove(x::T, signer::Signer)::TCryptographically sign a document x::T and returns a signed document with the same type. To check whether a document is signed see issuer method.
PeaceFounder.Core.Model.generator — Methodgenerator(member::Membership)::GeneratorGenerator at which member tries to roll in the braidchain.
PeaceFounder.Core.Model.id — Methodid(member::Membership)::PseudonymIdentity pseudonym for a member.
PeaceFounder.Core.Model.isbinding — Methodisbinding(admission::Admission, spec::DemeSpec)Check whether issuer of admission is a registrar set in spec.
PeaceFounder.Core.Model.issuer — Methodissuer(member::Membership)::PseudonymThe identiy of registrar who signed admission.
PeaceFounder.Core.Model.members — Methodmembers(ledger::BraidChainLedger[, 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.
PeaceFounder.Core.Model.pseudonym — Methodpseudonym(member::Membership)::PseudonymPseudonym for a member at the generator(member).
PeaceFounder.Core.Model.ticket — Methodticket(x::Admission)Return a TicketID which is admitted.
PeaceFounder.Core.Model.ticket — Methodticket(member::Membership)Ticket for a member admission certificate.
PeaceFounder.Core.Model.BraidReceipt — Typestruct BraidReceipt <: Transaction
braid::Simulator
reset::Bool
producer::DemeSpec
approval::Union{Seal, Nothing}
endRepresents a braider's computation which is supported with zero knowledge proof of shuffle and decryption assuring it's corectness stored in a braid field; 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
PeaceFounder.Core.Model.approve — Methodapprove(braid::BraidReceipt, spec::DemeSpec, braider::Signer)Sign a braidwork with a braider. Throws an error if braider is not in the producer demespec.
PeaceFounder.Core.Model.braid — Methodbraid(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.
PeaceFounder.Core.Model.input_generator — Methodinput_generator(braid::BraidReceipt)Return input generator of the braid.
PeaceFounder.Core.Model.input_members — Methodinput_members(braid::BraidReceipt)Return input member pseudonyms of the braid at provided input generator. See input_generator
PeaceFounder.Core.Model.output_generator — Methodoutput_generator(braid::BraidReceipt)Return output genertor of the braid.
PeaceFounder.Core.Model.output_members — Methodoutput_members(braid::BraidReceipt)Return output member pseudonyms of the braid at a resulting output generator. See output_generator
PeaceFounder.Core.Model.verify — Methodverify(braid::BraidReceipt, crypto::CryptoSpec)Verifies a braid approval and then it's zero knowledge proofs. A crypto argument is provided to avoid downgrading attacks.
Ballot Box
PeaceFounder.Core.Model.Ballot — Typestruct Ballot
options::Vector{String}
endRepresents a simple ballot form for multiple choice question.
PeaceFounder.Core.Model.BallotBoxState — Typestruct BallotBoxState
proposal::Digest
seed::Digest
index::Int
root::Digest
tally::Union{Nothing, Tally}
view::Union{Nothing, BitVector} #
endRepresents 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.
PeaceFounder.Core.Model.CastReceipt — Typestruct CastReceipt
vote::Digest
timestamp::DateTime
endRepresents 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!
PeaceFounder.Core.Model.CastRecord — Typestruct CastRecord
vote::Vote
timestamp::DateTime
endRepresents 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.
PeaceFounder.Core.Model.Proposal — Typestruct 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}
endRepresents 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.
PeaceFounder.Core.Model.Selection — Typestruct Selection
option::Int
endRepresents voter's selection for a Ballot form.
PeaceFounder.Core.Model.Tally — Typestruct Tally
data::Vector{Int}
endRepresent a tally for Ballot form obtained aftert counting multiple voter's Selection forms.
PeaceFounder.Core.Model.Vote — Typestruct Vote
proposal::Digest
seed::Digest
selection::Selection
seq::Int
approval::Union{Seal, Nothing}
endRepresents 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.
HistoryTrees.root — Methodroot(state::BallotBoxState)Return a history tree root for a current ballotbox ledger state.
PeaceFounder.Core.Model.generator — Methodgenerator(proposal::Proposal)A relative generator for at which memebers sign votes for this proposal.
PeaceFounder.Core.Model.index — Methodindex(state::BallotBoxState)Return an index for a current ballotbox ledger state.
PeaceFounder.Core.Model.isbinding — Methodisbinding(receipt::CastReceipt, vote::Vote, hasher::HashSpec)::BoolCheck that the receipt is bidning to a vote.
PeaceFounder.Core.Model.isbinding — Methodisbinding(vote::Vote, proposal::Proposal, crypto::HashSpec)Check that the vote is bound to a proposal..
PeaceFounder.Core.Model.isconsistent — Methodisconsistent(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.
PeaceFounder.Core.Model.issuer — Methodissuer(proposal::Proposal)Issuer of approval for the proposal.
PeaceFounder.Core.Model.pseudonym — Methodpseudonym(vote::Vote)::Union{Pseudonym, Nothing}Return a pseudonym with which vote is sealed.
PeaceFounder.Core.Model.receipt — Methodreceipt(record::CastRecord, hasher::HashSpec)::CastReceiptConstruct a CastReceipt from a CastRecord with a provided hasher function.
PeaceFounder.Core.Model.state — Functionstate(ledger::BallotBoxLedger; seed::Digest, root::Digest = root(ledger), with_tally::Union{Nothing, Bool} = nothing)::BallotBoxStateReturn a state metadata for ballotbox ledger.
PeaceFounder.Core.Model.state — Methodstate(proposal::Proposal)::ChainStateA braidchain ledger state which is used to anchor a relative generator for members.
PeaceFounder.Core.Model.tally — Functiontally(ledger::BallotBox)Compute a tally for a ballotbox ledger.
PeaceFounder.Core.Model.tally — Methodtally(ballot::Ballot, ballots::AbstractVector{Selection})::TallyCount ballots, check that they are filled consistently and return a final tally.
PeaceFounder.Core.Model.uuid — Methoduuid(proposal::Proposal)::UUIDUUID for a proposal. Issued by proposer and it's purpose is to croslink to an external system durring the proposal dreafting stage.
PeaceFounder.Core.Model.vote — Methodvote(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.
Auditing
PeaceFounder.Core.ProtocolSchema
PeaceFounder.Core.ProtocolSchema.AckConsistency — Typestruct AckConsistency{T}
proof::ConsistencyProof
commit::Commit{T}
endRepresents 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.
PeaceFounder.Core.ProtocolSchema.AckInclusion — Typestruct AckInclusion{T}
proof::InclusionProof
commit::Commit{T}
endRepresents 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.
PeaceFounder.Core.ProtocolSchema.CastAck — Typestruct CastAck
receipt::CastReceipt
ack::AckInclusion{BallotBoxState}
endRepresents 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.
PeaceFounder.Core.ProtocolSchema.TicketStatus — Typestruct TicketStatus ticketid::TicketID timestamp::DateTime admission::Union{Nothing, Admission} end
Represents a public state of a ticket. See isadmitted method.
HistoryTrees.leaf — Methodleaf(ack::AckInclusion)Access a leaf diggest for which the acknowledgment is made.
HistoryTrees.root — Methodroot(x::AckConsistency)Access a root diggest for which the acknowledgment is made.
PeaceFounder.Core.Model.commit — Methodcommit(x)Access a commit of an object x.
PeaceFounder.Core.Model.commit — Methodcommit(ack::CastAck)Return a commit from a CastAck.
PeaceFounder.Core.Model.index — Methodindex(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)).
PeaceFounder.Core.Model.index — Methodindex(ack::AckInclusion)::IntReturn an index at which the leaf is recorded in the ledger. To obtain the current ledger index use index(commit(ack)).
PeaceFounder.Core.Model.isbinding — Methodisbinding(receipt::CastReceipt, ack::AckInclusion, hasher::HashSpec)::BoolCheck that cast receipt is binding to received inclusion acknowledgment.
PeaceFounder.Core.Model.isbinding — Methodisbinding(record::Transaction, ack::AckInclusion{ChainState}, crypto::CryptoSpec)A generic method checking whether transaction is included in the braidchain.
PeaceFounder.Core.Model.isbinding — Methodisbinding(ack::CastAck, proposal::Proposal, hasher::HashSpec)::BoolCheck that acknowledgment is legitimate meaning that it is issued by a collector listed in the proposal.
PeaceFounder.Core.Model.verify — Methodverify(ack::CastAck, crypto::CryptoSpec)::BoolVerify the cast acknowledgment cryptographic signature.
PeaceFounder.Core.ProtocolSchema.isadmitted — Methodisadmitted(status::TicketStatus)Check whether ticket is addmitted.