Import
Initialization
assertVotingManifest), resolves runtime signals, and returns a client instance. Throws if contract_version !== "shyvoting-v1" or required fields are missing.
Read methods
Ballot build and submit
buildBallot(args)
Constructs a transaction envelope without submitting.
txJson is a JSON-serialized TxTypeBallotCast (type 2) payload ready for submitBallot. ballotNonce is the 32-byte random hex that the caller must retain as the private receipt — it is the only value that enables post-close self-verification. ballotId = H(ballotNonce) is the direction-free public identifier.
submitBallot(txJson)
{api.base_url}/ballots. Returns the server response.
castBallot(args) — combined
buildBallot + submitBallot + receipt persistence in one call. If a managed receipt store is configured and posture is recoverable, saves the private receipt automatically.
Receipt methods
verifyReceipt recomputes ballotId = H(hexNonce) and scans the public votes list for a matching record. It does not contact the server — the full vote list is the only dependency.
Posture
"write_only", castBallot suppresses receipt persistence and returns only { ballotId } — no nonce, no choice, no linkage material retained on device.
Voting methods
| Voting method | choices format |
|---|---|
yes_no | ["yes"] or ["no"] |
plurality | ["option_id"] |
approval | ["opt_a", "opt_b"] |
ranked_choice | ["first", "second", "third"] in preference order |
Write-only posture in hostile jurisdictions
ForSEDA_HAQQ and other coercion-resistant deployments, set default_posture: "coercion_resistant" and all three write_only_on_* fallbacks to true. After castBallot returns in write-only mode:
- device retains only
ballotId(publicly visible on-chain, direction-free) - no
ballotNoncestored - no
encSecretstored - a party seizing the device cannot derive vote direction