From 30f8e8346ed3328f2abb50864a66d02db7c37b19 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Wed, 27 Mar 2024 22:00:03 +0000 Subject: [PATCH] deploy: 4a0809696f013566503a5da0e94f20649b1ff172 --- 404.html | 4 ++-- assets/js/404eb028.16e71fec.js | 1 - assets/js/404eb028.b6323f6a.js | 1 + .../{46b36dc0.7cf4efeb.js => 46b36dc0.080e3f08.js} | 2 +- assets/js/4f32f676.2033f24f.js | 1 - assets/js/4f32f676.5a88cbbe.js | 1 + assets/js/54bc495f.19b764ac.js | 1 - assets/js/54bc495f.261c6427.js | 1 + assets/js/78bbaf06.d3323e91.js | 1 + assets/js/78bbaf06.e45630f7.js | 1 - ...e~main.1f79e99a.js => runtime~main.eebe15a9.js} | 2 +- index.html | 4 ++-- intro.html | 4 ++-- protocol.html | 4 ++-- protocol/anonymity.html | 4 ++-- protocol/anonymity/blind-signatures.html | 4 ++-- protocol/anonymity/on-chain.html | 4 ++-- protocol/anonymity/zk-census-proof.html | 4 ++-- protocol/ballot-protocol.html | 8 ++++---- protocol/census.html | 4 ++-- protocol/census/off-chain-csp.html | 4 ++-- protocol/census/off-chain-tree.html | 4 ++-- protocol/census/on-chain.html | 4 ++-- protocol/census/on-chain/census3.html | 4 ++-- protocol/data-schemes.html | 4 ++-- protocol/data-schemes/election.html | 4 ++-- protocol/data-schemes/organization.html | 4 ++-- protocol/data-schemes/vote.html | 4 ++-- sdk.html | 4 ++-- sdk/integration-details.html | 4 ++-- sdk/integration-details/census-types.html | 4 ++-- .../census-types/off-chain-csp.html | 4 ++-- .../census-types/off-chain-tree.html | 4 ++-- sdk/integration-details/census-types/on-chain.html | 4 ++-- .../census-types/on-chain/complex-census.html | 4 ++-- sdk/integration-details/vocdoni-tokens.html | 4 ++-- sdk/integration-details/voting-types.html | 14 +++----------- sdk/integration-details/voting-types/approval.html | 4 ++-- .../voting-types/quadratic.html | 11 +++-------- sdk/integration-details/voting-types/ranked.html | 4 ++-- .../voting-types/single-choice.html | 8 ++++---- sdk/integration-details/voting-types/weighted.html | 8 +++++--- sdk/reference/changelog.html | 4 ++-- sdk/reference/classes/Account.html | 4 ++-- sdk/reference/classes/AccountAPI.html | 4 ++-- sdk/reference/classes/AccountService.html | 4 ++-- sdk/reference/classes/AnonymousService.html | 4 ++-- sdk/reference/classes/AnonymousVote.html | 4 ++-- sdk/reference/classes/ApprovalElection.html | 4 ++-- sdk/reference/classes/ArchivedElection.html | 4 ++-- sdk/reference/classes/BudgetElection.html | 4 ++-- sdk/reference/classes/Census.html | 4 ++-- sdk/reference/classes/Census3CensusAPI.html | 4 ++-- sdk/reference/classes/Census3ServiceAPI.html | 4 ++-- sdk/reference/classes/Census3StrategyAPI.html | 4 ++-- sdk/reference/classes/Census3TokenAPI.html | 4 ++-- sdk/reference/classes/CensusAPI.html | 4 ++-- sdk/reference/classes/CensusService.html | 4 ++-- sdk/reference/classes/ChainAPI.html | 4 ++-- sdk/reference/classes/ChainService.html | 4 ++-- sdk/reference/classes/CspCensus.html | 4 ++-- sdk/reference/classes/CspService.html | 4 ++-- sdk/reference/classes/CspVote.html | 4 ++-- sdk/reference/classes/Election.html | 4 ++-- sdk/reference/classes/ElectionAPI.html | 4 ++-- sdk/reference/classes/ElectionService.html | 4 ++-- sdk/reference/classes/FaucetAPI.html | 4 ++-- sdk/reference/classes/FaucetService.html | 4 ++-- sdk/reference/classes/FileAPI.html | 4 ++-- sdk/reference/classes/FileService.html | 4 ++-- sdk/reference/classes/InvalidElection.html | 4 ++-- sdk/reference/classes/MultiChoiceElection.html | 4 ++-- sdk/reference/classes/OffchainCensus.html | 4 ++-- sdk/reference/classes/PlainCensus.html | 4 ++-- sdk/reference/classes/PublishedCensus.html | 4 ++-- sdk/reference/classes/PublishedElection.html | 4 ++-- sdk/reference/classes/Service.html | 4 ++-- sdk/reference/classes/TokenCensus.html | 4 ++-- sdk/reference/classes/UnpublishedElection.html | 4 ++-- sdk/reference/classes/VocdoniCensus3Client.html | 4 ++-- sdk/reference/classes/VocdoniSDKClient.html | 4 ++-- sdk/reference/classes/Vote.html | 4 ++-- sdk/reference/classes/VoteAPI.html | 4 ++-- sdk/reference/classes/VoteService.html | 4 ++-- sdk/reference/classes/WalletAPI.html | 4 ++-- sdk/reference/classes/WeightedCensus.html | 4 ++-- sdk/reference/enums/CensusOrigin.html | 4 ++-- sdk/reference/enums/CensusType.html | 4 ++-- sdk/reference/enums/CensusTypeEnum.html | 4 ++-- sdk/reference/enums/CspProofType.html | 4 ++-- sdk/reference/enums/ElectionCreationSteps.html | 4 ++-- sdk/reference/enums/ElectionResultsTypeNames.html | 4 ++-- sdk/reference/enums/ElectionStatus.html | 4 ++-- sdk/reference/enums/ElectionStatusReady.html | 4 ++-- sdk/reference/enums/EnvOptions.html | 4 ++-- sdk/reference/enums/TransactionType.html | 4 ++-- sdk/reference/enums/TxType.html | 4 ++-- sdk/reference/enums/VoteSteps.html | 4 ++-- sdk/reference/interfaces/AccountMetadata.html | 4 ++-- sdk/reference/interfaces/AdminTx.html | 4 ++-- sdk/reference/interfaces/CircuitInputs.html | 4 ++-- sdk/reference/interfaces/CollectFaucetTx.html | 4 ++-- sdk/reference/interfaces/ElectionMetadata.html | 4 ++-- .../interfaces/FetchElectionsParameters.html | 4 ++-- sdk/reference/interfaces/IAccount.html | 4 ++-- .../interfaces/IAccountTransfersCountResponse.html | 4 ++-- .../interfaces/IAccountsCountResponse.html | 4 ++-- .../interfaces/IAccountsListResponse.html | 4 ++-- .../interfaces/IApprovalElectionParameters.html | 4 ++-- .../interfaces/IBlockTransactionsResponse.html | 4 ++-- .../interfaces/IBudgetElectionParametersInfo.html | 4 ++-- .../IBudgetElectionParametersWithBudget.html | 4 ++-- .../IBudgetElectionParametersWithCensusWeight.html | 4 ++-- sdk/reference/interfaces/ICensus.html | 4 ++-- .../interfaces/ICensus3CensusListResponse.html | 4 ++-- .../interfaces/ICensus3CensusQueueResponse.html | 4 ++-- .../interfaces/ICensus3CensusResponse.html | 4 ++-- .../interfaces/ICensus3ServiceInfoResponse.html | 4 ++-- .../interfaces/ICensus3StrategiesListResponse.html | 4 ++-- .../ICensus3StrategiesListResponsePaginated.html | 4 ++-- .../interfaces/ICensus3StrategiesOperator.html | 4 ++-- .../ICensus3StrategiesOperatorsResponse.html | 4 ++-- .../interfaces/ICensus3StrategyCreateResponse.html | 4 ++-- .../ICensus3StrategyEstimationQueueResponse.html | 4 ++-- .../ICensus3StrategyHoldersResponse.html | 4 ++-- .../ICensus3StrategyHoldersResponsePaginated.html | 4 ++-- .../ICensus3StrategyImportQueueResponse.html | 4 ++-- .../interfaces/ICensus3StrategyToken.html | 4 ++-- .../interfaces/ICensus3SupportedChain.html | 4 ++-- .../interfaces/ICensus3TokenHolderResponse.html | 4 ++-- .../interfaces/ICensus3TokenListResponse.html | 4 ++-- .../ICensus3TokenListResponsePaginated.html | 4 ++-- .../interfaces/ICensus3TokenTypesResponse.html | 4 ++-- .../interfaces/ICensus3ValidatePredicateChild.html | 4 ++-- .../ICensus3ValidatePredicateResponse.html | 4 ++-- .../interfaces/ICensus3ValidatePredicateToken.html | 4 ++-- .../interfaces/ICensusExportResponse.html | 4 ++-- .../interfaces/ICensusImportResponse.html | 4 ++-- sdk/reference/interfaces/ICensusParticipant.html | 4 ++-- sdk/reference/interfaces/ICensusProofResponse.html | 4 ++-- .../interfaces/ICensusPublishResponse.html | 4 ++-- .../interfaces/IChainBlockInfoResponse.html | 4 ++-- .../interfaces/IChainGetCircuitResponse.html | 4 ++-- .../interfaces/IChainGetCostsResponse.html | 4 ++-- .../interfaces/IChainGetInfoResponse.html | 4 ++-- .../IChainOrganizationCountResponse.html | 4 ++-- .../interfaces/IChainOrganizationListResponse.html | 4 ++-- .../interfaces/IChainOrganizationResponse.html | 4 ++-- .../interfaces/IChainSubmitTxResponse.html | 4 ++-- .../interfaces/IChainTxCountResponse.html | 4 ++-- sdk/reference/interfaces/IChainTxListResponse.html | 4 ++-- sdk/reference/interfaces/IChainTxReference.html | 4 ++-- sdk/reference/interfaces/IChainValidator.html | 4 ++-- .../interfaces/IChainValidatorsListResponse.html | 4 ++-- sdk/reference/interfaces/IChoice.html | 4 ++-- .../interfaces/IElectionCreateResponse.html | 4 ++-- .../interfaces/IElectionInfoResponse.html | 4 ++-- .../interfaces/IElectionKeysResponse.html | 4 ++-- sdk/reference/interfaces/IElectionListFilter.html | 4 ++-- .../interfaces/IElectionListResponse.html | 4 ++-- sdk/reference/interfaces/IElectionMode.html | 4 ++-- .../interfaces/IElectionNextIdResponse.html | 4 ++-- sdk/reference/interfaces/IElectionParameters.html | 4 ++-- sdk/reference/interfaces/IElectionSummary.html | 4 ++-- sdk/reference/interfaces/IElectionType.html | 4 ++-- sdk/reference/interfaces/IElectionVote.html | 4 ++-- .../interfaces/IElectionVoteListResponse.html | 4 ++-- sdk/reference/interfaces/IEncryptionKey.html | 4 ++-- .../interfaces/IInvalidElectionParameters.html | 4 ++-- .../interfaces/IMultiChoiceElectionParameters.html | 4 ++-- .../interfaces/IPublishedElectionParameters.html | 4 ++-- sdk/reference/interfaces/IQuestion.html | 4 ++-- sdk/reference/interfaces/ITallyMode.html | 4 ++-- sdk/reference/interfaces/IVoteInfoResponse.html | 4 ++-- sdk/reference/interfaces/IVoteMode.html | 4 ++-- sdk/reference/interfaces/IVoteSubmitResponse.html | 4 ++-- sdk/reference/interfaces/IVoteType.html | 4 ++-- sdk/reference/interfaces/MintTokensTx.html | 4 ++-- sdk/reference/interfaces/NewProcessTx.html | 4 ++-- sdk/reference/interfaces/Process.html | 4 ++-- sdk/reference/interfaces/Proof.html | 4 ++-- sdk/reference/interfaces/RegisterKeyTx.html | 4 ++-- sdk/reference/interfaces/SendTokensTx.html | 4 ++-- sdk/reference/interfaces/ServiceProperties.html | 4 ++-- sdk/reference/interfaces/SetAccountTx.html | 4 ++-- sdk/reference/interfaces/SetProcessTx.html | 4 ++-- .../interfaces/SetTransactionCostsTx.html | 4 ++-- sdk/reference/interfaces/Tx.html | 4 ++-- sdk/reference/interfaces/VoteEnvelope.html | 4 ++-- sdk/reference/modules.html | 4 ++-- sdk/tutorial.html | 4 ++-- search.html | 4 ++-- ui-components.html | 4 ++-- ui-components/Election.html | 4 ++-- ui-components/Organization.html | 4 ++-- vocdoni-api/accounts.html | 4 ++-- vocdoni-api/add-account.html | 4 ++-- vocdoni-api/add-participants-to-census.html | 4 ++-- vocdoni-api/census-merkle-root.html | 4 ++-- vocdoni-api/census-size.html | 4 ++-- vocdoni-api/census-total-weight.html | 4 ++-- vocdoni-api/censuses.html | 4 ++-- vocdoni-api/chain.html | 4 ++-- vocdoni-api/circuit-info.html | 4 ++-- vocdoni-api/compute-election-price.html | 4 ++-- vocdoni-api/compute-ipfs-ci-dv-1-of-file.html | 4 ++-- vocdoni-api/count-election-votes.html | 4 ++-- vocdoni-api/count-organization-elections.html | 4 ++-- vocdoni-api/count-organizations.html | 4 ++-- vocdoni-api/create-a-new-census.html | 4 ++-- vocdoni-api/create-election-for-wallet.html | 4 ++-- vocdoni-api/create-election.html | 4 ++-- vocdoni-api/delete-census.html | 4 ++-- vocdoni-api/election-information.html | 4 ++-- vocdoni-api/election-results.html | 4 ++-- vocdoni-api/elections.html | 4 ++-- vocdoni-api/estimate-block-to-date.html | 4 ++-- vocdoni-api/estimate-date-to-block.html | 4 ++-- vocdoni-api/export-census-database.html | 4 ++-- vocdoni-api/export-census.html | 4 ++-- vocdoni-api/exports-the-indexer-database.html | 4 ++-- vocdoni-api/get-account.html | 4 ++-- vocdoni-api/get-block-by-hash.html | 4 ++-- vocdoni-api/get-block-by-height.html | 4 ++-- vocdoni-api/get-next-election-id.html | 4 ++-- vocdoni-api/get-type-of-census.html | 4 ++-- vocdoni-api/get-vote.html | 4 ++-- vocdoni-api/import-census-database.html | 4 ++-- vocdoni-api/import-census.html | 4 ++-- ...-account-received-and-sent-token-transfers.html | 4 ++-- vocdoni-api/list-account-token-fees.html | 4 ++-- vocdoni-api/list-all-census-references.html | 4 ++-- vocdoni-api/list-all-token-fees-by-reference.html | 4 ++-- vocdoni-api/list-all-token-fees-by-type.html | 4 ++-- vocdoni-api/list-all-token-fees.html | 4 ++-- vocdoni-api/list-election-votes.html | 4 ++-- vocdoni-api/list-elections-filtered.html | 4 ++-- vocdoni-api/list-elections.html | 4 ++-- vocdoni-api/list-encryption-keys.html | 4 ++-- vocdoni-api/list-of-the-existing-accounts.html | 4 ++-- vocdoni-api/list-of-valid-sik-roots.html | 4 ++-- .../list-organization-elections-by-status.html | 4 ++-- vocdoni-api/list-organization-elections.html | 4 ++-- vocdoni-api/list-organizations-filtered.html | 4 ++-- vocdoni-api/list-organizations.html | 4 ++-- vocdoni-api/list-transactions.html | 4 ++-- vocdoni-api/list-validators.html | 4 ++-- vocdoni-api/price-factors-information.html | 4 ++-- vocdoni-api/prove-key-to-census.html | 4 ++-- vocdoni-api/publish-census-at-root.html | 4 ++-- vocdoni-api/publish-census.html | 4 ++-- ...ns-if-the-address-provided-has-a-valid-sik.html | 4 ++-- vocdoni-api/set-account.html | 4 ++-- vocdoni-api/set-wallet-account.html | 4 ++-- vocdoni-api/sik.html | 4 ++-- vocdoni-api/submit-a-vote.html | 4 ++-- vocdoni-api/submit-transaction.html | 4 ++-- vocdoni-api/total-number-of-accounts.html | 4 ++-- ...l-number-of-sent-and-received-transactions.html | 4 ++-- .../transaction-by-block-height-and-index.html | 4 ++-- vocdoni-api/transaction-by-hash.html | 4 ++-- vocdoni-api/transaction-by-index.html | 4 ++-- vocdoni-api/transaction-costs.html | 4 ++-- vocdoni-api/transactions-count.html | 4 ++-- vocdoni-api/transactions-in-a-block.html | 4 ++-- vocdoni-api/transfer-tokens.html | 4 ++-- vocdoni-api/verify-merkle-proof.html | 4 ++-- vocdoni-api/verify-vote.html | 4 ++-- vocdoni-api/vocdoni-api.html | 4 ++-- vocdoni-api/vochain-information.html | 4 ++-- vocdoni-api/votes.html | 4 ++-- vocdoni-api/wallet.html | 4 ++-- 272 files changed, 539 insertions(+), 550 deletions(-) delete mode 100644 assets/js/404eb028.16e71fec.js create mode 100644 assets/js/404eb028.b6323f6a.js rename assets/js/{46b36dc0.7cf4efeb.js => 46b36dc0.080e3f08.js} (86%) delete mode 100644 assets/js/4f32f676.2033f24f.js create mode 100644 assets/js/4f32f676.5a88cbbe.js delete mode 100644 assets/js/54bc495f.19b764ac.js create mode 100644 assets/js/54bc495f.261c6427.js create mode 100644 assets/js/78bbaf06.d3323e91.js delete mode 100644 assets/js/78bbaf06.e45630f7.js rename assets/js/{runtime~main.1f79e99a.js => runtime~main.eebe15a9.js} (98%) diff --git a/404.html b/404.html index 360e157c7..876979509 100644 --- a/404.html +++ b/404.html @@ -12,13 +12,13 @@ - +
Skip to main content

Page Not Found

We could not find what you were looking for.

Please contact the owner of the site that linked you to the original URL and let them know their link is broken.

Resources

Guides
Soon

Tutorials
Soon

Copyright © 2024 Vocdoni, Inc. All rights reserved.
- + \ No newline at end of file diff --git a/assets/js/404eb028.16e71fec.js b/assets/js/404eb028.16e71fec.js deleted file mode 100644 index 4342c2f58..000000000 --- a/assets/js/404eb028.16e71fec.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkdemo=self.webpackChunkdemo||[]).push([[2827],{3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>h});var o=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function r(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var l=o.createContext({}),c=function(e){var t=o.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):r(r({},t),e)),n},p=function(e){var t=c(e.components);return o.createElement(l.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return o.createElement(o.Fragment,{},t)}},d=o.forwardRef((function(e,t){var n=e.components,a=e.mdxType,i=e.originalType,l=e.parentName,p=s(e,["components","mdxType","originalType","parentName"]),d=c(n),h=a,m=d["".concat(l,".").concat(h)]||d[h]||u[h]||i;return n?o.createElement(m,r(r({ref:t},p),{},{components:n})):o.createElement(m,r({ref:t},p))}));function h(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var i=n.length,r=new Array(i);r[0]=d;var s={};for(var l in t)hasOwnProperty.call(t,l)&&(s[l]=t[l]);s.originalType=e,s.mdxType="string"==typeof e?e:a,r[1]=s;for(var c=2;c{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>r,default:()=>u,frontMatter:()=>i,metadata:()=>s,toc:()=>c});var o=n(87462),a=(n(67294),n(3905));const i={},r="Quadratic voting",s={unversionedId:"sdk/integration-details/voting-types/quadratic",id:"sdk/integration-details/voting-types/quadratic",title:"Quadratic voting",description:"Quadratic voting is a voting mechanism that allows individuals to express their preferences on different issues with",source:"@site/docs/sdk/integration-details/voting-types/quadratic.md",sourceDirName:"sdk/integration-details/voting-types",slug:"/sdk/integration-details/voting-types/quadratic",permalink:"/sdk/integration-details/voting-types/quadratic",draft:!1,tags:[],version:"current",frontMatter:{},sidebar:"defaultSidebar",previous:{title:"Weighted voting",permalink:"/sdk/integration-details/voting-types/weighted"},next:{title:"Account",permalink:"/sdk/reference/classes/Account"}},l={},c=[{value:"Setting up the election",id:"setting-up-the-election",level:2},{value:"Voter credits",id:"voter-credits",level:3},{value:"Casting a vote",id:"casting-a-vote",level:2},{value:"Results interpretation",id:"results-interpretation",level:2}],p={toc:c};function u(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,o.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"quadratic-voting"},"Quadratic voting"),(0,a.kt)("p",null,"Quadratic voting is a voting mechanism that allows individuals to express their preferences on different issues with\nmore granularity and intensity. In quadratic voting, voters are allocated a fixed number of voting credits, and they can\ndistribute those credits across various options or issues in a quadratic manner. This means that voters can assign more\ncredits to options they care strongly about while still being able to express preferences on multiple issues."),(0,a.kt)("p",null,"The quadratic aspect of the system ensures that the cost of allocating additional credits increases quadratically, which\nhelps prevent a small number of voters from dominating the decision-making process. Quadratic voting aims to promote a\nmore accurate representation of individual preferences and allocate resources based on the collective intensity of\npreferences rather than just a simple majority rule."),(0,a.kt)("p",null,"See:"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"https://github.com/vocdoni/vocdoni-sdk/blob/main/examples/typescript/src/quadratic.ts"},"Complete example")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"/protocol/ballot-protocol#quadratic-voting"},"Ballot protocol implementation"))),(0,a.kt)("h2",{id:"setting-up-the-election"},"Setting up the election"),(0,a.kt)("p",null,"Here we are going to describe how to configure an election to set up a quadratic voting. When the election object is\ncreated,"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts"},"const election_opts: IVoteType = {\n maxValue: 0, // Must be 0 for quadratic elections\n maxCount: CHOICES_LENGTH, // Number of choices for the question\n uniqueChoices: false,\n costFromWeight: true, // This will set that the weight on a weighted census is actually the credits available\n costExponent: 2, // In the context of quadratic voting, this value is usually set to 2\n};\n")),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"The actual Vocdoni implementation only allow quadratic elections with only one question. For that, the ",(0,a.kt)("inlineCode",{parentName:"li"},"maxCount"),"\nrefers to the choices length for this unique question. "),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"costExponent")," define the exponent for quadratic voting calculation. In the context of quadratic voting, this value is\nusually set to 2. This exponent determines the cost of a vote. For example, if a voter assigns 2 credits to an option,\nthe cost of that vote would be 2^2 = 4. Look at SDK docs for more info.")),(0,a.kt)("h3",{id:"voter-credits"},"Voter credits"),(0,a.kt)("p",null,"To determine the number of credits each voter can use, the configuration must be defined in one of two ways:"),(0,a.kt)("ol",null,(0,a.kt)("li",{parentName:"ol"},(0,a.kt)("p",{parentName:"li"},"Adjusting the ",(0,a.kt)("inlineCode",{parentName:"p"},"maxTotalCost"),", on the election options, and using a ",(0,a.kt)("inlineCode",{parentName:"p"},"PlainCensus")," allows for an equal number of credits to be\nallocated to each voter.")),(0,a.kt)("li",{parentName:"ol"},(0,a.kt)("p",{parentName:"li"},"Alternatively, by enabling ",(0,a.kt)("inlineCode",{parentName:"p"},"costFromWeight")," and using a ",(0,a.kt)("inlineCode",{parentName:"p"},"WeightedCensus"),", the number of credits available will\ncorrespond to the voter's weight."))),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts"}," const census = new WeightedCensus();\n census.add(\n participants.map((participant, index) => ({\n key: participant.address,\n weight: BigInt(20), // Give 20 credits to every voter\n }))\n );\n")),(0,a.kt)("p",null,"Using this method will enable the possibility to give different number of credits for every voter. "),(0,a.kt)("h2",{id:"casting-a-vote"},"Casting a vote"),(0,a.kt)("p",null,"As of now, the ",(0,a.kt)("a",{parentName:"p",href:"/protocol/ballot-protocol#vocdoni-results-interpretation"},"protocol"),"\nfor quadratic elections only supports single question elections with discrete values. "),(0,a.kt)("p",null,"Therefore, to cast a vote, you can use the following method:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts"},"client.submitVote(new Vote([2, 3]));\n")),(0,a.kt)("p",null,"This approach calculates the cost of each vote based on the costExponent, for example, allocating 2 votes for option 0\nwill consume 4 credits (2^2 = 4 credits) and 3 votes for option 1 will consume 9 credits (3^2 = 9 credits), with a\ntotal of 13 (4 + 9) credits spent:"),(0,a.kt)("p",null,"The formula (in this case) is like:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},"Votes | Credits\n1\xb2 = 1\n2\xb2 = 4\n3\xb2 = 9\n4\xb2 = 16\n")),(0,a.kt)("h2",{id:"results-interpretation"},"Results interpretation"),(0,a.kt)("p",null,"Let's imagine a scenario where we have 10 voters and each of them casts the same vote ",(0,a.kt)("inlineCode",{parentName:"p"},"[2, 3]"),"."),(0,a.kt)("p",null,"The election results are presented as a bi-dimensional array:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},"[ \n [ '20' ], [ '30' ] \n]\n")),(0,a.kt)("p",null,"The first array position ",(0,a.kt)("inlineCode",{parentName:"p"},"[ '20' ]")," and the second ",(0,a.kt)("inlineCode",{parentName:"p"},"[ '30' ]")," represent the sum of votes cast for option one and option\ntwo, respectively. In this instance, each voter assigned two votes to option one and three votes to option two."),(0,a.kt)("p",null,"Given that there are 10 voters and each voted the same way, the sum of all the votes is as follows:"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"For option one ",(0,a.kt)("inlineCode",{parentName:"li"},"([ '20' ])"),": Each of the 10 voters gave two votes, leading to a total of 20 votes."),(0,a.kt)("li",{parentName:"ul"},"For option two ",(0,a.kt)("inlineCode",{parentName:"li"},"([ '30' ])"),": Each voter gave three votes, leading to a total of 30 votes.")),(0,a.kt)("p",null,"Remember, this interpretation assumes that all voters have used the same voting pattern. Moreover, under the\nquadratic voting system, while it is possible to cast more votes for a preferred option, it also becomes exponentially\nmore costly to do so, providing a self-balancing mechanism that aims to accurately reflect the strength of voters\npreferences."))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/404eb028.b6323f6a.js b/assets/js/404eb028.b6323f6a.js new file mode 100644 index 000000000..85390a6b5 --- /dev/null +++ b/assets/js/404eb028.b6323f6a.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkdemo=self.webpackChunkdemo||[]).push([[2827],{3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>h});var o=n(67294);function a(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function r(e){for(var t=1;t=0||(a[n]=e[n]);return a}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(a[n]=e[n])}return a}var l=o.createContext({}),c=function(e){var t=o.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):r(r({},t),e)),n},p=function(e){var t=c(e.components);return o.createElement(l.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return o.createElement(o.Fragment,{},t)}},d=o.forwardRef((function(e,t){var n=e.components,a=e.mdxType,i=e.originalType,l=e.parentName,p=s(e,["components","mdxType","originalType","parentName"]),d=c(n),h=a,m=d["".concat(l,".").concat(h)]||d[h]||u[h]||i;return n?o.createElement(m,r(r({ref:t},p),{},{components:n})):o.createElement(m,r({ref:t},p))}));function h(e,t){var n=arguments,a=t&&t.mdxType;if("string"==typeof e||a){var i=n.length,r=new Array(i);r[0]=d;var s={};for(var l in t)hasOwnProperty.call(t,l)&&(s[l]=t[l]);s.originalType=e,s.mdxType="string"==typeof e?e:a,r[1]=s;for(var c=2;c{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>r,default:()=>u,frontMatter:()=>i,metadata:()=>s,toc:()=>c});var o=n(87462),a=(n(67294),n(3905));const i={},r="Quadratic voting",s={unversionedId:"sdk/integration-details/voting-types/quadratic",id:"sdk/integration-details/voting-types/quadratic",title:"Quadratic voting",description:"Quadratic voting is a voting mechanism that allows individuals to express their preferences on different issues with",source:"@site/docs/sdk/integration-details/voting-types/quadratic.md",sourceDirName:"sdk/integration-details/voting-types",slug:"/sdk/integration-details/voting-types/quadratic",permalink:"/sdk/integration-details/voting-types/quadratic",draft:!1,tags:[],version:"current",frontMatter:{},sidebar:"defaultSidebar",previous:{title:"Weighted voting",permalink:"/sdk/integration-details/voting-types/weighted"},next:{title:"Account",permalink:"/sdk/reference/classes/Account"}},l={},c=[{value:"Setting up the election",id:"setting-up-the-election",level:2},{value:"Voter credits",id:"voter-credits",level:3},{value:"Casting a vote",id:"casting-a-vote",level:2},{value:"Results interpretation",id:"results-interpretation",level:2}],p={toc:c};function u(e){let{components:t,...n}=e;return(0,a.kt)("wrapper",(0,o.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,a.kt)("h1",{id:"quadratic-voting"},"Quadratic voting"),(0,a.kt)("p",null,"Quadratic voting is a voting mechanism that allows individuals to express their preferences on different issues with\nmore granularity and intensity. In quadratic voting, voters are allocated a fixed number of voting credits, and they can distribute those credits across various options or issues. This means that voters can assign more credits to options they care strongly about while still being able to express preferences on multiple issues."),(0,a.kt)("p",null,"The quadratic aspect of the system ensures that the cost of allocating additional credits increases quadratically, which helps prevent a small number of voters from dominating the decision-making process. Quadratic voting aims to promote a more accurate representation of individual preferences and allocate resources based on the collective intensity of preferences rather than just a simple majority rule."),(0,a.kt)("p",null,"See:"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"https://github.com/vocdoni/vocdoni-sdk/blob/main/examples/typescript/src/quadratic.ts"},"Complete example")),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("a",{parentName:"li",href:"/protocol/ballot-protocol#quadratic-voting"},"Ballot protocol implementation"))),(0,a.kt)("h2",{id:"setting-up-the-election"},"Setting up the election"),(0,a.kt)("p",null,"Here we are going to describe how to configure an election to set up a quadratic voting. When the election object is\ncreated,"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts"},"const election_opts: IVoteType = {\n maxValue: 0, // Must be 0 for quadratic elections\n maxCount: CHOICES_LENGTH, // Number of choices for the question\n uniqueChoices: false,\n costFromWeight: true, // This will set that the weight on a weighted census is actually the credits available\n costExponent: 2, // In the context of quadratic voting, this value is usually set to 2\n};\n")),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"The actual Vocdoni implementation only allow quadratic elections with only one question. For that, the ",(0,a.kt)("inlineCode",{parentName:"li"},"maxCount"),"\nrefers to the choices length for this unique question. "),(0,a.kt)("li",{parentName:"ul"},(0,a.kt)("inlineCode",{parentName:"li"},"costExponent")," define the exponent for quadratic voting calculation. In the context of quadratic voting, this value is\nusually set to 2. This exponent determines the cost of a vote. For example, if a voter assigns 2 credits to an option,\nthe cost of that vote would be 2^2 = 4. Look at SDK docs for more info.")),(0,a.kt)("h3",{id:"voter-credits"},"Voter credits"),(0,a.kt)("p",null,"To determine the number of credits each voter can use, the configuration must be defined in one of two ways:"),(0,a.kt)("ol",null,(0,a.kt)("li",{parentName:"ol"},(0,a.kt)("p",{parentName:"li"},"Adjusting the ",(0,a.kt)("inlineCode",{parentName:"p"},"maxTotalCost"),", on the election options, and using a ",(0,a.kt)("inlineCode",{parentName:"p"},"PlainCensus")," allows for an equal number of credits to be\nallocated to each voter.")),(0,a.kt)("li",{parentName:"ol"},(0,a.kt)("p",{parentName:"li"},"Alternatively, by enabling ",(0,a.kt)("inlineCode",{parentName:"p"},"costFromWeight")," and using a ",(0,a.kt)("inlineCode",{parentName:"p"},"WeightedCensus"),", the number of credits available will\ncorrespond to the voter's weight."))),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts"}," const census = new WeightedCensus();\n census.add(\n participants.map((participant, index) => ({\n key: participant.address,\n weight: BigInt(20), // Give 20 credits to every voter\n }))\n );\n")),(0,a.kt)("p",null,"Using this method will enable the possibility to give different number of credits for every voter. "),(0,a.kt)("h2",{id:"casting-a-vote"},"Casting a vote"),(0,a.kt)("p",null,"As of now, the ",(0,a.kt)("a",{parentName:"p",href:"/protocol/ballot-protocol#vocdoni-results-interpretation"},"protocol"),"\nfor quadratic elections only supports single question elections with discrete values. "),(0,a.kt)("p",null,"Therefore, to cast a vote, you can use the following method:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre",className:"language-ts"},"client.submitVote(new Vote([2, 3]));\n")),(0,a.kt)("p",null,"This approach calculates the cost of each vote based on the costExponent, for example, allocating 2 votes for option 0\nwill consume 4 credits (2^2 = 4 credits) and 3 votes for option 1 will consume 9 credits (3^2 = 9 credits), with a\ntotal of 13 (4 + 9) credits spent:"),(0,a.kt)("p",null,"The formula (in this case) is like:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},"Votes | Credits\n1\xb2 = 1\n2\xb2 = 4\n3\xb2 = 9\n4\xb2 = 16\n")),(0,a.kt)("h2",{id:"results-interpretation"},"Results interpretation"),(0,a.kt)("p",null,"Let's imagine a scenario where we have 10 voters and each of them casts the same vote ",(0,a.kt)("inlineCode",{parentName:"p"},"[2, 3]"),"."),(0,a.kt)("p",null,"The election results are presented as a bi-dimensional array:"),(0,a.kt)("pre",null,(0,a.kt)("code",{parentName:"pre"},"[ \n [ '20' ], [ '30' ] \n]\n")),(0,a.kt)("p",null,"The first array position ",(0,a.kt)("inlineCode",{parentName:"p"},"[ '20' ]")," and the second ",(0,a.kt)("inlineCode",{parentName:"p"},"[ '30' ]")," represent the sum of votes cast for option one and option\ntwo, respectively. In this instance, each voter assigned two votes to option one and three votes to option two."),(0,a.kt)("p",null,"Given that there are 10 voters and each voted the same way, the sum of all the votes is as follows:"),(0,a.kt)("ul",null,(0,a.kt)("li",{parentName:"ul"},"For option one ",(0,a.kt)("inlineCode",{parentName:"li"},"([ '20' ])"),": Each of the 10 voters gave two votes, leading to a total of 20 votes."),(0,a.kt)("li",{parentName:"ul"},"For option two ",(0,a.kt)("inlineCode",{parentName:"li"},"([ '30' ])"),": Each voter gave three votes, leading to a total of 30 votes.")),(0,a.kt)("p",null,"Remember, this interpretation assumes that all voters have used the same voting pattern. Moreover, under the\nquadratic voting system, while it is possible to cast more votes for a preferred option, it also becomes exponentially\nmore costly to do so, providing a self-balancing mechanism that aims to accurately reflect the strength of voters\npreferences."))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/46b36dc0.7cf4efeb.js b/assets/js/46b36dc0.080e3f08.js similarity index 86% rename from assets/js/46b36dc0.7cf4efeb.js rename to assets/js/46b36dc0.080e3f08.js index 92bcd20d7..f41ee3bc1 100644 --- a/assets/js/46b36dc0.7cf4efeb.js +++ b/assets/js/46b36dc0.080e3f08.js @@ -1 +1 @@ -"use strict";(self.webpackChunkdemo=self.webpackChunkdemo||[]).push([[3082],{3905:(e,t,n)=>{n.d(t,{Zo:()=>h,kt:()=>u});var i=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function a(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(i=0;i=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var l=i.createContext({}),p=function(e){var t=i.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):a(a({},t),e)),n},h=function(e){var t=p(e.components);return i.createElement(l.Provider,{value:t},e.children)},c={inlineCode:"code",wrapper:function(e){var t=e.children;return i.createElement(i.Fragment,{},t)}},d=i.forwardRef((function(e,t){var n=e.components,o=e.mdxType,r=e.originalType,l=e.parentName,h=s(e,["components","mdxType","originalType","parentName"]),d=p(n),u=o,g=d["".concat(l,".").concat(u)]||d[u]||c[u]||r;return n?i.createElement(g,a(a({ref:t},h),{},{components:n})):i.createElement(g,a({ref:t},h))}));function u(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var r=n.length,a=new Array(r);a[0]=d;var s={};for(var l in t)hasOwnProperty.call(t,l)&&(s[l]=t[l]);s.originalType=e,s.mdxType="string"==typeof e?e:o,a[1]=s;for(var p=2;p{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>a,default:()=>c,frontMatter:()=>r,metadata:()=>s,toc:()=>p});var i=n(87462),o=(n(67294),n(3905));const r={sidebar_position:5,slug:"weighted"},a="Weighted voting",s={unversionedId:"sdk/integration-details/voting-types/weighted",id:"sdk/integration-details/voting-types/weighted",title:"Weighted voting",description:"Weighted voting is a voting system where each voter is assigned a specific weight or value that reflects their relative influence or importance in the decision-making process.",source:"@site/docs/sdk/integration-details/voting-types/weighted.md",sourceDirName:"sdk/integration-details/voting-types",slug:"/sdk/integration-details/voting-types/weighted",permalink:"/sdk/integration-details/voting-types/weighted",draft:!1,tags:[],version:"current",sidebarPosition:5,frontMatter:{sidebar_position:5,slug:"weighted"},sidebar:"defaultSidebar",previous:{title:"Approval Voting (Multiple Choice)",permalink:"/sdk/integration-details/voting-types/approval"},next:{title:"Quadratic voting",permalink:"/sdk/integration-details/voting-types/quadratic"}},l={},p=[{value:"Setting up the election",id:"setting-up-the-election",level:2},{value:"Creating a WeightedCensus",id:"creating-a-weightedcensus",level:3},{value:"Casting a vote",id:"casting-a-vote",level:2},{value:"Results interpretation",id:"results-interpretation",level:2}],h={toc:p};function c(e){let{components:t,...n}=e;return(0,o.kt)("wrapper",(0,i.Z)({},h,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"weighted-voting"},"Weighted voting"),(0,o.kt)("p",null,"Weighted voting is a voting system where each voter is assigned a specific weight or value that reflects their relative influence or importance in the decision-making process."),(0,o.kt)("p",null,"When votes are cast, the value of each individual\u2019s vote is multiplied by their assigned weight, resulting in a weighted score. The sum of all the weighted scores determines the outcome of the vote. This system allows for a more nuanced\nrepresentation of voting power and can reflect the hierarchical structure or distribution of authority within the\norganization."),(0,o.kt)("h2",{id:"setting-up-the-election"},"Setting up the election"),(0,o.kt)("p",null,"The process creation and use of the ballot protocol is the same as on any other Election, the key difference is the\nuse of a ",(0,o.kt)("inlineCode",{parentName:"p"},"WeightedCensus")," instead of a ",(0,o.kt)("inlineCode",{parentName:"p"},"PlainCensus"),"."),(0,o.kt)("admonition",{title:"Where can I use a WeightedCensus?",type:"tip"},(0,o.kt)("p",{parentName:"admonition"},"Essentially, you can use the ",(0,o.kt)("inlineCode",{parentName:"p"},"WeightedCensus")," for any vote type except quadratic voting."),(0,o.kt)("p",{parentName:"admonition"},"Note that ",(0,o.kt)("inlineCode",{parentName:"p"},"quadratic voting")," already uses a ",(0,o.kt)("inlineCode",{parentName:"p"},"WeightedCensus")," but for other purposes. On a ",(0,o.kt)("inlineCode",{parentName:"p"},"quadratic election")," the\nweighted census are used to set the available credits for every voter when the option ",(0,o.kt)("inlineCode",{parentName:"p"},"costFromWeight")," is set to ",(0,o.kt)("inlineCode",{parentName:"p"},"true"),".")),(0,o.kt)("p",null,"The votes are stored on the blockchain with its weight like any other voting process. When the results are retrieved\nfrom the API, the indexer applies the weight to every vote, and this reflects in the results matrix."),(0,o.kt)("h3",{id:"creating-a-weightedcensus"},"Creating a ",(0,o.kt)("inlineCode",{parentName:"h3"},"WeightedCensus")),(0,o.kt)("p",null,"Following de above example, we are going to create a census where the weight is related to the position of the voter on\nthe participants array."),(0,o.kt)("p",null,"The process of generate a ",(0,o.kt)("inlineCode",{parentName:"p"},"WeightedCensus")," is similar to create a ",(0,o.kt)("inlineCode",{parentName:"p"},"PlainCensus")," with the difference that you have to\nadd the vote weight to every participant. As shown below, we are giving to each voter a weight associated to its\nposition on an array. For 4 voters, the first one will have a weight of 1, and the last will have 4."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-ts"}," const census = new WeightedCensus();\n census.add(\n participants.map((participant, index) => ({\n key: participant.address,\n weight: BigInt(index + 1), // Give the weight to each participant\n }))\n );\n")),(0,o.kt)("h2",{id:"casting-a-vote"},"Casting a vote"),(0,o.kt)("p",null,'For instance, consider that 4 voters have to vote on the question: "Do you like chocolate?" with possible answers "yes" and "no".\nThe weight distribution and votes are as follows:'),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},"Voter 1: Weight = 1, Votes for option 0 (no), hence adds 1 vote."),(0,o.kt)("li",{parentName:"ul"},"Voter 2: Weight = 2, Votes for option 1 (yes), hence adds 2 votes."),(0,o.kt)("li",{parentName:"ul"},"Voter 3: Weight = 3, Votes for option 0 (no), hence adds 3 votes."),(0,o.kt)("li",{parentName:"ul"},"Voter 4: Weight = 4, Votes for option 1 (yes), hence adds 4 votes.")),(0,o.kt)("p",null,"The total census weight is ",(0,o.kt)("inlineCode",{parentName:"p"},"1 + 2 + 3 + 4 = 10")," and will be distributed among the choices."),(0,o.kt)("p",null,"The related code could be something like:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-ts"},"client.submitVote(new Vote([participantIndex % 2]));\n")),(0,o.kt)("h2",{id:"results-interpretation"},"Results interpretation"),(0,o.kt)("p",null,"The results from a weighted voting process are returned by the API as an array, which encapsulates the sum of the\nweighted votes cast for each choice. In the given example, the API will return the following array:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"[ [ '4', '6' ] ]\n")),(0,o.kt)("p",null,"In this type of election, where there's only one question with two possible choices, the array represents the summed\nweights of votes for each option. Here, each index in the array corresponds to an option from the voting question."),(0,o.kt)("p",null,"The value at each index is the total of weighted votes that the corresponding option received. For the first option (no),\nthe total weighted votes are ",(0,o.kt)("inlineCode",{parentName:"p"},"1 (from voter 1) + 3 (from voter 3) = 4"),", hence '4' at the first index of the array."),(0,o.kt)("p",null,"For the second option (yes), the total weighted votes are ",(0,o.kt)("inlineCode",{parentName:"p"},"2 (from voter 2) + 4 (from voter 4) = 6"),", thus '6' at the\nsecond index."),(0,o.kt)("p",null,"The array ",(0,o.kt)("inlineCode",{parentName:"p"},"[ [ '4', '6' ] ]")," encapsulates this result, which can be interpreted as \"4 weighted votes for 'no' and 6\nweighted votes for 'yes'\"."))}c.isMDXComponent=!0}}]); \ No newline at end of file +"use strict";(self.webpackChunkdemo=self.webpackChunkdemo||[]).push([[3082],{3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>u});var i=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function r(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function a(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(e);for(i=0;i=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var l=i.createContext({}),h=function(e){var t=i.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):a(a({},t),e)),n},p=function(e){var t=h(e.components);return i.createElement(l.Provider,{value:t},e.children)},c={inlineCode:"code",wrapper:function(e){var t=e.children;return i.createElement(i.Fragment,{},t)}},d=i.forwardRef((function(e,t){var n=e.components,o=e.mdxType,r=e.originalType,l=e.parentName,p=s(e,["components","mdxType","originalType","parentName"]),d=h(n),u=o,g=d["".concat(l,".").concat(u)]||d[u]||c[u]||r;return n?i.createElement(g,a(a({ref:t},p),{},{components:n})):i.createElement(g,a({ref:t},p))}));function u(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var r=n.length,a=new Array(r);a[0]=d;var s={};for(var l in t)hasOwnProperty.call(t,l)&&(s[l]=t[l]);s.originalType=e,s.mdxType="string"==typeof e?e:o,a[1]=s;for(var h=2;h{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>a,default:()=>c,frontMatter:()=>r,metadata:()=>s,toc:()=>h});var i=n(87462),o=(n(67294),n(3905));const r={sidebar_position:5,slug:"weighted"},a="Weighted voting",s={unversionedId:"sdk/integration-details/voting-types/weighted",id:"sdk/integration-details/voting-types/weighted",title:"Weighted voting",description:"Weighted voting is a voting system where each voter is assigned a specific weight or value that reflects their relative influence or importance in the decision-making process.",source:"@site/docs/sdk/integration-details/voting-types/weighted.md",sourceDirName:"sdk/integration-details/voting-types",slug:"/sdk/integration-details/voting-types/weighted",permalink:"/sdk/integration-details/voting-types/weighted",draft:!1,tags:[],version:"current",sidebarPosition:5,frontMatter:{sidebar_position:5,slug:"weighted"},sidebar:"defaultSidebar",previous:{title:"Approval Voting (Multiple Choice)",permalink:"/sdk/integration-details/voting-types/approval"},next:{title:"Quadratic voting",permalink:"/sdk/integration-details/voting-types/quadratic"}},l={},h=[{value:"Setting up the election",id:"setting-up-the-election",level:2},{value:"Creating a WeightedCensus",id:"creating-a-weightedcensus",level:3},{value:"Casting a vote",id:"casting-a-vote",level:2},{value:"Results interpretation",id:"results-interpretation",level:2}],p={toc:h};function c(e){let{components:t,...n}=e;return(0,o.kt)("wrapper",(0,i.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"weighted-voting"},"Weighted voting"),(0,o.kt)("p",null,"Weighted voting is a voting system where each voter is assigned a specific weight or value that reflects their relative influence or importance in the decision-making process."),(0,o.kt)("p",null,"When votes are cast, the value of each individual\u2019s vote is multiplied by their assigned weight, resulting in a weighted score. The sum of all the weighted scores determines the outcome of the vote. This system allows for a more nuanced\nrepresentation of voting power and can reflect the hierarchical structure or distribution of authority within the\norganization."),(0,o.kt)("h2",{id:"setting-up-the-election"},"Setting up the election"),(0,o.kt)("p",null,"The process creation and use of the ballot protocol is the same as on any other Election, the key difference is the\nuse of a ",(0,o.kt)("inlineCode",{parentName:"p"},"WeightedCensus")," instead of a ",(0,o.kt)("inlineCode",{parentName:"p"},"PlainCensus"),"."),(0,o.kt)("admonition",{title:"Where can I use a WeightedCensus?",type:"tip"},(0,o.kt)("p",{parentName:"admonition"},"Essentially, you can use the ",(0,o.kt)("inlineCode",{parentName:"p"},"WeightedCensus")," for any vote type except quadratic voting."),(0,o.kt)("p",{parentName:"admonition"},"Note that ",(0,o.kt)("inlineCode",{parentName:"p"},"quadratic voting")," already uses a ",(0,o.kt)("inlineCode",{parentName:"p"},"WeightedCensus")," but for other purposes. On a ",(0,o.kt)("inlineCode",{parentName:"p"},"quadratic election")," the\nweighted census are used to set the available credits for every voter when the option ",(0,o.kt)("inlineCode",{parentName:"p"},"costFromWeight")," is set to ",(0,o.kt)("inlineCode",{parentName:"p"},"true"),".")),(0,o.kt)("p",null,"The votes are stored on the blockchain with its weight like any other voting process. When the results are retrieved\nfrom the API, the indexer applies the weight to every vote, and this reflects in the results matrix."),(0,o.kt)("h3",{id:"creating-a-weightedcensus"},"Creating a ",(0,o.kt)("inlineCode",{parentName:"h3"},"WeightedCensus")),(0,o.kt)("p",null,"Following de above example, we are going to create a census where the weight is related to the position of the voter on\nthe participants array."),(0,o.kt)("p",null,"The process of generate a ",(0,o.kt)("inlineCode",{parentName:"p"},"WeightedCensus")," is similar to create a ",(0,o.kt)("inlineCode",{parentName:"p"},"PlainCensus")," with the difference that you have to\nadd the vote weight to every participant. As shown below, we are giving to each voter a weight associated to its\nposition on an array. For 4 voters, the first one will have a weight of 1, and the last will have 4."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-ts"}," const census = new WeightedCensus();\n census.add(\n participants.map((participant, index) => ({\n key: participant.address,\n weight: BigInt(index + 1), // Give the weight to each participant\n }))\n );\n")),(0,o.kt)("h2",{id:"casting-a-vote"},"Casting a vote"),(0,o.kt)("p",null,'For instance, consider that 4 voters have to vote on the question: "Do you like chocolate?" with possible answers "yes" and "no".\nThe weight distribution and votes are as follows:'),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},"Voter 1: Weight = 1, Votes for option 0 (no), hence adds 1 vote."),(0,o.kt)("li",{parentName:"ul"},"Voter 2: Weight = 2, Votes for option 1 (yes), hence adds 2 votes."),(0,o.kt)("li",{parentName:"ul"},"Voter 3: Weight = 3, Votes for option 0 (no), hence adds 3 votes."),(0,o.kt)("li",{parentName:"ul"},"Voter 4: Weight = 4, Votes for option 1 (yes), hence adds 4 votes.")),(0,o.kt)("p",null,"The total census weight is ",(0,o.kt)("inlineCode",{parentName:"p"},"1 + 2 + 3 + 4 = 10")," and will be distributed among the choices."),(0,o.kt)("p",null,"The related code could be something like:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre",className:"language-ts"},"client.submitVote(new Vote([participantIndex % 2]));\n")),(0,o.kt)("h2",{id:"results-interpretation"},"Results interpretation"),(0,o.kt)("p",null,"The results from a weighted voting process are returned by the API as an array, which encapsulates the sum of the\nweighted votes cast for each choice. In the given example, the API will return the following array:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"[ [ '4', '6' ] ]\n")),(0,o.kt)("p",null,"In this type of election, where there's only one question with two possible choices, the array represents the summed\nweights of votes for each option. Here, each index in the array corresponds to an option from the voting question."),(0,o.kt)("p",null,"The value at each index is the total of weighted votes that the corresponding option received. For the first option (no),\nthe total weighted votes are ",(0,o.kt)("inlineCode",{parentName:"p"},"1 (from voter 1) + 3 (from voter 3) = 4"),", hence '4' at the first index of the array."),(0,o.kt)("p",null,"For the second option (yes), the total weighted votes are ",(0,o.kt)("inlineCode",{parentName:"p"},"2 (from voter 2) + 4 (from voter 4) = 6"),", thus '6' at the\nsecond index."),(0,o.kt)("p",null,"The array ",(0,o.kt)("inlineCode",{parentName:"p"},"[ [ '4', '6' ] ]")," encapsulates this result, which can be interpreted as \"4 weighted votes for 'no' and 6\nweighted votes for 'yes'\"."),(0,o.kt)("admonition",{type:"tip"},(0,o.kt)("p",{parentName:"admonition"},"In a weighted election, the Vochain stores the envelope without calculating the weight of each voter. However, when\nretrieving the results using the SDK, you will see the weights applied. The application of these weights is performed\nby the vocdoni-node indexer, which calculates the weights for you."),(0,o.kt)("p",{parentName:"admonition"},"The weights of each vote are stored in the envelope, which is saved on the Vochain.")))}c.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/4f32f676.2033f24f.js b/assets/js/4f32f676.2033f24f.js deleted file mode 100644 index 2ee121b04..000000000 --- a/assets/js/4f32f676.2033f24f.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkdemo=self.webpackChunkdemo||[]).push([[1187],{3905:(e,t,a)=>{a.d(t,{Zo:()=>s,kt:()=>k});var n=a(67294);function l(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function i(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function r(e){for(var t=1;t=0||(l[a]=e[a]);return l}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(l[a]=e[a])}return l}var p=n.createContext({}),u=function(e){var t=n.useContext(p),a=t;return e&&(a="function"==typeof e?e(t):r(r({},t),e)),a},s=function(e){var t=u(e.components);return n.createElement(p.Provider,{value:t},e.children)},m={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var a=e.components,l=e.mdxType,i=e.originalType,p=e.parentName,s=o(e,["components","mdxType","originalType","parentName"]),d=u(a),k=l,c=d["".concat(p,".").concat(k)]||d[k]||m[k]||i;return a?n.createElement(c,r(r({ref:t},s),{},{components:a})):n.createElement(c,r({ref:t},s))}));function k(e,t){var a=arguments,l=t&&t.mdxType;if("string"==typeof e||l){var i=a.length,r=new Array(i);r[0]=d;var o={};for(var p in t)hasOwnProperty.call(t,p)&&(o[p]=t[p]);o.originalType=e,o.mdxType="string"==typeof e?e:l,r[1]=o;for(var u=2;u{a.r(t),a.d(t,{assets:()=>p,contentTitle:()=>r,default:()=>m,frontMatter:()=>i,metadata:()=>o,toc:()=>u});var n=a(87462),l=(a(67294),a(3905));const i={description:"Ballot protocol"},r="Ballot Protocol",o={unversionedId:"protocol/ballot-protocol",id:"protocol/ballot-protocol",title:"Ballot Protocol",description:"Ballot protocol",source:"@site/docs/protocol/ballot-protocol.md",sourceDirName:"protocol",slug:"/protocol/ballot-protocol",permalink:"/protocol/ballot-protocol",draft:!1,tags:[],version:"current",frontMatter:{description:"Ballot protocol"},sidebar:"defaultSidebar",previous:{title:"Off-Chain Tree ZK Census Proof",permalink:"/protocol/anonymity/zk-census-proof"},next:{title:"The Census",permalink:"/protocol/census/"}},p={},u=[{value:"Results and example",id:"results-and-example",level:2},{value:"Example",id:"example",level:3},{value:"More Examples",id:"more-examples",level:2},{value:"Rate a product",id:"rate-a-product",level:3},{value:"Rate 3 candidates",id:"rate-3-candidates",level:3},{value:"Single choice",id:"single-choice",level:3},{value:"Multiple choice",id:"multiple-choice",level:3},{value:"Linear Weighted choice",id:"linear-weighted-choice",level:3},{value:"Quadratic voting",id:"quadratic-voting",level:3},{value:"Multiquestion",id:"multiquestion",level:3},{value:"Vocdoni results interpretation",id:"vocdoni-results-interpretation",level:2},{value:"Single question",id:"single-question",level:3},{value:"Multi question",id:"multi-question",level:3}],s={toc:u};function m(e){let{components:t,...a}=e;return(0,l.kt)("wrapper",(0,n.Z)({},s,a,{components:t,mdxType:"MDXLayout"}),(0,l.kt)("h1",{id:"ballot-protocol"},"Ballot Protocol"),(0,l.kt)("p",null,"The Vocdoni Ballot Protocol aims to be a very simple yet powerful specification for the representation of ballots and results for a voting process."),(0,l.kt)("p",null,"A ",(0,l.kt)("strong",{parentName:"p"},(0,l.kt)("em",{parentName:"strong"},"voting process"))," is made out of one or more ",(0,l.kt)("strong",{parentName:"p"},(0,l.kt)("em",{parentName:"strong"},"fields")),", each of which represents a single question or an option for a question, depending on the ",(0,l.kt)("strong",{parentName:"p"},(0,l.kt)("em",{parentName:"strong"},"type of process")),". When voting, eligible voters choose from a set of predefined ",(0,l.kt)("strong",{parentName:"p"},(0,l.kt)("em",{parentName:"strong"},"answers"))," for each field. The allowed number of answers, type of answer, etc. also depend on the specific type of process. An eligible voter expresses their choices by casting a ",(0,l.kt)("strong",{parentName:"p"},(0,l.kt)("em",{parentName:"strong"},"ballot")),"."),(0,l.kt)("p",null,"A ballot is represented as an array (or list) of natural numbers. Each position of the array contains an answer to one of the process' fields."),(0,l.kt)("p",null,"Results are accumulated in a two-dimension array of natural numbers (a matrix). Each row of this matrix corresponds to a ballot field, and each column corresponds to one of the possible values for that field. Any number in the results matrix is simply a count of the votes for the value represented at that index."),(0,l.kt)("p",null,(0,l.kt)("em",{parentName:"p"},"A more thorough introduction is available on ",(0,l.kt)("a",{parentName:"em",href:"https://blog.vocdoni.io/vocdoni-ballot-protocol/"},"our blog"),".")),(0,l.kt)("p",null,(0,l.kt)("img",{parentName:"p",src:"https://blog.vocdoni.io/_next/image?url=https%3A%2F%2Fstorage.googleapis.com%2Fpapyrus_images%2F47fc7647a24d815d609ad569c4456e39.png&w=1920&q=75",alt:"https://blog.vocdoni.io/_next/image?url=https%3A%2F%2Fstorage.googleapis.com%2Fpapyrus_images%2F47fc7647a24d815d609ad569c4456e39.png&w=1920&q=75"})),(0,l.kt)("p",null,"The protocol is composed by a set of numeric and boolean variables that restrict the format of the ballot. They are defined in the Process Parameters."),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("inlineCode",{parentName:"li"},"uint8 maxCount"),"\nMax number of fields per ballot. 1 <= maxCount <= 100."),(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("inlineCode",{parentName:"li"},"uint8 maxValue"),"\nDetermines the acceptable maximum value for all fields."),(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("inlineCode",{parentName:"li"},"uint8 minValue"),"\nDetermines the acceptable minimum value for all fields."),(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("inlineCode",{parentName:"li"},"bool uniqueValues"),"\nChoices for a question cannot appear twice or more"),(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("inlineCode",{parentName:"li"},"uint16 maxTotalCost"),"\nMaximum limit on the total sum of all ballot fields' values (if applicable).\n0 => No limit / Not applicable."),(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("inlineCode",{parentName:"li"},"uint16 minTotalCost"),"\nMinimum limit on the total sum of all ballot fields' values (if applicable).\n0 => No limit / Not applicable."),(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("inlineCode",{parentName:"li"},"uint16 costExponent"),'\nThe exponent that will be used to compute the "cost" of the field values.'),(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("inlineCode",{parentName:"li"},"totalCost = \u03a3 (value[i] ^ costExponent) <= maxTotalCost")),(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("inlineCode",{parentName:"li"},"costExponent")," is represented as ",(0,l.kt)("inlineCode",{parentName:"li"},"exp * 10000")," so:"),(0,l.kt)("li",{parentName:"ul"},"0 => 0.0000"),(0,l.kt)("li",{parentName:"ul"},"10000 => 1.0000"),(0,l.kt)("li",{parentName:"ul"},"65535 => 6.5535")),(0,l.kt)("p",null,(0,l.kt)("img",{parentName:"p",src:"https://blog.vocdoni.io/_next/image?url=https%3A%2F%2Fstorage.googleapis.com%2Fpapyrus_images%2Fb8d920f2d64cf347ff2f47f7e34a3340.png&w=1920&q=75",alt:"https://blog.vocdoni.io/_next/image?url=https%3A%2F%2Fstorage.googleapis.com%2Fpapyrus_images%2Fb8d920f2d64cf347ff2f47f7e34a3340.png&w=1920&q=75"})),(0,l.kt)("hr",null),(0,l.kt)("h2",{id:"results-and-example"},"Results and example"),(0,l.kt)("p",null,"The result is represented as a matrix of natural numbers. Let's take this JSON example:"),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-json"},"[\n [1,2,3], // in field 1: value 0 got 1 vote, value 1 got 2, value 2 got 3\n [1,4,2], // in field 2: value 0 got 1 vote, value 1 got 4, value 2 got 2\n [0,1,0] // in field 3: value 0 got 0 vote, value 1 got 1, value 2 got 0\n]\n")),(0,l.kt)("p",null,"Each row of the matrix represents a field, there are three fields:\n",(0,l.kt)("inlineCode",{parentName:"p"},"[ [First field], [Second field], [Third field] ]")),(0,l.kt)("p",null,"The ballot protocol does not cover interpretation. However, a very common interpretation would be to consider each field as the multiplier (weight) equal to its position."),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},"First question ","[1,2,3]"," = ",(0,l.kt)("inlineCode",{parentName:"li"},"0*1 + 1*2 + 2*3")," = ",(0,l.kt)("inlineCode",{parentName:"li"},"0 + 2 + 6")," = 8"),(0,l.kt)("li",{parentName:"ul"},"Second question ","[0,4,2]"," = ",(0,l.kt)("inlineCode",{parentName:"li"},"0*0 + 1*4 + 2*2")," = 8"),(0,l.kt)("li",{parentName:"ul"},"Third question ","[5,1,0]"," = ",(0,l.kt)("inlineCode",{parentName:"li"},"0*5 + 1*1 + 2*0")," = 1")),(0,l.kt)("p",null,"6 votes have been cast."),(0,l.kt)("h3",{id:"example"},"Example"),(0,l.kt)("p",null,"Lets see an example with ",(0,l.kt)("inlineCode",{parentName:"p"},"maxCount=3")," and ",(0,l.kt)("inlineCode",{parentName:"p"},"maxValue=5")),(0,l.kt)("p",null,"The human-friendly question would be: ",(0,l.kt)("em",{parentName:"p"},"Rate these 3 candidates to the best rock music player of the 20th century, from 0 to 5 stars.")),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},"Lennon is the candidate 0, so question 0"),(0,l.kt)("li",{parentName:"ul"},"Hendrix is the candidate 1, so question 1"),(0,l.kt)("li",{parentName:"ul"},"Joplin is the candidate 2, so question 2")),(0,l.kt)("p",null,"Let's start, currently there are no votes cast:"),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Results:")," Lennon:","[0,0,0]"," Hendrix:","[0,0,0]"," Joplin:","[0,0,0]"),(0,l.kt)("p",null,"New vote ","[2,1,2]"," =>"),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},"give 2 points to candidate 0"),(0,l.kt)("li",{parentName:"ul"},"give 1 point to candidate 1"),(0,l.kt)("li",{parentName:"ul"},"give 2 points to candidate 2")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Results:")," Lennon:","[0,0,1]"," Hendrix:","[0,1,0]"," Joplin:","[0,0,1]"),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},"candidate 0 = 2 points (1\xb72)"),(0,l.kt)("li",{parentName:"ul"},"candidate 1 = 1 point (1\xb71)"),(0,l.kt)("li",{parentName:"ul"},"candidate 2 = 2 points (1\xb72)")),(0,l.kt)("p",null,"New vote ","[0,1,2]"," =>"),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},"give 0 points to candidate 0"),(0,l.kt)("li",{parentName:"ul"},"give 1 point to candidate 1"),(0,l.kt)("li",{parentName:"ul"},"give 2 points to candidate 2")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Results:")," Lennon:","[1,0,1]"," Hendrix:","[0,2,0]"," Joplin:","[0,0,2]"),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},"candidate 0 = 2 points"),(0,l.kt)("li",{parentName:"ul"},"candidate 1 = 2 point"),(0,l.kt)("li",{parentName:"ul"},"candidate 2 = 4 points")),(0,l.kt)("p",null,"New vote ","[0,0,0]"," =>"),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},"give 0 points to candidate 0"),(0,l.kt)("li",{parentName:"ul"},"give 0 points to candidate 1"),(0,l.kt)("li",{parentName:"ul"},"give 0 points to candidate 2")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Results:")," Lennon:","[2,0,1]"," Hendrix:","[1,2,0]"," Joplin:","[1,0,2]"),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},"candidate 0 = 2 points"),(0,l.kt)("li",{parentName:"ul"},"candidate 1 = 2 point"),(0,l.kt)("li",{parentName:"ul"},"candidate 2 = 4 points")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Final Results:")," ",(0,l.kt)("inlineCode",{parentName:"p"},"[ [2,0,1], [1,2,0], [1,0,2] ]")),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},"Lennon got ",(0,l.kt)("inlineCode",{parentName:"li"},"2*0 + 1*0 + 2*1")," = 2 points"),(0,l.kt)("li",{parentName:"ul"},"Hendrix got ",(0,l.kt)("inlineCode",{parentName:"li"},"0*1 + 1*2 + 2*0")," = 2 points"),(0,l.kt)("li",{parentName:"ul"},"Joplin got ",(0,l.kt)("inlineCode",{parentName:"li"},"0*1 + 1*0 + 2*2")," = 4 points"),(0,l.kt)("li",{parentName:"ul"},"Participation is 3 votes: ",(0,l.kt)("inlineCode",{parentName:"li"},"[2+0+1] || [1+2+0] || [1+0+2]"))),(0,l.kt)("hr",null),(0,l.kt)("h2",{id:"more-examples"},"More Examples"),(0,l.kt)("h3",{id:"rate-a-product"},"Rate a product"),(0,l.kt)("p",null,"Give a value from 0-5 to a product"),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},"Vote Envelopes: ",(0,l.kt)("inlineCode",{parentName:"li"},"[2]")," ",(0,l.kt)("inlineCode",{parentName:"li"},"[5]")," ",(0,l.kt)("inlineCode",{parentName:"li"},"[2]")),(0,l.kt)("li",{parentName:"ul"},"Results: [ ","[0,0,2,0,0,1]"," ]"),(0,l.kt)("li",{parentName:"ul"},"Two users have given 2 stars"),(0,l.kt)("li",{parentName:"ul"},"One user have given 5 stars")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Parameters")),(0,l.kt)("table",null,(0,l.kt)("thead",{parentName:"table"},(0,l.kt)("tr",{parentName:"thead"},(0,l.kt)("th",{parentName:"tr",align:null},"maxCount"),(0,l.kt)("th",{parentName:"tr",align:null},"minValue"),(0,l.kt)("th",{parentName:"tr",align:null},"maxValue"),(0,l.kt)("th",{parentName:"tr",align:null},"minTotalCost"),(0,l.kt)("th",{parentName:"tr",align:null},"maxTotalCost"),(0,l.kt)("th",{parentName:"tr",align:null},"costExponent"),(0,l.kt)("th",{parentName:"tr",align:null},"uniqueValues"))),(0,l.kt)("tbody",{parentName:"table"},(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:null},"1"),(0,l.kt)("td",{parentName:"tr",align:null},"0"),(0,l.kt)("td",{parentName:"tr",align:null},"5"),(0,l.kt)("td",{parentName:"tr",align:null},"-"),(0,l.kt)("td",{parentName:"tr",align:null},"-"),(0,l.kt)("td",{parentName:"tr",align:null},"-"),(0,l.kt)("td",{parentName:"tr",align:null},"No")))),(0,l.kt)("h3",{id:"rate-3-candidates"},"Rate 3 candidates"),(0,l.kt)("p",null,"Lennon, Hendrix, Joplin \u21d2 0, 1, 2"),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},"Vote Envelope: ",(0,l.kt)("inlineCode",{parentName:"li"},"[2,1,2]")," ",(0,l.kt)("inlineCode",{parentName:"li"},"[0,1,2]")," ",(0,l.kt)("inlineCode",{parentName:"li"},"[0,0,0]")),(0,l.kt)("li",{parentName:"ul"},"Results: ",(0,l.kt)("inlineCode",{parentName:"li"},"[ [2,0,1], [1,2,0], [1,0,2] ]")),(0,l.kt)("li",{parentName:"ul"},"Lennon got ",(0,l.kt)("inlineCode",{parentName:"li"},"2*0 + 0*1 + 1*2")," = 2 points"),(0,l.kt)("li",{parentName:"ul"},"Hendrix got ",(0,l.kt)("inlineCode",{parentName:"li"},"1*0 + 2*1 + 0*2")," = 2 points"),(0,l.kt)("li",{parentName:"ul"},"Joplin got ",(0,l.kt)("inlineCode",{parentName:"li"},"1*0 + 0*1 + 2*2")," = 4 points")),(0,l.kt)("table",null,(0,l.kt)("thead",{parentName:"table"},(0,l.kt)("tr",{parentName:"thead"},(0,l.kt)("th",{parentName:"tr",align:null},"maxCount"),(0,l.kt)("th",{parentName:"tr",align:null},"minValue"),(0,l.kt)("th",{parentName:"tr",align:null},"maxValue"),(0,l.kt)("th",{parentName:"tr",align:null},"minTotalCost"),(0,l.kt)("th",{parentName:"tr",align:null},"maxTotalCost"),(0,l.kt)("th",{parentName:"tr",align:null},"costExponent"),(0,l.kt)("th",{parentName:"tr",align:null},"uniqueValues"))),(0,l.kt)("tbody",{parentName:"table"},(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:null},"3"),(0,l.kt)("td",{parentName:"tr",align:null},"0"),(0,l.kt)("td",{parentName:"tr",align:null},"2"),(0,l.kt)("td",{parentName:"tr",align:null},"-"),(0,l.kt)("td",{parentName:"tr",align:null},"-"),(0,l.kt)("td",{parentName:"tr",align:null},"-"),(0,l.kt)("td",{parentName:"tr",align:null},"Yes")))),(0,l.kt)("h3",{id:"single-choice"},"Single choice"),(0,l.kt)("p",null,"How do you feel today? Choose 1 out of 3 possible options: Bad, Good, Amazing"),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},"Vote Envelopes: ",(0,l.kt)("inlineCode",{parentName:"li"},"[0,1,0]")," ",(0,l.kt)("inlineCode",{parentName:"li"},"[0,1,0]")," ",(0,l.kt)("inlineCode",{parentName:"li"},"[0,0,1]")),(0,l.kt)("li",{parentName:"ul"},"Results: ",(0,l.kt)("inlineCode",{parentName:"li"},"[ [3,0,0], [1,2,0], [2,1,0] ]")),(0,l.kt)("li",{parentName:"ul"},"Bad: ",(0,l.kt)("inlineCode",{parentName:"li"},"0*3 + 1*0 + 2*0")," = 0"),(0,l.kt)("li",{parentName:"ul"},"Good: ",(0,l.kt)("inlineCode",{parentName:"li"},"0*1 + 1*2 + 2*0")," = 2"),(0,l.kt)("li",{parentName:"ul"},"Amazing: ",(0,l.kt)("inlineCode",{parentName:"li"},"0*2 + 1*1 + 2*0")," = 1")),(0,l.kt)("table",null,(0,l.kt)("thead",{parentName:"table"},(0,l.kt)("tr",{parentName:"thead"},(0,l.kt)("th",{parentName:"tr",align:null},"maxCount"),(0,l.kt)("th",{parentName:"tr",align:null},"minValue"),(0,l.kt)("th",{parentName:"tr",align:null},"maxValue"),(0,l.kt)("th",{parentName:"tr",align:null},"minTotalCost"),(0,l.kt)("th",{parentName:"tr",align:null},"maxTotalCost"),(0,l.kt)("th",{parentName:"tr",align:null},"costExponent"),(0,l.kt)("th",{parentName:"tr",align:null},"uniqueValues"))),(0,l.kt)("tbody",{parentName:"table"},(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:null},"3"),(0,l.kt)("td",{parentName:"tr",align:null},"0"),(0,l.kt)("td",{parentName:"tr",align:null},"1"),(0,l.kt)("td",{parentName:"tr",align:null},"1"),(0,l.kt)("td",{parentName:"tr",align:null},"1"),(0,l.kt)("td",{parentName:"tr",align:null},"-"),(0,l.kt)("td",{parentName:"tr",align:null},"No")))),(0,l.kt)("h3",{id:"multiple-choice"},"Multiple choice"),(0,l.kt)("p",null,"Choose your 3 favorite colours out of 5: green:0, blue:1, pink:2, orange:3, black:4"),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},"Vote Envelope: ",(0,l.kt)("inlineCode",{parentName:"li"},"[1,1,1,0,0]")," ",(0,l.kt)("inlineCode",{parentName:"li"},"[0,1,1,1,0]")," ",(0,l.kt)("inlineCode",{parentName:"li"},"[1,1,1,0,0]")),(0,l.kt)("li",{parentName:"ul"},"Results: ",(0,l.kt)("inlineCode",{parentName:"li"},"[ [1, 2], [0, 3], [0, 3], [2, 1], [3, 0] ]")),(0,l.kt)("li",{parentName:"ul"},"green: ",(0,l.kt)("inlineCode",{parentName:"li"},"0*1 + 2*1")," = 2"),(0,l.kt)("li",{parentName:"ul"},"blue: ",(0,l.kt)("inlineCode",{parentName:"li"},"0*0 + 1*3")," = 3"),(0,l.kt)("li",{parentName:"ul"},"pink: ",(0,l.kt)("inlineCode",{parentName:"li"},"0*0 + 1*3")," = 3"),(0,l.kt)("li",{parentName:"ul"},"orange: ",(0,l.kt)("inlineCode",{parentName:"li"},"0*2 + 1*1")," = 1"),(0,l.kt)("li",{parentName:"ul"},"black: ",(0,l.kt)("inlineCode",{parentName:"li"},"0*3 + 0*1")," = 0")),(0,l.kt)("table",null,(0,l.kt)("thead",{parentName:"table"},(0,l.kt)("tr",{parentName:"thead"},(0,l.kt)("th",{parentName:"tr",align:null},"maxCount"),(0,l.kt)("th",{parentName:"tr",align:null},"minValue"),(0,l.kt)("th",{parentName:"tr",align:null},"maxValue"),(0,l.kt)("th",{parentName:"tr",align:null},"minTotalCost"),(0,l.kt)("th",{parentName:"tr",align:null},"maxTotalCost"),(0,l.kt)("th",{parentName:"tr",align:null},"costExponent"),(0,l.kt)("th",{parentName:"tr",align:null},"uniqueValues"))),(0,l.kt)("tbody",{parentName:"table"},(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:null},"5"),(0,l.kt)("td",{parentName:"tr",align:null},"0"),(0,l.kt)("td",{parentName:"tr",align:null},"1"),(0,l.kt)("td",{parentName:"tr",align:null},"3"),(0,l.kt)("td",{parentName:"tr",align:null},"3"),(0,l.kt)("td",{parentName:"tr",align:null},"-"),(0,l.kt)("td",{parentName:"tr",align:null},"No")))),(0,l.kt)("h3",{id:"linear-weighted-choice"},"Linear Weighted choice"),(0,l.kt)("p",null,"Sort your 5 favorite blockchains: Bitcoin: 0, Ethereum: 1, Monero: 2, Zcash: 3, Polkadot: 4."),(0,l.kt)("p",null,"Your first option gets 4 points,... the last 0 points."),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},"Vote Envelope: ",(0,l.kt)("inlineCode",{parentName:"li"},"[0,3,1,4,2]")," ",(0,l.kt)("inlineCode",{parentName:"li"},"[3,0,1,4,2]")," ",(0,l.kt)("inlineCode",{parentName:"li"},"[1,2,3,4,0]")),(0,l.kt)("li",{parentName:"ul"},"Results;",(0,l.kt)("inlineCode",{parentName:"li"},"[ [1,1,0,1,0], [1,0,1,1,0], [0,2,1,0,0], [0,0,0,0,3], [1,0,2,0,0] ]")),(0,l.kt)("li",{parentName:"ul"},"Bitcoin: ",(0,l.kt)("inlineCode",{parentName:"li"},"0*1 + 1*1 + 2*0 + 3*1 + 0*4")," = 4"),(0,l.kt)("li",{parentName:"ul"},"Ethereum: ",(0,l.kt)("inlineCode",{parentName:"li"},"0*1 + 1*0 + 2*1 + 3*1 + 0*4")," = 5"),(0,l.kt)("li",{parentName:"ul"},"Monero: ",(0,l.kt)("inlineCode",{parentName:"li"},"0*1 + 1*2 + 2*1 + 3*0 + 4*0")," = 6"),(0,l.kt)("li",{parentName:"ul"},"Zcash: ",(0,l.kt)("inlineCode",{parentName:"li"},"0*0 + 1*0 + 2*0 + 3*0 + 4*3")," = 12"),(0,l.kt)("li",{parentName:"ul"},"Polkadot: ",(0,l.kt)("inlineCode",{parentName:"li"},"0*1 + 1*0 + 2*2 + 3*0 + 4*0")," = 4")),(0,l.kt)("table",null,(0,l.kt)("thead",{parentName:"table"},(0,l.kt)("tr",{parentName:"thead"},(0,l.kt)("th",{parentName:"tr",align:null},"maxCount"),(0,l.kt)("th",{parentName:"tr",align:null},"minValue"),(0,l.kt)("th",{parentName:"tr",align:null},"maxValue"),(0,l.kt)("th",{parentName:"tr",align:null},"minTotalCost"),(0,l.kt)("th",{parentName:"tr",align:null},"maxTotalCost"),(0,l.kt)("th",{parentName:"tr",align:null},"costExponent"),(0,l.kt)("th",{parentName:"tr",align:null},"uniqueValues"))),(0,l.kt)("tbody",{parentName:"table"},(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:null},"5"),(0,l.kt)("td",{parentName:"tr",align:null},"0"),(0,l.kt)("td",{parentName:"tr",align:null},"4"),(0,l.kt)("td",{parentName:"tr",align:null},"-"),(0,l.kt)("td",{parentName:"tr",align:null},"-"),(0,l.kt)("td",{parentName:"tr",align:null},"-"),(0,l.kt)("td",{parentName:"tr",align:null},"Yes")))),(0,l.kt)("h3",{id:"quadratic-voting"},"Quadratic voting"),(0,l.kt)("p",null,"You might distribute 12 credits among 4 NGOs. You can give as many tokens as you wish to a single option, but the cost\nraises exponentially with each additional token added to an option."),(0,l.kt)("p",null,"NGOs are: greenpeace:0, redcross:1, msf:2, amnesty:3"),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},"Vote Envelopes: ",(0,l.kt)("inlineCode",{parentName:"li"},"[2,2,2,0]")," ",(0,l.kt)("inlineCode",{parentName:"li"},"[1,1,2,2]")," ",(0,l.kt)("inlineCode",{parentName:"li"},"[0,3,1,1]"))),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre"},"Cost exponent calculations:\n\n [2, 2, 2, 0]\nenvelope 1 calculation: 2^2 + 2^2 + 2^2 + 0^2\n = 4 + 4 + 4 + 0 = 12 credits\n\n [1, 1, 2, 2]\nenvelope 2 calculation: 1^2 + 1^2 + 2^2 + 2^2\n = 1 + 1 + 4 + 4 = 10 credits\n\n [0, 3, 1, 1]\nenvelope 3 calculation: 0^2 + 3^2 + 1^2 + 1^2\n = 0 + 9 + 1 + 1 = 11 credits\n")),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},"Results: ",(0,l.kt)("inlineCode",{parentName:"li"},"[ [1,1,1,0], [0,1,1,1], [0,1,2,0], [1,1,1,0] ]")),(0,l.kt)("li",{parentName:"ul"},"greenpeace: ",(0,l.kt)("inlineCode",{parentName:"li"},"0*1 + 1*1 + 2*1 + 3*0")," = 3"),(0,l.kt)("li",{parentName:"ul"},"redcross: ",(0,l.kt)("inlineCode",{parentName:"li"},"0*0 + 1*1 + 2*1 + 3*1")," = 6"),(0,l.kt)("li",{parentName:"ul"},"msf: ",(0,l.kt)("inlineCode",{parentName:"li"},"0*0 + 1*1 + 2*2 + 3*0")," = 5"),(0,l.kt)("li",{parentName:"ul"},"amnesty: ",(0,l.kt)("inlineCode",{parentName:"li"},"0*1 + 1*1 + 2*1 + 3*0")," = 3")),(0,l.kt)("table",null,(0,l.kt)("thead",{parentName:"table"},(0,l.kt)("tr",{parentName:"thead"},(0,l.kt)("th",{parentName:"tr",align:null},"maxCount"),(0,l.kt)("th",{parentName:"tr",align:null},"minValue"),(0,l.kt)("th",{parentName:"tr",align:null},"maxValue"),(0,l.kt)("th",{parentName:"tr",align:null},"minTotalCost"),(0,l.kt)("th",{parentName:"tr",align:null},"maxTotalCost"),(0,l.kt)("th",{parentName:"tr",align:null},"costExponent"),(0,l.kt)("th",{parentName:"tr",align:null},"uniqueValues"))),(0,l.kt)("tbody",{parentName:"table"},(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:null},"4"),(0,l.kt)("td",{parentName:"tr",align:null},"0"),(0,l.kt)("td",{parentName:"tr",align:null},"-"),(0,l.kt)("td",{parentName:"tr",align:null},"0"),(0,l.kt)("td",{parentName:"tr",align:null},"12"),(0,l.kt)("td",{parentName:"tr",align:null},"2"),(0,l.kt)("td",{parentName:"tr",align:null},"No")))),(0,l.kt)("h3",{id:"multiquestion"},"Multiquestion"),(0,l.kt)("p",null,"This mode requires a different way of interpreting the results, since each position of the results array is not multiplied by its index."),(0,l.kt)("p",null,"3 positions (CEO, COO, CFO), 5 candidates"),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},"Ballots: ",(0,l.kt)("inlineCode",{parentName:"li"},"[4,3,2]")," ",(0,l.kt)("inlineCode",{parentName:"li"},"[4,2,3]")," ",(0,l.kt)("inlineCode",{parentName:"li"},"[0,1,4]")),(0,l.kt)("li",{parentName:"ul"},"Results: ",(0,l.kt)("inlineCode",{parentName:"li"},"[ [1,0,0,0,2], [0,1,1,1,0], [0,0,1,1,1] ]")),(0,l.kt)("li",{parentName:"ul"},"CEO: candidate0:1 candidate4:2"),(0,l.kt)("li",{parentName:"ul"},"COO: candidate1:1 candidate2:1 candidate3:1"),(0,l.kt)("li",{parentName:"ul"},"CFO: candidate2:1 candidate3:1 candidate4:1")),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre"},"Vote Envelopes: [4,3,2] [4,2,3] [0,1,4]\n\n CEO COO CFO\nOption A results: [ [1, 0, 0, 0, 2], [0, 1, 1, 1, 0], [0, 0, 1, 1, 1] ]\n\nCandidate 5 has won the CEO position, whereas COO is tied between candidates 2, 3, and 4, and CFO is tied between candidates 3, 4, and 5.\n\n")),(0,l.kt)("table",null,(0,l.kt)("thead",{parentName:"table"},(0,l.kt)("tr",{parentName:"thead"},(0,l.kt)("th",{parentName:"tr",align:null},"maxCount"),(0,l.kt)("th",{parentName:"tr",align:null},"minValue"),(0,l.kt)("th",{parentName:"tr",align:null},"maxValue"),(0,l.kt)("th",{parentName:"tr",align:null},"minTotalCost"),(0,l.kt)("th",{parentName:"tr",align:null},"maxTotalCost"),(0,l.kt)("th",{parentName:"tr",align:null},"costExponent"),(0,l.kt)("th",{parentName:"tr",align:null},"uniqueValues"))),(0,l.kt)("tbody",{parentName:"table"},(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:null},"3"),(0,l.kt)("td",{parentName:"tr",align:null},"0"),(0,l.kt)("td",{parentName:"tr",align:null},"4"),(0,l.kt)("td",{parentName:"tr",align:null},"-"),(0,l.kt)("td",{parentName:"tr",align:null},"-"),(0,l.kt)("td",{parentName:"tr",align:null},"-"),(0,l.kt)("td",{parentName:"tr",align:null},"No")))),(0,l.kt)("hr",null),(0,l.kt)("h2",{id:"vocdoni-results-interpretation"},"Vocdoni results interpretation"),(0,l.kt)("p",null,"Results interpretation is not part of the ballot protocol, but it informs how the protocol should be understood and displayed. The Process Metadata has a couple of flags describing the expected interpretation."),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-json"},' "results": {\n "aggregation": "index-weighted", // "index-weighted" | "discrete-counting",\n "display": "rating" // "rating" | "simple-question" | "multiple-choice" | "linear-weighted" | "quadratic-voting" | "multiple-question" | "raw"\n }\n')),(0,l.kt)("p",null,"The results provided by the scrutinizer contain a preliminary aggregation in a 2-dimensional matrix, where the final step needs to be completed by UI clients, depending on ",(0,l.kt)("inlineCode",{parentName:"p"},"results.aggregation"),"."),(0,l.kt)("h3",{id:"single-question"},"Single question"),(0,l.kt)("p",null,"Index-weighted: each option's value is multiplied by its position index, then summed."),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-json"},"[ [1,0,1], [2,0,0], [0,1,1] ] => [0*1+1*0+2*1], [0*2+1*0+2*0], [0*1+1*1+2*1] => [2,0,3]\noption1: 2 votes\noption2: 0 votes\noption3: 3 votes\n")),(0,l.kt)("p",null,"This interpretation suits any case with extended features, such as multiple choice, quadratic voting, linear-weighted, etc. This is because it is able to weigh multiple possible values for a single field."),(0,l.kt)("p",null,(0,l.kt)("img",{parentName:"p",src:"https://blog.vocdoni.io/_next/image?url=https%3A%2F%2Fstorage.googleapis.com%2Fpapyrus_images%2F345a07aee1ddf6a6aad51db7e58fd399.png&w=1920&q=75",alt:"https://blog.vocdoni.io/_next/image?url=https%3A%2F%2Fstorage.googleapis.com%2Fpapyrus_images%2F345a07aee1ddf6a6aad51db7e58fd399.png&w=1920&q=75"})),(0,l.kt)("h3",{id:"multi-question"},"Multi question"),(0,l.kt)("p",null,"Discrete values: field values are just counted (weight = 1)"),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-json"},"[ [1,2,0], [0,1,2], [1,1,1] ] => [ [question1], [question2], [question3] ]\nfield1: candidate0: 1 vote, candidate1: 2 votes, candidate 3: 0 votes\nfield2: candidate0: 0 votes, candidate1: 1 vote, candidate 2: 2 votes\nfield2: candidate0: 1 vote, candidate1: 1 vote, candidate 2: 1 vote\n")),(0,l.kt)("p",null,"As this format can only accept binary (yes/no) input for each option, it is only available for use with a basic set of features (multi-question, single-choice)"),(0,l.kt)("p",null,(0,l.kt)("img",{parentName:"p",src:"https://blog.vocdoni.io/_next/image?url=https%3A%2F%2Fstorage.googleapis.com%2Fpapyrus_images%2F97e8bca257a9b118b86ee3dd31165107.png&w=1920&q=75",alt:"https://blog.vocdoni.io/_next/image?url=https%3A%2F%2Fstorage.googleapis.com%2Fpapyrus_images%2F97e8bca257a9b118b86ee3dd31165107.png&w=1920&q=75"})))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/4f32f676.5a88cbbe.js b/assets/js/4f32f676.5a88cbbe.js new file mode 100644 index 000000000..8671b78ff --- /dev/null +++ b/assets/js/4f32f676.5a88cbbe.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkdemo=self.webpackChunkdemo||[]).push([[1187],{3905:(e,t,a)=>{a.d(t,{Zo:()=>s,kt:()=>k});var n=a(67294);function l(e,t,a){return t in e?Object.defineProperty(e,t,{value:a,enumerable:!0,configurable:!0,writable:!0}):e[t]=a,e}function i(e,t){var a=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),a.push.apply(a,n)}return a}function r(e){for(var t=1;t=0||(l[a]=e[a]);return l}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(n=0;n=0||Object.prototype.propertyIsEnumerable.call(e,a)&&(l[a]=e[a])}return l}var p=n.createContext({}),u=function(e){var t=n.useContext(p),a=t;return e&&(a="function"==typeof e?e(t):r(r({},t),e)),a},s=function(e){var t=u(e.components);return n.createElement(p.Provider,{value:t},e.children)},m={inlineCode:"code",wrapper:function(e){var t=e.children;return n.createElement(n.Fragment,{},t)}},d=n.forwardRef((function(e,t){var a=e.components,l=e.mdxType,i=e.originalType,p=e.parentName,s=o(e,["components","mdxType","originalType","parentName"]),d=u(a),k=l,c=d["".concat(p,".").concat(k)]||d[k]||m[k]||i;return a?n.createElement(c,r(r({ref:t},s),{},{components:a})):n.createElement(c,r({ref:t},s))}));function k(e,t){var a=arguments,l=t&&t.mdxType;if("string"==typeof e||l){var i=a.length,r=new Array(i);r[0]=d;var o={};for(var p in t)hasOwnProperty.call(t,p)&&(o[p]=t[p]);o.originalType=e,o.mdxType="string"==typeof e?e:l,r[1]=o;for(var u=2;u{a.r(t),a.d(t,{assets:()=>p,contentTitle:()=>r,default:()=>m,frontMatter:()=>i,metadata:()=>o,toc:()=>u});var n=a(87462),l=(a(67294),a(3905));const i={description:"Ballot protocol"},r="Ballot Protocol",o={unversionedId:"protocol/ballot-protocol",id:"protocol/ballot-protocol",title:"Ballot Protocol",description:"Ballot protocol",source:"@site/docs/protocol/ballot-protocol.md",sourceDirName:"protocol",slug:"/protocol/ballot-protocol",permalink:"/protocol/ballot-protocol",draft:!1,tags:[],version:"current",frontMatter:{description:"Ballot protocol"},sidebar:"defaultSidebar",previous:{title:"Off-Chain Tree ZK Census Proof",permalink:"/protocol/anonymity/zk-census-proof"},next:{title:"The Census",permalink:"/protocol/census/"}},p={},u=[{value:"Results and example",id:"results-and-example",level:2},{value:"Example",id:"example",level:3},{value:"More Examples",id:"more-examples",level:2},{value:"Rate a product",id:"rate-a-product",level:3},{value:"Rate 3 candidates",id:"rate-3-candidates",level:3},{value:"Single choice",id:"single-choice",level:3},{value:"Multiple choice",id:"multiple-choice",level:3},{value:"Linear Weighted choice",id:"linear-weighted-choice",level:3},{value:"Quadratic voting",id:"quadratic-voting",level:3},{value:"Multiquestion",id:"multiquestion",level:3},{value:"Vocdoni results interpretation",id:"vocdoni-results-interpretation",level:2},{value:"Single question",id:"single-question",level:3},{value:"Multi question",id:"multi-question",level:3}],s={toc:u};function m(e){let{components:t,...a}=e;return(0,l.kt)("wrapper",(0,n.Z)({},s,a,{components:t,mdxType:"MDXLayout"}),(0,l.kt)("h1",{id:"ballot-protocol"},"Ballot Protocol"),(0,l.kt)("p",null,"The Vocdoni Ballot Protocol aims to be a very simple yet powerful specification for the representation of ballots and results for a voting process."),(0,l.kt)("p",null,"A ",(0,l.kt)("strong",{parentName:"p"},(0,l.kt)("em",{parentName:"strong"},"voting process"))," is made out of one or more ",(0,l.kt)("strong",{parentName:"p"},(0,l.kt)("em",{parentName:"strong"},"fields")),", each of which represents a single question or an option for a question, depending on the ",(0,l.kt)("strong",{parentName:"p"},(0,l.kt)("em",{parentName:"strong"},"type of process")),". When voting, eligible voters choose from a set of predefined ",(0,l.kt)("strong",{parentName:"p"},(0,l.kt)("em",{parentName:"strong"},"answers"))," for each field. The allowed number of answers, type of answer, etc. also depend on the specific type of process. An eligible voter expresses their choices by casting a ",(0,l.kt)("strong",{parentName:"p"},(0,l.kt)("em",{parentName:"strong"},"ballot")),"."),(0,l.kt)("p",null,"A ballot is represented as an array (or list) of natural numbers. Each position of the array contains an answer to one of the process' fields."),(0,l.kt)("p",null,"Results are accumulated in a two-dimension array of natural numbers (a matrix). Each row of this matrix corresponds to a ballot field, and each column corresponds to one of the possible values for that field. Any number in the results matrix is simply a count of the votes for the value represented at that index."),(0,l.kt)("p",null,(0,l.kt)("em",{parentName:"p"},"A more thorough introduction is available on ",(0,l.kt)("a",{parentName:"em",href:"https://blog.vocdoni.io/vocdoni-ballot-protocol/"},"our blog"),".")),(0,l.kt)("p",null,(0,l.kt)("img",{parentName:"p",src:"https://blog.vocdoni.io/_next/image?url=https%3A%2F%2Fstorage.googleapis.com%2Fpapyrus_images%2F47fc7647a24d815d609ad569c4456e39.png&w=1920&q=75",alt:"https://blog.vocdoni.io/_next/image?url=https%3A%2F%2Fstorage.googleapis.com%2Fpapyrus_images%2F47fc7647a24d815d609ad569c4456e39.png&w=1920&q=75"})),(0,l.kt)("p",null,"The protocol is composed by a set of numeric and boolean variables that restrict the format of the ballot. They are defined in the Process Parameters."),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("inlineCode",{parentName:"li"},"uint8 maxCount"),"\nMax number of fields per ballot. 1 <= maxCount <= 100."),(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("inlineCode",{parentName:"li"},"uint8 maxValue"),"\nDetermines the acceptable maximum value for all fields. If ",(0,l.kt)("inlineCode",{parentName:"li"},"maxValue")," is set to ",(0,l.kt)("inlineCode",{parentName:"li"},"0"),", the results are aggregated."),(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("inlineCode",{parentName:"li"},"uint8 minValue"),"\nDetermines the acceptable minimum value for all fields."),(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("inlineCode",{parentName:"li"},"bool uniqueValues"),"\nChoices for a question cannot appear twice or more"),(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("inlineCode",{parentName:"li"},"uint16 maxTotalCost"),"\nMaximum limit on the total sum of all ballot fields' values (if applicable).\n0 => No limit / Not applicable."),(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("inlineCode",{parentName:"li"},"uint16 minTotalCost"),"\nMinimum limit on the total sum of all ballot fields' values (if applicable).\n0 => No limit / Not applicable."),(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("inlineCode",{parentName:"li"},"uint16 costExponent"),'\nThe exponent that will be used to compute the "cost" of the field values.'),(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("inlineCode",{parentName:"li"},"totalCost = \u03a3 (value[i] ^ costExponent) <= maxTotalCost")),(0,l.kt)("li",{parentName:"ul"},(0,l.kt)("inlineCode",{parentName:"li"},"costExponent")," is represented as ",(0,l.kt)("inlineCode",{parentName:"li"},"exp * 10000")," so:"),(0,l.kt)("li",{parentName:"ul"},"0 => 0.0000"),(0,l.kt)("li",{parentName:"ul"},"10000 => 1.0000"),(0,l.kt)("li",{parentName:"ul"},"65535 => 6.5535")),(0,l.kt)("p",null,(0,l.kt)("img",{parentName:"p",src:"https://blog.vocdoni.io/_next/image?url=https%3A%2F%2Fstorage.googleapis.com%2Fpapyrus_images%2Fb8d920f2d64cf347ff2f47f7e34a3340.png&w=1920&q=75",alt:"https://blog.vocdoni.io/_next/image?url=https%3A%2F%2Fstorage.googleapis.com%2Fpapyrus_images%2Fb8d920f2d64cf347ff2f47f7e34a3340.png&w=1920&q=75"})),(0,l.kt)("hr",null),(0,l.kt)("h2",{id:"results-and-example"},"Results and example"),(0,l.kt)("p",null,"The result is represented as a matrix of natural numbers. Let's take this JSON example:"),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-json"},"[\n [1,2,3], // in field 1: value 0 got 1 vote, value 1 got 2, value 2 got 3\n [1,4,2], // in field 2: value 0 got 1 vote, value 1 got 4, value 2 got 2\n [0,1,0] // in field 3: value 0 got 0 vote, value 1 got 1, value 2 got 0\n]\n")),(0,l.kt)("p",null,"Each row of the matrix represents a field, there are three fields:\n",(0,l.kt)("inlineCode",{parentName:"p"},"[ [First field], [Second field], [Third field] ]")),(0,l.kt)("p",null,"The ballot protocol does not cover interpretation. However, a very common interpretation would be to consider each field as the multiplier (weight) equal to its position."),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},"First question ","[1,2,3]"," = ",(0,l.kt)("inlineCode",{parentName:"li"},"0*1 + 1*2 + 2*3")," = ",(0,l.kt)("inlineCode",{parentName:"li"},"0 + 2 + 6")," = 8"),(0,l.kt)("li",{parentName:"ul"},"Second question ","[0,4,2]"," = ",(0,l.kt)("inlineCode",{parentName:"li"},"0*0 + 1*4 + 2*2")," = 8"),(0,l.kt)("li",{parentName:"ul"},"Third question ","[5,1,0]"," = ",(0,l.kt)("inlineCode",{parentName:"li"},"0*5 + 1*1 + 2*0")," = 1")),(0,l.kt)("p",null,"6 votes have been cast."),(0,l.kt)("h3",{id:"example"},"Example"),(0,l.kt)("p",null,"Lets see an example with ",(0,l.kt)("inlineCode",{parentName:"p"},"maxCount=3")," and ",(0,l.kt)("inlineCode",{parentName:"p"},"maxValue=5")),(0,l.kt)("p",null,"The human-friendly question would be: ",(0,l.kt)("em",{parentName:"p"},"Rate these 3 candidates to the best rock music player of the 20th century, from 0 to 5 stars.")),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},"Lennon is the candidate 0, so question 0"),(0,l.kt)("li",{parentName:"ul"},"Hendrix is the candidate 1, so question 1"),(0,l.kt)("li",{parentName:"ul"},"Joplin is the candidate 2, so question 2")),(0,l.kt)("p",null,"Let's start, currently there are no votes cast:"),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Results:")," Lennon:","[0,0,0]"," Hendrix:","[0,0,0]"," Joplin:","[0,0,0]"),(0,l.kt)("p",null,"New vote ","[2,1,2]"," =>"),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},"give 2 points to candidate 0"),(0,l.kt)("li",{parentName:"ul"},"give 1 point to candidate 1"),(0,l.kt)("li",{parentName:"ul"},"give 2 points to candidate 2")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Results:")," Lennon:","[0,0,1]"," Hendrix:","[0,1,0]"," Joplin:","[0,0,1]"),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},"candidate 0 = 2 points (1\xb72)"),(0,l.kt)("li",{parentName:"ul"},"candidate 1 = 1 point (1\xb71)"),(0,l.kt)("li",{parentName:"ul"},"candidate 2 = 2 points (1\xb72)")),(0,l.kt)("p",null,"New vote ","[0,1,2]"," =>"),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},"give 0 points to candidate 0"),(0,l.kt)("li",{parentName:"ul"},"give 1 point to candidate 1"),(0,l.kt)("li",{parentName:"ul"},"give 2 points to candidate 2")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Results:")," Lennon:","[1,0,1]"," Hendrix:","[0,2,0]"," Joplin:","[0,0,2]"),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},"candidate 0 = 2 points"),(0,l.kt)("li",{parentName:"ul"},"candidate 1 = 2 point"),(0,l.kt)("li",{parentName:"ul"},"candidate 2 = 4 points")),(0,l.kt)("p",null,"New vote ","[0,0,0]"," =>"),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},"give 0 points to candidate 0"),(0,l.kt)("li",{parentName:"ul"},"give 0 points to candidate 1"),(0,l.kt)("li",{parentName:"ul"},"give 0 points to candidate 2")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Results:")," Lennon:","[2,0,1]"," Hendrix:","[1,2,0]"," Joplin:","[1,0,2]"),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},"candidate 0 = 2 points"),(0,l.kt)("li",{parentName:"ul"},"candidate 1 = 2 point"),(0,l.kt)("li",{parentName:"ul"},"candidate 2 = 4 points")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Final Results:")," ",(0,l.kt)("inlineCode",{parentName:"p"},"[ [2,0,1], [1,2,0], [1,0,2] ]")),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},"Lennon got ",(0,l.kt)("inlineCode",{parentName:"li"},"2*0 + 1*0 + 2*1")," = 2 points"),(0,l.kt)("li",{parentName:"ul"},"Hendrix got ",(0,l.kt)("inlineCode",{parentName:"li"},"0*1 + 1*2 + 2*0")," = 2 points"),(0,l.kt)("li",{parentName:"ul"},"Joplin got ",(0,l.kt)("inlineCode",{parentName:"li"},"0*1 + 1*0 + 2*2")," = 4 points"),(0,l.kt)("li",{parentName:"ul"},"Participation is 3 votes: ",(0,l.kt)("inlineCode",{parentName:"li"},"[2+0+1] || [1+2+0] || [1+0+2]"))),(0,l.kt)("hr",null),(0,l.kt)("h2",{id:"more-examples"},"More Examples"),(0,l.kt)("h3",{id:"rate-a-product"},"Rate a product"),(0,l.kt)("p",null,"Give a value from 0-5 to a product"),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},"Vote Envelopes: ",(0,l.kt)("inlineCode",{parentName:"li"},"[2]")," ",(0,l.kt)("inlineCode",{parentName:"li"},"[5]")," ",(0,l.kt)("inlineCode",{parentName:"li"},"[2]")),(0,l.kt)("li",{parentName:"ul"},"Results: [ ","[0,0,2,0,0,1]"," ]"),(0,l.kt)("li",{parentName:"ul"},"Two users have given 2 stars"),(0,l.kt)("li",{parentName:"ul"},"One user have given 5 stars")),(0,l.kt)("p",null,(0,l.kt)("strong",{parentName:"p"},"Parameters")),(0,l.kt)("table",null,(0,l.kt)("thead",{parentName:"table"},(0,l.kt)("tr",{parentName:"thead"},(0,l.kt)("th",{parentName:"tr",align:null},"maxCount"),(0,l.kt)("th",{parentName:"tr",align:null},"minValue"),(0,l.kt)("th",{parentName:"tr",align:null},"maxValue"),(0,l.kt)("th",{parentName:"tr",align:null},"minTotalCost"),(0,l.kt)("th",{parentName:"tr",align:null},"maxTotalCost"),(0,l.kt)("th",{parentName:"tr",align:null},"costExponent"),(0,l.kt)("th",{parentName:"tr",align:null},"uniqueValues"))),(0,l.kt)("tbody",{parentName:"table"},(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:null},"1"),(0,l.kt)("td",{parentName:"tr",align:null},"0"),(0,l.kt)("td",{parentName:"tr",align:null},"5"),(0,l.kt)("td",{parentName:"tr",align:null},"-"),(0,l.kt)("td",{parentName:"tr",align:null},"-"),(0,l.kt)("td",{parentName:"tr",align:null},"-"),(0,l.kt)("td",{parentName:"tr",align:null},"No")))),(0,l.kt)("h3",{id:"rate-3-candidates"},"Rate 3 candidates"),(0,l.kt)("p",null,"Lennon, Hendrix, Joplin \u21d2 0, 1, 2"),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},"Vote Envelope: ",(0,l.kt)("inlineCode",{parentName:"li"},"[2,1,2]")," ",(0,l.kt)("inlineCode",{parentName:"li"},"[0,1,2]")," ",(0,l.kt)("inlineCode",{parentName:"li"},"[0,0,0]")),(0,l.kt)("li",{parentName:"ul"},"Results: ",(0,l.kt)("inlineCode",{parentName:"li"},"[ [2,0,1], [1,2,0], [1,0,2] ]")),(0,l.kt)("li",{parentName:"ul"},"Lennon got ",(0,l.kt)("inlineCode",{parentName:"li"},"2*0 + 0*1 + 1*2")," = 2 points"),(0,l.kt)("li",{parentName:"ul"},"Hendrix got ",(0,l.kt)("inlineCode",{parentName:"li"},"1*0 + 2*1 + 0*2")," = 2 points"),(0,l.kt)("li",{parentName:"ul"},"Joplin got ",(0,l.kt)("inlineCode",{parentName:"li"},"1*0 + 0*1 + 2*2")," = 4 points")),(0,l.kt)("table",null,(0,l.kt)("thead",{parentName:"table"},(0,l.kt)("tr",{parentName:"thead"},(0,l.kt)("th",{parentName:"tr",align:null},"maxCount"),(0,l.kt)("th",{parentName:"tr",align:null},"minValue"),(0,l.kt)("th",{parentName:"tr",align:null},"maxValue"),(0,l.kt)("th",{parentName:"tr",align:null},"minTotalCost"),(0,l.kt)("th",{parentName:"tr",align:null},"maxTotalCost"),(0,l.kt)("th",{parentName:"tr",align:null},"costExponent"),(0,l.kt)("th",{parentName:"tr",align:null},"uniqueValues"))),(0,l.kt)("tbody",{parentName:"table"},(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:null},"3"),(0,l.kt)("td",{parentName:"tr",align:null},"0"),(0,l.kt)("td",{parentName:"tr",align:null},"2"),(0,l.kt)("td",{parentName:"tr",align:null},"-"),(0,l.kt)("td",{parentName:"tr",align:null},"-"),(0,l.kt)("td",{parentName:"tr",align:null},"-"),(0,l.kt)("td",{parentName:"tr",align:null},"Yes")))),(0,l.kt)("h3",{id:"single-choice"},"Single choice"),(0,l.kt)("p",null,"How do you feel today? Choose 1 out of 3 possible options: Bad, Good, Amazing"),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},"Vote Envelopes: ",(0,l.kt)("inlineCode",{parentName:"li"},"[0,1,0]")," ",(0,l.kt)("inlineCode",{parentName:"li"},"[0,1,0]")," ",(0,l.kt)("inlineCode",{parentName:"li"},"[0,0,1]")),(0,l.kt)("li",{parentName:"ul"},"Results: ",(0,l.kt)("inlineCode",{parentName:"li"},"[ [3,0,0], [1,2,0], [2,1,0] ]")),(0,l.kt)("li",{parentName:"ul"},"Bad: ",(0,l.kt)("inlineCode",{parentName:"li"},"0*3 + 1*0 + 2*0")," = 0"),(0,l.kt)("li",{parentName:"ul"},"Good: ",(0,l.kt)("inlineCode",{parentName:"li"},"0*1 + 1*2 + 2*0")," = 2"),(0,l.kt)("li",{parentName:"ul"},"Amazing: ",(0,l.kt)("inlineCode",{parentName:"li"},"0*2 + 1*1 + 2*0")," = 1")),(0,l.kt)("table",null,(0,l.kt)("thead",{parentName:"table"},(0,l.kt)("tr",{parentName:"thead"},(0,l.kt)("th",{parentName:"tr",align:null},"maxCount"),(0,l.kt)("th",{parentName:"tr",align:null},"minValue"),(0,l.kt)("th",{parentName:"tr",align:null},"maxValue"),(0,l.kt)("th",{parentName:"tr",align:null},"minTotalCost"),(0,l.kt)("th",{parentName:"tr",align:null},"maxTotalCost"),(0,l.kt)("th",{parentName:"tr",align:null},"costExponent"),(0,l.kt)("th",{parentName:"tr",align:null},"uniqueValues"))),(0,l.kt)("tbody",{parentName:"table"},(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:null},"3"),(0,l.kt)("td",{parentName:"tr",align:null},"0"),(0,l.kt)("td",{parentName:"tr",align:null},"1"),(0,l.kt)("td",{parentName:"tr",align:null},"1"),(0,l.kt)("td",{parentName:"tr",align:null},"1"),(0,l.kt)("td",{parentName:"tr",align:null},"-"),(0,l.kt)("td",{parentName:"tr",align:null},"No")))),(0,l.kt)("h3",{id:"multiple-choice"},"Multiple choice"),(0,l.kt)("p",null,"Choose your 3 favorite colours out of 5: green:0, blue:1, pink:2, orange:3, black:4"),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},"Vote Envelope: ",(0,l.kt)("inlineCode",{parentName:"li"},"[1,1,1,0,0]")," ",(0,l.kt)("inlineCode",{parentName:"li"},"[0,1,1,1,0]")," ",(0,l.kt)("inlineCode",{parentName:"li"},"[1,1,1,0,0]")),(0,l.kt)("li",{parentName:"ul"},"Results: ",(0,l.kt)("inlineCode",{parentName:"li"},"[ [1, 2], [0, 3], [0, 3], [2, 1], [3, 0] ]")),(0,l.kt)("li",{parentName:"ul"},"green: ",(0,l.kt)("inlineCode",{parentName:"li"},"0*1 + 2*1")," = 2"),(0,l.kt)("li",{parentName:"ul"},"blue: ",(0,l.kt)("inlineCode",{parentName:"li"},"0*0 + 1*3")," = 3"),(0,l.kt)("li",{parentName:"ul"},"pink: ",(0,l.kt)("inlineCode",{parentName:"li"},"0*0 + 1*3")," = 3"),(0,l.kt)("li",{parentName:"ul"},"orange: ",(0,l.kt)("inlineCode",{parentName:"li"},"0*2 + 1*1")," = 1"),(0,l.kt)("li",{parentName:"ul"},"black: ",(0,l.kt)("inlineCode",{parentName:"li"},"0*3 + 0*1")," = 0")),(0,l.kt)("table",null,(0,l.kt)("thead",{parentName:"table"},(0,l.kt)("tr",{parentName:"thead"},(0,l.kt)("th",{parentName:"tr",align:null},"maxCount"),(0,l.kt)("th",{parentName:"tr",align:null},"minValue"),(0,l.kt)("th",{parentName:"tr",align:null},"maxValue"),(0,l.kt)("th",{parentName:"tr",align:null},"minTotalCost"),(0,l.kt)("th",{parentName:"tr",align:null},"maxTotalCost"),(0,l.kt)("th",{parentName:"tr",align:null},"costExponent"),(0,l.kt)("th",{parentName:"tr",align:null},"uniqueValues"))),(0,l.kt)("tbody",{parentName:"table"},(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:null},"5"),(0,l.kt)("td",{parentName:"tr",align:null},"0"),(0,l.kt)("td",{parentName:"tr",align:null},"1"),(0,l.kt)("td",{parentName:"tr",align:null},"3"),(0,l.kt)("td",{parentName:"tr",align:null},"3"),(0,l.kt)("td",{parentName:"tr",align:null},"-"),(0,l.kt)("td",{parentName:"tr",align:null},"No")))),(0,l.kt)("h3",{id:"linear-weighted-choice"},"Linear Weighted choice"),(0,l.kt)("p",null,"Sort your 5 favorite blockchains: Bitcoin: 0, Ethereum: 1, Monero: 2, Zcash: 3, Polkadot: 4."),(0,l.kt)("p",null,"Your first option gets 4 points,... the last 0 points."),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},"Vote Envelope: ",(0,l.kt)("inlineCode",{parentName:"li"},"[0,3,1,4,2]")," ",(0,l.kt)("inlineCode",{parentName:"li"},"[3,0,1,4,2]")," ",(0,l.kt)("inlineCode",{parentName:"li"},"[1,2,3,4,0]")),(0,l.kt)("li",{parentName:"ul"},"Results;",(0,l.kt)("inlineCode",{parentName:"li"},"[ [1,1,0,1,0], [1,0,1,1,0], [0,2,1,0,0], [0,0,0,0,3], [1,0,2,0,0] ]")),(0,l.kt)("li",{parentName:"ul"},"Bitcoin: ",(0,l.kt)("inlineCode",{parentName:"li"},"0*1 + 1*1 + 2*0 + 3*1 + 0*4")," = 4"),(0,l.kt)("li",{parentName:"ul"},"Ethereum: ",(0,l.kt)("inlineCode",{parentName:"li"},"0*1 + 1*0 + 2*1 + 3*1 + 0*4")," = 5"),(0,l.kt)("li",{parentName:"ul"},"Monero: ",(0,l.kt)("inlineCode",{parentName:"li"},"0*1 + 1*2 + 2*1 + 3*0 + 4*0")," = 6"),(0,l.kt)("li",{parentName:"ul"},"Zcash: ",(0,l.kt)("inlineCode",{parentName:"li"},"0*0 + 1*0 + 2*0 + 3*0 + 4*3")," = 12"),(0,l.kt)("li",{parentName:"ul"},"Polkadot: ",(0,l.kt)("inlineCode",{parentName:"li"},"0*1 + 1*0 + 2*2 + 3*0 + 4*0")," = 4")),(0,l.kt)("table",null,(0,l.kt)("thead",{parentName:"table"},(0,l.kt)("tr",{parentName:"thead"},(0,l.kt)("th",{parentName:"tr",align:null},"maxCount"),(0,l.kt)("th",{parentName:"tr",align:null},"minValue"),(0,l.kt)("th",{parentName:"tr",align:null},"maxValue"),(0,l.kt)("th",{parentName:"tr",align:null},"minTotalCost"),(0,l.kt)("th",{parentName:"tr",align:null},"maxTotalCost"),(0,l.kt)("th",{parentName:"tr",align:null},"costExponent"),(0,l.kt)("th",{parentName:"tr",align:null},"uniqueValues"))),(0,l.kt)("tbody",{parentName:"table"},(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:null},"5"),(0,l.kt)("td",{parentName:"tr",align:null},"0"),(0,l.kt)("td",{parentName:"tr",align:null},"4"),(0,l.kt)("td",{parentName:"tr",align:null},"-"),(0,l.kt)("td",{parentName:"tr",align:null},"-"),(0,l.kt)("td",{parentName:"tr",align:null},"-"),(0,l.kt)("td",{parentName:"tr",align:null},"Yes")))),(0,l.kt)("h3",{id:"quadratic-voting"},"Quadratic voting"),(0,l.kt)("p",null,"You might distribute 12 credits among 4 NGOs. You can give as many tokens as you wish to a single option, but the cost\nraises exponentially with each additional token added to an option."),(0,l.kt)("p",null,"NGOs are: greenpeace:0, redcross:1, msf:2, amnesty:3"),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},"Vote Envelopes: ",(0,l.kt)("inlineCode",{parentName:"li"},"[2,2,2,0]")," ",(0,l.kt)("inlineCode",{parentName:"li"},"[1,1,2,2]")," ",(0,l.kt)("inlineCode",{parentName:"li"},"[0,3,1,1]"))),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre"},"Cost exponent calculations:\n\n [2, 2, 2, 0]\nenvelope 1 calculation: 2^2 + 2^2 + 2^2 + 0^2\n = 4 + 4 + 4 + 0 = 12 credits\n\n [1, 1, 2, 2]\nenvelope 2 calculation: 1^2 + 1^2 + 2^2 + 2^2\n = 1 + 1 + 4 + 4 = 10 credits\n\n [0, 3, 1, 1]\nenvelope 3 calculation: 0^2 + 3^2 + 1^2 + 1^2\n = 0 + 9 + 1 + 1 = 11 credits\n")),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},"Results: ",(0,l.kt)("inlineCode",{parentName:"li"},"[ [1,1,1,0], [0,1,1,1], [0,1,2,0], [1,1,1,0] ]")),(0,l.kt)("li",{parentName:"ul"},"greenpeace: ",(0,l.kt)("inlineCode",{parentName:"li"},"0*1 + 1*1 + 2*1 + 3*0")," = 3"),(0,l.kt)("li",{parentName:"ul"},"redcross: ",(0,l.kt)("inlineCode",{parentName:"li"},"0*0 + 1*1 + 2*1 + 3*1")," = 6"),(0,l.kt)("li",{parentName:"ul"},"msf: ",(0,l.kt)("inlineCode",{parentName:"li"},"0*0 + 1*1 + 2*2 + 3*0")," = 5"),(0,l.kt)("li",{parentName:"ul"},"amnesty: ",(0,l.kt)("inlineCode",{parentName:"li"},"0*1 + 1*1 + 2*1 + 3*0")," = 3")),(0,l.kt)("table",null,(0,l.kt)("thead",{parentName:"table"},(0,l.kt)("tr",{parentName:"thead"},(0,l.kt)("th",{parentName:"tr",align:null},"maxCount"),(0,l.kt)("th",{parentName:"tr",align:null},"minValue"),(0,l.kt)("th",{parentName:"tr",align:null},"maxValue"),(0,l.kt)("th",{parentName:"tr",align:null},"minTotalCost"),(0,l.kt)("th",{parentName:"tr",align:null},"maxTotalCost"),(0,l.kt)("th",{parentName:"tr",align:null},"costExponent"),(0,l.kt)("th",{parentName:"tr",align:null},"uniqueValues"))),(0,l.kt)("tbody",{parentName:"table"},(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:null},"4"),(0,l.kt)("td",{parentName:"tr",align:null},"0"),(0,l.kt)("td",{parentName:"tr",align:null},"-"),(0,l.kt)("td",{parentName:"tr",align:null},"0"),(0,l.kt)("td",{parentName:"tr",align:null},"12"),(0,l.kt)("td",{parentName:"tr",align:null},"2"),(0,l.kt)("td",{parentName:"tr",align:null},"No")))),(0,l.kt)("h3",{id:"multiquestion"},"Multiquestion"),(0,l.kt)("p",null,"This mode requires a different way of interpreting the results, since each position of the results array is not multiplied by its index."),(0,l.kt)("p",null,"3 positions (CEO, COO, CFO), 5 candidates"),(0,l.kt)("ul",null,(0,l.kt)("li",{parentName:"ul"},"Ballots: ",(0,l.kt)("inlineCode",{parentName:"li"},"[4,3,2]")," ",(0,l.kt)("inlineCode",{parentName:"li"},"[4,2,3]")," ",(0,l.kt)("inlineCode",{parentName:"li"},"[0,1,4]")),(0,l.kt)("li",{parentName:"ul"},"Results: ",(0,l.kt)("inlineCode",{parentName:"li"},"[ [1,0,0,0,2], [0,1,1,1,0], [0,0,1,1,1] ]")),(0,l.kt)("li",{parentName:"ul"},"CEO: candidate0:1 candidate4:2"),(0,l.kt)("li",{parentName:"ul"},"COO: candidate1:1 candidate2:1 candidate3:1"),(0,l.kt)("li",{parentName:"ul"},"CFO: candidate2:1 candidate3:1 candidate4:1")),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre"},"Vote Envelopes: [4,3,2] [4,2,3] [0,1,4]\n\n CEO COO CFO\nOption A results: [ [1, 0, 0, 0, 2], [0, 1, 1, 1, 0], [0, 0, 1, 1, 1] ]\n\nCandidate 5 has won the CEO position, whereas COO is tied between candidates 2, 3, and 4, and CFO is tied between candidates 3, 4, and 5.\n\n")),(0,l.kt)("table",null,(0,l.kt)("thead",{parentName:"table"},(0,l.kt)("tr",{parentName:"thead"},(0,l.kt)("th",{parentName:"tr",align:null},"maxCount"),(0,l.kt)("th",{parentName:"tr",align:null},"minValue"),(0,l.kt)("th",{parentName:"tr",align:null},"maxValue"),(0,l.kt)("th",{parentName:"tr",align:null},"minTotalCost"),(0,l.kt)("th",{parentName:"tr",align:null},"maxTotalCost"),(0,l.kt)("th",{parentName:"tr",align:null},"costExponent"),(0,l.kt)("th",{parentName:"tr",align:null},"uniqueValues"))),(0,l.kt)("tbody",{parentName:"table"},(0,l.kt)("tr",{parentName:"tbody"},(0,l.kt)("td",{parentName:"tr",align:null},"3"),(0,l.kt)("td",{parentName:"tr",align:null},"0"),(0,l.kt)("td",{parentName:"tr",align:null},"4"),(0,l.kt)("td",{parentName:"tr",align:null},"-"),(0,l.kt)("td",{parentName:"tr",align:null},"-"),(0,l.kt)("td",{parentName:"tr",align:null},"-"),(0,l.kt)("td",{parentName:"tr",align:null},"No")))),(0,l.kt)("hr",null),(0,l.kt)("h2",{id:"vocdoni-results-interpretation"},"Vocdoni results interpretation"),(0,l.kt)("p",null,"Results interpretation is not part of the ballot protocol, but it informs how the protocol should be understood and displayed by clients. The Process Metadata has a couple of flags that can be used to tell clients how to interpret a results matrix:"),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-json"},' "results": {\n "aggregation": "index-weighted", // "index-weighted" | "discrete-counting",\n "display": "rating" // "rating" | "simple-question" | "multiple-choice" | "linear-weighted" | "quadratic-voting" | "multiple-question" | "raw"\n }\n')),(0,l.kt)("p",null,"The results provided by the scrutinizer contain a preliminary aggregation in a 2-dimensional matrix, where the final step needs to be completed by UI clients, depending on ",(0,l.kt)("inlineCode",{parentName:"p"},"results.aggregation"),"."),(0,l.kt)("h3",{id:"single-question"},"Single question"),(0,l.kt)("p",null,"Index-weighted: each option's value is multiplied by its position index, then summed."),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-json"},"[ [1,0,1], [2,0,0], [0,1,1] ] => [0*1+1*0+2*1], [0*2+1*0+2*0], [0*1+1*1+2*1] => [2,0,3]\noption1: 2 votes\noption2: 0 votes\noption3: 3 votes\n")),(0,l.kt)("p",null,"This interpretation suits any case with extended features, such as multiple choice, quadratic voting, linear-weighted, etc. This is because it is able to weigh multiple possible values for a single field."),(0,l.kt)("p",null,(0,l.kt)("img",{parentName:"p",src:"https://blog.vocdoni.io/_next/image?url=https%3A%2F%2Fstorage.googleapis.com%2Fpapyrus_images%2F345a07aee1ddf6a6aad51db7e58fd399.png&w=1920&q=75",alt:"https://blog.vocdoni.io/_next/image?url=https%3A%2F%2Fstorage.googleapis.com%2Fpapyrus_images%2F345a07aee1ddf6a6aad51db7e58fd399.png&w=1920&q=75"})),(0,l.kt)("h3",{id:"multi-question"},"Multi question"),(0,l.kt)("p",null,"Discrete values: field values are just counted (weight = 1)"),(0,l.kt)("pre",null,(0,l.kt)("code",{parentName:"pre",className:"language-json"},"[ [1,2,0], [0,1,2], [1,1,1] ] => [ [question1], [question2], [question3] ]\nfield1: candidate0: 1 vote, candidate1: 2 votes, candidate 3: 0 votes\nfield2: candidate0: 0 votes, candidate1: 1 vote, candidate 2: 2 votes\nfield2: candidate0: 1 vote, candidate1: 1 vote, candidate 2: 1 vote\n")),(0,l.kt)("p",null,"As this format can only accept binary (yes/no) input for each option, it is only available for use with a basic set of features (multi-question, single-choice)"),(0,l.kt)("p",null,(0,l.kt)("img",{parentName:"p",src:"https://blog.vocdoni.io/_next/image?url=https%3A%2F%2Fstorage.googleapis.com%2Fpapyrus_images%2F97e8bca257a9b118b86ee3dd31165107.png&w=1920&q=75",alt:"https://blog.vocdoni.io/_next/image?url=https%3A%2F%2Fstorage.googleapis.com%2Fpapyrus_images%2F97e8bca257a9b118b86ee3dd31165107.png&w=1920&q=75"})))}m.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/54bc495f.19b764ac.js b/assets/js/54bc495f.19b764ac.js deleted file mode 100644 index 4ae0b8984..000000000 --- a/assets/js/54bc495f.19b764ac.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkdemo=self.webpackChunkdemo||[]).push([[3706],{3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>m});var o=n(67294);function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function r(e){for(var t=1;t=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var l=o.createContext({}),c=function(e){var t=o.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):r(r({},t),e)),n},p=function(e){var t=c(e.components);return o.createElement(l.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return o.createElement(o.Fragment,{},t)}},d=o.forwardRef((function(e,t){var n=e.components,i=e.mdxType,a=e.originalType,l=e.parentName,p=s(e,["components","mdxType","originalType","parentName"]),d=c(n),m=i,h=d["".concat(l,".").concat(m)]||d[m]||u[m]||a;return n?o.createElement(h,r(r({ref:t},p),{},{components:n})):o.createElement(h,r({ref:t},p))}));function m(e,t){var n=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var a=n.length,r=new Array(a);r[0]=d;var s={};for(var l in t)hasOwnProperty.call(t,l)&&(s[l]=t[l]);s.originalType=e,s.mdxType="string"==typeof e?e:i,r[1]=s;for(var c=2;c{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>r,default:()=>u,frontMatter:()=>a,metadata:()=>s,toc:()=>c});var o=n(87462),i=(n(67294),n(3905));const a={slug:"single-choice",sidebar_position:2},r="Single Choice Voting",s={unversionedId:"sdk/integration-details/voting-types/single-choice",id:"sdk/integration-details/voting-types/single-choice",title:"Single Choice Voting",description:"An election with a single-choice result, also known as First-past-the-post voting (FPTP or FPP) or informally called",source:"@site/docs/sdk/integration-details/voting-types/single-choice.md",sourceDirName:"sdk/integration-details/voting-types",slug:"/sdk/integration-details/voting-types/single-choice",permalink:"/sdk/integration-details/voting-types/single-choice",draft:!1,tags:[],version:"current",sidebarPosition:2,frontMatter:{slug:"single-choice",sidebar_position:2},sidebar:"defaultSidebar",previous:{title:"Voting Types",permalink:"/sdk/integration-details/voting-types/"},next:{title:"Ranked Voting",permalink:"/sdk/integration-details/voting-types/ranked"}},l={},c=[{value:"Setting up the election",id:"setting-up-the-election",level:2},{value:"Casting a vote",id:"casting-a-vote",level:2},{value:"Results interpretation",id:"results-interpretation",level:2}],p={toc:c};function u(e){let{components:t,...n}=e;return(0,i.kt)("wrapper",(0,o.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"single-choice-voting"},"Single Choice Voting"),(0,i.kt)("p",null,"An election with a single-choice result, also known as First-past-the-post voting (FPTP or FPP) or informally called\nchoose-one voting, is a voting system where each voter is typically allowed to cast only one vote for their preferred\noption or candidate. The option or candidate with the most votes wins the election."),(0,i.kt)("p",null,'This voting system is considered one of the simplest, as a single-choice election involves selecting a single winner,\nand voters can mark only one option from the list of choices or candidates. However, despite its widespread use and\nsimplicity, it has some drawbacks. Since it operates on a "winner-take-all" principle, it can lead to disproportionate\noutcomes (the candidate/option with the most votes secures victory, even if their margin of victory is slim).'),(0,i.kt)("admonition",{type:"info"},(0,i.kt)("p",{parentName:"admonition"},"This voting system supports ",(0,i.kt)("strong",{parentName:"p"},"one")," or ",(0,i.kt)("strong",{parentName:"p"},"multiple questions"),".")),(0,i.kt)("p",null,"See:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"/protocol/ballot-protocol#single-choice"},"Ballot protocol implementation"))),(0,i.kt)("h2",{id:"setting-up-the-election"},"Setting up the election"),(0,i.kt)("p",null,"To establish this kind of election, you can utilize the default parameters:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts"},"const election = Election.from({\n census,\n title: 'Do you like chocolate?',\n description: 'A simple survey to assess chocolate preferences',\n})\n")),(0,i.kt)("p",null,"After creating the election and before publishing, add the questions, ensuring each choice has a distinct value:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts"},"election.addQuestion('Do you like chocolate without milk?', 'This is the description', [\n {\n title: 'Yes',\n value: 0,\n },\n {\n title: 'No',\n value: 1,\n },\n]).addQuestion('Do you like chocolate with milk', 'This is the description', [\n {\n title: 'Yes',\n value: 0,\n },\n {\n title: 'No',\n value: 1,\n },\n {\n title: 'Not always',\n value: 2,\n },\n])\n")),(0,i.kt)("admonition",{title:"About choices values",type:"info"},(0,i.kt)("p",{parentName:"admonition"},"Take note that the question values are ",(0,i.kt)("strong",{parentName:"p"},"incremental")," and the initial value ",(0,i.kt)("strong",{parentName:"p"},"must")," be 0")),(0,i.kt)("admonition",{title:"Multiple questions support",type:"tip"},(0,i.kt)("p",{parentName:"admonition"},"This election type can accommodate multiple questions.")),(0,i.kt)("admonition",{title:"Not all elections type supports multiple questions!",type:"caution"},(0,i.kt)("p",{parentName:"admonition"},"This is the sole type of election that supports multiple questions. Other election types, such as ",(0,i.kt)("inlineCode",{parentName:"p"},"ranked"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"quadratic"),",\netc, ",(0,i.kt)("strong",{parentName:"p"},"only support one question per election"),".")),(0,i.kt)("p",null,"To restrict the maximum number of questions or values an election can contain, adjust the ",(0,i.kt)("inlineCode",{parentName:"p"},"maxCount")," and\n",(0,i.kt)("inlineCode",{parentName:"p"},"maxValue")," parameters in ",(0,i.kt)("inlineCode",{parentName:"p"},"voteOpts"),":"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts"},"const election_opts: IVoteType = {\n maxCount: 2, // Represents the max number of questions\n maxValue: 3, // Represents the max number of choices for a given question.\n}\nconst election = Election.from({\n census,\n election_opts,\n //...\n})\n")),(0,i.kt)("h2",{id:"casting-a-vote"},"Casting a vote"),(0,i.kt)("p",null,"Votes can be submitted using the method below:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts"},"client.submitVote(new Vote([0, 2]));\n")),(0,i.kt)("p",null,"Each position in the vote array corresponds to a question, and the value is the associated selected choice. In this\ninstance, we select the first choice for the first question and the third choice for the second."),(0,i.kt)("admonition",{title:"Single question vote",type:"info"},(0,i.kt)("p",{parentName:"admonition"},"For single question is same philosophy, you could configure the election as:"),(0,i.kt)("pre",{parentName:"admonition"},(0,i.kt)("code",{parentName:"pre",className:"language-ts"},"// If you want to restrict the election creation\n// ...\n maxCount: 1, // Only one question\n maxValue: 3, // That accepts three choices\n// ...\n// And finally casting the vote\nclient.submitVote(new Vote([0, 2])); // Voting the third option\n"))),(0,i.kt)("h2",{id:"results-interpretation"},"Results interpretation"),(0,i.kt)("p",null,"Consider a scenario where 10 voters cast identical votes, i.e., ",(0,i.kt)("inlineCode",{parentName:"p"},"[0, 2]"),"."),(0,i.kt)("p",null,"The election results would be represented as a two-dimensional array:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"}," [\n [ '10', '0', '0' ],\n [ '0', '0', '10' ]\n ]\n")),(0,i.kt)("p",null,"Each sub-array signifies the results for a question, and each position of the sub-array indicates the number of votes a\nchoice has accumulated."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"For the first question (",(0,i.kt)("inlineCode",{parentName:"li"},"[ '10', '0', '0' ]"),"): all 10 voters chose the first option."),(0,i.kt)("li",{parentName:"ul"},"For the second question (",(0,i.kt)("inlineCode",{parentName:"li"},"[ '0', '0', '10' ]"),"): all 10 voters chose the third option.")),(0,i.kt)("p",null,"In the example above, the first question offers two options, and the second presents three. However, the results array\nfor the first question contains three elements, as the ",(0,i.kt)("inlineCode",{parentName:"p"},"maxValue")," for all questions is the same (in this case, 3, the\n",(0,i.kt)("inlineCode",{parentName:"p"},"maxValue")," of the question with the most options)."),(0,i.kt)("admonition",{title:"Single question results interpretation",type:"info"},(0,i.kt)("p",{parentName:"admonition"},"Not so different, the results array will look like:"),(0,i.kt)("pre",{parentName:"admonition"},(0,i.kt)("code",{parentName:"pre"},"[ [ '0', '0', '10' ] ]\n")),(0,i.kt)("p",{parentName:"admonition"},"For the only one question, 10 voters select the third option")))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/54bc495f.261c6427.js b/assets/js/54bc495f.261c6427.js new file mode 100644 index 000000000..969e909b0 --- /dev/null +++ b/assets/js/54bc495f.261c6427.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkdemo=self.webpackChunkdemo||[]).push([[3706],{3905:(e,t,n)=>{n.d(t,{Zo:()=>p,kt:()=>h});var o=n(67294);function i(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function r(e){for(var t=1;t=0||(i[n]=e[n]);return i}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(i[n]=e[n])}return i}var l=o.createContext({}),c=function(e){var t=o.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):r(r({},t),e)),n},p=function(e){var t=c(e.components);return o.createElement(l.Provider,{value:t},e.children)},u={inlineCode:"code",wrapper:function(e){var t=e.children;return o.createElement(o.Fragment,{},t)}},d=o.forwardRef((function(e,t){var n=e.components,i=e.mdxType,a=e.originalType,l=e.parentName,p=s(e,["components","mdxType","originalType","parentName"]),d=c(n),h=i,m=d["".concat(l,".").concat(h)]||d[h]||u[h]||a;return n?o.createElement(m,r(r({ref:t},p),{},{components:n})):o.createElement(m,r({ref:t},p))}));function h(e,t){var n=arguments,i=t&&t.mdxType;if("string"==typeof e||i){var a=n.length,r=new Array(a);r[0]=d;var s={};for(var l in t)hasOwnProperty.call(t,l)&&(s[l]=t[l]);s.originalType=e,s.mdxType="string"==typeof e?e:i,r[1]=s;for(var c=2;c{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>r,default:()=>u,frontMatter:()=>a,metadata:()=>s,toc:()=>c});var o=n(87462),i=(n(67294),n(3905));const a={slug:"single-choice",sidebar_position:2},r="Single Choice Voting",s={unversionedId:"sdk/integration-details/voting-types/single-choice",id:"sdk/integration-details/voting-types/single-choice",title:"Single Choice Voting",description:"An election with a single-choice result, also known as First-past-the-post voting (FPTP or FPP) or informally called",source:"@site/docs/sdk/integration-details/voting-types/single-choice.md",sourceDirName:"sdk/integration-details/voting-types",slug:"/sdk/integration-details/voting-types/single-choice",permalink:"/sdk/integration-details/voting-types/single-choice",draft:!1,tags:[],version:"current",sidebarPosition:2,frontMatter:{slug:"single-choice",sidebar_position:2},sidebar:"defaultSidebar",previous:{title:"Voting Types",permalink:"/sdk/integration-details/voting-types/"},next:{title:"Ranked Voting",permalink:"/sdk/integration-details/voting-types/ranked"}},l={},c=[{value:"Setting up the election",id:"setting-up-the-election",level:2},{value:"Casting a vote",id:"casting-a-vote",level:2},{value:"Results interpretation",id:"results-interpretation",level:2}],p={toc:c};function u(e){let{components:t,...n}=e;return(0,i.kt)("wrapper",(0,o.Z)({},p,n,{components:t,mdxType:"MDXLayout"}),(0,i.kt)("h1",{id:"single-choice-voting"},"Single Choice Voting"),(0,i.kt)("p",null,"An election with a single-choice result, also known as First-past-the-post voting (FPTP or FPP) or informally called\nchoose-one voting, is a voting system where each voter is typically allowed to cast only one vote for their preferred\noption or candidate. The option or candidate with the most votes wins the election."),(0,i.kt)("p",null,'This voting system is considered one of the simplest, as a single-choice election involves selecting a single winner,\nand voters can mark only one option from the list of choices or candidates. However, despite its widespread use and\nsimplicity, it has some drawbacks. Since it operates on a "winner-take-all" principle, it can lead to disproportionate\noutcomes (the candidate/option with the most votes secures victory, even if their margin of victory is slim).'),(0,i.kt)("admonition",{type:"info"},(0,i.kt)("p",{parentName:"admonition"},"This voting system supports ",(0,i.kt)("strong",{parentName:"p"},"one")," or ",(0,i.kt)("strong",{parentName:"p"},"multiple questions"),".")),(0,i.kt)("p",null,"See:"),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"https://github.com/vocdoni/vocdoni-sdk/blob/main/examples/typescript/src/index.ts"},"Complete example")),(0,i.kt)("li",{parentName:"ul"},(0,i.kt)("a",{parentName:"li",href:"/protocol/ballot-protocol#single-choice"},"Ballot protocol implementation"))),(0,i.kt)("h2",{id:"setting-up-the-election"},"Setting up the election"),(0,i.kt)("p",null,"To establish this kind of election, you can utilize the default parameters:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts"},"const election = Election.from({\n census,\n title: 'Do you like chocolate?',\n description: 'A simple survey to assess chocolate preferences',\n})\n")),(0,i.kt)("p",null,"After creating the election and before publishing, add the questions, ensuring each choice has a distinct value:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts"},"election.addQuestion('Do you like chocolate without milk?', 'This is the description', [\n {\n title: 'Yes',\n value: 0,\n },\n {\n title: 'No',\n value: 1,\n },\n]).addQuestion('Do you like chocolate with milk', 'This is the description', [\n {\n title: 'Yes',\n value: 0,\n },\n {\n title: 'No',\n value: 1,\n },\n {\n title: 'Not always',\n value: 2,\n },\n])\n")),(0,i.kt)("admonition",{title:"About choices values",type:"info"},(0,i.kt)("p",{parentName:"admonition"},"Take note that the question values are ",(0,i.kt)("strong",{parentName:"p"},"incremental")," and the initial value ",(0,i.kt)("strong",{parentName:"p"},"must")," be 0")),(0,i.kt)("admonition",{title:"Not all elections type supports multiple questions!",type:"caution"},(0,i.kt)("p",{parentName:"admonition"},"This is the sole type of election that supports multiple questions. Other election types, such as ",(0,i.kt)("inlineCode",{parentName:"p"},"ranked"),", ",(0,i.kt)("inlineCode",{parentName:"p"},"quadratic"),",\netc, ",(0,i.kt)("strong",{parentName:"p"},"only support one question per election"),".")),(0,i.kt)("p",null,"To restrict the maximum number of questions or values an election can contain, adjust the ",(0,i.kt)("inlineCode",{parentName:"p"},"maxCount")," and\n",(0,i.kt)("inlineCode",{parentName:"p"},"maxValue")," parameters in ",(0,i.kt)("inlineCode",{parentName:"p"},"voteOpts"),":"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts"},"const election_opts: IVoteType = {\n maxCount: 2, // Represents the max number of questions\n maxValue: 3, // Represents the max number of choices for a given question.\n}\nconst election = Election.from({\n census,\n election_opts,\n //...\n})\n")),(0,i.kt)("h2",{id:"casting-a-vote"},"Casting a vote"),(0,i.kt)("p",null,"Votes can be submitted using the method below:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre",className:"language-ts"},"client.submitVote(new Vote([0, 2]));\n")),(0,i.kt)("p",null,"Each position in the vote array corresponds to a question, and the value is the associated selected choice. In this\ninstance, we select the first choice for the first question and the third choice for the second."),(0,i.kt)("admonition",{title:"Single question vote",type:"info"},(0,i.kt)("p",{parentName:"admonition"},"For single question is same philosophy, you could configure the election as:"),(0,i.kt)("pre",{parentName:"admonition"},(0,i.kt)("code",{parentName:"pre",className:"language-ts"},"// If you want to restrict the election creation\n// ...\n maxCount: 1, // Only one question\n maxValue: 3, // That accepts three choices\n// ...\n// And finally casting the vote\nclient.submitVote(new Vote([2])); // Voting the third option\n"))),(0,i.kt)("h2",{id:"results-interpretation"},"Results interpretation"),(0,i.kt)("p",null,"Consider a scenario where 10 voters cast identical votes, i.e., ",(0,i.kt)("inlineCode",{parentName:"p"},"[0, 2]"),"."),(0,i.kt)("p",null,"The election results would be represented as a two-dimensional array:"),(0,i.kt)("pre",null,(0,i.kt)("code",{parentName:"pre"}," [\n [ '10', '0', '0' ],\n [ '0', '0', '10' ]\n ]\n")),(0,i.kt)("p",null,"Each sub-array signifies the results for a question, and each position of the sub-array indicates the number of votes a\nchoice has accumulated."),(0,i.kt)("ul",null,(0,i.kt)("li",{parentName:"ul"},"For the first question (",(0,i.kt)("inlineCode",{parentName:"li"},"[ '10', '0', '0' ]"),"): all 10 voters chose the first option."),(0,i.kt)("li",{parentName:"ul"},"For the second question (",(0,i.kt)("inlineCode",{parentName:"li"},"[ '0', '0', '10' ]"),"): all 10 voters chose the third option.")),(0,i.kt)("p",null,"In the example above, the first question offers two options, and the second presents three. However, the results array\nfor the first question contains three elements, as the ",(0,i.kt)("inlineCode",{parentName:"p"},"maxValue")," for all questions is the same (in this case, 3, the\n",(0,i.kt)("inlineCode",{parentName:"p"},"maxValue")," of the question with the most options)."),(0,i.kt)("admonition",{title:"Single question results interpretation",type:"info"},(0,i.kt)("p",{parentName:"admonition"},"Not so different, the results array will look like:"),(0,i.kt)("pre",{parentName:"admonition"},(0,i.kt)("code",{parentName:"pre"},"[ [ '0', '0', '10' ] ]\n")),(0,i.kt)("p",{parentName:"admonition"},"For the only one question, 10 voters select the third option")))}u.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/78bbaf06.d3323e91.js b/assets/js/78bbaf06.d3323e91.js new file mode 100644 index 000000000..d7d9c290b --- /dev/null +++ b/assets/js/78bbaf06.d3323e91.js @@ -0,0 +1 @@ +"use strict";(self.webpackChunkdemo=self.webpackChunkdemo||[]).push([[5995],{3905:(e,t,n)=>{n.d(t,{Zo:()=>d,kt:()=>u});var i=n(67294);function o(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function a(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,i)}return n}function r(e){for(var t=1;t=0||(o[n]=e[n]);return o}(e,t);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);for(i=0;i=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(o[n]=e[n])}return o}var l=i.createContext({}),c=function(e){var t=i.useContext(l),n=t;return e&&(n="function"==typeof e?e(t):r(r({},t),e)),n},d=function(e){var t=c(e.components);return i.createElement(l.Provider,{value:t},e.children)},p={inlineCode:"code",wrapper:function(e){var t=e.children;return i.createElement(i.Fragment,{},t)}},h=i.forwardRef((function(e,t){var n=e.components,o=e.mdxType,a=e.originalType,l=e.parentName,d=s(e,["components","mdxType","originalType","parentName"]),h=c(n),u=o,f=h["".concat(l,".").concat(u)]||h[u]||p[u]||a;return n?i.createElement(f,r(r({ref:t},d),{},{components:n})):i.createElement(f,r({ref:t},d))}));function u(e,t){var n=arguments,o=t&&t.mdxType;if("string"==typeof e||o){var a=n.length,r=new Array(a);r[0]=h;var s={};for(var l in t)hasOwnProperty.call(t,l)&&(s[l]=t[l]);s.originalType=e,s.mdxType="string"==typeof e?e:o,r[1]=s;for(var c=2;c{n.r(t),n.d(t,{assets:()=>l,contentTitle:()=>r,default:()=>p,frontMatter:()=>a,metadata:()=>s,toc:()=>c});var i=n(87462),o=(n(67294),n(3905));const a={},r="Voting Types",s={unversionedId:"sdk/integration-details/voting-types/voting-types",id:"sdk/integration-details/voting-types/voting-types",title:"Voting Types",description:"In this section, we will provide a brief overview of the different types of voting supported by the Vocdoni protocol and",source:"@site/docs/sdk/integration-details/voting-types/voting-types.md",sourceDirName:"sdk/integration-details/voting-types",slug:"/sdk/integration-details/voting-types/",permalink:"/sdk/integration-details/voting-types/",draft:!1,tags:[],version:"current",frontMatter:{},sidebar:"defaultSidebar",previous:{title:"Vocdoni Tokens",permalink:"/sdk/integration-details/vocdoni-tokens"},next:{title:"Single Choice Voting",permalink:"/sdk/integration-details/voting-types/single-choice"}},l={},c=[{value:"Election types",id:"election-types",level:2},{value:"Results interpretation",id:"results-interpretation",level:2},{value:"Linear-Weighted Choice Voting",id:"linear-weighted-choice-voting",level:4},{value:"Ranked-Choice Voting",id:"ranked-choice-voting",level:4},{value:"Multiple Question",id:"multiple-question",level:4}],d={toc:c};function p(e){let{components:t,...n}=e;return(0,o.kt)("wrapper",(0,i.Z)({},d,n,{components:t,mdxType:"MDXLayout"}),(0,o.kt)("h1",{id:"voting-types"},"Voting Types"),(0,o.kt)("p",null,"In this section, we will provide a brief overview of the different types of voting supported by the Vocdoni protocol and\nhow it operates."),(0,o.kt)("h2",{id:"election-types"},"Election types"),(0,o.kt)("p",null,"The ",(0,o.kt)("a",{parentName:"p",href:"/protocol/ballot-protocol"},"Vocdoni Ballot protocol")," in its current implementation accommodates multiple ",(0,o.kt)("strong",{parentName:"p"},"elections types"),":"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"voting-types/single-choice"},"Single choice"),", each voter is typically allowed to cast only one vote for their preferred option. This\nvoting system is the only one that ",(0,o.kt)("strong",{parentName:"li"},"supports multiple questions"),". "),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"voting-types/ranked"},"Ranked voting"),", also known as preferential voting, is an electoral system where voters rank candidates in order of preference"),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"voting-types/approval"},"Approval voting"),", or multiple choice, here the voters are allowed to indicate their support for multiple\ncandidates or options."),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"voting-types/weighted"},"Weighted voting"),", each voter is assigned a specific weight or value that reflects their relative influence or\nimportance in the decision-making process."),(0,o.kt)("li",{parentName:"ul"},(0,o.kt)("a",{parentName:"li",href:"voting-types/quadratic"},"Quadratic voting"),", voters can cast multiple votes for issues they prioritize, but the cost of casting\nadditional votes on the same issue rises exponentially.")),(0,o.kt)("p",null,"The configuration of these election types happens at the time of election creation using the SDK. Refer to the respective\ndocumentation for the parameter requirements for each election type."),(0,o.kt)("p",null,"These voting types describe different sets of behavior that can be generated with the set of election parameters. A comprehensive explanation of the parameters used in the ballot protocol can be found ",(0,o.kt)("a",{parentName:"p",href:"/protocol/ballot-protocol"},"here"),"."),(0,o.kt)("h2",{id:"results-interpretation"},"Results interpretation"),(0,o.kt)("p",null,"The structure for individual ballots and the corresponding results can vary depending on the election parameters. For example, a vote envelope ",(0,o.kt)("inlineCode",{parentName:"p"},"[0, 2, 1]")," could mean one of the following:"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},"0 points for the first candidate, 2 points for the second candidate, 1 point for the third candidate"),(0,o.kt)("li",{parentName:"ul"},"first-choice selection for the first candidate, third-choice for the second candidate, and second-choice for the third"),(0,o.kt)("li",{parentName:"ul"},"choice of option ",(0,o.kt)("inlineCode",{parentName:"li"},"0")," for the first question, option ",(0,o.kt)("inlineCode",{parentName:"li"},"2")," for the second question, and option ",(0,o.kt)("inlineCode",{parentName:"li"},"1")," for the third.")),(0,o.kt)("p",null,"The interpretation of votes is done at the protocol-level, according to the election parameters. The results are stored on the Vochain as a bi-dimensional array. Essentially, the ballot protocol is a system that transforms a unidimensional array (a vote, e.g., ",(0,o.kt)("inlineCode",{parentName:"p"},"[1,4]"),") into a bi-dimensional array of results (e.g., ",(0,o.kt)("inlineCode",{parentName:"p"},"[[2,5], [3,8]]"),")."),(0,o.kt)("p",null,"The interpretation of this matrix of results is done on the client side, which receives the raw results from the SDK. The SDK also provides metadata about the election to facilitate understanding of the results. More details on interpreting results can be found ",(0,o.kt)("a",{parentName:"p",href:"/protocol/ballot-protocol#vocdoni-results-interpretation"},"here"),"."),(0,o.kt)("p",null,"Here's a simple example to demonstrate how the same result array can be interpreted in different ways, depending on the election type:"),(0,o.kt)("h4",{id:"linear-weighted-choice-voting"},"Linear-Weighted Choice Voting"),(0,o.kt)("p",null,"Consider a single-choice question where three candidates are ranked by voters, each receiving a number of 'points' according to each voter's ranking. This is an example of ",(0,o.kt)("inlineCode",{parentName:"p"},"linear-weighted choice"),". A results array with 10 votes might look like this:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"[ \n [4, 6, 0], \n [2, 4, 4], \n [4, 0, 6] \n]\n")),(0,o.kt)("p",null,"Each row of this matrix represents a single candidate, and each column represents a chosen allocation of points. The numbers represent the total number of votes for that candidate/points combination."),(0,o.kt)("p",null,"In this scenario:"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},"The first candidate receives 4 0-point votes and 6 1-point votes"),(0,o.kt)("li",{parentName:"ul"},"The second candidate receives 2 0-point, 4 1-point, and 4 2-point votes"),(0,o.kt)("li",{parentName:"ul"},"The third candidate receives 4 0-point votes and 6 2-point votes")),(0,o.kt)("p",null,'We can use this results matrix to calculate the total weighted sum for each candidate: the first candidate receives 6 points, the second candidate receives 12, and the third candidate receives 12. Candidates 2 and 3 tie. This results interpretation is "weighted," meaning each choice represents a quantified amount of preference, and we could aggregate the results into a single array of allocated points without losing any information:'),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"[6, 12, 12]\n")),(0,o.kt)("admonition",{title:"aggregated results",type:"note"},(0,o.kt)("p",{parentName:"admonition"},"For all elections where ",(0,o.kt)("inlineCode",{parentName:"p"},"maxValue")," is set to ",(0,o.kt)("inlineCode",{parentName:"p"},"0"),", it is assumed that the election uses a weighted results system (like in this example). The aggregated results (",(0,o.kt)("inlineCode",{parentName:"p"},"[6, 12, 12]"),") are calculated on the indexer and reported as the official results.")),(0,o.kt)("h4",{id:"ranked-choice-voting"},"Ranked-Choice Voting"),(0,o.kt)("p",null,"Consider a single-choice question where three candidates are ranked by preference, and if no candidate receives more than 50% of the first-choice votes, second-choice votes are considered (a runoff election). This is one example of a ",(0,o.kt)("inlineCode",{parentName:"p"},"ranked voting")," scheme. The results array could look identical to the one above:"),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"[ \n [4, 6, 0], \n [2, 4, 4], \n [4, 0, 6] \n]\n")),(0,o.kt)("p",null,"Each row of this matrix represents a single candidate, and each column represents the choice (first, second, third). The numbers represent the total number of votes for that candidate/choice combination."),(0,o.kt)("p",null,"In this scenario:"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},"The first candidate receives 4 first-choice and 6 second-choice votes"),(0,o.kt)("li",{parentName:"ul"},"The second candidate receives 2 first-choice, 4 second-choice, and 4 third-choice votes"),(0,o.kt)("li",{parentName:"ul"},"The third candidate receives 6 first-choice and 4 third-choice votes")),(0,o.kt)("p",null,"The main difference between this example in the last is that each vote count has to be treated as a discrete piece of data rather than a value that can be combined arithmetically with others. This is because this election has a complex method for calculating the winner where first and second choices have different meanings rather than different amounts of the same meaning. The entire results matrix is needed in order to calculate a result. "),(0,o.kt)("admonition",{title:"ranked-choice",type:"tip"},(0,o.kt)("p",{parentName:"admonition"},"For ranked-choice, the ",(0,o.kt)("inlineCode",{parentName:"p"},"maxValue")," parameter cannot equal zero to signify that values are discrete options, not weighted points.")),(0,o.kt)("p",null,"In this case, the first and third candidates tie with 40% of the vote each when only first-choice votes are considered. Thus we must consider a runoff using second-choice votes: the first candidate gets 60% of the second-choice votes, and the third candidate gets 0%. The first candidate wins the election."),(0,o.kt)("h4",{id:"multiple-question"},"Multiple Question"),(0,o.kt)("p",null,"Now, let's consider an election with three questions, where each question has three options. Voters must select one of the three options for each question. This is a multiple-question, multiple-choice election."),(0,o.kt)("pre",null,(0,o.kt)("code",{parentName:"pre"},"[ \n [4, 6, 0], \n [2, 4, 4], \n [4, 0, 6] \n]\n")),(0,o.kt)("p",null,"Each row of this matrix represents a separate question, and each column represents the choice (first, second, third). The numbers represent the total number of votes for that question/choice combination."),(0,o.kt)("p",null,"In this scenario:"),(0,o.kt)("ul",null,(0,o.kt)("li",{parentName:"ul"},"For the first question, candidate 0 receives 4 votes and candidate 1 receives 6 (candidate 1 wins)"),(0,o.kt)("li",{parentName:"ul"},"For the second question, candidate 0 receives 2 votes, candidate 1 receives 4, and candidate 2 receives 4 (candidates 1 and 2 tie)"),(0,o.kt)("li",{parentName:"ul"},"For the third question, candidate 0 receives 4 votes and candidate 2 receives 6 (candidate 2 wins)")),(0,o.kt)("p",null,"You can see how the same results matrix could represent a wide set of interpretations, and it is crucial to pay attention to the election parameters and original design of the election when displaying the results. "))}p.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/78bbaf06.e45630f7.js b/assets/js/78bbaf06.e45630f7.js deleted file mode 100644 index 969eaa849..000000000 --- a/assets/js/78bbaf06.e45630f7.js +++ /dev/null @@ -1 +0,0 @@ -"use strict";(self.webpackChunkdemo=self.webpackChunkdemo||[]).push([[5995],{3905:(e,t,n)=>{n.d(t,{Zo:()=>c,kt:()=>h});var o=n(67294);function r(e,t,n){return t in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function i(e,t){var n=Object.keys(e);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);t&&(o=o.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),n.push.apply(n,o)}return n}function a(e){for(var t=1;t=0||(r[n]=e[n]);return r}(e,t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);for(o=0;o=0||Object.prototype.propertyIsEnumerable.call(e,n)&&(r[n]=e[n])}return r}var s=o.createContext({}),p=function(e){var t=o.useContext(s),n=t;return e&&(n="function"==typeof e?e(t):a(a({},t),e)),n},c=function(e){var t=p(e.components);return o.createElement(s.Provider,{value:t},e.children)},d={inlineCode:"code",wrapper:function(e){var t=e.children;return o.createElement(o.Fragment,{},t)}},u=o.forwardRef((function(e,t){var n=e.components,r=e.mdxType,i=e.originalType,s=e.parentName,c=l(e,["components","mdxType","originalType","parentName"]),u=p(n),h=r,f=u["".concat(s,".").concat(h)]||u[h]||d[h]||i;return n?o.createElement(f,a(a({ref:t},c),{},{components:n})):o.createElement(f,a({ref:t},c))}));function h(e,t){var n=arguments,r=t&&t.mdxType;if("string"==typeof e||r){var i=n.length,a=new Array(i);a[0]=u;var l={};for(var s in t)hasOwnProperty.call(t,s)&&(l[s]=t[s]);l.originalType=e,l.mdxType="string"==typeof e?e:r,a[1]=l;for(var p=2;p{n.r(t),n.d(t,{assets:()=>s,contentTitle:()=>a,default:()=>d,frontMatter:()=>i,metadata:()=>l,toc:()=>p});var o=n(87462),r=(n(67294),n(3905));const i={},a="Voting Types",l={unversionedId:"sdk/integration-details/voting-types/voting-types",id:"sdk/integration-details/voting-types/voting-types",title:"Voting Types",description:"In this section, we will provide a brief overview of the different types of voting supported by the Vocdoni protocol and",source:"@site/docs/sdk/integration-details/voting-types/voting-types.md",sourceDirName:"sdk/integration-details/voting-types",slug:"/sdk/integration-details/voting-types/",permalink:"/sdk/integration-details/voting-types/",draft:!1,tags:[],version:"current",frontMatter:{},sidebar:"defaultSidebar",previous:{title:"Vocdoni Tokens",permalink:"/sdk/integration-details/vocdoni-tokens"},next:{title:"Single Choice Voting",permalink:"/sdk/integration-details/voting-types/single-choice"}},s={},p=[{value:"Election types",id:"election-types",level:2},{value:"Results interpretation",id:"results-interpretation",level:2}],c={toc:p};function d(e){let{components:t,...n}=e;return(0,r.kt)("wrapper",(0,o.Z)({},c,n,{components:t,mdxType:"MDXLayout"}),(0,r.kt)("h1",{id:"voting-types"},"Voting Types"),(0,r.kt)("p",null,"In this section, we will provide a brief overview of the different types of voting supported by the Vocdoni protocol and\nhow it operates."),(0,r.kt)("h2",{id:"election-types"},"Election types"),(0,r.kt)("p",null,"The ",(0,r.kt)("a",{parentName:"p",href:"/protocol/ballot-protocol"},"Vocdoni Ballot protocol")," in its current implementation accommodates multiple ",(0,r.kt)("strong",{parentName:"p"},"elections types"),":"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"voting-types/single-choice"},"Single choice"),", each voter is typically allowed to cast only one vote for their preferred option. This\nvoting system is the only one that ",(0,r.kt)("strong",{parentName:"li"},"supports multiple questions"),". "),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"voting-types/ranked"},"Ranked voting"),", also known as preferential voting, is an electoral system where voters rank candidates in order of preference"),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"voting-types/approval"},"Approval voting"),", or multiple choice, here the voters are allowed to indicate their support for multiple\ncandidates or options."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"voting-types/weighted"},"Weighted voting"),", each voter is assigned a specific weight or value that reflects their relative influence or\nimportance in the decision-making process."),(0,r.kt)("li",{parentName:"ul"},(0,r.kt)("a",{parentName:"li",href:"voting-types/quadratic"},"Quadratic voting"),", voters can cast multiple votes for issues they prioritize, but the cost of casting\nadditional votes on the same issue rises exponentially.")),(0,r.kt)("p",null,"The configuration of these election types happens at the time of election creation using the SDK. Refer to the respective\ndocumentation for the parameter requirements for each election type."),(0,r.kt)("p",null,"A comprehensive explanation of the parameters used in the ballot protocol can be found ",(0,r.kt)("a",{parentName:"p",href:"/protocol/ballot-protocol"},"here"),"."),(0,r.kt)("h2",{id:"results-interpretation"},"Results interpretation"),(0,r.kt)("p",null,"The results are stored on the Vochain as a bi-dimensional array. Essentially, the ballot protocol is a system that\ntransforms a unidimensional array (a vote, e.g., ",(0,r.kt)("inlineCode",{parentName:"p"},"[1,4]"),") into a bi-dimensional array of results (e.g., ",(0,r.kt)("inlineCode",{parentName:"p"},"[[2,5]]"),")."),(0,r.kt)("p",null,"The interpretation of results is done on the user side, which receives the results from the SDK. The SDK provides\nmetadata about the election to facilitate understanding of the results. More details on interpreting results can be found ",(0,r.kt)("a",{parentName:"p",href:"/protocol/ballot-protocol#vocdoni-results-interpretation"},"here"),"."),(0,r.kt)("p",null,"Here's a simple example to demonstrate how the result array can be interpreted in different ways, depending on the\nelection type:"),(0,r.kt)("p",null,"Consider a question where 2 candidates are ranked by preference, which is an example of ",(0,r.kt)("inlineCode",{parentName:"p"},"ranked voting"),". The results\narray might look like this:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"[ \n [0, 0, 10], \n [0, 10, 0], \n [10, 0, 0] \n]\n")),(0,r.kt)("p",null,"In this scenario:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"10 voters select the first candidate as third option"),(0,r.kt)("li",{parentName:"ul"},"10 voters select the second candidate as second option"),(0,r.kt)("li",{parentName:"ul"},"10 voters select the third candidate as first option")),(0,r.kt)("p",null,'Now, let\'s examine another election type that can produce the same results array. For a question like "choose your 3\nfavorite colors out of 2", which is an example of ',(0,r.kt)("inlineCode",{parentName:"p"},"approval voting"),", the results array may look like that:"),(0,r.kt)("pre",null,(0,r.kt)("code",{parentName:"pre"},"[ \n [10, 0], \n [0, 10], \n [0, 10] \n]\n")),(0,r.kt)("p",null,"On this case, the results interpretation may vary:"),(0,r.kt)("ul",null,(0,r.kt)("li",{parentName:"ul"},"10 users give 0 points to first option"),(0,r.kt)("li",{parentName:"ul"},"10 users give 1 point to second and third options")),(0,r.kt)("p",null,"The examples above represent two methods for interpreting the results array. Additional examples are available for\ndifferent voting type result interpretations."),(0,r.kt)("admonition",{title:"Weighted results are calculated on the indexer",type:"note"},(0,r.kt)("p",{parentName:"admonition"},"In a weighted election, the Vochain stores the envelope without calculating the weight of each voter. However, when\nretrieving the results using the SDK, you will see the weights applied. The application of these weights is performed\nby the vocdoni-node indexer, which calculates the weights for you."),(0,r.kt)("p",{parentName:"admonition"},"The weights of each vote are stored in the envelope, which is saved on the Vochain.")))}d.isMDXComponent=!0}}]); \ No newline at end of file diff --git a/assets/js/runtime~main.1f79e99a.js b/assets/js/runtime~main.eebe15a9.js similarity index 98% rename from assets/js/runtime~main.1f79e99a.js rename to assets/js/runtime~main.eebe15a9.js index 58745621b..40ebf9170 100644 --- a/assets/js/runtime~main.1f79e99a.js +++ b/assets/js/runtime~main.eebe15a9.js @@ -1 +1 @@ -(()=>{"use strict";var e,d,f,c,a,b={},t={};function r(e){var d=t[e];if(void 0!==d)return d.exports;var f=t[e]={id:e,loaded:!1,exports:{}};return b[e].call(f.exports,f,f.exports,r),f.loaded=!0,f.exports}r.m=b,r.amdO={},e=[],r.O=(d,f,c,a)=>{if(!f){var b=1/0;for(i=0;i=a)&&Object.keys(r.O).every((e=>r.O[e](f[o])))?f.splice(o--,1):(t=!1,a0&&e[i-1][2]>a;i--)e[i]=e[i-1];e[i]=[f,c,a]},r.n=e=>{var d=e&&e.__esModule?()=>e.default:()=>e;return r.d(d,{a:d}),d},f=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,r.t=function(e,c){if(1&c&&(e=this(e)),8&c)return e;if("object"==typeof e&&e){if(4&c&&e.__esModule)return e;if(16&c&&"function"==typeof e.then)return e}var a=Object.create(null);r.r(a);var b={};d=d||[null,f({}),f([]),f(f)];for(var t=2&c&&e;"object"==typeof t&&!~d.indexOf(t);t=f(t))Object.getOwnPropertyNames(t).forEach((d=>b[d]=()=>e[d]));return b.default=()=>e,r.d(a,b),a},r.d=(e,d)=>{for(var f in d)r.o(d,f)&&!r.o(e,f)&&Object.defineProperty(e,f,{enumerable:!0,get:d[f]})},r.f={},r.e=e=>Promise.all(Object.keys(r.f).reduce(((d,f)=>(r.f[f](e,d),d)),[])),r.u=e=>"assets/js/"+({47:"bddc6002",53:"935f2afb",67:"d94ccd67",100:"0032f96f",135:"491af8ad",173:"df5c78e6",182:"c12940ed",211:"bec6d9ae",248:"e7df0fec",260:"aab6ad66",274:"2f59b2ef",297:"ae74964d",306:"39a96d3a",374:"08636a24",422:"c626f2cc",469:"e6e6cd34",522:"7acd0d27",656:"3da0b0fe",689:"5945b6f4",738:"134f4ebc",830:"15bb616c",848:"ac57e32f",891:"576aa68d",992:"ffeeb722",1011:"b7def961",1054:"d79e07b2",1084:"e07651bc",1094:"9f9eec24",1117:"fd8596db",1126:"9029ef47",1132:"fe9260cd",1142:"dfccb580",1173:"db5a5176",1187:"4f32f676",1205:"5125b704",1270:"b2b5a0c0",1290:"99a9ad46",1317:"f64e1fa2",1357:"d970501b",1371:"0fa69d70",1378:"d6b477f2",1414:"1c3bce93",1425:"11667d91",1510:"1821d9d7",1528:"d8c91af8",1557:"59d5b983",1573:"7c0d6738",1591:"47d20a96",1597:"c8cd88a5",1655:"71f8faad",1719:"87d0da39",1738:"dae27e03",1739:"123fab3b",1786:"d71b54cc",1806:"8b196d05",1865:"c2c73492",1871:"65e31fed",1893:"4c5e977b",1935:"d2ab4b32",1966:"a2cbb706",1968:"b0d01e95",2005:"d7d13fd1",2050:"ec0516f7",2079:"7365c198",2116:"54a4f78f",2175:"d8c992a6",2184:"8b5652a7",2192:"57136864",2226:"e7ebf400",2241:"ff7cb792",2277:"6aeb5732",2323:"5383e2bf",2329:"dded7333",2360:"2eb5a7fb",2367:"fbd96b78",2428:"1d5be7b1",2467:"0f556ffa",2470:"e9c5307c",2551:"8a23d602",2600:"999cbc12",2609:"63e7154e",2636:"0128e05f",2691:"de66f94a",2733:"fe008fee",2827:"404eb028",2832:"ea74a8a9",2859:"b491e6b8",2870:"109756a8",2872:"e24c431f",2931:"8ed7db60",2956:"7ccdd76e",2975:"f77e462c",3013:"d5851cb1",3023:"b0b03425",3038:"64aa0b9a",3044:"d46fdf20",3082:"46b36dc0",3086:"d6e648af",3158:"467b2519",3168:"3930cc8a",3195:"c121c8d5",3204:"5c4d0554",3227:"835897f5",3237:"1df93b7f",3334:"a21738db",3496:"ae785ce1",3516:"377fc202",3625:"3c152c78",3665:"f601f941",3706:"54bc495f",3754:"d4ce7faf",3773:"74b5ba26",3796:"437ed742",3802:"65d7ebf2",3868:"3aefc2b6",3913:"080a9ee7",3987:"f50a63d5",4013:"47d37469",4019:"d95cd4ff",4108:"ea27d690",4182:"5c98d4ea",4183:"aa9e799f",4201:"d28adde9",4243:"f9b740ff",4246:"64c2e320",4253:"4d61d27d",4259:"c4573554",4324:"c84aae18",4376:"2340828a",4463:"29c8ca5d",4519:"5344dd0e",4539:"5954c450",4540:"335f69d6",4600:"ad99c2e7",4635:"ee2798c9",4674:"c87cc133",4719:"1e6527e1",4720:"03c6674d",4721:"af663d33",4792:"efcaecf7",4805:"93908748",4820:"9ea3e4a5",4881:"1e8e5e9a",5058:"9f384d53",5104:"945f0be5",5122:"0a3f3d31",5214:"260b3d09",5220:"fc1a6383",5253:"0fc92a72",5268:"22155637",5277:"4bef2fb3",5288:"1edcfddb",5326:"24ee6be4",5347:"ed25d525",5378:"2dbb09aa",5421:"7644a8b6",5469:"900ced3f",5470:"9728e091",5487:"8d8eb18d",5580:"af55f10e",5596:"6a02f24e",5642:"fc158ac8",5677:"d250e750",5698:"99ffa32d",5861:"5708b463",5882:"4b742bf9",5909:"4a1ec646",5913:"fcca6750",5978:"3b56eb8e",5995:"78bbaf06",6135:"8e01bad3",6142:"d9f2d88a",6178:"29694922",6204:"59e232ee",6220:"e20b99b5",6349:"f116289e",6354:"925c0bed",6386:"a217fb3c",6412:"a674c74b",6418:"16e8ae75",6425:"af3402af",6483:"effdce5d",6499:"13df6360",6563:"6b41ffc9",6567:"9611c1ba",6686:"cce83bc5",6689:"8a92166d",6723:"a7835d3e",6781:"01f4109f",6811:"00ff508f",6873:"dffc9575",6891:"0bcfcae9",6906:"6bf5cd43",6956:"6a011cfc",6990:"5ddc4d53",7037:"518b90c0",7055:"b16aadd2",7071:"d4d2d783",7082:"6d3dfbcd",7136:"515de0d7",7165:"ed887fb8",7347:"a87232fc",7374:"783013b2",7456:"445f6f2d",7493:"10dce6d4",7533:"16c4bb07",7583:"49b14676",7592:"b8b370b8",7612:"ace89945",7631:"b3153972",7673:"787465aa",7694:"c5434c58",7799:"bfbab14f",7813:"6b697fd9",7862:"a7c28e13",7920:"1a4e3797",7998:"1ed63671",8004:"80975cc5",8016:"23e9e137",8033:"4adb919a",8048:"dcb8c93b",8119:"545dbd82",8149:"b80cad64",8161:"caece487",8168:"6b798853",8180:"94050a54",8253:"fe83dea5",8257:"e1594dfa",8277:"d234883f",8389:"7b4f5a52",8399:"8ec8cf1f",8493:"ed5700b4",8545:"1cd58b57",8597:"2730d8e4",8740:"3b8a1714",8756:"f8d5f1d3",8759:"11d03c56",8882:"4f61726b",8883:"705711d3",8913:"427be892",8930:"70e3ad0d",8976:"8d68bc4a",8999:"388546f3",9057:"4e2de210",9097:"b7cc9ed0",9128:"9e4ccdce",9184:"79e28b2f",9192:"fc441bf1",9202:"4d66e9ad",9203:"e0557e97",9209:"5977a97c",9217:"3fa72254",9229:"b83e4bd7",9232:"b212ee85",9347:"5f8415ed",9379:"ddb99459",9410:"09cca914",9470:"6b74149a",9514:"1be78505",9589:"b5881b04",9671:"0e384e19",9756:"b862b811",9849:"e3461e1c",9875:"e964279c",9940:"92348782",9942:"725284f7",9967:"03d8c746"}[e]||e)+"."+{47:"9ca95f5b",53:"82666c71",67:"7019dac6",100:"f2261e00",135:"1a62672d",173:"086adaed",182:"ea0e6428",211:"978467dd",248:"f2e13a38",260:"b5fe8450",274:"f14cc663",297:"81e27855",306:"93774ddb",374:"443ef2a2",422:"324913ea",469:"4094ce40",522:"c83dd29a",656:"f3f73c3d",689:"46a216f4",738:"99bbe153",830:"5ec6b582",848:"adf34f8a",891:"29c1031e",992:"7d693730",1011:"76601344",1054:"bfb74149",1084:"e725b53a",1094:"43121a7d",1117:"c3053c9b",1126:"a5256a16",1132:"0f8e982a",1142:"ab437776",1173:"6ebb9d37",1187:"2033f24f",1205:"4fe38135",1270:"26cad9d1",1290:"c9ca9aa1",1317:"7b11faae",1357:"479224f3",1371:"81d4642a",1378:"bafc55bd",1414:"48a2daa9",1425:"962ae557",1510:"a26cfb7c",1528:"0da8ebf7",1557:"6dd1afc2",1573:"d52f97e1",1591:"b9274118",1597:"b6c41e15",1655:"982338c1",1719:"30e80776",1738:"96d7abf8",1739:"a083e977",1786:"440099dd",1806:"c01a1145",1865:"f91539f5",1871:"fa60a062",1893:"44f245e4",1935:"b4a75af1",1966:"a4626245",1968:"c83b1ce9",2005:"9d7c980b",2050:"32f29ebe",2079:"5cbfcd46",2116:"7fd3616d",2175:"cd526c75",2184:"c922196d",2192:"3a947d0a",2226:"27c3ff88",2241:"5e7ed5b1",2277:"ee29d770",2284:"f53edd07",2323:"d3e95c9b",2329:"b415de8a",2360:"ce5744dd",2367:"8a3801d9",2428:"dc680d4c",2467:"b6d001f0",2470:"b7d23a90",2551:"3221e6d3",2600:"55078313",2609:"90935b54",2636:"1935f811",2691:"6c0bd156",2733:"cf11dbe8",2827:"16e71fec",2832:"9746e13e",2859:"be38cd62",2870:"80a6bf1f",2872:"70c28301",2931:"55701d52",2956:"c9b7d867",2975:"f82637e2",3013:"4d21ffc4",3023:"fc8239c7",3038:"f0e08347",3044:"5081d156",3082:"7cf4efeb",3086:"5470238d",3158:"27c4b0f0",3168:"fe35a089",3195:"69dedc5e",3204:"6b187dd8",3227:"2560cb82",3237:"c2bd2738",3334:"ca512a6b",3496:"debe11a7",3516:"ae83fc37",3625:"b77306fc",3665:"df975761",3706:"19b764ac",3750:"9c762273",3754:"a6ac12b8",3773:"1d9653a1",3796:"ec4ed7df",3802:"6f93843d",3849:"c1dab010",3868:"817aab97",3913:"03a28f87",3987:"658b39ff",4013:"5181bb2b",4019:"cb8c2e9f",4108:"f471cc3d",4182:"205f84d7",4183:"5fdc864b",4201:"bfe2ba61",4243:"e86ab320",4246:"3fb08bfa",4253:"f29b83f9",4259:"aa15c68f",4324:"b985fa6d",4376:"91321f5f",4463:"217183a7",4519:"39edfb58",4539:"6305f34e",4540:"898366dc",4600:"a4334ffd",4635:"3f3af785",4674:"95b296b0",4719:"85264cdc",4720:"f9d2eb2e",4721:"a9e10c1b",4792:"3340e6a5",4805:"f2786f57",4820:"2640dc57",4881:"7c030ad4",4972:"a1407955",5058:"1dd5dff2",5104:"29e416b7",5122:"21c9ba82",5214:"798af7e9",5220:"a209fde1",5253:"d51d9b6f",5268:"ed881385",5277:"5b400b28",5288:"6da30320",5326:"790bd875",5347:"34cbef9c",5378:"055c8460",5421:"7c6a982e",5469:"726967e9",5470:"c0cb931b",5487:"0c8db86a",5580:"04900c24",5596:"48b408e1",5642:"018b0bd1",5677:"d4d0049f",5698:"ca885f06",5861:"3de5890e",5882:"7eda0b6c",5909:"7a3fa26e",5913:"6ab3da63",5978:"1ede3679",5995:"e45630f7",6057:"1dee8281",6135:"c653b3f0",6142:"c3db47e0",6178:"b8af4a05",6204:"41ef5e52",6220:"1b3ac2b7",6349:"110cc6c3",6354:"8f46cc44",6386:"4313bb44",6412:"cd9b9ba2",6418:"bb7e3c81",6425:"fc9a5a33",6483:"b8f091e2",6499:"e05ab8a6",6563:"158534c9",6567:"0f8710fd",6686:"c69fb7af",6689:"0acc8fc5",6723:"d911dc4f",6780:"ced0dfaf",6781:"4ce59af9",6811:"7e2216fa",6873:"91ba00b5",6882:"f806a2af",6891:"a9713d19",6906:"3d6a6c26",6945:"316f91de",6956:"c0142071",6990:"c9c5764b",7037:"d18e7d71",7055:"0d579216",7071:"26afd096",7082:"25f209a7",7136:"01797190",7165:"cd9b93dc",7347:"8e1f1c7b",7374:"0ff448a4",7456:"6ffea66f",7493:"edf237c7",7533:"de8dba19",7583:"35e2bbc2",7592:"e3257804",7612:"6f24825f",7631:"6cdca435",7673:"48689bc4",7694:"f38add89",7799:"179a9719",7813:"1184cb32",7862:"40fad2a9",7920:"affc72c9",7998:"0620da21",8004:"c869bf2f",8016:"138738df",8033:"25dbb883",8048:"5fc165f9",8119:"0cc14e21",8149:"162e40ae",8161:"cb8fd156",8168:"bf585480",8180:"24ea16e0",8253:"4947cfb5",8257:"d1a2117e",8277:"b0f80fd5",8389:"32597e34",8399:"d9af2318",8493:"ea0d0747",8545:"5595aca5",8597:"086d0310",8740:"31123a79",8756:"0c3d26f5",8759:"ec0c844c",8882:"87a165f1",8883:"0daec4bf",8894:"7edbb6c9",8913:"201b1acd",8930:"16141c6f",8976:"d78e71b1",8999:"06ee90aa",9052:"a20c6099",9057:"a00aa087",9097:"53777c18",9128:"879c72ce",9184:"016cb049",9192:"d0642cb7",9202:"2d2a0407",9203:"a04b5ac9",9209:"3ba3e887",9217:"f66f0a7c",9229:"deb97711",9232:"b8670774",9347:"dee91760",9379:"858137f3",9410:"285a98db",9470:"a3547ccb",9514:"cc715246",9589:"dc88740c",9671:"c68aeaec",9756:"90f7ef0b",9849:"6348e938",9875:"196867be",9940:"c51212ce",9942:"cbabbce4",9967:"79f5c672"}[e]+".js",r.miniCssF=e=>{},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),r.o=(e,d)=>Object.prototype.hasOwnProperty.call(e,d),c={},a="demo:",r.l=(e,d,f,b)=>{if(c[e])c[e].push(d);else{var t,o;if(void 0!==f)for(var n=document.getElementsByTagName("script"),i=0;i{t.onerror=t.onload=null,clearTimeout(s);var a=c[e];if(delete c[e],t.parentNode&&t.parentNode.removeChild(t),a&&a.forEach((e=>e(f))),d)return d(f)},s=setTimeout(u.bind(null,void 0,{type:"timeout",target:t}),12e4);t.onerror=u.bind(null,t.onerror),t.onload=u.bind(null,t.onload),o&&document.head.appendChild(t)}},r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.nmd=e=>(e.paths=[],e.children||(e.children=[]),e),r.p="/",r.gca=function(e){return e={22155637:"5268",29694922:"6178",57136864:"2192",92348782:"9940",93908748:"4805",bddc6002:"47","935f2afb":"53",d94ccd67:"67","0032f96f":"100","491af8ad":"135",df5c78e6:"173",c12940ed:"182",bec6d9ae:"211",e7df0fec:"248",aab6ad66:"260","2f59b2ef":"274",ae74964d:"297","39a96d3a":"306","08636a24":"374",c626f2cc:"422",e6e6cd34:"469","7acd0d27":"522","3da0b0fe":"656","5945b6f4":"689","134f4ebc":"738","15bb616c":"830",ac57e32f:"848","576aa68d":"891",ffeeb722:"992",b7def961:"1011",d79e07b2:"1054",e07651bc:"1084","9f9eec24":"1094",fd8596db:"1117","9029ef47":"1126",fe9260cd:"1132",dfccb580:"1142",db5a5176:"1173","4f32f676":"1187","5125b704":"1205",b2b5a0c0:"1270","99a9ad46":"1290",f64e1fa2:"1317",d970501b:"1357","0fa69d70":"1371",d6b477f2:"1378","1c3bce93":"1414","11667d91":"1425","1821d9d7":"1510",d8c91af8:"1528","59d5b983":"1557","7c0d6738":"1573","47d20a96":"1591",c8cd88a5:"1597","71f8faad":"1655","87d0da39":"1719",dae27e03:"1738","123fab3b":"1739",d71b54cc:"1786","8b196d05":"1806",c2c73492:"1865","65e31fed":"1871","4c5e977b":"1893",d2ab4b32:"1935",a2cbb706:"1966",b0d01e95:"1968",d7d13fd1:"2005",ec0516f7:"2050","7365c198":"2079","54a4f78f":"2116",d8c992a6:"2175","8b5652a7":"2184",e7ebf400:"2226",ff7cb792:"2241","6aeb5732":"2277","5383e2bf":"2323",dded7333:"2329","2eb5a7fb":"2360",fbd96b78:"2367","1d5be7b1":"2428","0f556ffa":"2467",e9c5307c:"2470","8a23d602":"2551","999cbc12":"2600","63e7154e":"2609","0128e05f":"2636",de66f94a:"2691",fe008fee:"2733","404eb028":"2827",ea74a8a9:"2832",b491e6b8:"2859","109756a8":"2870",e24c431f:"2872","8ed7db60":"2931","7ccdd76e":"2956",f77e462c:"2975",d5851cb1:"3013",b0b03425:"3023","64aa0b9a":"3038",d46fdf20:"3044","46b36dc0":"3082",d6e648af:"3086","467b2519":"3158","3930cc8a":"3168",c121c8d5:"3195","5c4d0554":"3204","835897f5":"3227","1df93b7f":"3237",a21738db:"3334",ae785ce1:"3496","377fc202":"3516","3c152c78":"3625",f601f941:"3665","54bc495f":"3706",d4ce7faf:"3754","74b5ba26":"3773","437ed742":"3796","65d7ebf2":"3802","3aefc2b6":"3868","080a9ee7":"3913",f50a63d5:"3987","47d37469":"4013",d95cd4ff:"4019",ea27d690:"4108","5c98d4ea":"4182",aa9e799f:"4183",d28adde9:"4201",f9b740ff:"4243","64c2e320":"4246","4d61d27d":"4253",c4573554:"4259",c84aae18:"4324","2340828a":"4376","29c8ca5d":"4463","5344dd0e":"4519","5954c450":"4539","335f69d6":"4540",ad99c2e7:"4600",ee2798c9:"4635",c87cc133:"4674","1e6527e1":"4719","03c6674d":"4720",af663d33:"4721",efcaecf7:"4792","9ea3e4a5":"4820","1e8e5e9a":"4881","9f384d53":"5058","945f0be5":"5104","0a3f3d31":"5122","260b3d09":"5214",fc1a6383:"5220","0fc92a72":"5253","4bef2fb3":"5277","1edcfddb":"5288","24ee6be4":"5326",ed25d525:"5347","2dbb09aa":"5378","7644a8b6":"5421","900ced3f":"5469","9728e091":"5470","8d8eb18d":"5487",af55f10e:"5580","6a02f24e":"5596",fc158ac8:"5642",d250e750:"5677","99ffa32d":"5698","5708b463":"5861","4b742bf9":"5882","4a1ec646":"5909",fcca6750:"5913","3b56eb8e":"5978","78bbaf06":"5995","8e01bad3":"6135",d9f2d88a:"6142","59e232ee":"6204",e20b99b5:"6220",f116289e:"6349","925c0bed":"6354",a217fb3c:"6386",a674c74b:"6412","16e8ae75":"6418",af3402af:"6425",effdce5d:"6483","13df6360":"6499","6b41ffc9":"6563","9611c1ba":"6567",cce83bc5:"6686","8a92166d":"6689",a7835d3e:"6723","01f4109f":"6781","00ff508f":"6811",dffc9575:"6873","0bcfcae9":"6891","6bf5cd43":"6906","6a011cfc":"6956","5ddc4d53":"6990","518b90c0":"7037",b16aadd2:"7055",d4d2d783:"7071","6d3dfbcd":"7082","515de0d7":"7136",ed887fb8:"7165",a87232fc:"7347","783013b2":"7374","445f6f2d":"7456","10dce6d4":"7493","16c4bb07":"7533","49b14676":"7583",b8b370b8:"7592",ace89945:"7612",b3153972:"7631","787465aa":"7673",c5434c58:"7694",bfbab14f:"7799","6b697fd9":"7813",a7c28e13:"7862","1a4e3797":"7920","1ed63671":"7998","80975cc5":"8004","23e9e137":"8016","4adb919a":"8033",dcb8c93b:"8048","545dbd82":"8119",b80cad64:"8149",caece487:"8161","6b798853":"8168","94050a54":"8180",fe83dea5:"8253",e1594dfa:"8257",d234883f:"8277","7b4f5a52":"8389","8ec8cf1f":"8399",ed5700b4:"8493","1cd58b57":"8545","2730d8e4":"8597","3b8a1714":"8740",f8d5f1d3:"8756","11d03c56":"8759","4f61726b":"8882","705711d3":"8883","427be892":"8913","70e3ad0d":"8930","8d68bc4a":"8976","388546f3":"8999","4e2de210":"9057",b7cc9ed0:"9097","9e4ccdce":"9128","79e28b2f":"9184",fc441bf1:"9192","4d66e9ad":"9202",e0557e97:"9203","5977a97c":"9209","3fa72254":"9217",b83e4bd7:"9229",b212ee85:"9232","5f8415ed":"9347",ddb99459:"9379","09cca914":"9410","6b74149a":"9470","1be78505":"9514",b5881b04:"9589","0e384e19":"9671",b862b811:"9756",e3461e1c:"9849",e964279c:"9875","725284f7":"9942","03d8c746":"9967"}[e]||e,r.p+r.u(e)},(()=>{var e={1303:0,532:0};r.f.j=(d,f)=>{var c=r.o(e,d)?e[d]:void 0;if(0!==c)if(c)f.push(c[2]);else if(/^(1303|532)$/.test(d))e[d]=0;else{var a=new Promise(((f,a)=>c=e[d]=[f,a]));f.push(c[2]=a);var b=r.p+r.u(d),t=new Error;r.l(b,(f=>{if(r.o(e,d)&&(0!==(c=e[d])&&(e[d]=void 0),c)){var a=f&&("load"===f.type?"missing":f.type),b=f&&f.target&&f.target.src;t.message="Loading chunk "+d+" failed.\n("+a+": "+b+")",t.name="ChunkLoadError",t.type=a,t.request=b,c[1](t)}}),"chunk-"+d,d)}},r.O.j=d=>0===e[d];var d=(d,f)=>{var c,a,b=f[0],t=f[1],o=f[2],n=0;if(b.some((d=>0!==e[d]))){for(c in t)r.o(t,c)&&(r.m[c]=t[c]);if(o)var i=o(r)}for(d&&d(f);n{"use strict";var e,d,f,c,a,b={},t={};function r(e){var d=t[e];if(void 0!==d)return d.exports;var f=t[e]={id:e,loaded:!1,exports:{}};return b[e].call(f.exports,f,f.exports,r),f.loaded=!0,f.exports}r.m=b,r.amdO={},e=[],r.O=(d,f,c,a)=>{if(!f){var b=1/0;for(i=0;i=a)&&Object.keys(r.O).every((e=>r.O[e](f[o])))?f.splice(o--,1):(t=!1,a0&&e[i-1][2]>a;i--)e[i]=e[i-1];e[i]=[f,c,a]},r.n=e=>{var d=e&&e.__esModule?()=>e.default:()=>e;return r.d(d,{a:d}),d},f=Object.getPrototypeOf?e=>Object.getPrototypeOf(e):e=>e.__proto__,r.t=function(e,c){if(1&c&&(e=this(e)),8&c)return e;if("object"==typeof e&&e){if(4&c&&e.__esModule)return e;if(16&c&&"function"==typeof e.then)return e}var a=Object.create(null);r.r(a);var b={};d=d||[null,f({}),f([]),f(f)];for(var t=2&c&&e;"object"==typeof t&&!~d.indexOf(t);t=f(t))Object.getOwnPropertyNames(t).forEach((d=>b[d]=()=>e[d]));return b.default=()=>e,r.d(a,b),a},r.d=(e,d)=>{for(var f in d)r.o(d,f)&&!r.o(e,f)&&Object.defineProperty(e,f,{enumerable:!0,get:d[f]})},r.f={},r.e=e=>Promise.all(Object.keys(r.f).reduce(((d,f)=>(r.f[f](e,d),d)),[])),r.u=e=>"assets/js/"+({47:"bddc6002",53:"935f2afb",67:"d94ccd67",100:"0032f96f",135:"491af8ad",173:"df5c78e6",182:"c12940ed",211:"bec6d9ae",248:"e7df0fec",260:"aab6ad66",274:"2f59b2ef",297:"ae74964d",306:"39a96d3a",374:"08636a24",422:"c626f2cc",469:"e6e6cd34",522:"7acd0d27",656:"3da0b0fe",689:"5945b6f4",738:"134f4ebc",830:"15bb616c",848:"ac57e32f",891:"576aa68d",992:"ffeeb722",1011:"b7def961",1054:"d79e07b2",1084:"e07651bc",1094:"9f9eec24",1117:"fd8596db",1126:"9029ef47",1132:"fe9260cd",1142:"dfccb580",1173:"db5a5176",1187:"4f32f676",1205:"5125b704",1270:"b2b5a0c0",1290:"99a9ad46",1317:"f64e1fa2",1357:"d970501b",1371:"0fa69d70",1378:"d6b477f2",1414:"1c3bce93",1425:"11667d91",1510:"1821d9d7",1528:"d8c91af8",1557:"59d5b983",1573:"7c0d6738",1591:"47d20a96",1597:"c8cd88a5",1655:"71f8faad",1719:"87d0da39",1738:"dae27e03",1739:"123fab3b",1786:"d71b54cc",1806:"8b196d05",1865:"c2c73492",1871:"65e31fed",1893:"4c5e977b",1935:"d2ab4b32",1966:"a2cbb706",1968:"b0d01e95",2005:"d7d13fd1",2050:"ec0516f7",2079:"7365c198",2116:"54a4f78f",2175:"d8c992a6",2184:"8b5652a7",2192:"57136864",2226:"e7ebf400",2241:"ff7cb792",2277:"6aeb5732",2323:"5383e2bf",2329:"dded7333",2360:"2eb5a7fb",2367:"fbd96b78",2428:"1d5be7b1",2467:"0f556ffa",2470:"e9c5307c",2551:"8a23d602",2600:"999cbc12",2609:"63e7154e",2636:"0128e05f",2691:"de66f94a",2733:"fe008fee",2827:"404eb028",2832:"ea74a8a9",2859:"b491e6b8",2870:"109756a8",2872:"e24c431f",2931:"8ed7db60",2956:"7ccdd76e",2975:"f77e462c",3013:"d5851cb1",3023:"b0b03425",3038:"64aa0b9a",3044:"d46fdf20",3082:"46b36dc0",3086:"d6e648af",3158:"467b2519",3168:"3930cc8a",3195:"c121c8d5",3204:"5c4d0554",3227:"835897f5",3237:"1df93b7f",3334:"a21738db",3496:"ae785ce1",3516:"377fc202",3625:"3c152c78",3665:"f601f941",3706:"54bc495f",3754:"d4ce7faf",3773:"74b5ba26",3796:"437ed742",3802:"65d7ebf2",3868:"3aefc2b6",3913:"080a9ee7",3987:"f50a63d5",4013:"47d37469",4019:"d95cd4ff",4108:"ea27d690",4182:"5c98d4ea",4183:"aa9e799f",4201:"d28adde9",4243:"f9b740ff",4246:"64c2e320",4253:"4d61d27d",4259:"c4573554",4324:"c84aae18",4376:"2340828a",4463:"29c8ca5d",4519:"5344dd0e",4539:"5954c450",4540:"335f69d6",4600:"ad99c2e7",4635:"ee2798c9",4674:"c87cc133",4719:"1e6527e1",4720:"03c6674d",4721:"af663d33",4792:"efcaecf7",4805:"93908748",4820:"9ea3e4a5",4881:"1e8e5e9a",5058:"9f384d53",5104:"945f0be5",5122:"0a3f3d31",5214:"260b3d09",5220:"fc1a6383",5253:"0fc92a72",5268:"22155637",5277:"4bef2fb3",5288:"1edcfddb",5326:"24ee6be4",5347:"ed25d525",5378:"2dbb09aa",5421:"7644a8b6",5469:"900ced3f",5470:"9728e091",5487:"8d8eb18d",5580:"af55f10e",5596:"6a02f24e",5642:"fc158ac8",5677:"d250e750",5698:"99ffa32d",5861:"5708b463",5882:"4b742bf9",5909:"4a1ec646",5913:"fcca6750",5978:"3b56eb8e",5995:"78bbaf06",6135:"8e01bad3",6142:"d9f2d88a",6178:"29694922",6204:"59e232ee",6220:"e20b99b5",6349:"f116289e",6354:"925c0bed",6386:"a217fb3c",6412:"a674c74b",6418:"16e8ae75",6425:"af3402af",6483:"effdce5d",6499:"13df6360",6563:"6b41ffc9",6567:"9611c1ba",6686:"cce83bc5",6689:"8a92166d",6723:"a7835d3e",6781:"01f4109f",6811:"00ff508f",6873:"dffc9575",6891:"0bcfcae9",6906:"6bf5cd43",6956:"6a011cfc",6990:"5ddc4d53",7037:"518b90c0",7055:"b16aadd2",7071:"d4d2d783",7082:"6d3dfbcd",7136:"515de0d7",7165:"ed887fb8",7347:"a87232fc",7374:"783013b2",7456:"445f6f2d",7493:"10dce6d4",7533:"16c4bb07",7583:"49b14676",7592:"b8b370b8",7612:"ace89945",7631:"b3153972",7673:"787465aa",7694:"c5434c58",7799:"bfbab14f",7813:"6b697fd9",7862:"a7c28e13",7920:"1a4e3797",7998:"1ed63671",8004:"80975cc5",8016:"23e9e137",8033:"4adb919a",8048:"dcb8c93b",8119:"545dbd82",8149:"b80cad64",8161:"caece487",8168:"6b798853",8180:"94050a54",8253:"fe83dea5",8257:"e1594dfa",8277:"d234883f",8389:"7b4f5a52",8399:"8ec8cf1f",8493:"ed5700b4",8545:"1cd58b57",8597:"2730d8e4",8740:"3b8a1714",8756:"f8d5f1d3",8759:"11d03c56",8882:"4f61726b",8883:"705711d3",8913:"427be892",8930:"70e3ad0d",8976:"8d68bc4a",8999:"388546f3",9057:"4e2de210",9097:"b7cc9ed0",9128:"9e4ccdce",9184:"79e28b2f",9192:"fc441bf1",9202:"4d66e9ad",9203:"e0557e97",9209:"5977a97c",9217:"3fa72254",9229:"b83e4bd7",9232:"b212ee85",9347:"5f8415ed",9379:"ddb99459",9410:"09cca914",9470:"6b74149a",9514:"1be78505",9589:"b5881b04",9671:"0e384e19",9756:"b862b811",9849:"e3461e1c",9875:"e964279c",9940:"92348782",9942:"725284f7",9967:"03d8c746"}[e]||e)+"."+{47:"9ca95f5b",53:"82666c71",67:"7019dac6",100:"f2261e00",135:"1a62672d",173:"086adaed",182:"ea0e6428",211:"978467dd",248:"f2e13a38",260:"b5fe8450",274:"f14cc663",297:"81e27855",306:"93774ddb",374:"443ef2a2",422:"324913ea",469:"4094ce40",522:"c83dd29a",656:"f3f73c3d",689:"46a216f4",738:"99bbe153",830:"5ec6b582",848:"adf34f8a",891:"29c1031e",992:"7d693730",1011:"76601344",1054:"bfb74149",1084:"e725b53a",1094:"43121a7d",1117:"c3053c9b",1126:"a5256a16",1132:"0f8e982a",1142:"ab437776",1173:"6ebb9d37",1187:"5a88cbbe",1205:"4fe38135",1270:"26cad9d1",1290:"c9ca9aa1",1317:"7b11faae",1357:"479224f3",1371:"81d4642a",1378:"bafc55bd",1414:"48a2daa9",1425:"962ae557",1510:"a26cfb7c",1528:"0da8ebf7",1557:"6dd1afc2",1573:"d52f97e1",1591:"b9274118",1597:"b6c41e15",1655:"982338c1",1719:"30e80776",1738:"96d7abf8",1739:"a083e977",1786:"440099dd",1806:"c01a1145",1865:"f91539f5",1871:"fa60a062",1893:"44f245e4",1935:"b4a75af1",1966:"a4626245",1968:"c83b1ce9",2005:"9d7c980b",2050:"32f29ebe",2079:"5cbfcd46",2116:"7fd3616d",2175:"cd526c75",2184:"c922196d",2192:"3a947d0a",2226:"27c3ff88",2241:"5e7ed5b1",2277:"ee29d770",2284:"f53edd07",2323:"d3e95c9b",2329:"b415de8a",2360:"ce5744dd",2367:"8a3801d9",2428:"dc680d4c",2467:"b6d001f0",2470:"b7d23a90",2551:"3221e6d3",2600:"55078313",2609:"90935b54",2636:"1935f811",2691:"6c0bd156",2733:"cf11dbe8",2827:"b6323f6a",2832:"9746e13e",2859:"be38cd62",2870:"80a6bf1f",2872:"70c28301",2931:"55701d52",2956:"c9b7d867",2975:"f82637e2",3013:"4d21ffc4",3023:"fc8239c7",3038:"f0e08347",3044:"5081d156",3082:"080e3f08",3086:"5470238d",3158:"27c4b0f0",3168:"fe35a089",3195:"69dedc5e",3204:"6b187dd8",3227:"2560cb82",3237:"c2bd2738",3334:"ca512a6b",3496:"debe11a7",3516:"ae83fc37",3625:"b77306fc",3665:"df975761",3706:"261c6427",3750:"9c762273",3754:"a6ac12b8",3773:"1d9653a1",3796:"ec4ed7df",3802:"6f93843d",3849:"c1dab010",3868:"817aab97",3913:"03a28f87",3987:"658b39ff",4013:"5181bb2b",4019:"cb8c2e9f",4108:"f471cc3d",4182:"205f84d7",4183:"5fdc864b",4201:"bfe2ba61",4243:"e86ab320",4246:"3fb08bfa",4253:"f29b83f9",4259:"aa15c68f",4324:"b985fa6d",4376:"91321f5f",4463:"217183a7",4519:"39edfb58",4539:"6305f34e",4540:"898366dc",4600:"a4334ffd",4635:"3f3af785",4674:"95b296b0",4719:"85264cdc",4720:"f9d2eb2e",4721:"a9e10c1b",4792:"3340e6a5",4805:"f2786f57",4820:"2640dc57",4881:"7c030ad4",4972:"a1407955",5058:"1dd5dff2",5104:"29e416b7",5122:"21c9ba82",5214:"798af7e9",5220:"a209fde1",5253:"d51d9b6f",5268:"ed881385",5277:"5b400b28",5288:"6da30320",5326:"790bd875",5347:"34cbef9c",5378:"055c8460",5421:"7c6a982e",5469:"726967e9",5470:"c0cb931b",5487:"0c8db86a",5580:"04900c24",5596:"48b408e1",5642:"018b0bd1",5677:"d4d0049f",5698:"ca885f06",5861:"3de5890e",5882:"7eda0b6c",5909:"7a3fa26e",5913:"6ab3da63",5978:"1ede3679",5995:"d3323e91",6057:"1dee8281",6135:"c653b3f0",6142:"c3db47e0",6178:"b8af4a05",6204:"41ef5e52",6220:"1b3ac2b7",6349:"110cc6c3",6354:"8f46cc44",6386:"4313bb44",6412:"cd9b9ba2",6418:"bb7e3c81",6425:"fc9a5a33",6483:"b8f091e2",6499:"e05ab8a6",6563:"158534c9",6567:"0f8710fd",6686:"c69fb7af",6689:"0acc8fc5",6723:"d911dc4f",6780:"ced0dfaf",6781:"4ce59af9",6811:"7e2216fa",6873:"91ba00b5",6882:"f806a2af",6891:"a9713d19",6906:"3d6a6c26",6945:"316f91de",6956:"c0142071",6990:"c9c5764b",7037:"d18e7d71",7055:"0d579216",7071:"26afd096",7082:"25f209a7",7136:"01797190",7165:"cd9b93dc",7347:"8e1f1c7b",7374:"0ff448a4",7456:"6ffea66f",7493:"edf237c7",7533:"de8dba19",7583:"35e2bbc2",7592:"e3257804",7612:"6f24825f",7631:"6cdca435",7673:"48689bc4",7694:"f38add89",7799:"179a9719",7813:"1184cb32",7862:"40fad2a9",7920:"affc72c9",7998:"0620da21",8004:"c869bf2f",8016:"138738df",8033:"25dbb883",8048:"5fc165f9",8119:"0cc14e21",8149:"162e40ae",8161:"cb8fd156",8168:"bf585480",8180:"24ea16e0",8253:"4947cfb5",8257:"d1a2117e",8277:"b0f80fd5",8389:"32597e34",8399:"d9af2318",8493:"ea0d0747",8545:"5595aca5",8597:"086d0310",8740:"31123a79",8756:"0c3d26f5",8759:"ec0c844c",8882:"87a165f1",8883:"0daec4bf",8894:"7edbb6c9",8913:"201b1acd",8930:"16141c6f",8976:"d78e71b1",8999:"06ee90aa",9052:"a20c6099",9057:"a00aa087",9097:"53777c18",9128:"879c72ce",9184:"016cb049",9192:"d0642cb7",9202:"2d2a0407",9203:"a04b5ac9",9209:"3ba3e887",9217:"f66f0a7c",9229:"deb97711",9232:"b8670774",9347:"dee91760",9379:"858137f3",9410:"285a98db",9470:"a3547ccb",9514:"cc715246",9589:"dc88740c",9671:"c68aeaec",9756:"90f7ef0b",9849:"6348e938",9875:"196867be",9940:"c51212ce",9942:"cbabbce4",9967:"79f5c672"}[e]+".js",r.miniCssF=e=>{},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),r.o=(e,d)=>Object.prototype.hasOwnProperty.call(e,d),c={},a="demo:",r.l=(e,d,f,b)=>{if(c[e])c[e].push(d);else{var t,o;if(void 0!==f)for(var n=document.getElementsByTagName("script"),i=0;i{t.onerror=t.onload=null,clearTimeout(s);var a=c[e];if(delete c[e],t.parentNode&&t.parentNode.removeChild(t),a&&a.forEach((e=>e(f))),d)return d(f)},s=setTimeout(u.bind(null,void 0,{type:"timeout",target:t}),12e4);t.onerror=u.bind(null,t.onerror),t.onload=u.bind(null,t.onload),o&&document.head.appendChild(t)}},r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.nmd=e=>(e.paths=[],e.children||(e.children=[]),e),r.p="/",r.gca=function(e){return e={22155637:"5268",29694922:"6178",57136864:"2192",92348782:"9940",93908748:"4805",bddc6002:"47","935f2afb":"53",d94ccd67:"67","0032f96f":"100","491af8ad":"135",df5c78e6:"173",c12940ed:"182",bec6d9ae:"211",e7df0fec:"248",aab6ad66:"260","2f59b2ef":"274",ae74964d:"297","39a96d3a":"306","08636a24":"374",c626f2cc:"422",e6e6cd34:"469","7acd0d27":"522","3da0b0fe":"656","5945b6f4":"689","134f4ebc":"738","15bb616c":"830",ac57e32f:"848","576aa68d":"891",ffeeb722:"992",b7def961:"1011",d79e07b2:"1054",e07651bc:"1084","9f9eec24":"1094",fd8596db:"1117","9029ef47":"1126",fe9260cd:"1132",dfccb580:"1142",db5a5176:"1173","4f32f676":"1187","5125b704":"1205",b2b5a0c0:"1270","99a9ad46":"1290",f64e1fa2:"1317",d970501b:"1357","0fa69d70":"1371",d6b477f2:"1378","1c3bce93":"1414","11667d91":"1425","1821d9d7":"1510",d8c91af8:"1528","59d5b983":"1557","7c0d6738":"1573","47d20a96":"1591",c8cd88a5:"1597","71f8faad":"1655","87d0da39":"1719",dae27e03:"1738","123fab3b":"1739",d71b54cc:"1786","8b196d05":"1806",c2c73492:"1865","65e31fed":"1871","4c5e977b":"1893",d2ab4b32:"1935",a2cbb706:"1966",b0d01e95:"1968",d7d13fd1:"2005",ec0516f7:"2050","7365c198":"2079","54a4f78f":"2116",d8c992a6:"2175","8b5652a7":"2184",e7ebf400:"2226",ff7cb792:"2241","6aeb5732":"2277","5383e2bf":"2323",dded7333:"2329","2eb5a7fb":"2360",fbd96b78:"2367","1d5be7b1":"2428","0f556ffa":"2467",e9c5307c:"2470","8a23d602":"2551","999cbc12":"2600","63e7154e":"2609","0128e05f":"2636",de66f94a:"2691",fe008fee:"2733","404eb028":"2827",ea74a8a9:"2832",b491e6b8:"2859","109756a8":"2870",e24c431f:"2872","8ed7db60":"2931","7ccdd76e":"2956",f77e462c:"2975",d5851cb1:"3013",b0b03425:"3023","64aa0b9a":"3038",d46fdf20:"3044","46b36dc0":"3082",d6e648af:"3086","467b2519":"3158","3930cc8a":"3168",c121c8d5:"3195","5c4d0554":"3204","835897f5":"3227","1df93b7f":"3237",a21738db:"3334",ae785ce1:"3496","377fc202":"3516","3c152c78":"3625",f601f941:"3665","54bc495f":"3706",d4ce7faf:"3754","74b5ba26":"3773","437ed742":"3796","65d7ebf2":"3802","3aefc2b6":"3868","080a9ee7":"3913",f50a63d5:"3987","47d37469":"4013",d95cd4ff:"4019",ea27d690:"4108","5c98d4ea":"4182",aa9e799f:"4183",d28adde9:"4201",f9b740ff:"4243","64c2e320":"4246","4d61d27d":"4253",c4573554:"4259",c84aae18:"4324","2340828a":"4376","29c8ca5d":"4463","5344dd0e":"4519","5954c450":"4539","335f69d6":"4540",ad99c2e7:"4600",ee2798c9:"4635",c87cc133:"4674","1e6527e1":"4719","03c6674d":"4720",af663d33:"4721",efcaecf7:"4792","9ea3e4a5":"4820","1e8e5e9a":"4881","9f384d53":"5058","945f0be5":"5104","0a3f3d31":"5122","260b3d09":"5214",fc1a6383:"5220","0fc92a72":"5253","4bef2fb3":"5277","1edcfddb":"5288","24ee6be4":"5326",ed25d525:"5347","2dbb09aa":"5378","7644a8b6":"5421","900ced3f":"5469","9728e091":"5470","8d8eb18d":"5487",af55f10e:"5580","6a02f24e":"5596",fc158ac8:"5642",d250e750:"5677","99ffa32d":"5698","5708b463":"5861","4b742bf9":"5882","4a1ec646":"5909",fcca6750:"5913","3b56eb8e":"5978","78bbaf06":"5995","8e01bad3":"6135",d9f2d88a:"6142","59e232ee":"6204",e20b99b5:"6220",f116289e:"6349","925c0bed":"6354",a217fb3c:"6386",a674c74b:"6412","16e8ae75":"6418",af3402af:"6425",effdce5d:"6483","13df6360":"6499","6b41ffc9":"6563","9611c1ba":"6567",cce83bc5:"6686","8a92166d":"6689",a7835d3e:"6723","01f4109f":"6781","00ff508f":"6811",dffc9575:"6873","0bcfcae9":"6891","6bf5cd43":"6906","6a011cfc":"6956","5ddc4d53":"6990","518b90c0":"7037",b16aadd2:"7055",d4d2d783:"7071","6d3dfbcd":"7082","515de0d7":"7136",ed887fb8:"7165",a87232fc:"7347","783013b2":"7374","445f6f2d":"7456","10dce6d4":"7493","16c4bb07":"7533","49b14676":"7583",b8b370b8:"7592",ace89945:"7612",b3153972:"7631","787465aa":"7673",c5434c58:"7694",bfbab14f:"7799","6b697fd9":"7813",a7c28e13:"7862","1a4e3797":"7920","1ed63671":"7998","80975cc5":"8004","23e9e137":"8016","4adb919a":"8033",dcb8c93b:"8048","545dbd82":"8119",b80cad64:"8149",caece487:"8161","6b798853":"8168","94050a54":"8180",fe83dea5:"8253",e1594dfa:"8257",d234883f:"8277","7b4f5a52":"8389","8ec8cf1f":"8399",ed5700b4:"8493","1cd58b57":"8545","2730d8e4":"8597","3b8a1714":"8740",f8d5f1d3:"8756","11d03c56":"8759","4f61726b":"8882","705711d3":"8883","427be892":"8913","70e3ad0d":"8930","8d68bc4a":"8976","388546f3":"8999","4e2de210":"9057",b7cc9ed0:"9097","9e4ccdce":"9128","79e28b2f":"9184",fc441bf1:"9192","4d66e9ad":"9202",e0557e97:"9203","5977a97c":"9209","3fa72254":"9217",b83e4bd7:"9229",b212ee85:"9232","5f8415ed":"9347",ddb99459:"9379","09cca914":"9410","6b74149a":"9470","1be78505":"9514",b5881b04:"9589","0e384e19":"9671",b862b811:"9756",e3461e1c:"9849",e964279c:"9875","725284f7":"9942","03d8c746":"9967"}[e]||e,r.p+r.u(e)},(()=>{var e={1303:0,532:0};r.f.j=(d,f)=>{var c=r.o(e,d)?e[d]:void 0;if(0!==c)if(c)f.push(c[2]);else if(/^(1303|532)$/.test(d))e[d]=0;else{var a=new Promise(((f,a)=>c=e[d]=[f,a]));f.push(c[2]=a);var b=r.p+r.u(d),t=new Error;r.l(b,(f=>{if(r.o(e,d)&&(0!==(c=e[d])&&(e[d]=void 0),c)){var a=f&&("load"===f.type?"missing":f.type),b=f&&f.target&&f.target.src;t.message="Loading chunk "+d+" failed.\n("+a+": "+b+")",t.name="ChunkLoadError",t.type=a,t.request=b,c[1](t)}}),"chunk-"+d,d)}},r.O.j=d=>0===e[d];var d=(d,f)=>{var c,a,b=f[0],t=f[1],o=f[2],n=0;if(b.some((d=>0!==e[d]))){for(c in t)r.o(t,c)&&(r.m[c]=t[c]);if(o)var i=o(r)}for(d&&d(f);n - +

Develop secure & private digital voting apps with few lines of code

Designed for developers, abstracting the complexities involved in secure and private voting protocols. Create AGMs, elections and proposals with ease, multiple election types, check voter eligibility and much more!

Try it out!


Create and integrate
applications quickly and easily.

SDK

Check the docs for registering an account, creating a voting process, fetch election info, voting to a process and more!

DEMO

A live preview for testing the SDK, connect your wallet and start creating an election in less than 10 sec.

EXAMPLES

Review examples on how to implement Vocdoni SDK into your react applications.

Easy way to get started


Easily create variety of Elections

With just a few simple steps, it is very easy to set up everything, from basic surveys to complex voting systems, with single vote, weighted vote or anonymous, just with a simple configuration flag.

Docs

A first generation voting protocol

A completely anonymous voting system that guarantees the availability of the data and a censorship resistant of the data and a communication protocol resistant to censorship. Based on decentralised technologies such as Ethereum, Daichain, Tendermint, IPFS and zero-knowledge proofs.

hands up

Resources

Guides
Soon

Tutorials
Soon

Copyright © 2024 Vocdoni, Inc. All rights reserved.
- + \ No newline at end of file diff --git a/intro.html b/intro.html index bf3a114e4..fc13ccf37 100644 --- a/intro.html +++ b/intro.html @@ -12,13 +12,13 @@ - +

Getting Started

Vocdoni is the most open, secure, and universally verifiable voting protocol, used by hundreds of organizations worldwide. The core of our stack is a powerful decentralized backend, including blockchain, P2P gateway, and distributed file storage components.

The Vocdoni Protocol layer is accessible via a public API. This API is great for querying data, but running an election requires some advanced understanding of the protocol. Thus, we recommend integrators use the SDK.

The Software Development Kit is a wrapper for the API and provides developers with an easy way to integrate the functionality of the Vocdoni Protocol.

The UI Components library provides various basic React components for Vocdoni elections.

Looking to integrate digital voting into your web application?

Start with the SDK Tutorial

Live preview

These components all come together in our live demo. You can explore a basic Vocdoni implementation by creating some fake voters and starting a simple, single-question election. You will be able to cast a vote for each fake voter and see the results.

Live preview

This demo requires Metamask (or Walletconnect) to sign transactions. Metamask is a browser extension that holds custody of private keys and cryptocurrencies, but it is simple to install and use, and you need no prior knowledge of this technology.

No balance is needed

Metamask is used to sign the transactions that create elections and cast votes. Testing tokens are automatically sent once the account is created. No value is used or exchanged.

Resources

Guides
Soon

Tutorials
Soon

Copyright © 2024 Vocdoni, Inc. All rights reserved.
- + \ No newline at end of file diff --git a/protocol.html b/protocol.html index c8a48b8ce..cbff79898 100644 --- a/protocol.html +++ b/protocol.html @@ -12,13 +12,13 @@ - +

Vocdoni Protocol

1. Introduction

Voĉdoni in Esperanto translates to "to give voice". We aim to achieve change by empowering society from the bottom up, building the necessary primitives and tools to enable every voice to be heard, from a few individuals to millions of citizens. We aspire to be the most accessible and functional toolset on earth, open to every group of people, regardless of their position or resources.

We perceive voting as a collective signaling mechanism "to give voice", that can be fully digitalized, if provided with cryptographic guarantees about its integrity and its outcome. To this end, we have designed and implemented the Vocdoni Protocol, a universally verifiable set of rules and primitives that allow anyone to create and participate in collective decision making.

1.1 The blockchain

The Vocdoni blockchain is named Vochain. It is a Byzantine fault-tolerant network based on Tendermint that executes the Vocdoni Protocol logic represented as a state machine. Its main purpose is to register votes in a decentralized and verifiable format. Currently, the network can process more than 30K votes per minute while using no more than the resources found on commodity computers.

The Vocdoni blockchain requires a native token (VOC) to execute management transactions (i.e creating elections), but not for casting votes. Therefore, the voters can participate in governance processes in a free and gasless manner.

Vochain is currently based on Proof-of-Authority consensus. However, we are already working towards transitioning to Proof-of-Stake in 2023. Until then, the tokens are free and can be obtained by anyone by using our faucet service.

The current vocdoni-node code can be found in our github repository.

1.2 Gateways

The Gateways provide entry points to our P2P network. They allow clients to reach decentralized services through a standard HTTP(s) API interface.

Internally, the Gateways act as a standard blockchain full node, but also as indexers, meaning that they store and update a separate non state-related database that contains digested information useful for fulfilling client query requirements. For instance, Gateways compute election results (which are not part of the state) and provide census services (so voters can fetch their election Merkle proof). To perform the indexer function, Gateways need access to the auxiliary distributed filestore.

1.3 Distributed storage

Vocdoni currently relies on the InterPlanetary File System (IPFS) for storing auxiliary information. In a voting process, this includes information such as texts (questions, descriptions, and options), complementary images, as well as census. This data does not need to be permanent in order to ensure the voting guarantees, and is expensive to keep it around, so it is published to IPFS until it can be discarded.

We have designed the Vocdoni primitives in a modular fashion, which allows us to incorporate more data layers in the future, such as Ethersphere Swarm, DAT, STORj or Filecoin.

2. Process overview

This section provides an overview of the Vocdoni flow for creating a participatory process, its main attributes, and configuration options.

The following diagram is a summary of the flow, from creating an organization account to the vote casting.

process overview schema

Let's explore in more detail the different concepts.

2.1 The census

The census is a key component of every voting process. It defines the set of users (identified by a public key or address) who are eligible for participating in an election.

Vocdoni is designed to be as flexible as possible and to enable, at the very least, the most common use cases for elections. To this end, the protocol currently supports several census types and origins, and more may be added in the future.

The current census origins available are:

  • weighted merkle tree: for standard elections, allowing participants to vote with different "weights" (e.g. someone with 50 points might have 50 votes)
  • indexed merkle tree: an optimized merkle tree for voting on zkSnarks
  • credential service provider (CSP): for elections where an authority provides voting credentials (such as OAUTH, mailing, SMS, etc.)
  • ERC20 based on storage proofs: for Ethereum based tokens, the user needs to fetch an EIP1186 proof from a web3 provider (implemented as part of https://voice.aragon.org)

The current implementation of our Vocdoni API/SDK only provides the weighted merkle tree, so we will focus on this specific origin. More options will become available in the following months.

Weighted merkle tree census

The census itself is represented as a binary Merkle Tree, where the keys of the tree contain the (hashed) public keys or addresses of all eligible voters and the leafs (values) represent the voting weight.

Using Merkle Trees, we can efficiently prove that a key/value belongs to the tree. For a tree of size N elements, only log(N) elements are needed to generate a proof. A tree with 1 million leaves, for example, would only need 20 hashes to prove the inclusion of any one leaf.

A prover is able to prove the inclusion of any leaf of the Merkle Tree to a verifier:

  • The verifier only needs to know the Root Hash
  • The prover only needs to provide the Leaf and its Sibling, as well as the siblings of each of its ancestors (hence, log(N) elements).

2.2 Accounts

A Vocdoni account is identified by an Ethereum-like address. This allows us to use standard Web3 signers such as Metamask.

An account can:

  • Create and manage elections
  • Transfer tokens
  • Authorize other accounts to act on his behalf (delegates)
  • Manage its metadata

For creating an account, a faucet package is required, since bootstrapping requires a fee in Voc tokens. At the moment, Vocdoni provides a free faucet service for distributing such tokens (integrated within the client SDK).

An account often represents an organization and might have associated an infoURL pointing to an external IPFS file containing the metadata details (name, description, logo, etc.). All Vochain nodes automatically distribute and store this data. 

2.3 Elections

An Election (named a process internally) is a rule-set of options and requirements written into the blockchain state, thus guaranteeing that they can no longer be modified (unless explicitly configured to be upgradeable). The election is created and configured by an account owner or account delegates.

The following election options can be configured:

  • Census origin: description of the eligible voters or rules.
  • Lifecycle: initial state, start, and end blocks.
  • Election mode: how should the process behave.
  • Vote mode: the kind of ballots expected from voters.
  • Tally mode: how should the results be computed as defined by the Vocdoni Ballot protocol. Details and examples can be found here.

Election lifecycle states

An election must be in one of the following states:

  • Ready: the process is open to voters.
  • Paused: the process is active, but votes are not accepted.
  • Ended: the process is finished and the state can no longer be updated.
  • Canceled: the process is terminated by the election official and is no longer considered valid.
  • Result: the process has ended and results have been published.

The states can transition in the following ways:

Election mode

  • Auto-start: Enables the voting process to be started manually by the election administrator, as opposed to setting a start date.
  • Interruptible: The election administrator may pause or end the process at any point in time.
  • Encrypted metadata: Allows the questions and options of a process to be encrypted, so an external observer won't be able to see the questions unless they have the key.
  • Dynamic census: By default, the census is immutable and cannot be changed once published. However, long lasting polls may enable a dynamic census so that new members of a community may vote on a process after joining.
  • Allow override: If enabled, a voter may vote multiple times and replace any prior vote envelope. This protects voters from coercion and accidental mistakes.

Vote mode

  • Anonymous: If enabled, the voter’s public key will remain unrecoverable. Instead, the voter will prove that they are registered to vote by computing a zk-SNARK proof (ZKP) on their device. If this option is not chosen, the vote envelope will contain a signed vote, resulting in a pseudonymous vote. If an observer correlates the voter’s public key with personal data, the voter could be identified.
  • Encrypted: If enabled, the payload of the votes emitted will remain encrypted until the end of the process. The results will be available once the encryption keys are published by the miners at the end of the process. If disabled, the results can be seen in real time.
  • CostFromWeight: If enabled, the total cost defined in the ballot protocol will equal the voter's census weight.

2.4 Anonymous vote

A voting envelope is composed of two parts: the census proof (which defines the eligibility of the voter) and the ballot (the actual contents of the vote, containing the chosen options). The anonymization of the voting envelope is achieved by anonymizing the census proof using zk-SNARKs technology.

zk-SNARK proofs are a convenient method to prove something to a third-party verifier without revealing the contents of what is being proven.

The goal of the Vocdoni zk-SNARK circuit is to prove that a voter (identified by a public key) is part of a Census (a Merkle Tree composed of such public keys) without revealing the identity (public key) of that voter. This circuit produces a unique and deterministic identifier (nullifier) that can be processed by a public ledger/blockchain to distinguish whether the voter has previously submitted a vote.

Note: while zk-SNARK voting is enabled in the protocol and available at https://vocdoni.app, it is not yet implemented as part of the current SDK.

2.5 Results

The results are computed by a set of rules configured by the election owner and following the Vocdoni ballot protocol, which allows for almost any type of voting such as Range or Quadratic.

Results are represented as a matrix of numbers such as [ [1,2], [0,1] ] which can be interpreted as:

  • for the first question, the first option received 1 vote and the second option 2 votes
  • for the second question, the first option received 0 votes and the second option 1 vote

The computation of results is intricately woven into the fabric of blockchain logic. In this setup, each node within the network independently calculates the results and subsequently commits to the prevailing state. Should a node incorrectly evaluate the election results, it risks alienating itself from the network consensus, thereby impairing its continued participation.

Moreover, the system ensures absolute verifiability. Every end user possesses the capability to retrieve the comprehensive list of votes related to a specific election from the blockchain state, facilitating local replication of the tally. This accessibility further solidifies the credibility of the election results, fostering trust within the network.

2.6 Transactions and fees

Vochain transactions are protobuf encoded and signed by the sender. However, the SDK handles this operation transparently for the end user.

Transactions may have a fee that the sender needs to cover from its own balance. The fee cost per transaction is currently fixed and configured in the blockchain genesis file. At the moment, once a transaction is executed, the fee is automatically burned. This is an intermediate solution that will become invalid once the full features of the Voc tokenomics chain are implemented.

The following list shows the transactions:

Organization accounts

  • CreateAccount: create a new account in the blockchain, identified by an Ethereum compatible address
  • SendTokens: send tokens from to another account of the blockchain
  • CollectFaucet: collect a faucet code, provided and signed by an existing account
  • NewProcess: create a new election
  • SetProcessStatus: set the election status (see election lifecycle)
  • SetAccountInfoURI: set the external info URI for the account (containing account metadata)
  • SetProcessCensus: update the election census (only if dynamic census is enabled)
  • AddDelegateForAccount: add a delegate to the account
  • DelDelegateForAccount: delete a delegate from the account

Election participants

  • Vote: cast a vote to an existing election

Validators

  • RegisterKey: register a new encryption key for the election

More information

Resources

Guides
Soon

Tutorials
Soon

Copyright © 2024 Vocdoni, Inc. All rights reserved.
- + \ No newline at end of file diff --git a/protocol/anonymity.html b/protocol/anonymity.html index c78a2fce0..4714e87e2 100644 --- a/protocol/anonymity.html +++ b/protocol/anonymity.html @@ -12,13 +12,13 @@ - +

Anonymous Voting

Resources

Guides
Soon

Tutorials
Soon

Copyright © 2024 Vocdoni, Inc. All rights reserved.
- + \ No newline at end of file diff --git a/protocol/anonymity/blind-signatures.html b/protocol/anonymity/blind-signatures.html index 37b63eb2a..6fdec30de 100644 --- a/protocol/anonymity/blind-signatures.html +++ b/protocol/anonymity/blind-signatures.html @@ -12,14 +12,14 @@ - +

CSP Blind Signatures

The current approach by Vocdoni regarding determining the eligibility of a potential voter is to use a Census Merkle Tree. All voter public keys must be known in advance and aggregated together into a hash tree to compute a Merkle root. Then each voter needs to fetch their own Merkle proof to demonstrate their eligibility on a public ledger. The Merkle proof can be anonymized using a zk-SNARK so that the public ledger will verify the SNARK proof instead.

This approach is nice since the same census Merkle Tree can be reused repeatedly and by anyone (not only the owner). It adds resiliency to the process since any third party can obtain the tree (there is no private information involved; thus, it can be published into IPFS) to help the potential voters fetch their proofs. Finally, it is reproducible since anyone with the same list of keys could build the same root hash and verify the Tree generation was correctly executed.

However, this approach lacks flexibility since it is a static way to create a voter list (adding or deleting a public key requires rebuilding and publishing the census again). The current Vocdoni protocol implements an updateCensus mechanism, but this is not very convenient for use cases that require constant census modifications (each update requires an Ethereum transaction).

In order to support such scenarios and bring more flexibility to the Vocdoni stack, a new approach is proposed based on Credential Service Providers (CSP). A voter will need to show a proof provided by the election CSP for proving its eligibility which is made up of the CSP's signature to the voter's public key.

For preserving the anonymity of the voter, the CSP server will perform a blind signature. Blind signatures were first suggested by David Chaum: a cryptographic scheme that allows for signatures over disguised (blinded) messages. The blinder (voter in our scenario) can then un-blind the signature and use it as a normal/standard one. This protocol was designed for RSA, but we will use it over EC secp256k1 (Ethereum and Vocdoni standard).

Salted CSP keys

For making the CSP voter approval valid only for a specific election process (processId) and attached to a specific weight while preserving the privacy, a deterministic key derivation is used. So the CSP is only required to publish a single root public key. The specific per-election keys will be computed independently by all parties (CSP will derive its election private key and the election organizers will derive the election public key). To this end we use the following simple approach (G is the EC generator point):

PubKeyRoot = PrivKeyRoot * G
PrivKey2 = PrivkeyRoot + ProcessId + Weight
PubKey2 = PubKeyRoot + (ProcessId + Weight)*G

So if PubKey2 becomes the election CSP public key, there is no way the CSP can share signature proofs before the processId is known and there is no way to reuse a CSP signature for a different election process.

Flow diagram

flow_diagram_csp

Known Problems

  • Time correlation, the CSP might know which voter is actually casting a vote. Could be solved using a delay mixnet (such as Nymtech)
  1. H. Mala, N. Nezhadansari, "New Blind Signature Schemes Based on the (Elliptic Curve) Discrete Logarithm Problem" https://sci-hub.st/10.1109/iccke.2013.6682844 Implementation: https://github.com/arnaucube/go-blindsecp256k1
  2. EC deterministic derivation key schema PoC implementationhttps://github.com/p4u/go-eckey-derivation
  3. CSP server implementation https://github.com/vocdoni/blind-csp

Resources

Guides
Soon

Tutorials
Soon

Copyright © 2024 Vocdoni, Inc. All rights reserved.
- + \ No newline at end of file diff --git a/protocol/anonymity/on-chain.html b/protocol/anonymity/on-chain.html index 3b9a52594..b8a0b1d72 100644 --- a/protocol/anonymity/on-chain.html +++ b/protocol/anonymity/on-chain.html @@ -12,13 +12,13 @@ - +

On-Chain Census Anonymity

On-chain cenuses created with the Census3 Service derive their contents from a public set of holders of a given token (or set of tokens) on the Ethereum blockchain. This information is turned into a census by generating a Merkle Proof on that set of data. This Merkle Proof is similar to that used for a typical off-chain tree census, and the same sort of ZK Census Proof can be used to compute voter validation anonymously.

Unfortunately a zero-knowledge census itself is not enough to anonymize an on-chain election, because voters are weighted according to their unique token balances, making them easy to identify as the weight of a vote can be correlated with an address. We address this problem by rounding voter weights in order to hide unique token balances.

ethereum storage proofs

On-chain censuses created manually with Ethereum Storage Proofs cannot be anonymized

Rounding Censuses

To ensure that the balances of token-based censuses remain private, we must alter them in some way. However, any change must meet two requirements:

  1. The resulting balance must be less than or equal to the original one.

  2. The resulting balance should stay as close to the original as possible.

Our algorithm rounds balances to a nearby value, forming groups of equal rounded balance of a least some privacyThreshold in size (minimum 3). This process obscures individual holder's balances. The algorithm optimizes the number of members in a group, taking in account the difference between balances, to reduce accuracy loss.

Basic Steps

  1. Identify and exclude outliers: Participants balances are analyzed to detect outliers using z-score algorithm.

  2. Forming groups: Participants are initially grouped based on the privacy threshold. A group can extend to include participants with identical balances or with balances differences falling below the groupBalanceDiff criteria.

  3. Balancing groups: For each group, we adjust the balances, rounding them down to the smallest amount within the group to obscure individual values.

  4. Accuracy loop: The algorithm tries to find the highest accuracy possible while maintaining a minimum privacy threshold. It starts with the minimum privacy threshold and increases it by a small amount until the accuracy is maximized.

Results Accuracy

Because voter weights are rounded, there is a chance for the accuracy of elections to be affected.

To measure accuracy, we compare the total of the adjusted balances from the census against the sum of the original balances, incorporating outliers into both calculations for consistency.

Our tests covered censuses involving 21 different tokens, showcasing various holder counts and token formats, including ERC20, ERC721, and POAP. This comprehensive testing ensures our approach is robust across different Web3 assets.

accuracy-testing

Evidently, accuracy cannot be maintained under all possible conditions. We've established parameter settings that generally perform well across various token types and distributions, and under these conditions we consider accuracy levels to be sufficient.

Anonymity Level

This scheme for token-based census anonymity is not as absolutely anonymous as a zk-merkle-proof. The parameter settings are important- a privacyThreshold that is too small could result in a rounded group of voters who all vote for the same result, effectively de-anonymizing every member of the group. If this threshold is too high, however, accuracy is lost.

There are also potential vulnerabilities to specific attacks. For example, acquiring a certain amount of a token to manipulate the algorithm into grouping an address with others could theoretically expose that address. However, such strategies are impractical and unlikely to significantly impact election outcomes. This type of attack also requires an analysis of balance distributions, complicating its execution.

Resources

Guides
Soon

Tutorials
Soon

Copyright © 2024 Vocdoni, Inc. All rights reserved.
- + \ No newline at end of file diff --git a/protocol/anonymity/zk-census-proof.html b/protocol/anonymity/zk-census-proof.html index 95450addc..382e2ebf9 100644 --- a/protocol/anonymity/zk-census-proof.html +++ b/protocol/anonymity/zk-census-proof.html @@ -12,7 +12,7 @@ - + @@ -29,7 +29,7 @@ all the parameters are string or []string that represent bigInt or []bigInt :::

  • censusRoot: computed by the CensusAuthority from the Census Tree
  • censusSiblings: computed by the CensusAuthority, is the Merkle Proof
    • the User retrieves the siblings from the Vochain through the Gateway
    • the length of censusSiblings will depend on the zkCircuit:
      • The design of the MerkleTree used in circomlib provokes different lengths in the siblings returned when generating a MerkleProof
    • This is due the design of the MerkleTree defines a tree in which the deep of the tree (from the root to the leafs) will depend on each leaf and its neighbors. More details can be found in the MerkleTree spec.
      • In order to input those siblings into the circuit, the nLevels of the circuit is fixed, so the length of siblings needs to be fixed also.
      • So, the len(siblings) will depend on the zkCircuit being used, specifically from the nLevels parameter of the circuit
  • index: determined by the Vochain when adding the User's zkCensusKey into the CensusTree
  • secretKey: generated by the User
  • voteHash: hashed value of the User vote, composed by two big integers.
    • The raw user vote is a variable-length array of values and its values do not need to be checked in the circuit. Furthermore, the values can be encrypted.
    • Since the encoded vote values may not fit into a constant number of circuit inputs, we calculate a summary of the raw user vote using an EVM-friendly hash function: sha256(vote_bytes). The output of the sha256 hash is slightly larger than the field used in SNARKS, so we split the hash output (32-bytes) into 2 16-byte arrays, take them as integers (in little-endian), and use them as circuit inputs.
      • sha256 hash is used, as if necessary in the future it can be verified inside the circuit. This usage has two characteristics to keep in mind:
        • sha256 is twice as expensive as keccak256 in terms of gas in EVM, but it is implemented in circom, so it can be checked inside a circuit (keccak256 is also implemented inside a circuit, but it takes too many constraints for the current use case)
        • checking the sha256 inside a circom circuit is expensive in terms of number of constraints (in the current version of this spec, this is not checked inside the circuit)
    • example:
      h := sha256.Sum256(voteBytes) // voteBytes can be the votes array converted to bytes, or the encrypted votes
      b1 := new(big.Int).SetBytes(swapEndianness(h[:16])) // swap endianness, as golang big int package works in big-endian, and we use little-endian
      b2 := new(big.Int).SetBytes(swapEndianness(h[16:]))
      And the json input of the voteHash for the circuit would be: "voteHash": [b1, b2]
  • processId: the process ID in which the User is participating. As the process ID is a 32 byte array, we use the same method used for the voteHash: the 32 bytes of process ID are splitted by the half, and each one is represented as a big integer (little-endian).
    • example:
      processID0 := new(big.Int).SetBytes(swapEndianness(processIDBytes[:16])) // swap endianness, as golang big int package works in big-endian, and we use little-endian
    processID1 := new(big.Int).SetBytes(swapEndianness(processIDBytes[16:]))
  • nullifier: computed by User
    • nullifier = poseidon.Hash(sk, processID[0], processID[1])

Circuit identification

There will be different circuits of the zk-census-proof depending on the census size, also there could be more use cases with different circuit designs. Both the client and the Vochain need a way to univocally identify those circuits, in order to user the proper Proving key, Witness calculator and Verification key for each circuit.

Circuits are identified across the stack by using a Protobuf enum type. Each ProofZkSNARK protobuf package will have a Type identifier indicating which circuit the proof belongs to, so the Vochain knows which Verification Key to use for verifying the proof.

Format: CIRCUITNAME_PARAMETER1_PARAMETER2

List of current types:

  • ZKCENSUSPROOF_NLEVELS
    • Circuit name: ZKCENSUSPROOF
    • Parameters: nLevels
    • Example:
      • ZKCENSUSPROOF_100
      • ZKCENSUSPROOF_1000

Annex

Examples of flags combinations

Below there are listed some common combinations of flags used when created a new process:

  • Census MerkleTree (from CSV file or private database) with pre-register: preRegister=true, CensusOrigin=OFF_CHAIN_TREE
  • Census MerkleTree (from CSV file or private database) with the Organization defining the CensusRoot (creating the user's keys, without pre-register phase): preRegister=false, CensusOrigin=OFF_CHAIN_TREE
  • Ethereum Storage Proofs with an ERC20 token: preRegister=false, CensusOrigin=ERC20

KeyKeepers reveal and commit keys

A set of commitment keys are generated for each election process by a set of trusted identities named keykeepers. Only if all keykeepers are malicious could they tamper with the process, so it is crucial to distribute these special identities well. Once all these keys are revealed, anyone can generate a valid proof. This mechanism is added to the circuit in order to avoid vote buying when the process is over. Since anyone can now generate a valid proof, a voter will no longer be able to prove that they are the owner of a specific vote nullifier.

Circuit with keykeepers diagram

zkInputs of this alternative scheme:

// Example of zkInputs
{
"censusRoot": "51642541620950251760298704744678482162425252475654827255045491135352807540162",
"censusSiblings": ["0","0","0","0"],
"secretKey": "6190793965647866647574058687473278714480561351424348391693421151024369116465",
"voteHash": ["100964581237483263846637432502620436451", "278307331411790712608582894981321409946"],
"processId": ["242108076058607163538102198631955675649", "142667662805314151155817304537028292174"],
"nullifier": "1938187656076799017313903315498318464349291455761501098436114043715056719301",
"relayerPublicKey": "100",
"relayerProof": "21349690342514405503176665977362532634490340702670001813783738965751319356478",
"revealKey": ["0"],
"commitKey": ["19014214495641488759237505126948346942972912379615652741039992445865937985820"]
}
  • relayerPublicKey: given by the KeyKeeper
  • relayerProof: computed by the User
    • relayerProof = poseidon.Hash(nullifier, relayerPublicKey)
  • revealKey: not known by the user at the proof generation moment
    • the length of this array is determined by the nMiners parameter of the circuit
  • commitKey: given by the KeyKeeper
    • the length of this array is determined by the nMiners parameter of the circuit
    • poseidon.Hash(relayerPublicKey)

Resources

Guides
Soon

Tutorials
Soon

Copyright © 2024 Vocdoni, Inc. All rights reserved.
- + \ No newline at end of file diff --git a/protocol/ballot-protocol.html b/protocol/ballot-protocol.html index 5f94169ec..ce8c3b721 100644 --- a/protocol/ballot-protocol.html +++ b/protocol/ballot-protocol.html @@ -12,14 +12,14 @@ - +

Ballot Protocol

The Vocdoni Ballot Protocol aims to be a very simple yet powerful specification for the representation of ballots and results for a voting process.

A voting process is made out of one or more fields, each of which represents a single question or an option for a question, depending on the type of process. When voting, eligible voters choose from a set of predefined answers for each field. The allowed number of answers, type of answer, etc. also depend on the specific type of process. An eligible voter expresses their choices by casting a ballot.

A ballot is represented as an array (or list) of natural numbers. Each position of the array contains an answer to one of the process' fields.

Results are accumulated in a two-dimension array of natural numbers (a matrix). Each row of this matrix corresponds to a ballot field, and each column corresponds to one of the possible values for that field. Any number in the results matrix is simply a count of the votes for the value represented at that index.

A more thorough introduction is available on our blog.

https://blog.vocdoni.io/_next/image?url=https%3A%2F%2Fstorage.googleapis.com%2Fpapyrus_images%2F47fc7647a24d815d609ad569c4456e39.png&w=1920&q=75

The protocol is composed by a set of numeric and boolean variables that restrict the format of the ballot. They are defined in the Process Parameters.

  • uint8 maxCount Max number of fields per ballot. 1 <= maxCount <= 100.
  • uint8 maxValue -Determines the acceptable maximum value for all fields.
  • uint8 minValue +Determines the acceptable maximum value for all fields. If maxValue is set to 0, the results are aggregated.
  • uint8 minValue Determines the acceptable minimum value for all fields.
  • bool uniqueValues Choices for a question cannot appear twice or more
  • uint16 maxTotalCost Maximum limit on the total sum of all ballot fields' values (if applicable). @@ -28,8 +28,8 @@ 0 => No limit / Not applicable.
  • uint16 costExponent The exponent that will be used to compute the "cost" of the field values.
  • totalCost = Σ (value[i] ^ costExponent) <= maxTotalCost
  • costExponent is represented as exp * 10000 so:
  • 0 => 0.0000
  • 10000 => 1.0000
  • 65535 => 6.5535

https://blog.vocdoni.io/_next/image?url=https%3A%2F%2Fstorage.googleapis.com%2Fpapyrus_images%2Fb8d920f2d64cf347ff2f47f7e34a3340.png&w=1920&q=75


Results and example

The result is represented as a matrix of natural numbers. Let's take this JSON example:

[
[1,2,3], // in field 1: value 0 got 1 vote, value 1 got 2, value 2 got 3
[1,4,2], // in field 2: value 0 got 1 vote, value 1 got 4, value 2 got 2
[0,1,0] // in field 3: value 0 got 0 vote, value 1 got 1, value 2 got 0
]

Each row of the matrix represents a field, there are three fields: [ [First field], [Second field], [Third field] ]

The ballot protocol does not cover interpretation. However, a very common interpretation would be to consider each field as the multiplier (weight) equal to its position.

  • First question [1,2,3] = 0*1 + 1*2 + 2*3 = 0 + 2 + 6 = 8
  • Second question [0,4,2] = 0*0 + 1*4 + 2*2 = 8
  • Third question [5,1,0] = 0*5 + 1*1 + 2*0 = 1

6 votes have been cast.

Example

Lets see an example with maxCount=3 and maxValue=5

The human-friendly question would be: Rate these 3 candidates to the best rock music player of the 20th century, from 0 to 5 stars.

  • Lennon is the candidate 0, so question 0
  • Hendrix is the candidate 1, so question 1
  • Joplin is the candidate 2, so question 2

Let's start, currently there are no votes cast:

Results: Lennon:[0,0,0] Hendrix:[0,0,0] Joplin:[0,0,0]

New vote [2,1,2] =>

  • give 2 points to candidate 0
  • give 1 point to candidate 1
  • give 2 points to candidate 2

Results: Lennon:[0,0,1] Hendrix:[0,1,0] Joplin:[0,0,1]

  • candidate 0 = 2 points (1·2)
  • candidate 1 = 1 point (1·1)
  • candidate 2 = 2 points (1·2)

New vote [0,1,2] =>

  • give 0 points to candidate 0
  • give 1 point to candidate 1
  • give 2 points to candidate 2

Results: Lennon:[1,0,1] Hendrix:[0,2,0] Joplin:[0,0,2]

  • candidate 0 = 2 points
  • candidate 1 = 2 point
  • candidate 2 = 4 points

New vote [0,0,0] =>

  • give 0 points to candidate 0
  • give 0 points to candidate 1
  • give 0 points to candidate 2

Results: Lennon:[2,0,1] Hendrix:[1,2,0] Joplin:[1,0,2]

  • candidate 0 = 2 points
  • candidate 1 = 2 point
  • candidate 2 = 4 points

Final Results: [ [2,0,1], [1,2,0], [1,0,2] ]

  • Lennon got 2*0 + 1*0 + 2*1 = 2 points
  • Hendrix got 0*1 + 1*2 + 2*0 = 2 points
  • Joplin got 0*1 + 1*0 + 2*2 = 4 points
  • Participation is 3 votes: [2+0+1] || [1+2+0] || [1+0+2]

More Examples

Rate a product

Give a value from 0-5 to a product

  • Vote Envelopes: [2] [5] [2]
  • Results: [ [0,0,2,0,0,1] ]
  • Two users have given 2 stars
  • One user have given 5 stars

Parameters

maxCountminValuemaxValueminTotalCostmaxTotalCostcostExponentuniqueValues
105---No

Rate 3 candidates

Lennon, Hendrix, Joplin ⇒ 0, 1, 2

  • Vote Envelope: [2,1,2] [0,1,2] [0,0,0]
  • Results: [ [2,0,1], [1,2,0], [1,0,2] ]
  • Lennon got 2*0 + 0*1 + 1*2 = 2 points
  • Hendrix got 1*0 + 2*1 + 0*2 = 2 points
  • Joplin got 1*0 + 0*1 + 2*2 = 4 points
maxCountminValuemaxValueminTotalCostmaxTotalCostcostExponentuniqueValues
302---Yes

Single choice

How do you feel today? Choose 1 out of 3 possible options: Bad, Good, Amazing

  • Vote Envelopes: [0,1,0] [0,1,0] [0,0,1]
  • Results: [ [3,0,0], [1,2,0], [2,1,0] ]
  • Bad: 0*3 + 1*0 + 2*0 = 0
  • Good: 0*1 + 1*2 + 2*0 = 2
  • Amazing: 0*2 + 1*1 + 2*0 = 1
maxCountminValuemaxValueminTotalCostmaxTotalCostcostExponentuniqueValues
30111-No

Multiple choice

Choose your 3 favorite colours out of 5: green:0, blue:1, pink:2, orange:3, black:4

  • Vote Envelope: [1,1,1,0,0] [0,1,1,1,0] [1,1,1,0,0]
  • Results: [ [1, 2], [0, 3], [0, 3], [2, 1], [3, 0] ]
  • green: 0*1 + 2*1 = 2
  • blue: 0*0 + 1*3 = 3
  • pink: 0*0 + 1*3 = 3
  • orange: 0*2 + 1*1 = 1
  • black: 0*3 + 0*1 = 0
maxCountminValuemaxValueminTotalCostmaxTotalCostcostExponentuniqueValues
50133-No

Linear Weighted choice

Sort your 5 favorite blockchains: Bitcoin: 0, Ethereum: 1, Monero: 2, Zcash: 3, Polkadot: 4.

Your first option gets 4 points,... the last 0 points.

  • Vote Envelope: [0,3,1,4,2] [3,0,1,4,2] [1,2,3,4,0]
  • Results;[ [1,1,0,1,0], [1,0,1,1,0], [0,2,1,0,0], [0,0,0,0,3], [1,0,2,0,0] ]
  • Bitcoin: 0*1 + 1*1 + 2*0 + 3*1 + 0*4 = 4
  • Ethereum: 0*1 + 1*0 + 2*1 + 3*1 + 0*4 = 5
  • Monero: 0*1 + 1*2 + 2*1 + 3*0 + 4*0 = 6
  • Zcash: 0*0 + 1*0 + 2*0 + 3*0 + 4*3 = 12
  • Polkadot: 0*1 + 1*0 + 2*2 + 3*0 + 4*0 = 4
maxCountminValuemaxValueminTotalCostmaxTotalCostcostExponentuniqueValues
504---Yes

Quadratic voting

You might distribute 12 credits among 4 NGOs. You can give as many tokens as you wish to a single option, but the cost -raises exponentially with each additional token added to an option.

NGOs are: greenpeace:0, redcross:1, msf:2, amnesty:3

  • Vote Envelopes: [2,2,2,0] [1,1,2,2] [0,3,1,1]
Cost exponent calculations:

[2, 2, 2, 0]
envelope 1 calculation: 2^2 + 2^2 + 2^2 + 0^2
= 4 + 4 + 4 + 0 = 12 credits

[1, 1, 2, 2]
envelope 2 calculation: 1^2 + 1^2 + 2^2 + 2^2
= 1 + 1 + 4 + 4 = 10 credits

[0, 3, 1, 1]
envelope 3 calculation: 0^2 + 3^2 + 1^2 + 1^2
= 0 + 9 + 1 + 1 = 11 credits
  • Results: [ [1,1,1,0], [0,1,1,1], [0,1,2,0], [1,1,1,0] ]
  • greenpeace: 0*1 + 1*1 + 2*1 + 3*0 = 3
  • redcross: 0*0 + 1*1 + 2*1 + 3*1 = 6
  • msf: 0*0 + 1*1 + 2*2 + 3*0 = 5
  • amnesty: 0*1 + 1*1 + 2*1 + 3*0 = 3
maxCountminValuemaxValueminTotalCostmaxTotalCostcostExponentuniqueValues
40-0122No

Multiquestion

This mode requires a different way of interpreting the results, since each position of the results array is not multiplied by its index.

3 positions (CEO, COO, CFO), 5 candidates

  • Ballots: [4,3,2] [4,2,3] [0,1,4]
  • Results: [ [1,0,0,0,2], [0,1,1,1,0], [0,0,1,1,1] ]
  • CEO: candidate0:1 candidate4:2
  • COO: candidate1:1 candidate2:1 candidate3:1
  • CFO: candidate2:1 candidate3:1 candidate4:1
Vote Envelopes: [4,3,2] [4,2,3] [0,1,4]

CEO COO CFO
Option A results: [ [1, 0, 0, 0, 2], [0, 1, 1, 1, 0], [0, 0, 1, 1, 1] ]

Candidate 5 has won the CEO position, whereas COO is tied between candidates 2, 3, and 4, and CFO is tied between candidates 3, 4, and 5.

maxCountminValuemaxValueminTotalCostmaxTotalCostcostExponentuniqueValues
304---No

Vocdoni results interpretation

Results interpretation is not part of the ballot protocol, but it informs how the protocol should be understood and displayed. The Process Metadata has a couple of flags describing the expected interpretation.

    "results": {
"aggregation": "index-weighted", // "index-weighted" | "discrete-counting",
"display": "rating" // "rating" | "simple-question" | "multiple-choice" | "linear-weighted" | "quadratic-voting" | "multiple-question" | "raw"
}

The results provided by the scrutinizer contain a preliminary aggregation in a 2-dimensional matrix, where the final step needs to be completed by UI clients, depending on results.aggregation.

Single question

Index-weighted: each option's value is multiplied by its position index, then summed.

[ [1,0,1], [2,0,0], [0,1,1] ] => [0*1+1*0+2*1], [0*2+1*0+2*0], [0*1+1*1+2*1] => [2,0,3]
option1: 2 votes
option2: 0 votes
option3: 3 votes

This interpretation suits any case with extended features, such as multiple choice, quadratic voting, linear-weighted, etc. This is because it is able to weigh multiple possible values for a single field.

https://blog.vocdoni.io/_next/image?url=https%3A%2F%2Fstorage.googleapis.com%2Fpapyrus_images%2F345a07aee1ddf6a6aad51db7e58fd399.png&w=1920&q=75

Multi question

Discrete values: field values are just counted (weight = 1)

[ [1,2,0], [0,1,2], [1,1,1] ] => [ [question1], [question2], [question3] ]
field1: candidate0: 1 vote, candidate1: 2 votes, candidate 3: 0 votes
field2: candidate0: 0 votes, candidate1: 1 vote, candidate 2: 2 votes
field2: candidate0: 1 vote, candidate1: 1 vote, candidate 2: 1 vote

As this format can only accept binary (yes/no) input for each option, it is only available for use with a basic set of features (multi-question, single-choice)

https://blog.vocdoni.io/_next/image?url=https%3A%2F%2Fstorage.googleapis.com%2Fpapyrus_images%2F97e8bca257a9b118b86ee3dd31165107.png&w=1920&q=75

Resources

Guides
Soon

Tutorials
Soon

Copyright © 2024 Vocdoni, Inc. All rights reserved.
- +raises exponentially with each additional token added to an option.

NGOs are: greenpeace:0, redcross:1, msf:2, amnesty:3

  • Vote Envelopes: [2,2,2,0] [1,1,2,2] [0,3,1,1]
Cost exponent calculations:

[2, 2, 2, 0]
envelope 1 calculation: 2^2 + 2^2 + 2^2 + 0^2
= 4 + 4 + 4 + 0 = 12 credits

[1, 1, 2, 2]
envelope 2 calculation: 1^2 + 1^2 + 2^2 + 2^2
= 1 + 1 + 4 + 4 = 10 credits

[0, 3, 1, 1]
envelope 3 calculation: 0^2 + 3^2 + 1^2 + 1^2
= 0 + 9 + 1 + 1 = 11 credits
  • Results: [ [1,1,1,0], [0,1,1,1], [0,1,2,0], [1,1,1,0] ]
  • greenpeace: 0*1 + 1*1 + 2*1 + 3*0 = 3
  • redcross: 0*0 + 1*1 + 2*1 + 3*1 = 6
  • msf: 0*0 + 1*1 + 2*2 + 3*0 = 5
  • amnesty: 0*1 + 1*1 + 2*1 + 3*0 = 3
maxCountminValuemaxValueminTotalCostmaxTotalCostcostExponentuniqueValues
40-0122No

Multiquestion

This mode requires a different way of interpreting the results, since each position of the results array is not multiplied by its index.

3 positions (CEO, COO, CFO), 5 candidates

  • Ballots: [4,3,2] [4,2,3] [0,1,4]
  • Results: [ [1,0,0,0,2], [0,1,1,1,0], [0,0,1,1,1] ]
  • CEO: candidate0:1 candidate4:2
  • COO: candidate1:1 candidate2:1 candidate3:1
  • CFO: candidate2:1 candidate3:1 candidate4:1
Vote Envelopes: [4,3,2] [4,2,3] [0,1,4]

CEO COO CFO
Option A results: [ [1, 0, 0, 0, 2], [0, 1, 1, 1, 0], [0, 0, 1, 1, 1] ]

Candidate 5 has won the CEO position, whereas COO is tied between candidates 2, 3, and 4, and CFO is tied between candidates 3, 4, and 5.

maxCountminValuemaxValueminTotalCostmaxTotalCostcostExponentuniqueValues
304---No

Vocdoni results interpretation

Results interpretation is not part of the ballot protocol, but it informs how the protocol should be understood and displayed by clients. The Process Metadata has a couple of flags that can be used to tell clients how to interpret a results matrix:

    "results": {
"aggregation": "index-weighted", // "index-weighted" | "discrete-counting",
"display": "rating" // "rating" | "simple-question" | "multiple-choice" | "linear-weighted" | "quadratic-voting" | "multiple-question" | "raw"
}

The results provided by the scrutinizer contain a preliminary aggregation in a 2-dimensional matrix, where the final step needs to be completed by UI clients, depending on results.aggregation.

Single question

Index-weighted: each option's value is multiplied by its position index, then summed.

[ [1,0,1], [2,0,0], [0,1,1] ] => [0*1+1*0+2*1], [0*2+1*0+2*0], [0*1+1*1+2*1] => [2,0,3]
option1: 2 votes
option2: 0 votes
option3: 3 votes

This interpretation suits any case with extended features, such as multiple choice, quadratic voting, linear-weighted, etc. This is because it is able to weigh multiple possible values for a single field.

https://blog.vocdoni.io/_next/image?url=https%3A%2F%2Fstorage.googleapis.com%2Fpapyrus_images%2F345a07aee1ddf6a6aad51db7e58fd399.png&w=1920&q=75

Multi question

Discrete values: field values are just counted (weight = 1)

[ [1,2,0], [0,1,2], [1,1,1] ] => [ [question1], [question2], [question3] ]
field1: candidate0: 1 vote, candidate1: 2 votes, candidate 3: 0 votes
field2: candidate0: 0 votes, candidate1: 1 vote, candidate 2: 2 votes
field2: candidate0: 1 vote, candidate1: 1 vote, candidate 2: 1 vote

As this format can only accept binary (yes/no) input for each option, it is only available for use with a basic set of features (multi-question, single-choice)

https://blog.vocdoni.io/_next/image?url=https%3A%2F%2Fstorage.googleapis.com%2Fpapyrus_images%2F97e8bca257a9b118b86ee3dd31165107.png&w=1920&q=75

Resources

Guides
Soon

Tutorials
Soon

Copyright © 2024 Vocdoni, Inc. All rights reserved.
+ \ No newline at end of file diff --git a/protocol/census.html b/protocol/census.html index e36a22b88..d063b7947 100644 --- a/protocol/census.html +++ b/protocol/census.html @@ -12,13 +12,13 @@ - +

The Census

In Vocdoni, a census of identities can be represented in one of three ways. For Ethereum-based processes, in which eligible voters are represented by Ethereum addresses holding a specific token, an on-chain (ERC-20) census is used. In cases where a central authority wants to manually validate each voter at the time of voting, off-chain credential service provider is used. For all other voting processes (organizations that are not represented as DAOs), an off-chain tree census is used.

tip

Between the three of these census methods, an incredible range of use-cases and third-party integrations for voter eligibility management is possible. Furthermore, the flexibility of the voting protocol is designed to allow more census types to be easily added in the future.

When a voting process is created, the Census Origin is set to signify which type of census the process should expect to use.

On-Chain Based Census (Ethereum ERC-20)

On-chain census allow the set of eligible voters to be expressed as a weighted census of holders of a specific token on an Ethereum blockchain. This type of census is useful for organizations whose members are represented as token-holders. This is possible with either Ethereum Storage Proofs or the Census3 Service (only the Census3 Service is supported by the Vocdoni SDK).

Technical details for on-chain censuses can be found at On-Chain Census.

Off-Chain CSP Based Census (Credential Service Provider)

In order to support frequent modifications to the census of an ongoing process and to bring more flexibility to the Vocdoni stack, a census based on Credential Service Providers (CSP) or Certificate Authorities (CAs) is implemented. This method allows organizations to set up a centralized authority that provides credentials to each voter, one-by-one, based on any arbitrary criteria decided by the organization.

Technical details for off-chain CSP census can be found at Off-Chain CSP Census.

Off-Chain Tree Based Census (Merkle Tree)

An off-chain tree census allows organizations to centrally manage the set of members who can vote on any given process. Organizations can generate the Census Merkle Tree itself with the help of the Census Service, but they are responsible for manually generating a list of voters. Vocdoni.app currently provides a CSV-based census mechanism.

Technical details for off-chain tree census can be found at Off-Chain Tree Census.

Resources

Guides
Soon

Tutorials
Soon

Copyright © 2024 Vocdoni, Inc. All rights reserved.
- + \ No newline at end of file diff --git a/protocol/census/off-chain-csp.html b/protocol/census/off-chain-csp.html index dd01967a7..9a9774784 100644 --- a/protocol/census/off-chain-csp.html +++ b/protocol/census/off-chain-csp.html @@ -12,7 +12,7 @@ - + @@ -20,7 +20,7 @@

Off-Chain CSP Census

A census approach based on Credential Service Providers (CSPs) allows organizations to validate users manually and based off of any arbitrary criteria. Rather than a static census published before-hand, CSP census allows each user to be evaluated for voting eligibility individually, throughout the duration of the voting process.

In order to prove they are a member of the census, a voter needs to retrieve a certificate of eligibility from the CSP for that process. The CSP first verifies the user's validity (eg. resident of Istanbul or human being standing in front of me) and then provides this certificate by signing the voter's public key.

Blind Signatures

In order to preserve the anonymity of each voter, the CSP server will perform a blind signature. Blind signatures were first suggested by David Chaum, who designed a cryptographic scheme that allows for signatures over disguised (blinded) messages. The blinder (voter in our scenario) can then un-blind the signature and use it as a standard one. This protocol was designed for RSA, but we will use it over EC secp256k1 (Ethereum and Vocdoni standard).

In order to ensure that each CSP voter approval is valid only for one specific election process (processId), a deterministic key derivation is be used. Thus, the CSP is only required to publish a single root public key. The specific per-election keys are computed independently by all parties (CSP will derive its election private key and the election organizers will derive the election public key). To this end we use the following simple approach (G is the elliptic curve generator):

PubKeyRoot=PrivKeyRootGPubKeyRoot = PrivKeyRoot * G
PrivKey2=PrivkeyRoot+ProcessIdPrivKey2 = PrivkeyRoot + ProcessId
PubKey2=PubKeyRoot+ProcessIdPubKey2 = PubKeyRoot + ProcessId

Following this derivation, PubKey2PubKey2 becomes the election public key. Thus, there is no way the CSP can share claims before the ProcessId is known and there is no way to reuse a CSP signature for a different election process.

The SDK comes with an implementation of the common handler API of a CSP which is explained here.

csp voting diagram

Resources

Guides
Soon

Tutorials
Soon

Copyright © 2024 Vocdoni, Inc. All rights reserved.
- + \ No newline at end of file diff --git a/protocol/census/off-chain-tree.html b/protocol/census/off-chain-tree.html index a662ac4ab..f7a2ad70e 100644 --- a/protocol/census/off-chain-tree.html +++ b/protocol/census/off-chain-tree.html @@ -12,13 +12,13 @@ - +

Off-Chain Tree Census

The census itself is represented as a binary Merkle Tree, where the leaves of the tree contain the public keys of all eligible voters, hashed.

A Merkle Tree can efficiently prove that a leaf belongs to the tree. For a tree of size N elements, only log(N) elements are needed to generate a proof. A tree with 1 million leaves, for example, would only need 20 hashes to prove the inclusion of any one leaf.

The tree structure is made of nodes. Terminal nodes contain the actual values; every other node contains the hash of its two children. If a leaf is updated, all its parent nodes are affected.

A prover is able to prove the inclusion of any leaf of the Merkle Tree to a verifier:

  • The verifier only needs to know the Root Hash
  • The prover only needs to provide the Leaf and its Sibling, as well as the sibling of each of its ancestors (hence, log(N) elements).

This means that, in the case of our example Voting Merkle Tree, the owner of PubKey1 only needs HashPubKey1 + H4 + H2 (highlighted in green on the graph below) to prove that their key is part of the Merkle Tree, and therefore that their public key is in the voter census.

To verify this proof, the verifier simply computes hash( hash( hash(HashPubKey1) + H4 ) + H2 ) and compares this result with the known Root hash of the Merkle Tree.

This Merkle Proof design allows voters to prove census inclusion without knowing any other voters' keys, and with a computation time that is logarithmically proportionate to the census size.

Vocdoni stores a hash of public keys instead of public keys themselves to provide an additional privacy layer when publishing the census.

Creating & publishing the census

Any organization which does not wish to use the on-chain census mechanism is required to generate and publish a census Merkle Tree in order to host a voting process on the Voting Blockchain. The method for managing and filtering users and generating the Merkle Tree, however, is up to integrators of the Voting Protocol. The census module is further documented on the census integration page.

Accessing the census

The Gateways deployed by Vocdoni and third parties constantly monitor the Process Smart Contract. Upon identifying a new process, they will fetch and import that process' Census Merkle Tree. At this point, users can use any available Gateway to check whether they are eligible for voting and then fetch their Merkle Proof (this as well may be handled by the client implementation)

Users with a valid Merkle Proof can efficiently show that their key belongs to a large census by providing a very small fraction of the whole tree.

Resources

Guides
Soon

Tutorials
Soon

Copyright © 2024 Vocdoni, Inc. All rights reserved.
- + \ No newline at end of file diff --git a/protocol/census/on-chain.html b/protocol/census/on-chain.html index b012a782f..1a3a37a0d 100644 --- a/protocol/census/on-chain.html +++ b/protocol/census/on-chain.html @@ -12,14 +12,14 @@ - +

On-Chain Census

An on-chain census is one which is dependent on the status of the Ethereum blockchain at a given point in time. This census type enables the set of eligible voters to be derived from the token holder balances for some ERC-20 Ethereum token, weighted according to token balances. The ideal use-case for such a census is an organization whose members are represented as holders of some token, such as a DAO.

There are two ways with Vocdoni to create an on-chain census: Ethereum Storage Proofs and the Census3 service. Ethereum Storage Proofs is the legacy method which requires a higher setup cost and more manual work by integrators. The Census3 Service provided by Vocdoni abstracts this complexity away and exposes an API to create and access token-holder censuses.

Census3 Service

The Census3 Service is an API service which provides an easy way to create censuses for elections with holders of a single token or a combination of them. This is a wrapper of the on-chain census design and enables integrators to use on-chain censuses without manually registering tokens or generating storage proofs.

The Census3 Service is documented in-depth here.

ERC-20 Token Storage Proofs

An Ethereum Storage Proof is a way to create an on-chain census without the use of the Census3 Service. This approach uses a Token Storage Proof Smart Contract to generate a proof of a given token's holders which can then be used directly as a census.

Anyone can permissionlessly register a token to the Storage Proof Smart Contract, incurring some gas cost. Then any holder of the token can create a voting process for that token and set the proper census origin value to signal the use of an on-chain census. The Census Merkle Root is the Ethereum Root Hash at a given block height, and any user can request a Merkle Proof that their address holds tokens on the target ERC20 smart contract. They can then provide this proof to vote on processes for the entity representing that token address. Weighted processes enable users to employ a voting power that is proportionate to the number of tokens they hold.

Storage Tries

Each Ethereum account has its own Storage Trie, which is where all of the contract data lives for that account. A 256-bit hash of the storage trie’s root node is stored as the storageRoot value in the global Ethereum state trie. In the context of storage proofs, we are concerned with ERC-20 Token Smart Contract accounts, whose Storage Tries contain the list of token balances of each token holder.

A storage proof is a Merkle Proof computed on this storage trie. For the scope of this proposal, the storage proof allows anyone to demonstrate the balance of a token holder for a given ERC-20 token, at a specific State Root Hash (Ethereum block). In other words, we can cheaply generate a proof of any user's balance of a token, and this proof can be used in a Vocdoni voting census.

Token Registration

Before starting an election, the target token needs to be registered to the Token StorageProof Smart Contract. Any token holder can register the token by providing a valid storage proof.

In order to create a storage proof, on a mapping-based ERC20 contract, the index slot must be found. This depends on the contract implementation and refers to the storage layout of the Ethereum EVM. Most of the index slots are between 1 and 10.

The user registering a new token must first try to find the index slot. To this aim, a web-frontend and a typescript library will be available. Once the index slot is found, the user must send a transaction to the Token StorageProof SC indicating the index slot and providing the Merkle proof that demonstrates the index slot and their possession of the token.

Election creation

When a token holder wants to create a process with an on-chain census origin, they must send a transaction to the Vocdoni Smart Contract with the election process details, including the token contract address for which the process is being created. The Smart Contract will check if the sender holds some minimum threshold tokens on the ERC20 contract address.

Voting

In order to cast a vote, each user needs to fetch their Census Merkle Proof. The client connects to a Web3 endpoint and uses the RPC call eth_getProof to retrieve this proof.

Once the user decides to cast a vote, a package will be forged containing the census proof, vote choice (represented as an array of integers) and signature (using Metamask).

The transaction of sending a vote is as follows:

{
"eth_getProof": {
"type":"vote",
"processId": "0x47384...",
"weight": "0x123",
"proof": "MerkleProof",
"votePackage": "base64encoded vote package",
"signature": "signature performed with the privkey that computes the address"
}
}

The vote will be considered valid only if the signature computes an Ethereum address for which the provided Merkle proof and its weight (balance) is valid for the census root hash (Ethereum storage root) at the height of the process start block.

The storage proofs contract acts as a registry which allows token holders to prove that they held funds at a given point in time and therefore are eligible voters for a process.

Resources

Guides
Soon

Tutorials
Soon

Copyright © 2024 Vocdoni, Inc. All rights reserved.
- + \ No newline at end of file diff --git a/protocol/census/on-chain/census3.html b/protocol/census/on-chain/census3.html index 051372c2f..5de8d5308 100644 --- a/protocol/census/on-chain/census3.html +++ b/protocol/census/on-chain/census3.html @@ -12,7 +12,7 @@ - + @@ -20,7 +20,7 @@

Census3 Service

The Census3 Service is an API service which provides an easy way to create censuses for elections with holders of a single token or a combination of them. This is a wrapper of the on-chain census design and enables integrators to use on-chain censuses without manually registering tokens or generating storage proofs.

census3

This section only describes how the Census3 service works. In order to use this service, we recommend using the Vocdoni SDK Census3 client. The details for using the census3 client are documented here.

The service creates a list of token-holder addresses and balances for every registered token. It does this by regularly scanning Ethereum-based networks and analyzing all transactions. In order to generate a census, the service uses token-holder data to create a Merkle Tree with the relation HolderAddress->Balance. This Merkle tree represents a census identically to an off-chain merkle tree census, with those those holders as the set of voters and their balances as vote weights.

Using the Census3 Service

There are three main steps in using the Census3 Service: registering a token, creating a strategy, and generating a census.

Registering a token

Before a token can be used to create a census, it must be registered. A user requests that the service register a given token, and the service then begins to scan the target Ethereum network for transactions, building an index of that token. This may take some time.

The service suports the following token types:

  • ERC20
  • ERC721
  • ERC777
  • POAP
  • Gitcoin Passport Score
  • Gitcoin Passport Shields (coming soon)
  • ERC1155 (coming soon)
token selection

While all of the above token types are supported, the recommended use-case for a token-based census is a custom token created specifically to govern an organization. It is theoretically possible to create a census with a popular token such as ETH, but it would be infeasible for the Census3 service to keep an updated index of all Ethereum transactions.

Creating a strategy

A strategy is the logic behind building a single Merkle Tree from the set of holders of a token. The most basic strategy is "everyone who holds token X", but there can be more restrictions such as "everyone who holds more than 900 of token X", or complex statements like "everyone who holds token X AND token Y or Z".

Predicates

Strategies are defined by statements called "predicates." A predicate is comprised of:

  • A operator, which is a function associated with a tag (e.g. AND) that is used to combine token holders and define how to combine them.
  • Token symbols (e.g. BTC), that identify the token holders to combine. Predicates are structured by the following format: <token_symbol> <operator> <token_symbol>, e.g. BTC OR ETH. The syntax also support groups of operators, e.g. USDC AND (ETH OR (BTC AND DAI))

Operators

Each of the operators uses a different logical strategy for combining token holder balances to create a weighted census:

OperatorPowerupUsageDescription
ANDANDHolders of both tokens, with a fixed weight of 1.
OROR Holders of either or both tokens, with fixed weight of 1.
ANDsumAND:sumHolders of both tokens, with a weight adding the token balances.
ANDmulAND:mulHolders of both tokens, with a weight multiplying the token balances.
ORsumOR:sumHolders of either or both tokens, with a weight adding the token balances.
ORmulOR:mulHolders of either or both tokens, with a weight multiplying the token balances if both are non-zero, or equaling the balance that is non-zero.

Generating a census

A census is created from a given strategy and a registered token (or tokens) pertaining to that strategy. The service scans its index of token-holder data to accumulate a set of token holders and balance values and creates a Merkle tree to serve as the census. In the case of an anonymous census, there is one extra step called rounding.

Some details about the census:

  • The censuses are published on IPFS after their creation.
  • Census3 uses go.vocdoni.io/dvote/tree/arbo to build the census merkle trees.
  • The censuses can be created with the holders of just one token or a combination of tokens, using complex strategies.
  • The censuses are zk-friendly and can also be used for anonymous voting.

API Defintion

The Census3 Service provides a REST API with all of the above functionality. There is an example bash script that shows the basic usage of this API.

The service should be available at the following URLs, depending on the environment:

dev: 'https://census3-dev.vocdoni.net/api',
stg: 'https://census3-stg.vocdoni.net/api',
prod: 'https://census3.vocdoni.io/api',

Endpoints:


API Info

GET /info

Show information about the API service.

  • 📥 response:
{
"supportedChains": [
{
"chainID": 5,
"shortName": "gor",
"name": "Goerli"
},
{
"chainID": 137,
"shortName": "matic",
"name": "Polygon Mainnet"
},
{
"chainID": 80001,
"shortName": "maticmum",
"name": "Mumbai"
},
{
"chainID": 1,
"shortName": "eth",
"name": "Ethereum Mainnet"
}
]
}
  • ⚠️ errors:
HTTP StatusMessageInternal error
500error encoding API info5023

Tokens

GET /tokens

List of already added tokens.

Pagination URL params

URL keyDescriptionExample
pageSize(optional) Defines the number of results per page. By default, 100.?pageSize=2
nextCursor(optional) When is defined, it is used to get the page results, going forward. By default, "".?nextCursor=0x1234
prevCursor(optional) When is defined, it is used to get the page results, going backwards. By default, "".?prevCursor=0x1234

The maximus default page size is 10, but if you provide a page size of -1, the endpoint will return all the results, and it does not require to be paginated.

  • 📥 response:
{
"tokens": [
{
"ID": "0x1324",
"type": "erc20",
"decimals": 18,
"startBlock": 123456,
"symbol": "$",
"totalSupply": "21323",
"name": "Amazing token",
"synced": true|false,
"defaultStrategy": 1,
"tags": "testTag1,testTag2",
"chainID": 1,
"externalID": "",
"chainAddress": "eth:0x1234",
"iconURI": "http://...png"
}
],
"pagination": {
"nextCursor": "",
"prevCursor": "0x1234",
"pageSize": 10
}
}

If tags is empty, it will be ommited.

If externalID is empty, it will be ommited.

  • ⚠️ errors:
HTTP StatusMessageInternal error
204no tokens found4007
400malformed pagination params4022
500error getting tokens information5005
500error encoding tokens5011

GET /tokens/types

List the supported token types.

  • 📥 response:
{
"supportedTypes": [
"erc20",
"erc721",
"erc777",
"erc1155",
"nation3",
"wANT",
"poap"
]
}
  • ⚠️ errors:
HTTP StatusMessageInternal error
500error encoding supported tokens types5012

POST /tokens

Creates a new token in the database to be scanned. It gets the token information from the provider associated to the token type defined. If the creation success the token will be scanned in the next scanner iteration. The scan process status can be checked getting the token information.

Important: When a token is created, the API also creates a simple strategy with just the holders of that token, which is assigned to it as defaultStrategy.

  • 📤 request:
{
"ID": "0x1234",
"type": "erc20|erc721|erc777|erc1155|nation3|wANT|poap",
"tags": "testTag1,testTag2",
"chainID": 1,
"externalID": "" // id for external holders providers
}

tags attribute is optional.

externalID URL parameter is optional by default, but required for external provided tokens like POAPs.

  • ⚠️ errors:
 HTTP StatusMessageInternal error
400malformed token information4000
409token already created4009
400chain ID provided not supported4013
500the token cannot be created5000
500error getting token information5004
500error initialising web3 client5019

GET /tokens/{tokenID}?chainID={chainID}&externalID={externalID}

Returns the information about the token referenced by the provided ID and chain ID, the external ID is optional.

chainID URL parameter is mandatory.

externalID URL parameter is optional by default, but required for external provided tokens like POAPs.

  • 📥 response:
{
"ID": "0x1324",
"type": "erc20",
"size": 120,
"decimals": 18,
"startBlock": 123456,
"symbol": "$",
"totalSupply": "21323",
"name": "Amazing token",
"status": {
"atBlock": 12345,
"synced": true|false,
"progress": 87
},
"defaultStrategy": 1,
"tags": "testTag1,testTag2",
"chainID": 1,
"externalID": "",
"chainAddress": "eth:0x1234",
"iconURI": "http://...png"
}

If tags is empty, it will be ommited.

If externalID is empty, it will be ommited.

  • ⚠️ errors:
HTTP StatusMessageInternal error
400malformed token information4001
400malformed chain ID4018
404no token found4003
500error getting token information5004
500error encoding token5010
500chain ID provided not supported5013
500error initialising web3 client5019
500error getting number of token holders5020
500error getting last block number from web3 endpoint5021

GET /tokens/{tokenID}/holders/{holderID}?chainID={chainID}&externalID={externalID}

Returns the holder balance if the holder ID is already registered in the database as a holder of the token ID and chain ID provided, the external ID is optional.

chainID URL parameter is mandatory.

externalID URL parameter is optional by default, but required for external provided tokens like POAPs.

  • 📥 response:
{
"balance": "1234567890"
}
  • ⚠️ errors:
HTTP StatusMessageInternal error
400malformed token information4001
400malformed chain ID4018
404no token found4003
404token holder not found for the token provided4023
500error getting token holders5006

Strategies

GET /strategies

Returns the ID's list of the strategies registered.

Pagination URL params

URL keyDescriptionExample
pageSize(optional) Defines the number of results per page. By default, 100.?pageSize=2
nextCursor(optional) When is defined, it is used to get the page results, going forward. By default, "".?nextCursor=3
prevCursor(optional) When is defined, it is used to get the page results, going backwards. By default, "".?prevCursor=1

The maximus default page size is 10, but if you provide a page size of -1, the endpoint will return all the results, and it does not require to be paginated

  • 📥 response:
{
"strategies": [
{
"ID": 1,
"alias": "default MON strategy",
"predicate": "MON",
"uri": "ipfs://...",
"tokens": {
"MON": {
"ID": "0x1234",
"chainID": 5,
"chainAddress": "gor:0x1234",
"externalID": "mon_id_on_external_holder_provider"
}
}
},
{
"ID": 2,
"alias": "default ANT strategy",
"predicate": "ANT",
"uri": "ipfs://...",
"tokens": {
"ANT": {
"ID": "0x1234",
"chainID": 1,
"chainAddress": "eth:0x1234"
}
}
},
{
"ID": 3,
"alias": "default USDC strategy",
"predicate": "USDC",
"uri": "ipfs://...",
"tokens": {
"USDC": {
"ID": "0x1234",
"chainID": 1,
"chainAddress": "eth:0x1234"
}
}
},
{
"ID": 4,
"alias": "strategy_alias",
"predicate": "MON AND (ANT OR USDC)",
"uri": "ipfs://...",
"tokens": {
"MON": {
"ID": "0x1234",
"chainID": 5,
"chainAddress": "gor:0x1234",
"externalID": "mon_id_on_external_holder_provider"
},
"ANT": {
"ID": "0x1234",
"chainID": 1,
"chainAddress": "eth:0x1234",
"minBalance": "1"
},
"USDC": {
"ID": "0x1234",
"chainID": 1,
"chainAddress": "eth:0x1234"
}
}
}
],
"pagination": {
"nextCursor": "",
"prevCursor": "1",
"pageSize": 10
}
}
  • ⚠️ errors:
HTTP StatusMessageInternal error
204-4008
400malformed pagination params4022
500error getting strategies information5008
500error encoding strategies5016

POST /strategies

Stores a new strategy based on the defined combination of tokens provided, these tokens must be registered previously.

  • 📤 request:
    {
"alias": "test_strategy",
"predicate": "(wANT OR ANT) AND USDC",
"tokens": {
"wANT": {
"ID": "0x1324",
"chainID": 1,
"minBalance": "10000"
},
"ANT": {
"ID": "0x1324",
"chainID": 5,
},
"USDC": {
"ID": "0x1324",
"chainID": 1,
"minBalance": "50"
},
}
}
  • 📥 response:
{
"strategyID": 1
}
  • ⚠️ errors:
HTTP StatusMessageInternal error
404no token found4003
400malformed strategy provided4014
400the predicate provided is not valid4015
400the predicate includes tokens that are not included in the request4016
500error encoding strategy info5015
500error creating strategy5025

POST /strategies/import/{cid}

Imports a strategy from IPFS downloading it with the cid provided in background. The strategy import will fail if the strategy tokens are not previously created in the database.

  • 📥 response:
{
"queueID": "0123456789abcdef0123456789abcdef01234567"
}
  • ⚠️ errors:
HTTP StatusMessageInternal error
400malformed strategy provided4014
500error encoding strategy info5015

GET /strategies/import/queue/{queueID}

Returns the information of the strategy that are in the creation queue.

  • 📥 response:
{
"done": true,
"error": {
"code": 0,
"error": "error message or null"
},
"progress": 0,
"data": { /* <same_get_strategy_response> */ }
}
  • ⚠️ errors:
HTTP StatusMessageInternal error
404strategy not found4006
400malformed queue ID4011
500error getting strategy information5009
500error encoding queue item5022
  • ⚠️ possible error values inside the body:
The request could response `OK 200` and at the same time includes an error because it is an error of the enqueued process and not of the request processing).

GET /strategies/{strategyID}

Returns the information of the strategy related to the provided ID.

  • 📥 response:
{
"ID": 4,
"alias": "strategy_alias",
"predicate": "MON AND (ANT OR USDC)",
"uri": "ipfs://...",
"tokens": {
"MON": {
"ID": "0x1234",
"chainID": 5,
"chainAddress": "gor:0x1234",
"externalID": "mon_id_on_external_holder_provider"
},
"ANT": {
"ID": "0x1234",
"chainID": 1,
"chainAddress": "eth:0x1234",
"minBalance": "1"
},
"USDC": {
"ID": "0x1234",
"chainID": 1,
"chainAddress": "eth:0x1234"
}
}
}
  • ⚠️ errors:
HTTP StatusMessageInternal error
400malformed strategy ID, it must be an integer4002
404no strategy found with the ID provided4005
500error getting tokens information5005
500error getting strategy information5007
500error encoding strategy info5015

GET /strategies/{strategyID}/estimation?anonymous={true|false}

Enqueue the estimation of size and time (in milliseconds) to create the census generated for the provided strategy. It also calculates the accuracy of the resulting census, it could be different to 100% if the census will be anonymous.

  • 📥 response:
{
"queueID": "0123456789abcdef0123456789abcdef01234567",
}
  • ⚠️ errors:
HTTP StatusMessageInternal error
400malformed strategy ID, it must be an integer4002
500error encoding strategy info5015

GET /strategies/{strategyID}/estimation/queue/{queueID}

Returns the estimation of size and time (in milliseconds) to create the census generated for the strategy related to the queue ID.

  • 📥 response:
{
"done": true,
"error": {
"code": 0,
"error": "error message or null"
},
"progress": 50,
"data": {
"size": 15000,
"timeToCreateCensus": 10900,
"accuracy": 100.0,
}
}
  • ⚠️ errors:
HTTP StatusMessageInternal error
404no strategy found with the ID provided4005
400malformed queue ID4020
500error encoding queue item5022
  • ⚠️ possible error values inside the body:
The request could response `OK 200` and at the same time includes an error because it is an error of the enqueued process and not of the request processing).
HTTP StatusMessageInternal error
404no strategy found with the ID provided4005
400the predicate provided is not valid4015
204strategy has not registered holders4017
500error getting strategy information5007
500error evaluating strategy predicate5026

GET /strategies/{strategyID}/holders

Returns the list of holders with their balances for a strategy. This endpoint only works with single token strategies like default ones.

Pagination URL params

URL keyDescriptionExample
pageSize(optional) Defines the number of results per page. By default, 1000.?pageSize=2
nextCursor(optional) When is defined, it is used to get the page results, going forward. By default, "".?nextCursor=0x1234
prevCursor(optional) When is defined, it is used to get the page results, going backwards. By default, "".?prevCursor=0x1234
  • 📥 response:
{
"holders": {
"0x1": "1",
"0x2": "2",
"0x3": "3",
"0x4": "4",
"0x...": "1000",
},
"pagination": {
"nextCursor": "0x5",
"prevCursor": "0x1",
"pageSize": 5
}
}
  • ⚠️ errors:
HTTP StatusMessageInternal error
400malformed strategy ID, it must be an integer4002
404no token holders found4004
404no strategy found with the ID provided4005
400malformed pagination params4022
500error encoding token holders5013
500error getting strategy holders5030

GET /strategies/token/{tokenID}?chainID={chainID}&externalID={externalID}

Returns strategies registered that includes the token provided for the chain also provided, the external token id is an optional parameter.

externalID URL parameter is optional by default, but required for external provided tokens like POAPs.

  • 📥 response:
{
"strategies": [
{
"ID": 1,
"alias": "default MON strategy",
"predicate": "MON",
"tokens": {
"MON": {
"ID": "0x1234",
"chainID": 5,
"chainAddress": "gor:0x1234"
}
}
},
{
"ID": 4,
"alias": "strategy_alias",
"predicate": "MON AND (ANT OR USDC)",
"tokens": {
"MON": {
"ID": "0x1234",
"chainID": 5,
"chainAddress": "gor:0x1234",
"externalID": "mon_id_on_external_holder_provider"
},
"ANT": {
"ID": "0x1234",
"chainID": 1,
"chainAddress": "eth:0x1234",
"minBalance": "1"
},
"USDC": {
"ID": "0x1234",
"chainID": 1,
"chainAddress": "eth:0x1234"
}
}
}
]
}
  • ⚠️ errors:
HTTP StatusMessageInternal error
204-4008
500error getting strategies information5008
500error encoding strategies5016

POST /strategies/predicate/validate

Returns if the provided strategy predicate is valid and well-formatted. If the predicate is valid the handler returns a parsed version of the predicate as a JSON.

  • 📤 request:
{
"predicate": "DAI AND (ANT OR ETH)"
}
  • 📥 response:
{
"result": {
"childs": {
"operator": "AND",
"tokens": [
{
"literal": "DAI"
},
{
"childs": {
"operator": "OR",
"tokens": [
{
"literal": "ANT"
},
{
"literal": "ETH"
}
]
}
}
]
}
}
}
  • ⚠️ errors:
HTTP StatusMessageInternal error
400malformed strategy provided4014
400the predicate provided is not valid4015
500error encoding validated strategy predicate5024

GET /strategies/predicate/operators

Returns the list of supported operators to build strategy predicates.

  • 📥 response:
{
"operators": [
{
"description": "logical operator that returns the common token holders between symbols with fixed balance to 1",
"tag": "AND"
},
{
"description": "logical operator that returns the token holders of both symbols with fixed balance to 1",
"tag": "OR"
}
]
}
  • ⚠️ errors:
HTTP StatusMessageInternal error
500error encoding supported strategy predicate operators5027

Censuses

POST /censuses

Request the creation of a new census with the strategy provided and returns the census ID.

  • 📤 request:
{
"strategyID": 1,
"anonymous": false
}
  • 📥 response:
{
"queueID": "0123456789abcdef0123456789abcdef01234567"
}
  • ⚠️ errors :
HTTP StatusMessageInternal error
400malformed strategy ID, it must be an integer4002
500error encoding census5017

GET /censuses/{censusID}

Returns the information of the snapshots related to the provided ID.

  • 📥 response:
{ 
"ID": 2,
"strategyID": 1,
"merkleRoot": "e3cb8941e25dcdb36fc21acbe5f6c5a42e0d4f89839ae94952f0ebbd9acd04ac",
"uri": "ipfs://Qma....",
"size": 1000,
"weight": "200000000000000000000",
"anonymous": true,
"accuracy": 100.0
}
  • ⚠️ errors:
HTTP StatusMessageInternal error
400malformed census ID, it must be a integer4001
404census not found4006
500error getting census information5009
500error encoding census5017

GET /censuses/queue/{queueID}

Returns the information of the census that are in the creation queue.

  • 📥 response:
{
"done": true,
"error": {
"code": 0,
"error": "error message or null"
},
"progress": 100,
"data": { /* <same_get_census_response> */ }
}
  • ⚠️ errors:
HTTP StatusMessageInternal error
404census not found4006
400malformed queue ID4011
500error getting census information5009
500error encoding queue item5022
  • ⚠️ possible error values inside the body:
The request could response `OK 200` and at the same time includes an error because it is an error of the enqueued process and not of the request processing).
HTTP StatusMessageInternal error
404no token holders found4004
404no strategy found with the ID provided4005
400no tokens found for the strategy provided4010
409census already exists4012
400the predicate provided is not valid4015
204strategy has not registered holders4017
500error creating the census tree on the census database5001
500error evaluating strategy predicate5026

GET /censuses/strategy/{strategyID}

Returns a list of censuses previously created for the strategy provided.

  • 📥 response:
{
"censuses": [
{
"ID": 1,
"strategyID": 1,
"merkleRoot": "e3cb8941e25dcdb36fc21acbe5f6c5a42e0d4f89839ae94952f0ebbd9acd04ac",
"uri": "ipfs://Qma....",
"size": 1000,
"weight": "200000000000000000000",
"anonymous": true,
"accuracy": 100.0
}
]
}
  • ⚠️ errors:
HTTP StatusMessageInternal error
204-4007
400malformed census ID, it must be a integer4001
404census not found4006
500error getting census information5009
500error encoding censuses5018

Resources

Guides
Soon

Tutorials
Soon

Copyright © 2024 Vocdoni, Inc. All rights reserved.
- + \ No newline at end of file diff --git a/protocol/data-schemes.html b/protocol/data-schemes.html index e8947d368..c51b6672b 100644 --- a/protocol/data-schemes.html +++ b/protocol/data-schemes.html @@ -12,13 +12,13 @@ - +

Data Schemes

When it comes to voting processes, there are two main types of data storage at the protocol-level: protocol-level data stored on the Vochain and readable metadata like election descriptions stored on IPFS.

Protocol Data

Protocol data is data that is published directly to the blockchain and determines how election, votes, and organizations behave. Much of the protocol data is defined by Protobuf-encoded packages sent in blockchain transactions.

Metadata

Metadata is typically human-readable data that is important but does not define how an election behaves at a protocol level. Metadata is represented as a JSON file that conforms to a specific schema. This data is typically retrieved using a P2P storage system like IPFS, with an immutable URI and hash of that data stored on the blockchain to ensure it cannot be tampered with.

Resources

Guides
Soon

Tutorials
Soon

Copyright © 2024 Vocdoni, Inc. All rights reserved.
- + \ No newline at end of file diff --git a/protocol/data-schemes/election.html b/protocol/data-schemes/election.html index 1824e7056..63e491873 100644 --- a/protocol/data-schemes/election.html +++ b/protocol/data-schemes/election.html @@ -12,13 +12,13 @@ - +

Election Metadata

Election metadata provides the human-readable data associated with an election.

The creation of this data structure is critical. Multiple checks should be in place to ensure that the data is coherent (well formatted, all relevant locales present, etc).

The Election Metadata should not be confused with the Election Parameters, which define how the election should behave.

JSON Schema

The metadata of a election is represented as follows:

{
"version": "1.1", // Protocol version
"title": {
"en": "Universal Basic Income",
"ca": "Renda Bàsica Universal"
},
"description": {
"en": "The description goes here",
"ca": "La descripció va aquí"
},
"media": {
"header": "<content uri>",
"streamUri": "https://.../"
},
"questions": [
{
"title": {
"en": "Should universal basic income become a human right?",
"ca": "Estàs d'acord amb que la renda bàsica universal sigui un dret humà?"
},
"description": {
"en": "The description goes here",
"ca": "La descripció va aquí"
},
"choices": [
{
"title": {
"en": "Yes",
"ca": "Sí"
},
"value": 0
},
{
"title": {
"en": "No",
"ca": "No"
},
"value": 1
}
]
}
],
"results": {
"aggregation": "index-weighted", // "index-weighted" | "discrete-counting",
"display": "rating" // "rating" | "simple-question" | "multiple-choice" | "linear-weighted" | "quadratic-voting" | "multiple-question" | "raw"
}
}

The results fields are informational only. Regardless of the chosen aggregation or display, the scrutiny is the same for all cases. However, these fields help the UI components to interpret and display the results according to the ballot protocol

Resources

Guides
Soon

Tutorials
Soon

Copyright © 2024 Vocdoni, Inc. All rights reserved.
- + \ No newline at end of file diff --git a/protocol/data-schemes/organization.html b/protocol/data-schemes/organization.html index faf7252c4..e5d395e95 100644 --- a/protocol/data-schemes/organization.html +++ b/protocol/data-schemes/organization.html @@ -12,13 +12,13 @@ - +

Organization Metadata

The metadata of an organization provides human readable content, featuring names, descriptions, images, the list of available processes and more.

JSON schema

{
"version": "1.0",
// The first language in the list is the default one
// Use "default" or https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes
"languages": ["en", "fr"],
"name": {
"en": "Free Republic of Liberland",
"fr": "République Libre de Liberland"
},
"description": {
"en": "In a sovereign state...",
"fr": "Dans un état souverain..."
},
"votingProcesses": {
"active":["0x987...","0x876..."], // Process ID of the active votes
"ended":["0x887...","0x886..."] // Process ID of the ended votes
},
"newsFeed": { // Unused, subject to revision
"en": "ipfs://34567,https://hipsterpixel.co/feed.json",
"fr": "ipfs://23456,https://feed2json.org/convert?url=http://www.intertwingly.net/blog/index.atom"
},
"media": {
"avatar": "https://liberland.org/logo.png,ipfs://12345,ipfs://12345",
"header": "https://liberland.org/header.png,ipfs://12345,ipfs://12345",
},

"actions": [ <ActionSchema>, ... ], // Unused, subject to revision

"bootEntities": [ <OrganizationReference>, ... ], // Unused, subject to revision

"fallbackBootNodeEntities": [ <OrganizationReference>, ... ], // Unused, subject to revision

"trustedEntities": [ <OrganizationReference>, ... ], // Unused, subject to revision

"censusServiceManagedEntities": [ <OrganizationReference>, ... ] // Unused, subject to revision
}

Register

Open a registration form within the client app.

{
"type": "register",
"actionKey": "sign-up", // The name you give to identify the action

"name": {
"default": "Register",
"fr": "S'inscrire"
},

// The URL to POST the provided data to.
// See the format below.
"url": "https://census-registry.cloud/lambda/actions/",

// Endpoint to query for the visibility (if dynamic).
// Returning true will show the action and hide it otherwise.
// See Action Visibility below.
"visible": "https://census-registry.cloud/lambda/actions/"

// "visible": "always" (or make it always visible)
}

The body of the POST request submitted to url will contain a JSON body like:

{
"request": {
"method": "register",
"actionKey": "sign-up",
"organizationId": "0xaabbccdd...",
"firstName": "John",
"lastName:": "Snow",
"dateOfBirth": "2020-02-19T10:09:19.738Z",
"email": "john@snow.me",
"phone": "+1235678838",
"timestamp": 1556110671
},
"signature": "0x1234..." // The public key will be extracted from the signature
̣}

As this all happens through Gateway requests, signature is computed from the stringified JSON of request, where its keys are sorted alphabetically.

The response from the backend should look like like:

{
"response": {
"ok": true,
// "error": "Something went wrong", // Only if `ok` == false
"timestamp": 1556110671
},
"signature": "" // Empty until registry public keys are available
}

Resources

Guides
Soon

Tutorials
Soon

Copyright © 2024 Vocdoni, Inc. All rights reserved.
- + \ No newline at end of file diff --git a/protocol/data-schemes/vote.html b/protocol/data-schemes/vote.html index 8754483b0..56891e9d2 100644 --- a/protocol/data-schemes/vote.html +++ b/protocol/data-schemes/vote.html @@ -12,13 +12,13 @@ - +

Vote Data

Vote Envelope

The Vote Envelope contains a (possibly encrypted) Vote Package and provides details to prove that the incoming vote is valid. Some fields may be optional depending on the election mode and envelopeType.

When envelopeType.ANONYMOUS is enabled

This section will be available soon.

When envelopeType.ANONYMOUS is disabled

A signed (non-anonymous) Vote Envelope features the election ID, the Census Merkle Proof of the user, a nonce to prevent replay attacks, the index of the encryption keys used, a Base64 representation of the Vote Package and the user's signature.

In order to guarantee 100% reproduceability of the signature, the Vote Envelope is encoded as a Protobuf model and serialized into a byte array. This byte array is then signed and both fields are sent via a SignedTx model to a Gateway.

// Protobuf models

message VoteEnvelope {
bytes nonce = 1; // Unique number per vote attempt, so that replay attacks can't reuse this payload
bytes electionId = 2; // The election for which the vote is cast
Proof proof = 3; // One of ProofGraviton, ProofIden3, ProofEthereumStorage, ProofEthereumAccount, or ProofCA
bytes votePackage = 4; // JSON string of the Vote Package, encoded as bytes. It may be encrypted.
bytes nullifier = 5; // Hash of the private key + electionId (optional, depending on the type)

repeated uint32 encryptionKeyIndexes = 6; // On encrypted votes, contains the (sorted) indexes of the keys used to encrypt
}

// ...

message Tx {
oneof payload {
VoteEnvelope vote = 1;
// ...
}
}

message SignedTx {
bytes tx = 1; // The bytes produced by Marshaling a Tx{} message
optional bytes signature = 2; // The signature for the tx bytes.
// signature is only required in those transactions that actually need a signature.
// I.e zk-SNARKs based transactions won't needed, however the transaction should use
// this message type in order to preserve consistency on the Vochain
}

Vote Package

Contains the actual votes and is part of the Vote Envelope.

{
"nonce": "01234567890abcdef", // 8+ byte random string to prevent guessing the encrypted payload before the reveal key is released
"votes": [ // Directly mapped to the `questions` field of the metadata
1, 3, 2
]
}
When envelopeType.ENCRYPTED_VOTE is disabled
  • The nonce can be omitted.
  • The package has to be serialized as a JSON string and encoded as bytes.
When envelopeType.ENCRYPTED_VOTE is enabled
  • The nonce is mandatory.
  • The package has to be serialized as a JSON string encoded as bytes.
  • It must be encrypted with a subset of the public keys or all of them.
  • The index of the public keys used to encrypt must be included in the Vote Envelope in the exact order they have been used.

Results

Requests to the Results API will return an Array of number arrays, following the Ballot Protocol. They will contain a bi-dimensional array of integers, aggregating the values currently stored on the Vochain.

The interpretation of these values is left to the Client apps, and is determined by the results.aggregation and results.display fields of the Election Metadata, listed above.

Resources

Guides
Soon

Tutorials
Soon

Copyright © 2024 Vocdoni, Inc. All rights reserved.
- + \ No newline at end of file diff --git a/sdk.html b/sdk.html index 70395a2b7..a5b27c49d 100644 --- a/sdk.html +++ b/sdk.html @@ -12,7 +12,7 @@ - + @@ -20,7 +20,7 @@

Vocdoni SDK

The Vocdoni SDK is a convenient way to interact with the Vocdoni Protocol through the API, allowing anyone to create, manage and participate in voting processes and collective decision-making. The SDK is the primary mode by which developers should interface with Vocdoni - if you think the SDK is missing functionality you need, please get in touch.

Start by following along with the SDK tutorial

There is also a tutorial for using an on-chain token-based census

Detailed SDK reference

Examples

You can find examples using es modules, typescript, and vite react in the examples folder.

example-esm demo

Reference Docs

You can find the autogenerated docs in our SDK Reference. You can build them following this guide.

Disclaimer

The Vocdoni SDK and the underlying API is WIP. Please beware that it can be broken at any time if the release is alpha or beta. We encourage to review this repository for any change.

License

This SDK is licensed under the GNU Affero General Public License v3.0.

Vocdoni API Typescript SDK
Copyright (C) 2022 Vocdoni Roots MCU

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License
along with this program. If not, see <https://www.gnu.org/licenses/>.

Resources

Guides
Soon

Tutorials
Soon

Copyright © 2024 Vocdoni, Inc. All rights reserved.
- + \ No newline at end of file diff --git a/sdk/integration-details.html b/sdk/integration-details.html index 052e368b9..1caa93947 100644 --- a/sdk/integration-details.html +++ b/sdk/integration-details.html @@ -12,7 +12,7 @@ - + @@ -25,7 +25,7 @@ Wallet based on arbitrary data, like, for example, the user and hash password from a custom CRM.

Here is an example of client.generateWalletFromData where a Wallet is generated using the username and the hash of the password which we would use to identify the user in our platform. This Wallet can then be used for the census and for voting purposes. This enables users to keep the same private key without having to store it in their browser or application.

// 9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08 is the sha256 of 'test'
const userWallet = VocdoniSDKClient.generateWalletFromData(['user1', '9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08']);
console.log(userWallet) // address is 0x8AF1b3EDB817b5854e3311d583905a3421F49829

Resources

Guides
Soon

Tutorials
Soon

Copyright © 2024 Vocdoni, Inc. All rights reserved.
- + \ No newline at end of file diff --git a/sdk/integration-details/census-types.html b/sdk/integration-details/census-types.html index e40643b80..81e48e0a6 100644 --- a/sdk/integration-details/census-types.html +++ b/sdk/integration-details/census-types.html @@ -12,13 +12,13 @@ - +

Census Types

A census is a list of voters who are eligible to vote in a given election. There are multiple ways to define a census with Vocdoni, each with different privacy and verifiability considerations. The census types are defined and documented at a protocol level and include on-chain, off-chain Merkle tree, and off-chain Credential Service Provider.

The census type is selected from the SDK by using a census of that type when creating an election. The SDK census types correspond to the three protocol-level census types according to the following table:

SDK Census TypeProtocol TypeweightedanonymousCensusType
CSPCensusOff-chain CSPnooptionalCSP
PublishedCensus -> TokenCensusOn-chainyesnoWEIGHTED
PublishedCensus -> TokenCensusOn-chainyesyesANONYMOUS
OffchainCensus -> PlainCensusOff-chain treenonoWEIGHTED
OffchainCensus -> PlainCensusOff-chain treenoyesWEIGHTED
OffchainCensus -> WeightedCensusOff-chain treeyesnoANONYMOUS
OffchainCensus -> WeightedCensusOff-chain treeyesyesANONYMOUS
note

A weighted census is one where some voters' votes have more power than others, set by a weight value. PlainCensus is described by a WEIGHTED CensusType because it technically is a weighted census, with every weight set to 1.

Resources

Guides
Soon

Tutorials
Soon

Copyright © 2024 Vocdoni, Inc. All rights reserved.
- + \ No newline at end of file diff --git a/sdk/integration-details/census-types/off-chain-csp.html b/sdk/integration-details/census-types/off-chain-csp.html index f7ac39abb..34c3e0929 100644 --- a/sdk/integration-details/census-types/off-chain-csp.html +++ b/sdk/integration-details/census-types/off-chain-csp.html @@ -12,14 +12,14 @@ - +

Off-chain Credential Service Provider

A Credential Service Provider is an external component that serves as a validator for the identities of voters. An example of this could be a service set up by a municipal government that validates if a given voter is registered, or a forum that validates if a given voter has an active account. With this type of census, voters show proof of registry and receive a cryptographic package from the CSP allowing them to cast a vote.

Because using an off-chain CSP census requires a custom CSP for each use-case, it is not ready to use out-of-the-box. If you are interested in setting up a CSP election, please reach out to us for help.

CSP census elections have the option of full-anonymity with the use of Blind Signatures.

If a CSP is set up for a census, minor modifications are needed on the client side. For creating a CSP based election, a CspCensus has to be used with the CSP's public key and URL as parameters.

const election = Election.from({
title: 'Election title',
description: 'Election description',
// a header image for your process (this is for example purposes; avoid using random sources)
header: 'https://source.unsplash.com/random/2048x600',
endDate: new Date('2023-01-23 23:23:23'),
census: new CspCensus(CSP_PUBKEY, CSP_URL),
})
// The election can be created the same way from here...

The next step is requesting a blind signature from the CSP for each voter before casting their vote.

This is done with client.cspStep. This function sends an API call to the given CSP to perform an "authentication step" predefined by whoever sets up the CSP. A step could be validating a name, sending an authentication token, or anything else. Non-final steps should return a ICspIntermediateStepResponse object containing an authToken and arbitrary response data. Once the predefined set of steps has been performed successfully, the final step should return a ICspFinalStepResponse object containing a token registered to the verified voter.

// Client initialization
const client = new VocdoniSDKClient({
env: EnvOptions.DEV,
wallet: voter, // the signer used (Metamask, Walletconnect)
electionId: '934234...', // The election identifier (has to be a CSP configured election)
})

// Auth steps for the CSP (can vary of the type of the CSP)
const step0 = (await client.cspStep(0, ['Name test'])) as ICspIntermediateStepResponse;
const step1 = (await client.cspStep(
1,
[step0.response.reduce((acc, v) => +acc + +v, 0).toString()],
step0.authToken
)) as ICspFinalStepResponse;

Once this token has been received, the client requests blind signature from the CSP and then uses this signature to cast vote. Because this signature is blinded, the vote cannot be traced back to the voter address or verification information.

// Get the blind signature
const signature = await client.cspSign(voter.address, step1.token);

// Get the vote based on the signature
const vote = client.cspVote(new Vote([Math.round(Math.random())]), signature);

// Vote
const voteId = await client.submitVote(vote);

Anonymity

Credential Service Provider elections provide strong anonymity by the use of Blind Signatures. This is a slight modification on the standard CSP Census design, in which users are able to send a "blinded" version of their vote to the CSP after getting verified. The CSP signs this blinded package, and the user is then able cast their vote signed by the CSP without their identity being traced to that vote by anybody, including the CSP.

Ask us if you would like to try setting up at CSP that can compute blind signatures.

Resources

Guides
Soon

Tutorials
Soon

Copyright © 2024 Vocdoni, Inc. All rights reserved.
- + \ No newline at end of file diff --git a/sdk/integration-details/census-types/off-chain-tree.html b/sdk/integration-details/census-types/off-chain-tree.html index 3e0584464..f7b982abf 100644 --- a/sdk/integration-details/census-types/off-chain-tree.html +++ b/sdk/integration-details/census-types/off-chain-tree.html @@ -12,13 +12,13 @@ - +

Off-chain Merkle Tree

This is the most basic census type, is the default when creating an election, and is the one used in the SDK tutorial. In this scheme, the census is essentially a basic list of voter, with some behind-the-scenes cryptography. With an off-train tree census, voters are added as wallet addresses using census.add().

This is the census type used in the SDK Tutorial. Follow along or look at the tutorial code for basic usage of the Merkle tree census.

Off-chain tree census can be created as PlainCensus or WeightedCensus. If a weighted census is used, voters can be assigned a weight which proportionally determines the power of their vote:

weightedCensus.add([
{
key: address1,
weight: BigInt(1),
},
{
key: address2,
// This voter will have 100x the vote power as voter1. This is not a very equitable election.
weight: BigInt(100),
},
]);

Anonymity

Complete cryptographic anonymity is possible alongside universal verifiability with anonymous Merkle tree-based censuses. This is possible due to a cutting-edge technology called zk-SNARKs. The protocol-level design is detailed here.

For an anonymous off-chain tree election, the election must be created with the option

electionType: {
anonymous: true
}

In this case, votes must also be cast as AnonymousVotes. The cryptography needed for anonymous voting is very different from typical voting, but this is all handled by the SDK without any other changes needed.

Resources

Guides
Soon

Tutorials
Soon

Copyright © 2024 Vocdoni, Inc. All rights reserved.
- + \ No newline at end of file diff --git a/sdk/integration-details/census-types/on-chain.html b/sdk/integration-details/census-types/on-chain.html index 361d42bcd..d6dc72cb6 100644 --- a/sdk/integration-details/census-types/on-chain.html +++ b/sdk/integration-details/census-types/on-chain.html @@ -12,7 +12,7 @@ - + @@ -20,7 +20,7 @@

On-chain Token-Based Census

An on-chain census is one whose voters are defined by holding tokens on the Ethereum blockchain. Currently the following token types are supported:

  • ERC20
  • ERC721
  • ERC777
  • POAP
  • Gitcoin Passport Score
  • Gitcoin Passport Shields (coming soon)
  • ERC1155 (coming soon)
token selection

While all of the above token types are supported, the recommended use-case for a token-based census is a custom token created specifically to govern an organization. It is theoretically possible to create a census with a popular token such as ETH, but the number of token-holders and frequency of transactions for such a token make census generation impractical.

This census type is supported by our Census3 service which serves as a bridge between Ethereum and clients, collecting token-holder data and generating census trees.

Tutorial

You can check out a full working example of this tutorial here

The on-chain census requires some extra setup, as censuses depend on indexing token balances from a public blockchain. Luckily the SDK provides a client to the Census3 service which keeps track of token balances and translates blockchain data to a straightforward census of voters. This tutorial explains how to set up your environment and use the VocdoniCensus3Client.

Setup

The first consideration when setting up an on-chain census is which token you will use to validate voters. This section will explain how to create a token for testing and register that token to the census3 service.

Creating a Token

existing token

If you already have a token that represents your organization, feel free to skip this step and register your token with the census3 service.

The easiest way to start using and testing the census3 service is to create a testing token on a testnet (a blockchain network built for testing integrations, where tokens have no real value). We will use a free service to generate a token on the Sepolia testnet. Before you can generate a token, however, there are two steps:

  • Make sure you have a wallet such as Metamask and an account to use for testing.
  • Request some Sepolia ETH from the Sepolia faucet. You need testnet Ethereum to "pay" for transactions on Sepolia.

You can use Coin Factory to create a standard token. For testing purposes the name, symbol, and initial supply of the token do not matter. After pressing "create token" and signing with you metamask account, make sure to open the token's etherscan page and copy its address.

Registering Your Token

With a token created, you now need to register this token to the census3 service. You can set up a fresh Vocdoni SDK environment as described in the tutorial.

For the sake of testing, let's simply hard-code some information about the token we want to use. We need the address of the token you just published as well as the public Chain ID for the testnet (or mainnet) you are using. Sepolia's chainID is 11155111. We also need the token type, which in this case is erc20.

const myToken = {
address: '0x...',
chainID: 11155111,
type: 'erc20',
};

In addition to creating a normal VocdoniSDKClient, you also need a VocdoniCensus3Client. Use the same environment as you would for the standard SDK client, in this case Staging for a stable testing environment.

const census3client = new VocdoniCensus3Client({ env: EnvOptions.STG });

Make sure the Sepolia network is supported by the census3 service with getSupportedChains. Sepolia should always be supported, but if it is not, you need to create a token on a chain that is.

let chains = await census3Client.getSupportedChains();
let supportsChain = false;
for (let chain of chains) {
if (chain.chainID == myToken.chainID) {
supportsChain = true;
}
}

Similarly, before registering the token, you can double-check whether it already is supported with getSupportedTokens. Here we convert our target token address to lowercase because it is represented by a case-insensitive hex-string. If the token is already supported (not possible if the token is brand-new), you can skip the next step.

let tokens = await census3Client.getSupportedTokens();
let supportsToken = false;
for (let token of tokens) {
if (token.ID.toLowerCase() === myToken.address.toLowerCase()) {
supportsToken = true;
}
}

Now we can register the token.

await census3Client.createToken(myToken.address, myToken.type, myToken.chainID);
warning

The createToken function asks the census3 service to add the token to its registry, but this does not mean the token is ready to use.

Now that the token is registered, we can request the token info from the census3 service. Before using this token to create a census or getting information about the number of token-holders, however, we need to wait for the census3 service to peruse the blockchain and index the entire history of the token. Even with a brand new token this can take some time in the range of 30 minutes. info.status reports whether the token has synced and the syncing progress percentage.

let status = (await census3Client.getToken(myToken.address, myToken.chainID)).status;
if (!status.synced) {
console.log('Token %s is syncing. Progress %d%. Try again later.', myToken.address, status.progress);
return;
}

Creating the Census

Once a token has been registered and is synced, the steps above never have to be performed again. Simple censuses can be created with createTokenCensus: this creates the 'default' census, in which every token-holder has a weighted vote according to their token balance.

const census = await census3Client.createTokenCensus(myToken.address, myToken.chainID);

Complex Census

It is possible to create a census with more complex inclusion criteria, such as holders of two different tokens. In order to do this, each token must individually be supported by the census3 service. The first step is to create a 'strategy' with census3Client.createStrategy. This strategy ID is then passed to census3Client.createCensus to generate the census itself. createStrategy takes a predicate string which defines the logical operations representing inclusion criteria for the census strategy.

For a detailed guide on creating complex on-chain censuses, check out Complex Census

Election & Voting

Once a census has been created, the entire process is identical to the off-chain tree census process.

  1. Create account
  2. Create election
  3. Publish election & wait for it to be posted
  4. Cast votes
  5. Count votes

The one difference here is how voter wallets are accessed. Because we are using a token-based census, voters are expected to have custody of their private keys. In a web application, you would need to ask users to connect with a wallet provider (like Metamask) to provide the public key associated with their token-holder account and to sign their vote transaction. You can see how we implemented this in our vite-react example.

For the purposes of this tutorial, we can just manually import the private key of the testing-only wallet we used to generate the token initially. You could also make other testing wallets and send some of your testing token to them so you can use multiple voters with different weights.

// Private-keys copied from your wallet provider. NEVER do this with an account you use to hold real funds.
const voters = ['...', '...'];
for (const voter of voters) {
const wallet = new Wallet(voter);
const client = new VocdoniSDKClient({ env: EnvOptions.STG, wallet: wallet, electionId: electionId });
...
// Create the vote and cast is as you would with an off-chain census

Anonymity

Anonymity may seem impossible for token-based censuses, as votes are weighted based on public token balance values. However, we have been able to design a sufficiently-anonymous approach by rounding token values, which you can read about on our blog. This form of anonymity has some drawbacks and theoretical weaknesses that users should be aware of, but it provides a strong layer of anonymity under the right conditions.

All you need to do to create an anonymous token-based census is to set the anonymous parameter to true:

const census = await census3Client.createTokenCensus(myToken.address, myToken.chainID, true);

You can then use this census with an anonymous election:

electionType: { anonymous: true },

Voting proceeds as normal and the anonymity is applied.

Resources

Guides
Soon

Tutorials
Soon

Copyright © 2024 Vocdoni, Inc. All rights reserved.
- + \ No newline at end of file diff --git a/sdk/integration-details/census-types/on-chain/complex-census.html b/sdk/integration-details/census-types/on-chain/complex-census.html index 5e31b5519..974415a1e 100644 --- a/sdk/integration-details/census-types/on-chain/complex-census.html +++ b/sdk/integration-details/census-types/on-chain/complex-census.html @@ -12,13 +12,13 @@ - +

Complex Census

The census3 service makes it easy to create a census based off of the balance holders of a token taken to represent an organization. It is possible, however, to create a token-based census with more complex logic, incorporating balance information from multiple tokens at once.

Strategies

The logic that defines inclusion in a token-based census is called a 'strategy.' For the basic token-holder use case, the strategy is defined solely by that token. createTokenCensus chooses the default strategy for that token, so for a basic token-based census you don't need to worry about strategies at all.

More complex strategies exist, however, such as "holders of both VOC1 token AND VOC2 token."

Just like checking for supported tokens, you can see a list of the strategies supported by the census3 service:

const strategies = await census3Client.getStrategies();
console.log(JSON.stringify(strategies, null, 4));

This will print a long list of strategies. Some of them will be basic strategies for a single token:

...
{
"ID": 72,
"alias": "Default strategy for token VOC3TEST",
"predicate": "VOC3TEST",
"uri": "ipfs://bafybeih7rmjsdzqjr6pyjv46jo4kjpl3qfv2yufpdxzmcw2j63z47u6czy",
"tokens": {
"VOC3TEST": {
"ID": "0x9286d95DB5a59306113028EF0BA85bF7068A199F",
"chainID": 11155111,
"minBalance": "1",
"chainAddress": "sep:0x9286d95DB5a59306113028EF0BA85bF7068A199F"
}
}
},
...

Some, on the other hand, will be more complex strategies involving multiple tokens:

...
{
"ID": 103,
"alias": "gitcoin_onvote_1711040172449",
"predicate": "GPS AND:mul (GPS:Discord OR GPS:Github)",
"uri": "ipfs://bafybeidopynxc746oorzkh7yvhomcw56w72aaw3klqce4gkjcczc7ry3uu",
"tokens": {
"GPS": {
"ID": "0x000000000000000000000000000000000000006C",
"chainID": 1,
"minBalance": "16",
"chainAddress": "eth:0x000000000000000000000000000000000000006C"
},
"GPS:Discord": {
"ID": "0x000000000000000000000000000000000000006C",
"chainID": 1,
"minBalance": "1",
"chainAddress": "eth:0x000000000000000000000000000000000000006C",
"externalID": "Discord"
},
"GPS:Github": {
"ID": "0x000000000000000000000000000000000000006C",
"chainID": 1,
"minBalance": "1",
"chainAddress": "eth:0x000000000000000000000000000000000000006C",
"externalID": "Github"
}
}
},
...

Predicates

As you can see, there are two main differences between the simple and complex strategies: the predicate and the tokens.

Predicates are logical operators that define how strategies create a census. There are currently two logical operators (AND and OR), each with two additional 'powerups' (sum and mul).

The predicate syntax and available operators are documented in-depth at Creating a Strategy.

You can also query the census3 service for a list of available operators:

const operators = await census3Client.getSupportedOperators();
console.log(operators);
[
{
description: 'AND logical operator that returns the common token holders between symbols with fixed balance to 1',
tag: 'AND'
},
{
description: 'AND:sum logical operator that returns the common token holders between symbols with the sum of their balances on both tokens',
tag: 'AND:sum'
},
{
description: 'AND:mul logical operator that returns the common token holders between symbols with the multiplication of their balances on both tokens',
tag: 'AND:mul'
},
{
description: 'OR logical operator that returns the token holders of both symbols with fixed balance to 1',
tag: 'OR'
},
{
description: 'OR:sum logical operator that returns the token holders of both symbols with the sum of their balances on both tokens',
tag: 'OR:sum'
},
{
description: 'OR:mul logical operator that returns the token holders of both symbols with the multiplication of their balances on both tokens',
tag: 'OR:mul'
}
]

As seen in the strategy example above, you can combine operators to create complex predicates with many tokens:

"predicate": "GPS AND:mul (GPS:Discord OR GPS:Github)"

Creating a Census

The first step in creating a complex census is to create the strategy itself. You can write a predicate with the operators defined above and use the predicate with createStrategy(). The only requirement is that you include a list of the necessary tokens used by this predicate, including the token ID (address), chainID, and optionally the minBalance (the minimum necessary balance to include a token-holder in a census).

const strategyID = await census3Client.createStrategy('voc_test_strategy', 'VOC3TEST AND VOC3TEST3', {
VOC3TEST: {
ID: '0x9286d95DB5a59306113028EF0BA85bF7068A199F',
chainID: 11155111,
minBalance: '1',
},
VOC3TEST3: {
ID: '0x61353Bc49B062EEe99F4768225f4e4f0df5DB1b9',
chainID: 11155111,
minBalance: '1',
},
});

This API call, if successful, returns the ID of the newly-created strategy. You can also use getStrategies() again to make sure the strategy is supported. This ID is needed to create the census based off of the strategy:

const censusInfo = await census3Client.createCensus(strategyID);

This returns a set of information about the census but cannot be used to directly create an election. To do this, just manually create a PublishedCensus.

const census = new PublishedCensus(
censusInfo.merkleRoot,
censusInfo.uri,
censusInfo.anonymous ? CensusType.ANONYMOUS : CensusType.WEIGHTED,
censusInfo.size,
BigInt(censusInfo.weight)
);

This census can be used to create an election just like any other. In this case, the census would represent all token-holders of the VOC3TEST and VOC3TEST3 tokens, all with a weight of 1.

Resources

Guides
Soon

Tutorials
Soon

Copyright © 2024 Vocdoni, Inc. All rights reserved.
- + \ No newline at end of file diff --git a/sdk/integration-details/vocdoni-tokens.html b/sdk/integration-details/vocdoni-tokens.html index 1dd7cc43a..d608562b9 100644 --- a/sdk/integration-details/vocdoni-tokens.html +++ b/sdk/integration-details/vocdoni-tokens.html @@ -12,14 +12,14 @@ - +

Vocdoni Tokens

Behind-the-scenes, Vocdoni is powered by a custom blockchain. This component provides universal verifiability, but it also introduces some complexity. In order to distribute workload and verify transactions, our blockchain uses a digital "currency" of Vocdoni tokens that have no real-world value but help with load-balancing and spam reduction. Actions that update data on the blockchain, such as creating an election, incur a "cost." Integrators are responsible for ensuring that accounts creating elections have a sufficient balance of tokens.

info

Casting a vote never requires Vocdoni tokens.

Initial Tokens

Because accounts cannot hold Vocdoni tokens before they are created, client.createAccount() automatically requests tokens from the blockchain. In production environments, only enough tokens to create the account itself are provided. Moving forward, more tokens must be requested in order to create elections. In non-production environments, a large amount of tokens is automatically supplied to accounts when they are created. You can create many elections in the STG and DEV environments before worrying about maintaining a balance.

Checking Token Balance

From this point on, you can check your account balance with client.createAccount() or client.fetchAccountInfo(). This provides all the information associated with the account, including the balance.

Election Cost

The token cost of a voting process is not constant; it is determined by many factors. After creating an election, but before publishing it to the blockchain, you should get a sense of the cost of the operation in order to ensure your account has sufficient balance. There are two methods to do this: client.estimateElectionCost() quickly provides a decent estimate of the cost and can be useful for writing UI components. client.calculateElectionCost() makes a time-intensive API call but provides an exact figure. It is helpful to use this directly before publishing the election to ensure it can be published.

const price = await client.estimateElectionCost(election); // Should be an UnpublishedElection with a maxCensusSize
console.log(price); // shows the estimated price
estimate election cost

In order to estimate the cost of an election quickly, the election must be created with a specified maxCensusSize. This restricts the number of users who can enter the census but enables quick election cost estimation. If you want an unlimited census size, just use calculateElectionCost instead.

const electionCost = await client.calculateElectionCost(election);
const info = await client.createAccount();
if (info.balance < electionCost) {
console.log('Need to request more tokens');
}

Requesting Tokens: The Faucet

The main way for users to gain tokens in a production environment is via a faucet, a free provider of tokens. A faucet enables users to generate a faucetPackage. This package is essentially a set of instructions; it must still be sent to the blockchain in order to request the actual tokens.

users & tokens

Some systems require election administrators to request tokens manually for their elections. In other systems, integrators may handle token requests automatically on behalf of their users. This can be done manually or with a custom faucet implementation. Reach out for help with this.

DEV & STG

In development and staging environments, the faucet functionality is handled automatically. Behind-the-scenes, createAccount requests a large amount of tokens from a development faucet. These tokens should last a while, but once the account balance is low, more tokens must be requested. This can be done with

await client.collectFaucetTokens();

This method uses the default development faucet to generate a faucetPackage requesting new tokens. It can be used any number of times. In development environments, this is all that needs to be done!

PROD

Production environments require more hands-on generation of a faucetPackage. First you need to identify the account address you are requesting tokens for.

console.log((await client.fetchAccountInfo()).address);

There are multiple ways to request a faucet package:

  • Use https://app.vocdoni.io/faucet, our web-based faucet that requires users to login with some form of existing account (google, github, social media). It provides a large amount of tokens to the given address but limits the number of times a single user can request tokens per week.
  • Reach out via discord to request tokens sent to your account address.
  • If you are an integrator who needs to manage your own faucet to provide tokens to users automatically, ask us for help with creating a custom faucet.

All of these faucets should provide you with a base-64 string containing the necessary information to request tokens from the blockchain with collectFaucetTokens. Note that each faucet package can only be used once.

await client.collectFaucetTokens("<b64string>")
collect faucet tokens

In production environments, the collectFaucetTokens method requires a faucetPackage to be provided. In development and stage, this is optional as a package is generated automatically by default.

Resources

Guides
Soon

Tutorials
Soon

Copyright © 2024 Vocdoni, Inc. All rights reserved.
- + \ No newline at end of file diff --git a/sdk/integration-details/voting-types.html b/sdk/integration-details/voting-types.html index a4903d53c..ecbb94522 100644 --- a/sdk/integration-details/voting-types.html +++ b/sdk/integration-details/voting-types.html @@ -12,7 +12,7 @@ - + @@ -23,16 +23,8 @@ candidates or options.
  • Weighted voting, each voter is assigned a specific weight or value that reflects their relative influence or importance in the decision-making process.
  • Quadratic voting, voters can cast multiple votes for issues they prioritize, but the cost of casting additional votes on the same issue rises exponentially.
  • The configuration of these election types happens at the time of election creation using the SDK. Refer to the respective -documentation for the parameter requirements for each election type.

    A comprehensive explanation of the parameters used in the ballot protocol can be found here.

    Results interpretation

    The results are stored on the Vochain as a bi-dimensional array. Essentially, the ballot protocol is a system that -transforms a unidimensional array (a vote, e.g., [1,4]) into a bi-dimensional array of results (e.g., [[2,5]]).

    The interpretation of results is done on the user side, which receives the results from the SDK. The SDK provides -metadata about the election to facilitate understanding of the results. More details on interpreting results can be found here.

    Here's a simple example to demonstrate how the result array can be interpreted in different ways, depending on the -election type:

    Consider a question where 2 candidates are ranked by preference, which is an example of ranked voting. The results -array might look like this:

    [ 
    [0, 0, 10],
    [0, 10, 0],
    [10, 0, 0]
    ]

    In this scenario:

    • 10 voters select the first candidate as third option
    • 10 voters select the second candidate as second option
    • 10 voters select the third candidate as first option

    Now, let's examine another election type that can produce the same results array. For a question like "choose your 3 -favorite colors out of 2", which is an example of approval voting, the results array may look like that:

    [ 
    [10, 0],
    [0, 10],
    [0, 10]
    ]

    On this case, the results interpretation may vary:

    • 10 users give 0 points to first option
    • 10 users give 1 point to second and third options

    The examples above represent two methods for interpreting the results array. Additional examples are available for -different voting type result interpretations.

    Weighted results are calculated on the indexer

    In a weighted election, the Vochain stores the envelope without calculating the weight of each voter. However, when -retrieving the results using the SDK, you will see the weights applied. The application of these weights is performed -by the vocdoni-node indexer, which calculates the weights for you.

    The weights of each vote are stored in the envelope, which is saved on the Vochain.

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - +documentation for the parameter requirements for each election type.

    These voting types describe different sets of behavior that can be generated with the set of election parameters. A comprehensive explanation of the parameters used in the ballot protocol can be found here.

    Results interpretation

    The structure for individual ballots and the corresponding results can vary depending on the election parameters. For example, a vote envelope [0, 2, 1] could mean one of the following:

    • 0 points for the first candidate, 2 points for the second candidate, 1 point for the third candidate
    • first-choice selection for the first candidate, third-choice for the second candidate, and second-choice for the third
    • choice of option 0 for the first question, option 2 for the second question, and option 1 for the third.

    The interpretation of votes is done at the protocol-level, according to the election parameters. The results are stored on the Vochain as a bi-dimensional array. Essentially, the ballot protocol is a system that transforms a unidimensional array (a vote, e.g., [1,4]) into a bi-dimensional array of results (e.g., [[2,5], [3,8]]).

    The interpretation of this matrix of results is done on the client side, which receives the raw results from the SDK. The SDK also provides metadata about the election to facilitate understanding of the results. More details on interpreting results can be found here.

    Here's a simple example to demonstrate how the same result array can be interpreted in different ways, depending on the election type:

    Linear-Weighted Choice Voting

    Consider a single-choice question where three candidates are ranked by voters, each receiving a number of 'points' according to each voter's ranking. This is an example of linear-weighted choice. A results array with 10 votes might look like this:

    [ 
    [4, 6, 0],
    [2, 4, 4],
    [4, 0, 6]
    ]

    Each row of this matrix represents a single candidate, and each column represents a chosen allocation of points. The numbers represent the total number of votes for that candidate/points combination.

    In this scenario:

    • The first candidate receives 4 0-point votes and 6 1-point votes
    • The second candidate receives 2 0-point, 4 1-point, and 4 2-point votes
    • The third candidate receives 4 0-point votes and 6 2-point votes

    We can use this results matrix to calculate the total weighted sum for each candidate: the first candidate receives 6 points, the second candidate receives 12, and the third candidate receives 12. Candidates 2 and 3 tie. This results interpretation is "weighted," meaning each choice represents a quantified amount of preference, and we could aggregate the results into a single array of allocated points without losing any information:

    [6, 12, 12]
    aggregated results

    For all elections where maxValue is set to 0, it is assumed that the election uses a weighted results system (like in this example). The aggregated results ([6, 12, 12]) are calculated on the indexer and reported as the official results.

    Ranked-Choice Voting

    Consider a single-choice question where three candidates are ranked by preference, and if no candidate receives more than 50% of the first-choice votes, second-choice votes are considered (a runoff election). This is one example of a ranked voting scheme. The results array could look identical to the one above:

    [ 
    [4, 6, 0],
    [2, 4, 4],
    [4, 0, 6]
    ]

    Each row of this matrix represents a single candidate, and each column represents the choice (first, second, third). The numbers represent the total number of votes for that candidate/choice combination.

    In this scenario:

    • The first candidate receives 4 first-choice and 6 second-choice votes
    • The second candidate receives 2 first-choice, 4 second-choice, and 4 third-choice votes
    • The third candidate receives 6 first-choice and 4 third-choice votes

    The main difference between this example in the last is that each vote count has to be treated as a discrete piece of data rather than a value that can be combined arithmetically with others. This is because this election has a complex method for calculating the winner where first and second choices have different meanings rather than different amounts of the same meaning. The entire results matrix is needed in order to calculate a result.

    ranked-choice

    For ranked-choice, the maxValue parameter cannot equal zero to signify that values are discrete options, not weighted points.

    In this case, the first and third candidates tie with 40% of the vote each when only first-choice votes are considered. Thus we must consider a runoff using second-choice votes: the first candidate gets 60% of the second-choice votes, and the third candidate gets 0%. The first candidate wins the election.

    Multiple Question

    Now, let's consider an election with three questions, where each question has three options. Voters must select one of the three options for each question. This is a multiple-question, multiple-choice election.

    [ 
    [4, 6, 0],
    [2, 4, 4],
    [4, 0, 6]
    ]

    Each row of this matrix represents a separate question, and each column represents the choice (first, second, third). The numbers represent the total number of votes for that question/choice combination.

    In this scenario:

    • For the first question, candidate 0 receives 4 votes and candidate 1 receives 6 (candidate 1 wins)
    • For the second question, candidate 0 receives 2 votes, candidate 1 receives 4, and candidate 2 receives 4 (candidates 1 and 2 tie)
    • For the third question, candidate 0 receives 4 votes and candidate 2 receives 6 (candidate 2 wins)

    You can see how the same results matrix could represent a wide set of interpretations, and it is crucial to pay attention to the election parameters and original design of the election when displaying the results.

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    + \ No newline at end of file diff --git a/sdk/integration-details/voting-types/approval.html b/sdk/integration-details/voting-types/approval.html index e0a909569..8918c666c 100644 --- a/sdk/integration-details/voting-types/approval.html +++ b/sdk/integration-details/voting-types/approval.html @@ -12,7 +12,7 @@ - + @@ -27,7 +27,7 @@ match the total number of choices in the election (maxCount).

    Results interpretation

    Assume a scenario where ten voters cast identical votes, i.e. [0, 1, 0, 1].

    The election results would be represented as a two-dimensional array:

    [ 
    [ '10', '0' ],
    [ '0', '10' ],
    [ '10', '0' ],
    [ '0', '10' ]
    ]

    Each position in the outer array corresponds to the available choices, and each position within the inner arrays signifies the number of voters who selected or did not select the corresponding choice. For example, [10, 0] indicates ten users did not select the choice, whereas [0, 10] means that ten users voted for the choice. So:

    • For choice 0, all 10 voters assigned it 0 points,
    • For choice 1, all 10 voters assigned it 1 point,
    • For choice 2, all 10 voters assigned it 0 points, and
    • For choice 3, all 10 voters assigned it 1 point.

    Remember, this interpretation assumes that all voters have used the same voting pattern.

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/sdk/integration-details/voting-types/quadratic.html b/sdk/integration-details/voting-types/quadratic.html index 86ccf6b32..e05fa664c 100644 --- a/sdk/integration-details/voting-types/quadratic.html +++ b/sdk/integration-details/voting-types/quadratic.html @@ -12,18 +12,13 @@ - +

    Quadratic voting

    Quadratic voting is a voting mechanism that allows individuals to express their preferences on different issues with -more granularity and intensity. In quadratic voting, voters are allocated a fixed number of voting credits, and they can -distribute those credits across various options or issues in a quadratic manner. This means that voters can assign more -credits to options they care strongly about while still being able to express preferences on multiple issues.

    The quadratic aspect of the system ensures that the cost of allocating additional credits increases quadratically, which -helps prevent a small number of voters from dominating the decision-making process. Quadratic voting aims to promote a -more accurate representation of individual preferences and allocate resources based on the collective intensity of -preferences rather than just a simple majority rule.

    See:

    Setting up the election

    Here we are going to describe how to configure an election to set up a quadratic voting. When the election object is +more granularity and intensity. In quadratic voting, voters are allocated a fixed number of voting credits, and they can distribute those credits across various options or issues. This means that voters can assign more credits to options they care strongly about while still being able to express preferences on multiple issues.

    The quadratic aspect of the system ensures that the cost of allocating additional credits increases quadratically, which helps prevent a small number of voters from dominating the decision-making process. Quadratic voting aims to promote a more accurate representation of individual preferences and allocate resources based on the collective intensity of preferences rather than just a simple majority rule.

    See:

    Setting up the election

    Here we are going to describe how to configure an election to set up a quadratic voting. When the election object is created,

    const election_opts: IVoteType = {
    maxValue: 0, // Must be 0 for quadratic elections
    maxCount: CHOICES_LENGTH, // Number of choices for the question
    uniqueChoices: false,
    costFromWeight: true, // This will set that the weight on a weighted census is actually the credits available
    costExponent: 2, // In the context of quadratic voting, this value is usually set to 2
    };
    • The actual Vocdoni implementation only allow quadratic elections with only one question. For that, the maxCount refers to the choices length for this unique question.
    • costExponent define the exponent for quadratic voting calculation. In the context of quadratic voting, this value is usually set to 2. This exponent determines the cost of a vote. For example, if a voter assigns 2 credits to an option, @@ -37,7 +32,7 @@ quadratic voting system, while it is possible to cast more votes for a preferred option, it also becomes exponentially more costly to do so, providing a self-balancing mechanism that aims to accurately reflect the strength of voters preferences.

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/sdk/integration-details/voting-types/ranked.html b/sdk/integration-details/voting-types/ranked.html index fedeeec47..e7b2113f1 100644 --- a/sdk/integration-details/voting-types/ranked.html +++ b/sdk/integration-details/voting-types/ranked.html @@ -12,7 +12,7 @@ - + @@ -28,7 +28,7 @@ (maxCount), and the value assigned to each entry should not exceed maxValue.

    With the vote array [2, 3, 0, 1, 4], it means:

    • Choice 1 is ranked as the 3nd option
    • Choice 2 is ranked as the 4rd option
    • Choice 3 is ranked as the 1st option
    • Choice 4 is ranked as the 2nd option
    • Choice 5 is ranked as the 5th option

    Results interpretation

    Consider a scenario where 10 voters cast identical votes, i.e., [2, 3, 0, 1, 4].

    The election results would be represented as a two-dimensional array:

     [
    [ '0', '0', '10', '0', '0' ],
    [ '0', '0', '0', '10', '0' ],
    [ '10', '0', '0', '0', '0' ],
    [ '0', '10', '0', '0', '0' ],
    [ '0', '0', '0', '0', '10' ]
    ]

    Each position in the outer array corresponds to the available choices, as in the previous example: "Bitcoin:0, Ethereum:1, Monero:2, Zcash:3, Polkadot:4".

    Every position within the inner arrays indicates how many voters selected the corresponding choice for a specific ranking:

    • Choice 0 (Bitcoin) was selected as the 2nd option by all 10 voters
    • Choice 1 (Ethereum) was selected as the 3rd option by all 10 voters
    • Choice 2 (Monero) was selected as the 1st option by all 10 voters
    • Choice 3 (Zcash) was selected as the 2nd option by all 10 voters
    • Choice 4 (Polkadot) was selected as the 5th option by all 10 voters

    Remember, this interpretation assumes that all voters have used the same voting pattern.

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/sdk/integration-details/voting-types/single-choice.html b/sdk/integration-details/voting-types/single-choice.html index 6ea96332e..698a0b922 100644 --- a/sdk/integration-details/voting-types/single-choice.html +++ b/sdk/integration-details/voting-types/single-choice.html @@ -12,7 +12,7 @@ - + @@ -22,14 +22,14 @@ option or candidate. The option or candidate with the most votes wins the election.

    This voting system is considered one of the simplest, as a single-choice election involves selecting a single winner, and voters can mark only one option from the list of choices or candidates. However, despite its widespread use and simplicity, it has some drawbacks. Since it operates on a "winner-take-all" principle, it can lead to disproportionate -outcomes (the candidate/option with the most votes secures victory, even if their margin of victory is slim).

    info

    This voting system supports one or multiple questions.

    See:

    Setting up the election

    To establish this kind of election, you can utilize the default parameters:

    const election = Election.from({
    census,
    title: 'Do you like chocolate?',
    description: 'A simple survey to assess chocolate preferences',
    })

    After creating the election and before publishing, add the questions, ensuring each choice has a distinct value:

    election.addQuestion('Do you like chocolate without milk?', 'This is the description', [
    {
    title: 'Yes',
    value: 0,
    },
    {
    title: 'No',
    value: 1,
    },
    ]).addQuestion('Do you like chocolate with milk', 'This is the description', [
    {
    title: 'Yes',
    value: 0,
    },
    {
    title: 'No',
    value: 1,
    },
    {
    title: 'Not always',
    value: 2,
    },
    ])
    About choices values

    Take note that the question values are incremental and the initial value must be 0

    Multiple questions support

    This election type can accommodate multiple questions.

    Not all elections type supports multiple questions!

    This is the sole type of election that supports multiple questions. Other election types, such as ranked, quadratic, +outcomes (the candidate/option with the most votes secures victory, even if their margin of victory is slim).

    info

    This voting system supports one or multiple questions.

    See:

    Setting up the election

    To establish this kind of election, you can utilize the default parameters:

    const election = Election.from({
    census,
    title: 'Do you like chocolate?',
    description: 'A simple survey to assess chocolate preferences',
    })

    After creating the election and before publishing, add the questions, ensuring each choice has a distinct value:

    election.addQuestion('Do you like chocolate without milk?', 'This is the description', [
    {
    title: 'Yes',
    value: 0,
    },
    {
    title: 'No',
    value: 1,
    },
    ]).addQuestion('Do you like chocolate with milk', 'This is the description', [
    {
    title: 'Yes',
    value: 0,
    },
    {
    title: 'No',
    value: 1,
    },
    {
    title: 'Not always',
    value: 2,
    },
    ])
    About choices values

    Take note that the question values are incremental and the initial value must be 0

    Not all elections type supports multiple questions!

    This is the sole type of election that supports multiple questions. Other election types, such as ranked, quadratic, etc, only support one question per election.

    To restrict the maximum number of questions or values an election can contain, adjust the maxCount and maxValue parameters in voteOpts:

    const election_opts: IVoteType = {
    maxCount: 2, // Represents the max number of questions
    maxValue: 3, // Represents the max number of choices for a given question.
    }
    const election = Election.from({
    census,
    election_opts,
    //...
    })

    Casting a vote

    Votes can be submitted using the method below:

    client.submitVote(new Vote([0, 2]));

    Each position in the vote array corresponds to a question, and the value is the associated selected choice. In this -instance, we select the first choice for the first question and the third choice for the second.

    Single question vote

    For single question is same philosophy, you could configure the election as:

    // If you want to restrict the election creation
    // ...
    maxCount: 1, // Only one question
    maxValue: 3, // That accepts three choices
    // ...
    // And finally casting the vote
    client.submitVote(new Vote([0, 2])); // Voting the third option

    Results interpretation

    Consider a scenario where 10 voters cast identical votes, i.e., [0, 2].

    The election results would be represented as a two-dimensional array:

     [
    [ '10', '0', '0' ],
    [ '0', '0', '10' ]
    ]

    Each sub-array signifies the results for a question, and each position of the sub-array indicates the number of votes a +instance, we select the first choice for the first question and the third choice for the second.

    Single question vote

    For single question is same philosophy, you could configure the election as:

    // If you want to restrict the election creation
    // ...
    maxCount: 1, // Only one question
    maxValue: 3, // That accepts three choices
    // ...
    // And finally casting the vote
    client.submitVote(new Vote([2])); // Voting the third option

    Results interpretation

    Consider a scenario where 10 voters cast identical votes, i.e., [0, 2].

    The election results would be represented as a two-dimensional array:

     [
    [ '10', '0', '0' ],
    [ '0', '0', '10' ]
    ]

    Each sub-array signifies the results for a question, and each position of the sub-array indicates the number of votes a choice has accumulated.

    • For the first question ([ '10', '0', '0' ]): all 10 voters chose the first option.
    • For the second question ([ '0', '0', '10' ]): all 10 voters chose the third option.

    In the example above, the first question offers two options, and the second presents three. However, the results array for the first question contains three elements, as the maxValue for all questions is the same (in this case, 3, the maxValue of the question with the most options).

    Single question results interpretation

    Not so different, the results array will look like:

    [ [ '0', '0', '10' ] ]

    For the only one question, 10 voters select the third option

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/sdk/integration-details/voting-types/weighted.html b/sdk/integration-details/voting-types/weighted.html index 37fb7d9fe..2080f9025 100644 --- a/sdk/integration-details/voting-types/weighted.html +++ b/sdk/integration-details/voting-types/weighted.html @@ -12,7 +12,7 @@ - + @@ -31,8 +31,10 @@ weights of votes for each option. Here, each index in the array corresponds to an option from the voting question.

    The value at each index is the total of weighted votes that the corresponding option received. For the first option (no), the total weighted votes are 1 (from voter 1) + 3 (from voter 3) = 4, hence '4' at the first index of the array.

    For the second option (yes), the total weighted votes are 2 (from voter 2) + 4 (from voter 4) = 6, thus '6' at the second index.

    The array [ [ '4', '6' ] ] encapsulates this result, which can be interpreted as "4 weighted votes for 'no' and 6 -weighted votes for 'yes'".

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - +weighted votes for 'yes'".

    tip

    In a weighted election, the Vochain stores the envelope without calculating the weight of each voter. However, when +retrieving the results using the SDK, you will see the weights applied. The application of these weights is performed +by the vocdoni-node indexer, which calculates the weights for you.

    The weights of each vote are stored in the envelope, which is saved on the Vochain.

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    + \ No newline at end of file diff --git a/sdk/reference/changelog.html b/sdk/reference/changelog.html index 5a6cd495e..17b578866 100644 --- a/sdk/reference/changelog.html +++ b/sdk/reference/changelog.html @@ -12,7 +12,7 @@ - + @@ -21,7 +21,7 @@ and this project adheres to Semantic Versioning.

    [0.7.5] - 2024-02-15

    Added

    • Added support for getting token holder balance in Census3 using tokenHolderBalance.
    • Added support for getting token holders based on strategy using getStrategyHolders.

    Fixed

    • Fixed CensusOrigin when election is using CSP census and anonymous.
    • Fixed bad generation of dist bundles in previous version.

    0.7.4 - 2024-02-06

    Added

    • Added new CspProofType type when voting in a CSP based election to choose the encryption type.

    0.7.3 - 2024-01-23

    Added

    • Added new ApprovalElection election type for creating approval elections easily.

    Fixed

    • Fixed costExponent to 1.
    • Fixed error when election has no metadata.
    • Fixed error with questions results for elections with no new type metadata.

    0.7.2 - 2024-01-17

    Added

    • Added new MultiChoiceElection election type for creating multi-choice elections easily.
    • Added new BudgetElection election type for creating budget elections easily.

    Fixed

    • Results in published elections are now correctly returned for each type of election.

    0.7.1 - 2024-01-11

    Changed

    • Supported tokens from Census3 using getSupportedTokens() returns now a token summary.
    • Census3 getStrategyEstimation accepts anonymous flag and returns accuracy for anonymous censuses.

    Fixed

    • Removed nullifier from vote package.
    • Returning census from type CspCensus when election is for CSP.

    Added

    • Added ArchivedAccountData for dealing with archived accounts and new fetchAccount function in client.
    • Added ErrFaucetAlreadyFunded for faucet limit requests.
    • Added ErrElectionFinished for doing actions when election is finished.
    • Added submitVoteSteps for voting using async generator steps.

    0.7.0 - 2023-12-13

    Changed

    • Changed sha256 library from @ethersproject/sha2 to js-sha256 for web workers.
    • Using API endpoint for estimating blocks from dates when creating an election.
    • [BREAKING] Census3 getStrategySize function changed to getStrategyEstimation giving estimated time and size for the given strategy.

    0.6.1 - 2023-11-29

    Added

    • New anonymous function hasRegisteredSIK for checking if a user has registered a SIK.

    Fixed

    • Removed outliers from block times for avoiding block estimation issues.

    0.6.0 - 2023-11-28

    Added

    • New election service functions nextElectionId and getElectionSalt.

    Changed

    • [BREAKING] Refactored options for isInCensus, hasAlreadyVoted, isAbleToVote and votesLeftCount.
    • [BREAKING] New options for AnonymousVote which enable to add the user's signature.
    • [BREAKING] New internal anonymous flow when signature is given by the consumer.

    0.5.3 - 2023-11-28

    Added

    • New account methods supported for listing, counting and checking account transfers in AccountAPI.

    Fixed

    • Archived elections without census URI are now accepted.

    Changed

    • Faucet options don't require token_limit anymore.

    0.5.2 - 2023-11-16

    Fixed

    • Anonymous vote packages are no longer signed.

    0.5.1 - 2023-11-15

    Fixed

    • Missing exported election type ArchivedElection.
    • Faucet errors correctly shown with message.

    0.5.0 - 2023-11-14

    Changed

    • [BREAKING] New full integration for Census3 v2, using tokens, strategies and censuses.

    0.4.3 - 2023-11-09

    Added

    • Support for archived elections with new election type ArchivedElection and with new census with type ArchivedCensus.

    0.4.2 - 2023-11-06

    Changed

    • Removed faucet path from default URLs.
    • Updated @vocdoni/proto dependency to 1.15.4.

    Added

    • Import, export and delete census functionality in census service.
    • Added new election parameter temporarySecretIdentity for deleting temporary SIKs once election is finished.

    Fixed

    • Fixed ffjavascript dependency to 0.2.59.

    0.4.1 - 2023-10-24

    Changed

    • Modified dev, stg and prod default URLs for all services.
    • Upgraded to new faucet.

    0.4.0 - 2023-10-10

    Changed

    • [BREAKING] New signatures for chain transactions.

    0.3.2 - 2023-10-10

    Added

    • Added support for uploading big censuses in chunks.

    Fixed

    • Added assert as embedded in rollup configuration.

    0.3.1 - 2023-09-20

    Added

    • New createElectionSteps function in client for using async generators and control creation flow.
    • New sendTokens function in client for transferring tokens between accounts.

    Changed

    • New user-friendly text for SIK payload signing.

    Fixed

    • Added ethers as embedded in rollup configuration for circomlibjs dependencies.

    0.3.0 - 2023-09-13

    Fixed

    • Ensuring proof value handled as hex for anonymous circuits inputs.

    Changed

    • [BREAKING] Removed some (probably not used) client properties for future refactor.
    • Added services as mid-layer between pure SDK client and API wrappers.

    Added

    • Census3 supported chains information.

    0.2.0 - 2023-09-04

    Fixed

    • dotobject helper returns null when key is not found.

    Changed

    • collectFaucetTokens function accepts raw faucet package payload.

    Added

    • Census3 error typings.
    • [BREAKING] Census3 anonymous censuses.

    0.1.1 - 2023-08-14

    Fixed

    • Added missing dependency readable-stream.

    0.1.0 - 2023-08-11

    Added

    • [BREAKING] Anonymous integration

    Fixed

    • Added missing maxCensusSize and manuallyEnded in fetchElection.

    0.0.18 - 2023-08-01

    Added

    • Election get function to fetch metadata values using dotobject

    Fixed

    • Added missing dependencies

    0.0.17 - 2023-07-21

    Added

    • Anonymous support using zkSNARK.

    Changed

    • Election meta field has a more lax typing.

    0.0.16 - 2023-07-04

    Added

    • SDK version added to election metadata.
    • Added new function changeElectionCensus to change the election census dynamically.
    • Added new helper function formatUnits for formatting big decimals values.

    Changed

    • New types defined in VocdoniCensus3Client with some additional documentation.
    • Added new field symbol to summary token list in Census3.
    • Added new field size to token information in Census3 as number of token holders.

    Fixed

    • Error codes coming from the API.

    0.0.15 - 2023-06-20

    Added

    • New InvalidElection type for invalid elections.
    • New estimateElectionCost function in client for estimating election cost.
    • New calculateElectionCost function in client for calculating the exact election cost.
    • New API wrappers for general chain information.

    Changed

    • fetchElections returns new InvalidElection type instead of throwing.

    Fixed

    • CSP elections use the URI and public key from the election census defined at creation.

    0.0.14 - 2023-06-12

    Added

    • maxValue, maxCount and maxTotalCost properties in IVoteType in an election for creating quadratic, approval and ranked elections.

    0.0.13 - 2023-06-06

    Added

    • Census3 integration
    • Added meta parameters to election metadata
    • Minor helper functions

    Changed

    • Added some new information to API endpoints

    Fixed

    • Unlocked rollup version

    0.0.12 - 2023-05-09

    Fixed

    • Fixed personal_sign provider call bug for certain environments

    0.0.11 - 2023-04-25

    Fixed

    • Fix type error in fetchAccountInfo

    0.0.10 - 2023-04-25

    Fixed

    • Fixed internal SetAccountTx nonce when creating transactions

    0.0.9 - 2023-04-25

    Added

    • generateRandomWallet function for assigning a random Wallet to the client

    Changed

    • isInCensus doesn't accept census type because censuses with public keys are removed
    • Refactored account methods to return new AccountData definition with Account field

    Removed

    • Ability to create censuses using public keys

    0.0.8 - 2023-04-05

    Added

    • Custom error handling (WIP)

    Changed

    • votesLeftCount checks if user is in census.
    • hasAlreadyVoted() returns the vote id or null if the account hasn't voted.

    Fixed

    • Increased time for transaction confirmation due to block time increase.

    0.0.7 - 2023-03-29

    Changed

    • Updated vocdoni/proto library to version 1.14.1.
    • Added maxCensusSize to the election creation.

    0.0.6 - 2023-03-22

    Changed

    • ElectionStatus includes new values ONGOING and UPCOMING. READY is removed an only used internally.
    • Election description changed from mandatory to optional.
    • fetchElections accepts no account and returns all elections in the chain.
    • fetchAccountInfo accepts arbitrary account to retrieve information.

    0.0.5 - 2023-03-08

    Added

    • fetchElections function to fetch all elections based on a given account
    • New organizationId property in PublishedElection

    Changed

    • PublishedCensus has size and weight fields for offchain census.

    0.0.4-alpha - 2023-03-01

    Added

    • Credential service provider integrated
    • Custom retry attempts and time for transactions waiting functionality
    • Added votesLeftCount function for checking how many times a user can submit a vote
    • New API requests added for chain information

    Changed

    • header and streamUri are no longer mandatory when creating an election.

    Fixed

    • No more 400 error status HTTP requests when asking for a non-confirmed transaction
    • maxValue property fixed in election data

    0.0.3-alpha - 2023-01-31

    Added

    • Functionality to check if a user is in census isInCensus
    • Functionality to check if a user has already voted hasAlreadyVoted
    • Functionality to check if a user is able to vote isAbleToVote
    • Export UMD version via @vocdoni/sdk/umd
    • Deterministic Wallet generation from arbitrary data

    Fixed

    • Return voteId when submitting vote instead of the transaction hash.
    • Buffer imports for bundle
    • Bundling & export issues

    Changed

    • Removed dvote-solidity dependency.

    0.0.2-alpha - 2022-12-20

    Added

    • Staging environment options for API and Faucet
    • Functionality to end, pause, cancel and continue an election

    Fixed

    • Fixed proof check using public key when signer is from type Wallet

    Changed

    • Use voting endpoint instead of generic submitTx.
    • Naming for client initialization options changed.
    • There are now the new UnpublishedElection and PublishedElection classes which extend from the abstract Election class.
    • fetchElection accepts an election id.

    0.0.1-alpha - 2022-12-01

    Added

    • First unstable version of the SDK for testing purposes

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/sdk/reference/classes/Account.html b/sdk/reference/classes/Account.html index 74b595322..959d9c6b4 100644 --- a/sdk/reference/classes/Account.html +++ b/sdk/reference/classes/Account.html @@ -12,13 +12,13 @@ - +

    Account

    @vocdoni/sdk / Exports / Account

    Class: Account

    Represents an account

    Table of contents

    Constructors

    Properties

    Accessors

    Methods

    Constructors

    constructor

    new Account(params?): Account

    Constructs an account

    Parameters

    NameTypeDescription
    params?IAccountAccount parameters

    Returns

    Account

    Defined in

    types/account.ts:33

    Properties

    _avatar

    Private _avatar: string

    Defined in

    types/account.ts:24


    _description

    Private _description: MultiLanguage\<string>

    Defined in

    types/account.ts:21


    _feed

    Private _feed: MultiLanguage\<string>

    Defined in

    types/account.ts:22


    _header

    Private _header: string

    Defined in

    types/account.ts:23


    _languages

    Private _languages: string[]

    Defined in

    types/account.ts:19


    Private _logo: string

    Defined in

    types/account.ts:25


    _meta

    Private _meta: { key: string ; value: any }[]

    Defined in

    types/account.ts:26


    _name

    Private _name: MultiLanguage\<string>

    Defined in

    types/account.ts:20

    Accessors

    avatar

    get avatar(): string

    Returns

    string

    Defined in

    types/account.ts:108

    set avatar(value): void

    Parameters

    NameType
    valuestring

    Returns

    void

    Defined in

    types/account.ts:112


    description

    get description(): MultiLanguage\<string>

    Returns

    MultiLanguage\<string>

    Defined in

    types/account.ts:92

    set description(value): void

    Parameters

    NameType
    valueMultiLanguage\<string>

    Returns

    void

    Defined in

    types/account.ts:96


    feed

    get feed(): MultiLanguage\<string>

    Returns

    MultiLanguage\<string>

    Defined in

    types/account.ts:124

    set feed(value): void

    Parameters

    NameType
    valueMultiLanguage\<string>

    Returns

    void

    Defined in

    types/account.ts:128


    get header(): string

    Returns

    string

    Defined in

    types/account.ts:100

    set header(value): void

    Parameters

    NameType
    valuestring

    Returns

    void

    Defined in

    types/account.ts:104


    languages

    get languages(): string[]

    Returns

    string[]

    Defined in

    types/account.ts:140

    set languages(value): void

    Parameters

    NameType
    valuestring[]

    Returns

    void

    Defined in

    types/account.ts:144


    get logo(): string

    Returns

    string

    Defined in

    types/account.ts:116

    set logo(value): void

    Parameters

    NameType
    valuestring

    Returns

    void

    Defined in

    types/account.ts:120


    meta

    get meta(): { key: string ; value: any }[]

    Returns

    { key: string ; value: any }[]

    Defined in

    types/account.ts:132

    set meta(value): void

    Parameters

    NameType
    value{ key: string ; value: any }[]

    Returns

    void

    Defined in

    types/account.ts:136


    name

    get name(): MultiLanguage\<string>

    Returns

    MultiLanguage\<string>

    Defined in

    types/account.ts:84

    set name(value): void

    Parameters

    NameType
    valueMultiLanguage\<string>

    Returns

    void

    Defined in

    types/account.ts:88

    Methods

    generateMetadata

    generateMetadata(): AccountMetadata

    Returns

    AccountMetadata

    Defined in

    types/account.ts:65


    build

    build(params): Account

    Returns an account object

    Parameters

    NameTypeDescription
    paramsIAccountAccount parameters

    Returns

    Account

    Defined in

    types/account.ts:61

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/sdk/reference/classes/AccountAPI.html b/sdk/reference/classes/AccountAPI.html index 8184f85fa..0ed98fdb2 100644 --- a/sdk/reference/classes/AccountAPI.html +++ b/sdk/reference/classes/AccountAPI.html @@ -12,13 +12,13 @@ - +

    AccountAPI

    @vocdoni/sdk / Exports / AccountAPI

    Class: AccountAPI

    Hierarchy

    • API

      AccountAPI

    Table of contents

    Constructors

    Methods

    Constructors

    constructor

    new AccountAPI(): AccountAPI

    Cannot be constructed.

    Returns

    AccountAPI

    Overrides

    API.constructor

    Defined in

    api/account.ts:109

    Methods

    count

    count(url): Promise\<IAccountsCountResponse>

    Returns the number of accounts

    Parameters

    NameTypeDescription
    urlstringAPI endpoint URL

    Returns

    Promise\<IAccountsCountResponse>

    Defined in

    api/account.ts:133


    electionsList

    electionsList(url, accountId, page?): Promise\<IElectionListResponse>

    Returns paginated list of elections for a specific account

    Parameters

    NameTypeDefault valueDescription
    urlstringundefinedAPI endpoint URL
    accountIdstringundefinedaccountId to get elections
    pagenumber0The page number

    Returns

    Promise\<IElectionListResponse>

    Defined in

    api/account.ts:220


    info

    info(url, accountId): Promise\<IAccountInfoResponse>

    Fetches an Account information

    Parameters

    NameTypeDescription
    urlstringAPI endpoint URL
    accountIdstringThe account we want the info from

    Returns

    Promise\<IAccountInfoResponse>

    Defined in

    api/account.ts:147


    isApiError

    isApiError(error): never

    Parameters

    NameType
    errorAxiosError\<unknown, any>

    Returns

    never

    Inherited from

    API.isApiError

    Defined in

    api/api.ts:21


    isUndefinedError

    isUndefinedError(error, message?): never

    Parameters

    NameType
    errorAxiosError\<unknown, any>
    message?string

    Returns

    never

    Inherited from

    API.isUndefinedError

    Defined in

    api/api.ts:64


    list

    list(url, page?): Promise\<IAccountsListResponse>

    Returns paginated list of accounts

    Parameters

    NameTypeDefault valueDescription
    urlstringundefinedAPI endpoint URL
    pagenumber0The page number

    Returns

    Promise\<IAccountsListResponse>

    Defined in

    api/account.ts:120


    metadata

    metadata(url, accountId): Promise\<AccountMetadata>

    Fetches the account metadata

    Parameters

    NameTypeDescription
    urlstringAPI endpoint URL
    accountIdstringThe account we want the info from

    Returns

    Promise\<AccountMetadata>

    Defined in

    api/account.ts:161


    setInfo

    setInfo(url, payload, metadata): Promise\<IAccountSetInfoResponse>

    Sets Account information

    Parameters

    NameTypeDescription
    urlstringAPI endpoint URL
    payloadstringThe set information info raw payload to be submitted to the chain
    metadatastringThe base64 encoded metadata JSON object

    Returns

    Promise\<IAccountSetInfoResponse>

    Defined in

    api/account.ts:176


    transfersCount

    transfersCount(url, accountId): Promise\<IAccountTransfersCountResponse>

    Returns the account's transfers count

    Parameters

    NameTypeDescription
    urlstringAPI endpoint URL
    accountIdstringaccountId to get the transfers count

    Returns

    Promise\<IAccountTransfersCountResponse>

    Defined in

    api/account.ts:205


    transfersList

    transfersList(url, accountId, page?): Promise\<IAccountTransfersResponse>

    Returns paginated list of transfers for a specific account

    Parameters

    NameTypeDefault valueDescription
    urlstringundefinedAPI endpoint URL
    accountIdstringundefinedaccountId to get transfers
    pagenumber0The page number

    Returns

    Promise\<IAccountTransfersResponse>

    Defined in

    api/account.ts:191

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/sdk/reference/classes/AccountService.html b/sdk/reference/classes/AccountService.html index 98bd3bc9c..a4b535bc6 100644 --- a/sdk/reference/classes/AccountService.html +++ b/sdk/reference/classes/AccountService.html @@ -12,13 +12,13 @@ - +

    AccountService

    @vocdoni/sdk / Exports / AccountService

    Class: AccountService

    Hierarchy

    Implements

    • AccountServiceProperties

    Table of contents

    Constructors

    Properties

    Methods

    Constructors

    constructor

    new AccountService(params): AccountService

    Instantiate the election service.

    Parameters

    NameTypeDescription
    paramsPartial\<AccountServiceParameters>The service parameters

    Returns

    AccountService

    Overrides

    Service.constructor

    Defined in

    services/account.ts:45

    Properties

    chainService

    chainService: ChainService

    Implementation of

    AccountServiceProperties.chainService

    Defined in

    services/account.ts:38


    url

    url: string

    Inherited from

    Service.url

    Defined in

    services/service.ts:6

    Methods

    fetchAccountInfo

    fetchAccountInfo(address): Promise\<AccountData | ArchivedAccountData>

    Fetches account information.

    Parameters

    NameTypeDescription
    addressstringThe account address to fetch the information

    Returns

    Promise\<AccountData | ArchivedAccountData>

    Defined in

    services/account.ts:56


    setInfo

    setInfo(tx, metadata): Promise\<string>

    Updates an account with information

    Parameters

    NameTypeDescription
    txstringThe transaction for setting the account
    metadatastringThe account metadata

    Returns

    Promise\<string>

    The transaction hash

    Defined in

    services/account.ts:96


    signTransaction

    signTransaction(tx, message, walletOrSigner): Promise\<string>

    Parameters

    NameType
    txUint8Array
    messagestring
    walletOrSignerWallet | Signer

    Returns

    Promise\<string>

    Defined in

    services/account.ts:101

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/sdk/reference/classes/AnonymousService.html b/sdk/reference/classes/AnonymousService.html index 0a31068d5..c32fdda8e 100644 --- a/sdk/reference/classes/AnonymousService.html +++ b/sdk/reference/classes/AnonymousService.html @@ -12,13 +12,13 @@ - +

    AnonymousService

    @vocdoni/sdk / Exports / AnonymousService

    Class: AnonymousService

    Hierarchy

    Implements

    • AnonymousServiceProperties

    Table of contents

    Constructors

    Properties

    Methods

    Constructors

    constructor

    new AnonymousService(params): AnonymousService

    Instantiate the anonymous service.

    Parameters

    NameTypeDescription
    paramsPartial\<AnonymousServiceParameters>The service parameters

    Returns

    AnonymousService

    Overrides

    Service.constructor

    Defined in

    services/anonymous.ts:71

    Properties

    chainCircuits

    chainCircuits: ChainCircuits

    Implementation of

    AnonymousServiceProperties.chainCircuits

    Defined in

    services/anonymous.ts:64


    url

    url: string

    Inherited from

    Service.url

    Defined in

    services/service.ts:6


    arbo_utils

    Static arbo_utils: Object

    Type declaration

    NameType
    toBigInt(str: string) => bigint
    toHash(input: string) => Promise\<string[]>
    toString(n: bigint) => string

    Defined in

    services/anonymous.ts:277


    ff_utils

    Static ff_utils: Object

    Type declaration

    NameType
    bigIntToFF(bi: bigint) => bigint
    hexToFFBigInt(hexStr: string) => bigint
    qbigint

    Defined in

    services/anonymous.ts:329


    hex_utils

    Static hex_utils: Object

    Type declaration

    NameType
    fromArrayBuffer(input: Uint8Array) => string
    fromBigInt(bi: bigint) => string
    toArrayBuffer(input: string) => Uint8Array

    Defined in

    services/anonymous.ts:304

    Methods

    checkCircuitsHashes

    checkCircuitsHashes(): ChainCircuits

    Checks circuit hashes

    Returns

    ChainCircuits

    The checked circuit parameters

    Defined in

    services/anonymous.ts:107


    fetchAccountSIK

    fetchAccountSIK(address): Promise\<string>

    Parameters

    NameType
    addressstring

    Returns

    Promise\<string>

    Defined in

    services/anonymous.ts:82


    fetchCircuits

    fetchCircuits(circuits?): Promise\<ChainCircuits>

    Fetches circuits for anonymous voting

    Parameters

    NameTypeDescription
    circuits?Omit\<ChainCircuits, "zKeyData" | "vKeyData" | "wasmData">Additional options for custom circuits

    Returns

    Promise\<ChainCircuits>

    Defined in

    services/anonymous.ts:131


    fetchZKProof

    fetchZKProof(address): Promise\<IZkProofResponse>

    Parameters

    NameType
    addressstring

    Returns

    Promise\<IZkProofResponse>

    Defined in

    services/anonymous.ts:93


    generateZkProof

    generateZkProof(inputs): Promise\<ZkProof>

    Parameters

    NameType
    inputsCircuitInputs

    Returns

    Promise\<ZkProof>

    Defined in

    services/anonymous.ts:76


    hasRegisteredSIK

    hasRegisteredSIK(address, signature, password?): Promise\<boolean>

    Parameters

    NameType
    addressstring
    signaturestring
    password?string

    Returns

    Promise\<boolean>

    Defined in

    services/anonymous.ts:87


    setCircuits

    setCircuits(circuits): ChainCircuits

    Sets circuits for anonymous voting

    Parameters

    NameTypeDescription
    circuitsChainCircuitsCustom circuits

    Returns

    ChainCircuits

    Defined in

    services/anonymous.ts:187


    signSIKPayload

    signSIKPayload(wallet): Promise\<string>

    Parameters

    NameType
    walletWallet | Signer

    Returns

    Promise\<string>

    Defined in

    services/anonymous.ts:98


    calcCircuitInputs

    calcCircuitInputs(signature, password, electionId): Promise\<{ arboElectionId: string[] ; ffpassword: string ; ffsignature: string ; nullifier: any }>

    Parameters

    NameType
    signaturestring
    passwordstring
    electionIdstring

    Returns

    Promise\<{ arboElectionId: string[] ; ffpassword: string ; ffsignature: string ; nullifier: any }>

    Defined in

    services/anonymous.ts:234


    calcNullifier

    calcNullifier(signature, password, electionId): Promise\<bigint>

    Parameters

    NameType
    signaturestring
    passwordstring
    electionIdstring

    Returns

    Promise\<bigint>

    Defined in

    services/anonymous.ts:247


    calcSik

    calcSik(address, personal_sign, password?): Promise\<string>

    Parameters

    NameTypeDefault value
    addressstringundefined
    personal_signstringundefined
    passwordstring'0'

    Returns

    Promise\<string>

    Defined in

    services/anonymous.ts:257


    calcVoteId

    calcVoteId(signature, password, electionId): Promise\<string>

    Parameters

    NameType
    signaturestring
    passwordstring
    electionIdstring

    Returns

    Promise\<string>

    Defined in

    services/anonymous.ts:251


    generateGroth16Proof

    generateGroth16Proof(inputs, circuitPath, provingKey): Promise\<ZkProof>

    Parameters

    NameType
    inputsCircuitInputs
    circuitPathUint8Array
    provingKeyUint8Array

    Returns

    Promise\<ZkProof>

    Defined in

    services/anonymous.ts:192


    prepareCircuitInputs

    prepareCircuitInputs(electionId, address, password, signature, voteWeight, availableWeight, sikRoot, sikSiblings, censusRoot, censusSiblings, votePackage): Promise\<CircuitInputs>

    Parameters

    NameType
    electionIdstring
    addressstring
    passwordstring
    signaturestring
    voteWeightstring
    availableWeightstring
    sikRootstring
    sikSiblingsstring[]
    censusRootstring
    censusSiblingsstring[]
    votePackageBuffer

    Returns

    Promise\<CircuitInputs>

    Defined in

    services/anonymous.ts:200


    signatureToVocdoniSikSignature

    signatureToVocdoniSikSignature(personal_sign): string

    Parameters

    NameType
    personal_signstring

    Returns

    string

    Defined in

    services/anonymous.ts:270

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/sdk/reference/classes/AnonymousVote.html b/sdk/reference/classes/AnonymousVote.html index 432f242f2..b0ff22ee8 100644 --- a/sdk/reference/classes/AnonymousVote.html +++ b/sdk/reference/classes/AnonymousVote.html @@ -12,13 +12,13 @@ - +

    AnonymousVote

    @vocdoni/sdk / Exports / AnonymousVote

    Class: AnonymousVote

    Represents a vote

    Hierarchy

    • Vote

      AnonymousVote

    Table of contents

    Constructors

    Properties

    Accessors

    Constructors

    constructor

    new AnonymousVote(votes, signature?, password?): AnonymousVote

    Constructs a csp vote

    Parameters

    NameTypeDefault valueDescription
    votes(number | bigint)[]undefinedThe list of votes values
    signature?stringundefinedThe signature of the payload
    passwordstring'0'The password of the anonymous vote

    Returns

    AnonymousVote

    Overrides

    Vote.constructor

    Defined in

    types/vote/anonymous.ts:14

    Properties

    _password

    Private _password: string

    Defined in

    types/vote/anonymous.ts:4


    _signature

    Private _signature: string

    Defined in

    types/vote/anonymous.ts:5

    Accessors

    password

    get password(): string

    Returns

    string

    Defined in

    types/vote/anonymous.ts:20

    set password(value): void

    Parameters

    NameType
    valuestring

    Returns

    void

    Defined in

    types/vote/anonymous.ts:24


    signature

    get signature(): string

    Returns

    string

    Defined in

    types/vote/anonymous.ts:28

    set signature(value): void

    Parameters

    NameType
    valuestring

    Returns

    void

    Defined in

    types/vote/anonymous.ts:32


    votes

    get votes(): (number | bigint)[]

    Returns

    (number | bigint)[]

    Inherited from

    Vote.votes

    Defined in

    types/vote/vote.ts:16

    set votes(value): void

    Parameters

    NameType
    value(number | bigint)[]

    Returns

    void

    Inherited from

    Vote.votes

    Defined in

    types/vote/vote.ts:20

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/sdk/reference/classes/ApprovalElection.html b/sdk/reference/classes/ApprovalElection.html index c3acdeba6..e04f63073 100644 --- a/sdk/reference/classes/ApprovalElection.html +++ b/sdk/reference/classes/ApprovalElection.html @@ -12,13 +12,13 @@ - +

    ApprovalElection

    @vocdoni/sdk / Exports / ApprovalElection

    Class: ApprovalElection

    Represents an approval election

    Hierarchy

    Table of contents

    Constructors

    Properties

    Accessors

    Methods

    Constructors

    constructor

    new ApprovalElection(params): ApprovalElection

    Constructs an approval election

    Parameters

    NameTypeDescription
    paramsIApprovalElectionParametersApproval election parameters

    Returns

    ApprovalElection

    Overrides

    UnpublishedElection.constructor

    Defined in

    types/election/approval.ts:18

    Properties

    _addSDKVersion

    Protected _addSDKVersion: boolean

    Inherited from

    UnpublishedElection._addSDKVersion

    Defined in

    types/election/election.ts:175


    _census

    Protected _census: Census

    Inherited from

    UnpublishedElection._census

    Defined in

    types/election/election.ts:172


    _description

    Protected _description: MultiLanguage\<string>

    Inherited from

    UnpublishedElection._description

    Defined in

    types/election/election.ts:163


    _electionType

    Protected _electionType: IElectionType

    Inherited from

    UnpublishedElection._electionType

    Defined in

    types/election/election.ts:169


    _endDate

    Protected _endDate: Date

    Inherited from

    UnpublishedElection._endDate

    Defined in

    types/election/election.ts:168


    _header

    Protected _header: string

    Inherited from

    UnpublishedElection._header

    Defined in

    types/election/election.ts:164


    _maxCensusSize

    Protected _maxCensusSize: number

    Inherited from

    UnpublishedElection._maxCensusSize

    Defined in

    types/election/election.ts:173


    _meta

    Protected _meta: any

    Inherited from

    UnpublishedElection._meta

    Defined in

    types/election/election.ts:166


    _questions

    Protected _questions: IQuestion[]

    Inherited from

    UnpublishedElection._questions

    Defined in

    types/election/election.ts:171


    _startDate

    Protected _startDate: Date

    Inherited from

    UnpublishedElection._startDate

    Defined in

    types/election/election.ts:167


    _streamUri

    Protected _streamUri: string

    Inherited from

    UnpublishedElection._streamUri

    Defined in

    types/election/election.ts:165


    _temporarySecretIdentity

    Protected _temporarySecretIdentity: boolean

    Inherited from

    UnpublishedElection._temporarySecretIdentity

    Defined in

    types/election/election.ts:174


    _title

    Protected _title: MultiLanguage\<string>

    Inherited from

    UnpublishedElection._title

    Defined in

    types/election/election.ts:162


    _voteType

    Protected _voteType: IVoteType

    Inherited from

    UnpublishedElection._voteType

    Defined in

    types/election/election.ts:170

    Accessors

    addSDKVersion

    get addSDKVersion(): boolean

    Returns

    boolean

    Inherited from

    UnpublishedElection.addSDKVersion

    Defined in

    types/election/unpublished.ts:275

    set addSDKVersion(value): void

    Parameters

    NameType
    valueboolean

    Returns

    void

    Inherited from

    UnpublishedElection.addSDKVersion

    Defined in

    types/election/unpublished.ts:279


    census

    get census(): Census

    Returns

    Census

    Inherited from

    UnpublishedElection.census

    Defined in

    types/election/unpublished.ts:249

    set census(value): void

    Parameters

    NameType
    valueCensus

    Returns

    void

    Inherited from

    UnpublishedElection.census

    Defined in

    types/election/unpublished.ts:253


    description

    get description(): MultiLanguage\<string>

    Returns

    MultiLanguage\<string>

    Inherited from

    UnpublishedElection.description

    Defined in

    types/election/unpublished.ts:173

    set description(value): void

    Parameters

    NameType
    valueMultiLanguage\<string>

    Returns

    void

    Inherited from

    UnpublishedElection.description

    Defined in

    types/election/unpublished.ts:177


    duration

    get duration(): number

    Returns

    number

    Inherited from

    UnpublishedElection.duration

    Defined in

    types/election/unpublished.ts:138


    electionType

    get electionType(): IElectionType

    Returns

    IElectionType

    Inherited from

    UnpublishedElection.electionType

    Defined in

    types/election/unpublished.ts:225

    set electionType(value): void

    Parameters

    NameType
    valueIElectionType

    Returns

    void

    Inherited from

    UnpublishedElection.electionType

    Defined in

    types/election/unpublished.ts:229


    endDate

    get endDate(): Date

    Returns

    Date

    Inherited from

    UnpublishedElection.endDate

    Defined in

    types/election/unpublished.ts:215

    set endDate(value): void

    Parameters

    NameType
    valueDate

    Returns

    void

    Inherited from

    UnpublishedElection.endDate

    Defined in

    types/election/unpublished.ts:219


    get header(): string

    Returns

    string

    Inherited from

    UnpublishedElection.header

    Defined in

    types/election/unpublished.ts:181

    set header(value): void

    Parameters

    NameType
    valuestring

    Returns

    void

    Inherited from

    UnpublishedElection.header

    Defined in

    types/election/unpublished.ts:185


    maxCensusSize

    get maxCensusSize(): number

    Returns

    number

    Inherited from

    UnpublishedElection.maxCensusSize

    Defined in

    types/election/unpublished.ts:258

    set maxCensusSize(value): void

    Parameters

    NameType
    valuenumber

    Returns

    void

    Inherited from

    UnpublishedElection.maxCensusSize

    Defined in

    types/election/unpublished.ts:262


    meta

    get meta(): any

    Returns

    any

    Inherited from

    UnpublishedElection.meta

    Defined in

    types/election/unpublished.ts:197

    set meta(value): void

    Parameters

    NameType
    valueany

    Returns

    void

    Inherited from

    UnpublishedElection.meta

    Defined in

    types/election/unpublished.ts:201


    questions

    get questions(): IQuestion[]

    Returns

    IQuestion[]

    Inherited from

    UnpublishedElection.questions

    Defined in

    types/election/unpublished.ts:241

    set questions(value): void

    Parameters

    NameType
    valueIQuestion[]

    Returns

    void

    Inherited from

    UnpublishedElection.questions

    Defined in

    types/election/unpublished.ts:245


    startDate

    get startDate(): Date

    Returns

    Date

    Inherited from

    UnpublishedElection.startDate

    Defined in

    types/election/unpublished.ts:206

    set startDate(value): void

    Parameters

    NameType
    valueDate

    Returns

    void

    Inherited from

    UnpublishedElection.startDate

    Defined in

    types/election/unpublished.ts:210


    streamUri

    get streamUri(): string

    Returns

    string

    Inherited from

    UnpublishedElection.streamUri

    Defined in

    types/election/unpublished.ts:189

    set streamUri(value): void

    Parameters

    NameType
    valuestring

    Returns

    void

    Inherited from

    UnpublishedElection.streamUri

    Defined in

    types/election/unpublished.ts:193


    temporarySecretIdentity

    get temporarySecretIdentity(): boolean

    Returns

    boolean

    Inherited from

    UnpublishedElection.temporarySecretIdentity

    Defined in

    types/election/unpublished.ts:267

    set temporarySecretIdentity(value): void

    Parameters

    NameType
    valueboolean

    Returns

    void

    Inherited from

    UnpublishedElection.temporarySecretIdentity

    Defined in

    types/election/unpublished.ts:271


    title

    get title(): MultiLanguage\<string>

    Returns

    MultiLanguage\<string>

    Inherited from

    UnpublishedElection.title

    Defined in

    types/election/unpublished.ts:164

    set title(value): void

    Parameters

    NameType
    valueMultiLanguage\<string>

    Returns

    void

    Inherited from

    UnpublishedElection.title

    Defined in

    types/election/unpublished.ts:168


    voteType

    get voteType(): IVoteType

    Returns

    IVoteType

    Inherited from

    UnpublishedElection.voteType

    Defined in

    types/election/unpublished.ts:233

    set voteType(value): void

    Parameters

    NameType
    valueIVoteType

    Returns

    void

    Inherited from

    UnpublishedElection.voteType

    Defined in

    types/election/unpublished.ts:237

    Methods

    addQuestion

    addQuestion(title, description, choices): UnpublishedElection

    Parameters

    NameType
    titlestring | MultiLanguage\<string>
    descriptionstring | MultiLanguage\<string>
    choices({ title: string } | { title: MultiLanguage\<string> })[]

    Returns

    UnpublishedElection

    Overrides

    UnpublishedElection.addQuestion

    Defined in

    types/election/approval.ts:26


    generateEnvelopeType

    generateEnvelopeType(): object

    Returns

    object

    Overrides

    UnpublishedElection.generateEnvelopeType

    Defined in

    types/election/approval.ts:55


    generateMetadata

    generateMetadata(): ElectionMetadata

    Returns

    ElectionMetadata

    Overrides

    UnpublishedElection.generateMetadata

    Defined in

    types/election/approval.ts:65


    generateMode

    generateMode(): object

    Returns

    object

    Inherited from

    UnpublishedElection.generateMode

    Defined in

    types/election/unpublished.ts:154


    generateVoteOptions

    generateVoteOptions(): object

    Returns

    object

    Overrides

    UnpublishedElection.generateVoteOptions

    Defined in

    types/election/approval.ts:45


    get

    get(dot): any

    Parameters

    NameType
    dotstring

    Returns

    any

    Inherited from

    UnpublishedElection.get

    Defined in

    types/election/election.ts:266


    removeQuestion

    removeQuestion(questionNumber): UnpublishedElection

    Parameters

    NameType
    questionNumbernumber

    Returns

    UnpublishedElection

    Inherited from

    UnpublishedElection.removeQuestion

    Defined in

    types/election/unpublished.ts:60


    checkVote

    checkVote(vote, voteType): void

    Parameters

    NameType
    voteVote
    voteTypeIVoteType

    Returns

    void

    Defined in

    types/election/approval.ts:79


    from

    from(params): ApprovalElection

    Returns an unpublished election object

    Parameters

    NameTypeDescription
    paramsIApprovalElectionParametersUnpublished Election parameters

    Returns

    ApprovalElection

    Overrides

    UnpublishedElection.from

    Defined in

    types/election/approval.ts:22

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/sdk/reference/classes/ArchivedElection.html b/sdk/reference/classes/ArchivedElection.html index 9851a95d7..f2c0c853a 100644 --- a/sdk/reference/classes/ArchivedElection.html +++ b/sdk/reference/classes/ArchivedElection.html @@ -12,13 +12,13 @@ - +

    ArchivedElection

    @vocdoni/sdk / Exports / ArchivedElection

    Class: ArchivedElection

    Represents a published election

    Hierarchy

    Table of contents

    Constructors

    Properties

    Accessors

    Methods

    Constructors

    constructor

    new ArchivedElection(params): ArchivedElection

    Constructs an archived election

    Parameters

    NameTypeDescription
    paramsIPublishedElectionParametersElection parameters

    Returns

    ArchivedElection

    Overrides

    PublishedElection.constructor

    Defined in

    types/election/archived.ts:13

    Properties

    _addSDKVersion

    Protected _addSDKVersion: boolean

    Inherited from

    PublishedElection._addSDKVersion

    Defined in

    types/election/election.ts:175


    _census

    Protected _census: Census

    Inherited from

    PublishedElection._census

    Defined in

    types/election/election.ts:172


    _description

    Protected _description: MultiLanguage\<string>

    Inherited from

    PublishedElection._description

    Defined in

    types/election/election.ts:163


    _electionType

    Protected _electionType: IElectionType

    Inherited from

    PublishedElection._electionType

    Defined in

    types/election/election.ts:169


    _endDate

    Protected _endDate: Date

    Inherited from

    PublishedElection._endDate

    Defined in

    types/election/election.ts:168


    _header

    Protected _header: string

    Inherited from

    PublishedElection._header

    Defined in

    types/election/election.ts:164


    _maxCensusSize

    Protected _maxCensusSize: number

    Inherited from

    PublishedElection._maxCensusSize

    Defined in

    types/election/election.ts:173


    _meta

    Protected _meta: any

    Inherited from

    PublishedElection._meta

    Defined in

    types/election/election.ts:166


    _questions

    Protected _questions: IQuestion[]

    Inherited from

    PublishedElection._questions

    Defined in

    types/election/election.ts:171


    _startDate

    Protected _startDate: Date

    Inherited from

    PublishedElection._startDate

    Defined in

    types/election/election.ts:167


    _streamUri

    Protected _streamUri: string

    Inherited from

    PublishedElection._streamUri

    Defined in

    types/election/election.ts:165


    _temporarySecretIdentity

    Protected _temporarySecretIdentity: boolean

    Inherited from

    PublishedElection._temporarySecretIdentity

    Defined in

    types/election/election.ts:174


    _title

    Protected _title: MultiLanguage\<string>

    Inherited from

    PublishedElection._title

    Defined in

    types/election/election.ts:162


    _voteType

    Protected _voteType: IVoteType

    Inherited from

    PublishedElection._voteType

    Defined in

    types/election/election.ts:170

    Accessors

    addSDKVersion

    get addSDKVersion(): boolean

    Returns

    boolean

    Inherited from

    PublishedElection.addSDKVersion

    Defined in

    types/election/election.ts:262


    census

    get census(): ArchivedCensus

    Returns

    ArchivedCensus

    Overrides

    PublishedElection.census

    Defined in

    types/election/archived.ts:17


    chainId

    get chainId(): string

    Returns

    string

    Inherited from

    PublishedElection.chainId

    Defined in

    types/election/published.ts:219


    creationTime

    get creationTime(): Date

    Returns

    Date

    Inherited from

    PublishedElection.creationTime

    Defined in

    types/election/published.ts:223


    description

    get description(): MultiLanguage\<string>

    Returns

    MultiLanguage\<string>

    Inherited from

    PublishedElection.description

    Defined in

    types/election/published.ts:147


    electionType

    get electionType(): IElectionType

    Returns

    IElectionType

    Inherited from

    PublishedElection.electionType

    Defined in

    types/election/published.ts:167


    endDate

    get endDate(): Date

    Returns

    Date

    Inherited from

    PublishedElection.endDate

    Defined in

    types/election/published.ts:163


    finalResults

    get finalResults(): boolean

    Returns

    boolean

    Inherited from

    PublishedElection.finalResults

    Defined in

    types/election/published.ts:203


    fromArchive

    get fromArchive(): boolean

    Returns

    boolean

    Inherited from

    PublishedElection.fromArchive

    Defined in

    types/election/published.ts:215


    get header(): string

    Returns

    string

    Inherited from

    PublishedElection.header

    Defined in

    types/election/published.ts:151


    id

    get id(): string

    Returns

    string

    Inherited from

    PublishedElection.id

    Defined in

    types/election/published.ts:187


    isValid

    get isValid(): boolean

    Returns

    boolean

    Inherited from

    PublishedElection.isValid

    Defined in

    types/election/published.ts:239


    manuallyEnded

    get manuallyEnded(): boolean

    Returns

    boolean

    Inherited from

    PublishedElection.manuallyEnded

    Defined in

    types/election/published.ts:211


    maxCensusSize

    get maxCensusSize(): number

    Returns

    number

    Inherited from

    PublishedElection.maxCensusSize

    Defined in

    types/election/published.ts:183


    meta

    get meta(): any

    Returns

    any

    Inherited from

    PublishedElection.meta

    Defined in

    types/election/election.ts:226


    metadataURL

    get metadataURL(): string

    Returns

    string

    Inherited from

    PublishedElection.metadataURL

    Defined in

    types/election/published.ts:227


    organizationId

    get organizationId(): string

    Returns

    string

    Inherited from

    PublishedElection.organizationId

    Defined in

    types/election/published.ts:191


    questions

    get questions(): IQuestion[]

    Returns

    IQuestion[]

    Inherited from

    PublishedElection.questions

    Defined in

    types/election/published.ts:175


    raw

    get raw(): object

    Returns

    object

    Inherited from

    PublishedElection.raw

    Defined in

    types/election/published.ts:235


    results

    get results(): string[][]

    Returns

    string[][]

    Inherited from

    PublishedElection.results

    Defined in

    types/election/published.ts:207


    resultsType

    get resultsType(): ElectionResultsType

    Returns

    ElectionResultsType

    Inherited from

    PublishedElection.resultsType

    Defined in

    types/election/published.ts:231


    startDate

    get startDate(): Date

    Returns

    Date

    Inherited from

    PublishedElection.startDate

    Defined in

    types/election/published.ts:159


    status

    get status(): ElectionStatus

    Returns

    ElectionStatus

    Inherited from

    PublishedElection.status

    Defined in

    types/election/published.ts:195


    streamUri

    get streamUri(): string

    Returns

    string

    Inherited from

    PublishedElection.streamUri

    Defined in

    types/election/published.ts:155


    temporarySecretIdentity

    get temporarySecretIdentity(): boolean

    Returns

    boolean

    Inherited from

    PublishedElection.temporarySecretIdentity

    Defined in

    types/election/election.ts:258


    title

    get title(): MultiLanguage\<string>

    Returns

    MultiLanguage\<string>

    Inherited from

    PublishedElection.title

    Defined in

    types/election/published.ts:143


    voteCount

    get voteCount(): number

    Returns

    number

    Inherited from

    PublishedElection.voteCount

    Defined in

    types/election/published.ts:199


    voteType

    get voteType(): IVoteType

    Returns

    IVoteType

    Inherited from

    PublishedElection.voteType

    Defined in

    types/election/published.ts:171

    Methods

    checkVote

    checkVote(vote): void

    Parameters

    NameType
    voteVote

    Returns

    void

    Inherited from

    PublishedElection.checkVote

    Defined in

    types/election/published.ts:113


    get

    get(dot): any

    Parameters

    NameType
    dotstring

    Returns

    any

    Inherited from

    PublishedElection.get

    Defined in

    types/election/election.ts:266


    build

    build(params): PublishedElection

    Returns a published election object

    Parameters

    NameTypeDescription
    paramsIPublishedElectionParametersPublished election parameters

    Returns

    PublishedElection

    Inherited from

    PublishedElection.build

    Defined in

    types/election/published.ts:100


    checkVote

    checkVote(vote, voteType): void

    Parameters

    NameType
    voteVote
    voteTypeIVoteType

    Returns

    void

    Inherited from

    PublishedElection.checkVote

    Defined in

    types/election/published.ts:127


    from

    from(params): UnpublishedElection

    Returns an unpublished election object

    Parameters

    NameTypeDescription
    paramsIElectionParametersUnpublished Election parameters

    Returns

    UnpublishedElection

    Inherited from

    PublishedElection.from

    Defined in

    types/election/election.ts:206


    getStatus

    getStatus(status, startDate): ElectionStatus

    Parameters

    NameType
    statusAllElectionStatus
    startDateDate

    Returns

    ElectionStatus

    Inherited from

    PublishedElection.getStatus

    Defined in

    types/election/published.ts:104

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/sdk/reference/classes/BudgetElection.html b/sdk/reference/classes/BudgetElection.html index 03f4708a5..a8e944fab 100644 --- a/sdk/reference/classes/BudgetElection.html +++ b/sdk/reference/classes/BudgetElection.html @@ -12,13 +12,13 @@ - +

    BudgetElection

    @vocdoni/sdk / Exports / BudgetElection

    Class: BudgetElection

    Represents a budget election

    Hierarchy

    Table of contents

    Constructors

    Properties

    Accessors

    Methods

    Constructors

    constructor

    new BudgetElection(params): BudgetElection

    Constructs a budget election

    Parameters

    NameTypeDescription
    paramsIBudgetElectionParametersBudget election parameters

    Returns

    BudgetElection

    Overrides

    UnpublishedElection.constructor

    Defined in

    types/election/budget.ts:35

    Properties

    _addSDKVersion

    Protected _addSDKVersion: boolean

    Inherited from

    UnpublishedElection._addSDKVersion

    Defined in

    types/election/election.ts:175


    _census

    Protected _census: Census

    Inherited from

    UnpublishedElection._census

    Defined in

    types/election/election.ts:172


    _description

    Protected _description: MultiLanguage\<string>

    Inherited from

    UnpublishedElection._description

    Defined in

    types/election/election.ts:163


    _electionType

    Protected _electionType: IElectionType

    Inherited from

    UnpublishedElection._electionType

    Defined in

    types/election/election.ts:169


    _endDate

    Protected _endDate: Date

    Inherited from

    UnpublishedElection._endDate

    Defined in

    types/election/election.ts:168


    _forceFullBudget

    Private _forceFullBudget: boolean

    Defined in

    types/election/budget.ts:28


    _header

    Protected _header: string

    Inherited from

    UnpublishedElection._header

    Defined in

    types/election/election.ts:164


    _maxCensusSize

    Protected _maxCensusSize: number

    Inherited from

    UnpublishedElection._maxCensusSize

    Defined in

    types/election/election.ts:173


    _meta

    Protected _meta: any

    Inherited from

    UnpublishedElection._meta

    Defined in

    types/election/election.ts:166


    _minStep

    Private _minStep: number

    Defined in

    types/election/budget.ts:27


    _questions

    Protected _questions: IQuestion[]

    Inherited from

    UnpublishedElection._questions

    Defined in

    types/election/election.ts:171


    _startDate

    Protected _startDate: Date

    Inherited from

    UnpublishedElection._startDate

    Defined in

    types/election/election.ts:167


    _streamUri

    Protected _streamUri: string

    Inherited from

    UnpublishedElection._streamUri

    Defined in

    types/election/election.ts:165


    _temporarySecretIdentity

    Protected _temporarySecretIdentity: boolean

    Inherited from

    UnpublishedElection._temporarySecretIdentity

    Defined in

    types/election/election.ts:174


    _title

    Protected _title: MultiLanguage\<string>

    Inherited from

    UnpublishedElection._title

    Defined in

    types/election/election.ts:162


    _voteType

    Protected _voteType: IVoteType

    Inherited from

    UnpublishedElection._voteType

    Defined in

    types/election/election.ts:170

    Accessors

    addSDKVersion

    get addSDKVersion(): boolean

    Returns

    boolean

    Inherited from

    UnpublishedElection.addSDKVersion

    Defined in

    types/election/unpublished.ts:275

    set addSDKVersion(value): void

    Parameters

    NameType
    valueboolean

    Returns

    void

    Inherited from

    UnpublishedElection.addSDKVersion

    Defined in

    types/election/unpublished.ts:279


    census

    get census(): Census

    Returns

    Census

    Inherited from

    UnpublishedElection.census

    Defined in

    types/election/unpublished.ts:249

    set census(value): void

    Parameters

    NameType
    valueCensus

    Returns

    void

    Inherited from

    UnpublishedElection.census

    Defined in

    types/election/unpublished.ts:253


    description

    get description(): MultiLanguage\<string>

    Returns

    MultiLanguage\<string>

    Inherited from

    UnpublishedElection.description

    Defined in

    types/election/unpublished.ts:173

    set description(value): void

    Parameters

    NameType
    valueMultiLanguage\<string>

    Returns

    void

    Inherited from

    UnpublishedElection.description

    Defined in

    types/election/unpublished.ts:177


    duration

    get duration(): number

    Returns

    number

    Inherited from

    UnpublishedElection.duration

    Defined in

    types/election/unpublished.ts:138


    electionType

    get electionType(): IElectionType

    Returns

    IElectionType

    Inherited from

    UnpublishedElection.electionType

    Defined in

    types/election/unpublished.ts:225

    set electionType(value): void

    Parameters

    NameType
    valueIElectionType

    Returns

    void

    Inherited from

    UnpublishedElection.electionType

    Defined in

    types/election/unpublished.ts:229


    endDate

    get endDate(): Date

    Returns

    Date

    Inherited from

    UnpublishedElection.endDate

    Defined in

    types/election/unpublished.ts:215

    set endDate(value): void

    Parameters

    NameType
    valueDate

    Returns

    void

    Inherited from

    UnpublishedElection.endDate

    Defined in

    types/election/unpublished.ts:219


    forceFullBudget

    get forceFullBudget(): boolean

    Returns

    boolean

    Defined in

    types/election/budget.ts:132

    set forceFullBudget(value): void

    Parameters

    NameType
    valueboolean

    Returns

    void

    Defined in

    types/election/budget.ts:136


    get header(): string

    Returns

    string

    Inherited from

    UnpublishedElection.header

    Defined in

    types/election/unpublished.ts:181

    set header(value): void

    Parameters

    NameType
    valuestring

    Returns

    void

    Inherited from

    UnpublishedElection.header

    Defined in

    types/election/unpublished.ts:185


    maxBudget

    get maxBudget(): number

    Returns

    number

    Defined in

    types/election/budget.ts:148

    set maxBudget(value): void

    Parameters

    NameType
    valuenumber

    Returns

    void

    Defined in

    types/election/budget.ts:152


    maxCensusSize

    get maxCensusSize(): number

    Returns

    number

    Inherited from

    UnpublishedElection.maxCensusSize

    Defined in

    types/election/unpublished.ts:258

    set maxCensusSize(value): void

    Parameters

    NameType
    valuenumber

    Returns

    void

    Inherited from

    UnpublishedElection.maxCensusSize

    Defined in

    types/election/unpublished.ts:262


    meta

    get meta(): any

    Returns

    any

    Inherited from

    UnpublishedElection.meta

    Defined in

    types/election/unpublished.ts:197

    set meta(value): void

    Parameters

    NameType
    valueany

    Returns

    void

    Inherited from

    UnpublishedElection.meta

    Defined in

    types/election/unpublished.ts:201


    minStep

    get minStep(): number

    Returns

    number

    Defined in

    types/election/budget.ts:124

    set minStep(value): void

    Parameters

    NameType
    valuenumber

    Returns

    void

    Defined in

    types/election/budget.ts:128


    questions

    get questions(): IQuestion[]

    Returns

    IQuestion[]

    Inherited from

    UnpublishedElection.questions

    Defined in

    types/election/unpublished.ts:241

    set questions(value): void

    Parameters

    NameType
    valueIQuestion[]

    Returns

    void

    Inherited from

    UnpublishedElection.questions

    Defined in

    types/election/unpublished.ts:245


    startDate

    get startDate(): Date

    Returns

    Date

    Inherited from

    UnpublishedElection.startDate

    Defined in

    types/election/unpublished.ts:206

    set startDate(value): void

    Parameters

    NameType
    valueDate

    Returns

    void

    Inherited from

    UnpublishedElection.startDate

    Defined in

    types/election/unpublished.ts:210


    streamUri

    get streamUri(): string

    Returns

    string

    Inherited from

    UnpublishedElection.streamUri

    Defined in

    types/election/unpublished.ts:189

    set streamUri(value): void

    Parameters

    NameType
    valuestring

    Returns

    void

    Inherited from

    UnpublishedElection.streamUri

    Defined in

    types/election/unpublished.ts:193


    temporarySecretIdentity

    get temporarySecretIdentity(): boolean

    Returns

    boolean

    Inherited from

    UnpublishedElection.temporarySecretIdentity

    Defined in

    types/election/unpublished.ts:267

    set temporarySecretIdentity(value): void

    Parameters

    NameType
    valueboolean

    Returns

    void

    Inherited from

    UnpublishedElection.temporarySecretIdentity

    Defined in

    types/election/unpublished.ts:271


    title

    get title(): MultiLanguage\<string>

    Returns

    MultiLanguage\<string>

    Inherited from

    UnpublishedElection.title

    Defined in

    types/election/unpublished.ts:164

    set title(value): void

    Parameters

    NameType
    valueMultiLanguage\<string>

    Returns

    void

    Inherited from

    UnpublishedElection.title

    Defined in

    types/election/unpublished.ts:168


    useCensusWeightAsBudget

    get useCensusWeightAsBudget(): boolean

    Returns

    boolean

    Defined in

    types/election/budget.ts:140

    set useCensusWeightAsBudget(value): void

    Parameters

    NameType
    valueboolean

    Returns

    void

    Defined in

    types/election/budget.ts:144


    voteType

    get voteType(): IVoteType

    Returns

    IVoteType

    Inherited from

    UnpublishedElection.voteType

    Defined in

    types/election/unpublished.ts:233

    set voteType(value): void

    Parameters

    NameType
    valueIVoteType

    Returns

    void

    Inherited from

    UnpublishedElection.voteType

    Defined in

    types/election/unpublished.ts:237

    Methods

    addQuestion

    addQuestion(title, description, choices): UnpublishedElection

    Parameters

    NameType
    titlestring | MultiLanguage\<string>
    descriptionstring | MultiLanguage\<string>
    choices({ title: string } | { title: MultiLanguage\<string> })[]

    Returns

    UnpublishedElection

    Overrides

    UnpublishedElection.addQuestion

    Defined in

    types/election/budget.ts:49


    generateEnvelopeType

    generateEnvelopeType(): object

    Returns

    object

    Overrides

    UnpublishedElection.generateEnvelopeType

    Defined in

    types/election/budget.ts:78


    generateMetadata

    generateMetadata(): ElectionMetadata

    Returns

    ElectionMetadata

    Overrides

    UnpublishedElection.generateMetadata

    Defined in

    types/election/budget.ts:88


    generateMode

    generateMode(): object

    Returns

    object

    Inherited from

    UnpublishedElection.generateMode

    Defined in

    types/election/unpublished.ts:154


    generateVoteOptions

    generateVoteOptions(): object

    Returns

    object

    Overrides

    UnpublishedElection.generateVoteOptions

    Defined in

    types/election/budget.ts:68


    get

    get(dot): any

    Parameters

    NameType
    dotstring

    Returns

    any

    Inherited from

    UnpublishedElection.get

    Defined in

    types/election/election.ts:266


    removeQuestion

    removeQuestion(questionNumber): UnpublishedElection

    Parameters

    NameType
    questionNumbernumber

    Returns

    UnpublishedElection

    Inherited from

    UnpublishedElection.removeQuestion

    Defined in

    types/election/unpublished.ts:60


    checkVote

    checkVote(vote, resultsType, voteType): void

    Parameters

    NameType
    voteVote
    resultsTypeElectionResultsType
    voteTypeIVoteType

    Returns

    void

    Defined in

    types/election/budget.ts:104


    from

    from(params): BudgetElection

    Returns an unpublished election object

    Parameters

    NameTypeDescription
    paramsIBudgetElectionParametersUnpublished Election parameters

    Returns

    BudgetElection

    Overrides

    UnpublishedElection.from

    Defined in

    types/election/budget.ts:45

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/sdk/reference/classes/Census.html b/sdk/reference/classes/Census.html index fbd23cca4..0d810749a 100644 --- a/sdk/reference/classes/Census.html +++ b/sdk/reference/classes/Census.html @@ -12,13 +12,13 @@ - +

    Census

    @vocdoni/sdk / Exports / Census

    Class: Census

    Represents a generic census

    Hierarchy

    Table of contents

    Constructors

    Properties

    Accessors

    Methods

    Constructors

    constructor

    new Census(censusId?, censusURI?, type?, size?, weight?): Census

    Constructs a generic census

    Parameters

    NameTypeDescription
    censusId?stringThe id of the census
    censusURI?stringThe URI of the census
    type?CensusTypeThe type of the census
    size?numberThe size of the census
    weight?bigintThe weight of the census

    Returns

    Census

    Defined in

    types/census/census.ts:27

    Properties

    _censusId

    Protected _censusId: string

    Defined in

    types/census/census.ts:12


    _censusURI

    Protected _censusURI: string

    Defined in

    types/census/census.ts:13


    _size

    Private _size: number

    Defined in

    types/census/census.ts:15


    _type

    Protected _type: CensusType

    Defined in

    types/census/census.ts:14


    _weight

    Private _weight: bigint

    Defined in

    types/census/census.ts:16

    Accessors

    censusId

    get censusId(): string

    Returns

    string

    Defined in

    types/census/census.ts:35

    set censusId(value): void

    Parameters

    NameType
    valuestring

    Returns

    void

    Defined in

    types/census/census.ts:39


    censusURI

    get censusURI(): string

    Returns

    string

    Defined in

    types/census/census.ts:43

    set censusURI(value): void

    Parameters

    NameType
    valuestring

    Returns

    void

    Defined in

    types/census/census.ts:47


    isPublished

    get isPublished(): boolean

    Returns

    boolean

    Defined in

    types/census/census.ts:75


    size

    get size(): number

    Returns

    number

    Defined in

    types/census/census.ts:59

    set size(value): void

    Parameters

    NameType
    valuenumber

    Returns

    void

    Defined in

    types/census/census.ts:63


    type

    get type(): CensusType

    Returns

    CensusType

    Defined in

    types/census/census.ts:51

    set type(value): void

    Parameters

    NameType
    valueCensusType

    Returns

    void

    Defined in

    types/census/census.ts:55


    weight

    get weight(): bigint

    Returns

    bigint

    Defined in

    types/census/census.ts:67

    set weight(value): void

    Parameters

    NameType
    valuebigint

    Returns

    void

    Defined in

    types/census/census.ts:71

    Methods

    censusTypeFromCensusOrigin

    censusTypeFromCensusOrigin(censusOrigin, anonymous?): CensusType

    Parameters

    NameTypeDefault value
    censusOriginstringundefined
    anonymousbooleanfalse

    Returns

    CensusType

    Defined in

    types/census/census.ts:81

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/sdk/reference/classes/Census3CensusAPI.html b/sdk/reference/classes/Census3CensusAPI.html index 86d271d25..065c47e74 100644 --- a/sdk/reference/classes/Census3CensusAPI.html +++ b/sdk/reference/classes/Census3CensusAPI.html @@ -12,13 +12,13 @@ - +

    Census3CensusAPI

    @vocdoni/sdk / Exports / Census3CensusAPI

    Class: Census3CensusAPI

    Hierarchy

    • Census3API

      Census3CensusAPI

    Table of contents

    Constructors

    Methods

    Constructors

    constructor

    new Census3CensusAPI(): Census3CensusAPI

    Cannot be constructed.

    Returns

    Census3CensusAPI

    Overrides

    Census3API.constructor

    Defined in

    api/census3/census.ts:96

    Methods

    census

    census(url, id): Promise\<ICensus3CensusResponse>

    Returns the information of the census

    Parameters

    NameTypeDescription
    urlstringAPI endpoint URL
    idnumberThe identifier of the census

    Returns

    Promise\<ICensus3CensusResponse>

    Defined in

    api/census3/census.ts:121


    create

    create(url, strategyId, anonymous?): Promise\<ICensus3QueueResponse>

    Requests the creation of a new census with the strategy provided.

    Parameters

    NameTypeDefault valueDescription
    urlstringundefinedAPI endpoint URL
    strategyIdnumberundefinedThe strategy identifier
    anonymousbooleanfalseIf the census has to be anonymous

    Returns

    Promise\<ICensus3QueueResponse>

    The queue identifier

    Defined in

    api/census3/census.ts:150


    isApiError

    isApiError(error): never

    Parameters

    NameType
    errorAxiosError\<unknown, any>

    Returns

    never

    Inherited from

    Census3API.isApiError

    Defined in

    api/census3/api.ts:101


    isUndefinedError

    isUndefinedError(error, message?): never

    Parameters

    NameType
    errorAxiosError\<unknown, any>
    message?string

    Returns

    never

    Inherited from

    Census3API.isUndefinedError

    Defined in

    api/api.ts:64


    list

    list(url, strategy): Promise\<ICensus3CensusListResponse>

    Fetches list of census based on given strategy

    Parameters

    NameTypeDescription
    urlstringAPI endpoint URL
    strategynumberThe identifier of the strategy

    Returns

    Promise\<ICensus3CensusListResponse>

    Defined in

    api/census3/census.ts:107


    queue

    queue(url, id): Promise\<ICensus3CensusQueueResponse>

    Returns the information of the census queue

    Parameters

    NameTypeDescription
    urlstringAPI endpoint URL
    idstringThe identifier of the census queue

    Returns

    Promise\<ICensus3CensusQueueResponse>

    Defined in

    api/census3/census.ts:135


    serializePagination

    serializePagination(pagination?): string

    Parameters

    NameType
    pagination?Census3Pagination

    Returns

    string

    Inherited from

    Census3API.serializePagination

    Defined in

    api/census3/api.ts:92

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/sdk/reference/classes/Census3ServiceAPI.html b/sdk/reference/classes/Census3ServiceAPI.html index d4a73355c..edf885e5d 100644 --- a/sdk/reference/classes/Census3ServiceAPI.html +++ b/sdk/reference/classes/Census3ServiceAPI.html @@ -12,13 +12,13 @@ - +

    Census3ServiceAPI

    @vocdoni/sdk / Exports / Census3ServiceAPI

    Class: Census3ServiceAPI

    Hierarchy

    • Census3API

      Census3ServiceAPI

    Table of contents

    Constructors

    Methods

    Constructors

    constructor

    new Census3ServiceAPI(): Census3ServiceAPI

    Cannot be constructed.

    Returns

    Census3ServiceAPI

    Overrides

    Census3API.constructor

    Defined in

    api/census3/service.ts:36

    Methods

    info

    info(url): Promise\<ICensus3ServiceInfoResponse>

    Fetches supported chains from the service

    Parameters

    NameTypeDescription
    urlstringAPI endpoint URL

    Returns

    Promise\<ICensus3ServiceInfoResponse>

    Defined in

    api/census3/service.ts:46


    isApiError

    isApiError(error): never

    Parameters

    NameType
    errorAxiosError\<unknown, any>

    Returns

    never

    Inherited from

    Census3API.isApiError

    Defined in

    api/census3/api.ts:101


    isUndefinedError

    isUndefinedError(error, message?): never

    Parameters

    NameType
    errorAxiosError\<unknown, any>
    message?string

    Returns

    never

    Inherited from

    Census3API.isUndefinedError

    Defined in

    api/api.ts:64


    serializePagination

    serializePagination(pagination?): string

    Parameters

    NameType
    pagination?Census3Pagination

    Returns

    string

    Inherited from

    Census3API.serializePagination

    Defined in

    api/census3/api.ts:92

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/sdk/reference/classes/Census3StrategyAPI.html b/sdk/reference/classes/Census3StrategyAPI.html index 86112fdba..94e4579af 100644 --- a/sdk/reference/classes/Census3StrategyAPI.html +++ b/sdk/reference/classes/Census3StrategyAPI.html @@ -12,13 +12,13 @@ - +

    Census3StrategyAPI

    @vocdoni/sdk / Exports / Census3StrategyAPI

    Class: Census3StrategyAPI

    Hierarchy

    • Census3API

      Census3StrategyAPI

    Table of contents

    Constructors

    Methods

    Constructors

    constructor

    new Census3StrategyAPI(): Census3StrategyAPI

    Cannot be constructed.

    Returns

    Census3StrategyAPI

    Overrides

    Census3API.constructor

    Defined in

    api/census3/strategy.ts:264

    Methods

    create

    create(url, alias, predicate, tokens): Promise\<ICensus3StrategyCreateResponse>

    Creates a new strategy based on the given token strategies and predicate.

    Parameters

    NameTypeDescription
    urlstringAPI endpoint URL
    aliasstringThe alias of the strategy
    predicatestringThe predicate of the strategy
    tokensObjectThe token list for the strategy

    Returns

    Promise\<ICensus3StrategyCreateResponse>

    The identifier of the created strategy

    Defined in

    api/census3/strategy.ts:422


    estimation

    estimation(url, id, anonymous?): Promise\<ICensus3QueueResponse>

    Returns the estimation of size and time (in milliseconds) to create the census generated for the provided strategy

    Parameters

    NameTypeDefault valueDescription
    urlstringundefinedAPI endpoint URL
    idnumberundefinedThe identifier of the strategy
    anonymousbooleanfalseIf the estimation should be done for anonymous census

    Returns

    Promise\<ICensus3QueueResponse>

    The queue identifier

    Defined in

    api/census3/strategy.ts:352


    estimationQueue

    estimationQueue(url, strategyId, queueId): Promise\<ICensus3StrategyEstimationQueueResponse>

    Returns the information of the strategy estimation queue

    Parameters

    NameTypeDescription
    urlstringAPI endpoint URL
    strategyIdnumberThe identifier of the strategy
    queueIdstringThe identifier of the strategy estimation queue

    Returns

    Promise\<ICensus3StrategyEstimationQueueResponse>

    Defined in

    api/census3/strategy.ts:369


    holders

    holders(url, id, pagination?): Promise\<ICensus3StrategyHoldersResponsePaginated>

    Fetches list of holders by strategy

    Parameters

    NameTypeDescription
    urlstringAPI endpoint URL
    idnumberThe identifier of the strategy
    pagination?Census3PaginationPagination options

    Returns

    Promise\<ICensus3StrategyHoldersResponsePaginated>

    Defined in

    api/census3/strategy.ts:292


    import

    import(url, cid): Promise\<ICensus3QueueResponse>

    Imports a strategy from IPFS from the given cid.

    Parameters

    NameTypeDescription
    urlstringAPI endpoint URL
    cidstringThe cid of the IPFS where the strategy is stored

    Returns

    Promise\<ICensus3QueueResponse>

    The queue identifier

    Defined in

    api/census3/strategy.ts:406


    importQueue

    importQueue(url, queueId): Promise\<ICensus3StrategyImportQueueResponse>

    Returns the information of the strategy import queue

    Parameters

    NameTypeDescription
    urlstringAPI endpoint URL
    queueIdstringThe identifier of the strategy import queue

    Returns

    Promise\<ICensus3StrategyImportQueueResponse>

    Defined in

    api/census3/strategy.ts:390


    isApiError

    isApiError(error): never

    Parameters

    NameType
    errorAxiosError\<unknown, any>

    Returns

    never

    Inherited from

    Census3API.isApiError

    Defined in

    api/census3/api.ts:101


    isUndefinedError

    isUndefinedError(error, message?): never

    Parameters

    NameType
    errorAxiosError\<unknown, any>
    message?string

    Returns

    never

    Inherited from

    Census3API.isUndefinedError

    Defined in

    api/api.ts:64


    list

    list(url, pagination?): Promise\<ICensus3StrategiesListResponsePaginated>

    Fetches list of strategies

    Parameters

    NameTypeDescription
    urlstringAPI endpoint URL
    pagination?Census3PaginationPagination options

    Returns

    Promise\<ICensus3StrategiesListResponsePaginated>

    Defined in

    api/census3/strategy.ts:275


    listByToken

    listByToken(url, tokenId, chainId, externalId?): Promise\<ICensus3StrategiesListResponse>

    Fetches list of strategies based on given token

    Parameters

    NameTypeDescription
    urlstringAPI endpoint URL
    tokenIdstringThe identifier of the token
    chainIdnumberThe chain identifier of the token
    externalId?stringThe identifier used by external provider

    Returns

    Promise\<ICensus3StrategiesListResponse>

    Defined in

    api/census3/strategy.ts:314


    operators

    operators(url): Promise\<ICensus3StrategiesOperatorsResponse>

    Returns the list of supported operators to build strategy predicates.

    Parameters

    NameTypeDescription
    urlstringAPI endpoint URL

    Returns

    Promise\<ICensus3StrategiesOperatorsResponse>

    Defined in

    api/census3/strategy.ts:454


    serializePagination

    serializePagination(pagination?): string

    Parameters

    NameType
    pagination?Census3Pagination

    Returns

    string

    Inherited from

    Census3API.serializePagination

    Defined in

    api/census3/api.ts:92


    strategy

    strategy(url, id): Promise\<Census3Strategy>

    Returns the information of the strategy

    Parameters

    NameTypeDescription
    urlstringAPI endpoint URL
    idnumberThe identifier of the strategy

    Returns

    Promise\<Census3Strategy>

    Defined in

    api/census3/strategy.ts:337


    validatePredicate

    validatePredicate(url, predicate): Promise\<ICensus3ValidatePredicateResponse>

    Validates a predicate.

    Parameters

    NameTypeDescription
    urlstringAPI endpoint URL
    predicatestringThe predicate of the strategy

    Returns

    Promise\<ICensus3ValidatePredicateResponse>

    Parsed version of the predicate

    Defined in

    api/census3/strategy.ts:441

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/sdk/reference/classes/Census3TokenAPI.html b/sdk/reference/classes/Census3TokenAPI.html index dd13935e1..ee37a7f08 100644 --- a/sdk/reference/classes/Census3TokenAPI.html +++ b/sdk/reference/classes/Census3TokenAPI.html @@ -12,13 +12,13 @@ - +

    Census3TokenAPI

    @vocdoni/sdk / Exports / Census3TokenAPI

    Class: Census3TokenAPI

    Hierarchy

    • Census3API

      Census3TokenAPI

    Table of contents

    Constructors

    Methods

    Constructors

    constructor

    new Census3TokenAPI(): Census3TokenAPI

    Cannot be constructed.

    Returns

    Census3TokenAPI

    Overrides

    Census3API.constructor

    Defined in

    api/census3/token.ts:138

    Methods

    create

    create(url, id, type, chainId, tags?, externalId?): Promise\<void>

    Triggers a new scan for the provided token.

    Parameters

    NameTypeDescription
    urlstringAPI endpoint URL
    idstringThe token address
    typestringThe type of the token
    chainIdnumberThe chain id of the token
    tags?stringThe tags assigned for the token
    externalId?stringThe identifier used by external provider

    Returns

    Promise\<void>

    promised IFileCIDResponse

    Defined in

    api/census3/token.ts:229


    holder

    holder(url, tokenId, chainId, holderId, externalId?): Promise\<ICensus3TokenHolderResponse>

    Returns if the holder ID is already registered in the database as a holder of the token ID and chain ID provided.

    Parameters

    NameTypeDescription
    urlstringAPI endpoint URL
    tokenIdstringThe identifier of the token
    chainIdnumberThe chain identifier of the token
    holderIdstringThe identifier of the holder
    externalId?stringThe identifier used by external provider

    Returns

    Promise\<ICensus3TokenHolderResponse>

    The balance of holder

    Defined in

    api/census3/token.ts:199


    isApiError

    isApiError(error): never

    Parameters

    NameType
    errorAxiosError\<unknown, any>

    Returns

    never

    Inherited from

    Census3API.isApiError

    Defined in

    api/census3/api.ts:101


    isUndefinedError

    isUndefinedError(error, message?): never

    Parameters

    NameType
    errorAxiosError\<unknown, any>
    message?string

    Returns

    never

    Inherited from

    Census3API.isUndefinedError

    Defined in

    api/api.ts:64


    list

    list(url, pagination?): Promise\<ICensus3TokenListResponsePaginated>

    Fetches list of already added tokens

    Parameters

    NameTypeDescription
    urlstringAPI endpoint URL
    pagination?Census3PaginationPagination options

    Returns

    Promise\<ICensus3TokenListResponsePaginated>

    Defined in

    api/census3/token.ts:149


    serializePagination

    serializePagination(pagination?): string

    Parameters

    NameType
    pagination?Census3Pagination

    Returns

    string

    Inherited from

    Census3API.serializePagination

    Defined in

    api/census3/api.ts:92


    token

    token(url, tokenId, chainId, externalId?): Promise\<Census3Token>

    Fetch the full token information

    Parameters

    NameTypeDescription
    urlstringAPI endpoint URL
    tokenIdstringThe identifier of the token
    chainIdnumberThe chain identifier of the token
    externalId?stringThe identifier used by external provider

    Returns

    Promise\<Census3Token>

    Defined in

    api/census3/token.ts:178


    types

    types(url): Promise\<ICensus3TokenTypesResponse>

    Fetches list of tokens types

    Parameters

    NameTypeDescription
    urlstringAPI endpoint URL

    Returns

    Promise\<ICensus3TokenTypesResponse>

    Defined in

    api/census3/token.ts:162

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/sdk/reference/classes/CensusAPI.html b/sdk/reference/classes/CensusAPI.html index 7a68e776f..64e5bb808 100644 --- a/sdk/reference/classes/CensusAPI.html +++ b/sdk/reference/classes/CensusAPI.html @@ -12,13 +12,13 @@ - +

    CensusAPI

    @vocdoni/sdk / Exports / CensusAPI

    Class: CensusAPI

    Hierarchy

    • API

      CensusAPI

    Table of contents

    Constructors

    Methods

    Constructors

    constructor

    new CensusAPI(): CensusAPI

    Cannot be constructed.

    Returns

    CensusAPI

    Overrides

    API.constructor

    Defined in

    api/census.ts:121

    Methods

    add

    add(url, authToken, censusId, participants): Promise\<ICensusAddResponse>

    Adds participants to a census

    Parameters

    NameTypeDescription
    urlstringAPI endpoint URL
    authTokenstringAuthentication token
    censusIdstringThe id of the census to which participants are being added
    participants{ key: string ; weight?: bigint }[]An array of participants

    Returns

    Promise\<ICensusAddResponse>

    Defined in

    api/census.ts:153


    create

    create(url, authToken, type): Promise\<ICensusCreateResponse>

    Create's a new census in the API.

    Parameters

    NameTypeDescription
    urlstringAPI endpoint URL
    authTokenstringAuthentication token
    typeCensusTypeType of census to be created

    Returns

    Promise\<ICensusCreateResponse>

    Defined in

    api/census.ts:133


    delete

    delete(url, authToken, censusId): Promise\<void>

    Deletes the given census

    Parameters

    NameTypeDescription
    urlstringAPI endpoint URL
    authTokenstringAuthentication token
    censusIdstringThe census ID we want to export

    Returns

    Promise\<void>

    on success

    Defined in

    api/census.ts:275


    export

    export(url, authToken, censusId): Promise\<ICensusExportResponse>

    Exports the given census identifier

    Parameters

    NameTypeDescription
    urlstringAPI endpoint URL
    authTokenstringAuthentication token
    censusIdstringThe census ID we want to export

    Returns

    Promise\<ICensusExportResponse>

    on success

    Defined in

    api/census.ts:223


    import

    import(url, authToken, censusId, type, rootHash, data): Promise\<ICensusImportResponse>

    Imports data into the given census identifier

    Parameters

    NameTypeDescription
    urlstringAPI endpoint URL
    authTokenstringAuthentication token
    censusIdstringThe census ID we want to export
    typenumberThe type of the census
    rootHashstringThe root hash of the census
    datastringThe census data to be imported

    Returns

    Promise\<ICensusImportResponse>

    on success

    Defined in

    api/census.ts:245


    isApiError

    isApiError(error): never

    Parameters

    NameType
    errorAxiosError\<unknown, any>

    Returns

    never

    Inherited from

    API.isApiError

    Defined in

    api/api.ts:21


    isUndefinedError

    isUndefinedError(error, message?): never

    Parameters

    NameType
    errorAxiosError\<unknown, any>
    message?string

    Returns

    never

    Inherited from

    API.isUndefinedError

    Defined in

    api/api.ts:64


    proof

    proof(url, censusId, key): Promise\<ICensusProofResponse>

    Checks if the specified address is in the specified census

    Parameters

    NameTypeDescription
    urlstringAPI endpoint URL
    censusIdstringThe census ID of which we want the proof from
    keystringThe address to be checked

    Returns

    Promise\<ICensusProofResponse>

    on success

    Defined in

    api/census.ts:208


    publish

    publish(url, authToken, censusId): Promise\<ICensusPublishResponse>

    Publishes the census, so it can be used in processes

    Parameters

    NameTypeDescription
    urlstringAPI endpoint URL
    authTokenstringAuthentication token
    censusIdstringThe census ID we're publishing

    Returns

    Promise\<ICensusPublishResponse>

    on success

    Defined in

    api/census.ts:189


    size

    size(url, censusId): Promise\<ICensusSizeResponse>

    Returns the size of a given census

    Parameters

    NameTypeDescription
    urlstringAPI endpoint URL
    censusIdstringThe census ID

    Returns

    Promise\<ICensusSizeResponse>

    Defined in

    api/census.ts:293


    type

    type(url, censusId): Promise\<ICensusTypeResponse>

    Returns the type of given census

    Parameters

    NameTypeDescription
    urlstringAPI endpoint URL
    censusIdstringThe census ID

    Returns

    Promise\<ICensusTypeResponse>

    Defined in

    api/census.ts:321


    weight

    weight(url, censusId): Promise\<ICensusWeightResponse>

    Returns the weight of a given census

    Parameters

    NameTypeDescription
    urlstringAPI endpoint URL
    censusIdstringThe census ID

    Returns

    Promise\<ICensusWeightResponse>

    Defined in

    api/census.ts:307

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/sdk/reference/classes/CensusService.html b/sdk/reference/classes/CensusService.html index 00bf7dbb3..1566efc48 100644 --- a/sdk/reference/classes/CensusService.html +++ b/sdk/reference/classes/CensusService.html @@ -12,13 +12,13 @@ - +

    CensusService

    @vocdoni/sdk / Exports / CensusService

    Class: CensusService

    Hierarchy

    Implements

    • CensusServiceProperties

    Table of contents

    Constructors

    Properties

    Methods

    Constructors

    constructor

    new CensusService(params): CensusService

    Instantiate the census service.

    Parameters

    NameTypeDescription
    paramsPartial\<CensusServiceParameters>The service parameters

    Returns

    CensusService

    Overrides

    Service.constructor

    Defined in

    services/census.ts:73

    Properties

    auth

    auth: CensusAuth

    Implementation of

    CensusServiceProperties.auth

    Defined in

    services/census.ts:65


    chunk_size

    chunk_size: number

    Implementation of

    CensusServiceProperties.chunk_size

    Defined in

    services/census.ts:66


    url

    url: string

    Inherited from

    Service.url

    Defined in

    services/service.ts:6

    Methods

    add

    add(censusId, participants): Promise\<string>

    Parameters

    NameType
    censusIdstring
    participantsICensusParticipant[]

    Returns

    Promise\<string>

    Defined in

    services/census.ts:145


    addParallel

    addParallel(censusId, participants): Promise\<ICensusAddResponse>[]

    Parameters

    NameType
    censusIdstring
    participantsICensusParticipant[]

    Returns

    Promise\<ICensusAddResponse>[]

    Defined in

    services/census.ts:169


    create

    create(censusType): Promise\<{ auth: string ; id: string }>

    Parameters

    NameType
    censusTypeCensusType

    Returns

    Promise\<{ auth: string ; id: string }>

    Defined in

    services/census.ts:137


    createCensus

    createCensus(census): Promise\<void>

    Publishes the given census.

    Parameters

    NameTypeDescription
    censusPlainCensus | WeightedCensusThe census to be published.

    Returns

    Promise\<void>

    Defined in

    services/census.ts:232


    createCensusParallel

    createCensusParallel(census): Promise\<void>

    Publishes the given census.

    Parameters

    NameTypeDescription
    censusPlainCensus | WeightedCensusThe census to be published.

    Returns

    Promise\<void>

    Defined in

    services/census.ts:254


    delete

    delete(censusId): Promise\<void>

    Deletes the given census.

    Parameters

    NameType
    censusIdstring

    Returns

    Promise\<void>

    Defined in

    services/census.ts:110


    export

    export(censusId): Promise\<CensusImportExport>

    Exports the given census identifier.

    Parameters

    NameTypeDescription
    censusIdstringThe census identifier

    Returns

    Promise\<CensusImportExport>

    Defined in

    services/census.ts:206


    fetchAccountToken

    fetchAccountToken(): Promise\<void>

    Fetches the specific account token auth and sets it to the current instance.

    Returns

    Promise\<void>

    Defined in

    services/census.ts:275


    fetchProof

    fetchProof(censusId, key): Promise\<CensusProof>

    Fetches proof that an address is part of the specified census.

    Parameters

    NameTypeDescription
    censusIdstringCensus we want to check the address against
    keystringThe address to be found

    Returns

    Promise\<CensusProof>

    Defined in

    services/census.ts:124


    get

    get(censusId): Promise\<{ size: number ; type: CensusType ; weight: bigint }>

    Fetches the information of a given census.

    Parameters

    NameType
    censusIdstring

    Returns

    Promise\<{ size: number ; type: CensusType ; weight: bigint }>

    Defined in

    services/census.ts:84


    import

    import(censusId, data): Promise\<ICensusImportResponse>

    Imports data into the given census identifier.

    Parameters

    NameTypeDescription
    censusIdstringThe census identifier
    dataCensusImportExportThe census data

    Returns

    Promise\<ICensusImportResponse>

    Defined in

    services/census.ts:219


    publish

    publish(censusId): Promise\<ICensusPublishResponse>

    Publishes the given census identifier.

    Parameters

    NameTypeDescription
    censusIdstringThe census identifier

    Returns

    Promise\<ICensusPublishResponse>

    Defined in

    services/census.ts:194

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/sdk/reference/classes/ChainAPI.html b/sdk/reference/classes/ChainAPI.html index 507ca5f20..85146dee1 100644 --- a/sdk/reference/classes/ChainAPI.html +++ b/sdk/reference/classes/ChainAPI.html @@ -12,13 +12,13 @@ - +

    ChainAPI

    @vocdoni/sdk / Exports / ChainAPI

    Class: ChainAPI

    Hierarchy

    • API

      ChainAPI

    Table of contents

    Constructors

    Methods

    Constructors

    constructor

    new ChainAPI(): ChainAPI

    Cannot be constructed.

    Returns

    ChainAPI

    Overrides

    API.constructor

    Defined in

    api/chain.ts:358

    Methods

    blockByHash

    blockByHash(url, hash): Promise\<IChainBlockInfoResponse>

    Get block information by hash

    Parameters

    NameTypeDescription
    urlstringAPI endpoint URL
    hashstringblock hash

    Returns

    Promise\<IChainBlockInfoResponse>

    Defined in

    api/chain.ts:556


    blockByHeight

    blockByHeight(url, height): Promise\<IChainBlockInfoResponse>

    Get block information by height

    Parameters

    NameTypeDescription
    urlstringAPI endpoint URL
    heightnumberblock height

    Returns

    Promise\<IChainBlockInfoResponse>

    Defined in

    api/chain.ts:529


    blockToDate

    blockToDate(url, height): Promise\<IBlockToDateResponse>

    Return approximate date by a given block height.

    Parameters

    NameTypeDescription
    urlstringAPI URL
    heightnumberblock height to calculate approximate timestamp

    Returns

    Promise\<IBlockToDateResponse>

    Defined in

    api/chain.ts:600


    blockTransactions

    blockTransactions(url, height, page?): Promise\<IBlockTransactionsResponse>

    Get paginated list of transactions registered on specific block

    Parameters

    NameTypeDefault valueDescription
    urlstringundefinedAPI endpoint URL
    heightnumberundefinedblock height
    pagenumber0the page number

    Returns

    Promise\<IBlockTransactionsResponse>

    Defined in

    api/chain.ts:571


    circuit

    circuit(url): Promise\<Uint8Array>

    Fetches a circuit.

    Parameters

    NameTypeDescription
    urlstringCircuit URL

    Returns

    Promise\<Uint8Array>

    Defined in

    api/chain.ts:407


    circuits

    circuits(url): Promise\<IChainGetCircuitResponse>

    Fetches info about the blockchain anonymous circuits.

    Parameters

    NameTypeDescription
    urlstringAPI endpoint URL

    Returns

    Promise\<IChainGetCircuitResponse>

    Defined in

    api/chain.ts:394


    costs

    costs(url): Promise\<IChainGetCostsResponse>

    Fetches info about the blockchain costs.

    Parameters

    NameTypeDescription
    urlstringAPI endpoint URL

    Returns

    Promise\<IChainGetCostsResponse>

    Defined in

    api/chain.ts:381


    dateToBlock

    dateToBlock(url, timeStamp): Promise\<IDateToBlockResponse>

    By a given date give the estimate block for the current Vochain.

    Parameters

    NameTypeDescription
    urlstringAPI URL
    timeStampnumberunix format timestamp

    Returns

    Promise\<IDateToBlockResponse>

    Defined in

    api/chain.ts:586


    info

    info(url): Promise\<IChainGetInfoResponse>

    Fetches info about the blockchain status.

    Parameters

    NameTypeDescription
    urlstringAPI endpoint URL

    Returns

    Promise\<IChainGetInfoResponse>

    Defined in

    api/chain.ts:368


    isApiError

    isApiError(error): never

    Parameters

    NameType
    errorAxiosError\<unknown, any>

    Returns

    never

    Inherited from

    API.isApiError

    Defined in

    api/api.ts:21


    isUndefinedError

    isUndefinedError(error, message?): never

    Parameters

    NameType
    errorAxiosError\<unknown, any>
    message?string

    Returns

    never

    Inherited from

    API.isUndefinedError

    Defined in

    api/api.ts:64


    organizationCount

    organizationCount(url): Promise\<IChainOrganizationCountResponse>

    Returns the number of organizations

    Parameters

    NameTypeDescription
    urlstringAPI endpoint URL

    Returns

    Promise\<IChainOrganizationCountResponse>

    Defined in

    api/chain.ts:488


    organizationList

    organizationList(url, page?, organizationId?): Promise\<IChainOrganizationListResponse>

    Returns the list of organizations by page

    Parameters

    NameTypeDefault valueDescription
    urlstringundefinedAPI endpoint URL
    pagenumber0The page number
    organizationId?stringundefinedOrganization id or partial id to search. It has to be a valid hex string.

    Returns

    Promise\<IChainOrganizationListResponse>

    Defined in

    api/chain.ts:503


    submitTx

    submitTx(url, payload): Promise\<IChainSubmitTxResponse>

    Submits a transaction to the blockchain

    Parameters

    NameTypeDescription
    urlstringAPI endpoint URL
    payloadstringThe transaction data payload

    Returns

    Promise\<IChainSubmitTxResponse>

    Defined in

    api/chain.ts:461


    txInfo

    txInfo(url, txHash): Promise\<IChainTxReference>

    Fetches information about a transaction from the blockchain.

    Parameters

    NameTypeDescription
    urlstringAPI endpoint URL
    txHashstringThe transaction hash which we want to retrieve the info from

    Returns

    Promise\<IChainTxReference>

    Defined in

    api/chain.ts:421


    txInfoByBlock

    txInfoByBlock(url, blockHeight, txIndex): Promise\<Tx>

    Fetches information about a transaction by its containing block an index on the block.

    Parameters

    NameTypeDescription
    urlstringAPI endpoint URL
    blockHeightnumberBlock with the containing transaction
    txIndexnumberIndex on the block

    Returns

    Promise\<Tx>

    Defined in

    api/chain.ts:441


    txList

    txList(url, page?): Promise\<IChainTxListResponse>

    Returns the list of transactions by page

    Parameters

    NameTypeDefault valueDescription
    urlstringundefined{string} url API endpoint URL
    pagenumber0{number} page The page number

    Returns

    Promise\<IChainTxListResponse>

    Defined in

    api/chain.ts:475


    validatorsList

    validatorsList(url): Promise\<IChainValidatorsListResponse>

    Returns the list of validators

    Parameters

    NameTypeDescription
    urlstringAPI endpoint URL

    Returns

    Promise\<IChainValidatorsListResponse>

    Defined in

    api/chain.ts:542

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/sdk/reference/classes/ChainService.html b/sdk/reference/classes/ChainService.html index cb60c0187..a5f3a1f7d 100644 --- a/sdk/reference/classes/ChainService.html +++ b/sdk/reference/classes/ChainService.html @@ -12,7 +12,7 @@ - + @@ -20,7 +20,7 @@

    ChainService

    @vocdoni/sdk / Exports / ChainService

    Class: ChainService

    Hierarchy

    Implements

    • ChainServiceProperties

    Table of contents

    Constructors

    Properties

    Methods

    Constructors

    constructor

    new ChainService(params): ChainService

    Instantiate the chain service.

    Parameters

    NameTypeDescription
    paramsPartial\<ChainServiceParameters>The service parameters

    Returns

    ChainService

    Overrides

    Service.constructor

    Defined in

    services/chain.ts:47

    Properties

    chainCosts

    chainCosts: IChainGetCostsResponse

    Implementation of

    ChainServiceProperties.chainCosts

    Defined in

    services/chain.ts:38


    chainData

    chainData: ChainData

    Implementation of

    ChainServiceProperties.chainData

    Defined in

    services/chain.ts:39


    txWait

    txWait: TxWaitOptions

    Implementation of

    ChainServiceProperties.txWait

    Defined in

    services/chain.ts:40


    url

    url: string

    Inherited from

    Service.url

    Defined in

    services/service.ts:6

    Methods

    dateToBlock

    dateToBlock(date): Promise\<number>

    Returns the block number for a given date.

    Parameters

    NameTypeDescription
    dateDateThe date which we want to retrieve the block number from

    Returns

    Promise\<number>

    The block number

    Defined in

    services/chain.ts:114


    fetchChainCosts

    fetchChainCosts(): Promise\<IChainGetCostsResponse>

    Fetches blockchain costs information if needed.

    Returns

    Promise\<IChainGetCostsResponse>

    Defined in

    services/chain.ts:74


    fetchChainData

    fetchChainData(): Promise\<ChainData>

    Fetches blockchain information if needed.

    Returns

    Promise\<ChainData>

    Defined in

    services/chain.ts:57


    submitTx

    submitTx(payload): Promise\<string>

    Submits a transaction to the blockchain

    Parameters

    NameTypeDescription
    payloadstringThe transaction data payload

    Returns

    Promise\<string>

    The transaction hash

    Defined in

    services/chain.ts:92


    txInfo

    txInfo(txHash): Promise\<IChainTxReference>

    Fetches information about a transaction from the blockchain.

    Parameters

    NameTypeDescription
    txHashstringThe transaction hash which we want to retrieve the info from

    Returns

    Promise\<IChainTxReference>

    The chain transaction

    Defined in

    services/chain.ts:103


    waitForTransaction

    waitForTransaction(tx, wait?, attempts?): Promise\<void>

    A convenience method to wait for a transaction to be executed. It will loop trying to get the transaction information, and will retry every time it fails.

    Parameters

    NameTypeDescription
    txstringTransaction to wait for
    wait?numberThe delay in milliseconds between tries
    attempts?numberThe attempts to try before failing

    Returns

    Promise\<void>

    Defined in

    services/chain.ts:129

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/sdk/reference/classes/CspCensus.html b/sdk/reference/classes/CspCensus.html index 1c409f2a7..bb5fcb042 100644 --- a/sdk/reference/classes/CspCensus.html +++ b/sdk/reference/classes/CspCensus.html @@ -12,13 +12,13 @@ - +

    CspCensus

    @vocdoni/sdk / Exports / CspCensus

    Class: CspCensus

    Represents a published census

    Hierarchy

    Table of contents

    Constructors

    Properties

    Accessors

    Methods

    Constructors

    constructor

    new CspCensus(publicKey, cspURI): CspCensus

    Constructs a CSP census

    Parameters

    NameTypeDescription
    publicKeystringThe public
    cspURIstringThe URI of the CSP server

    Returns

    CspCensus

    Overrides

    Census.constructor

    Defined in

    types/census/csp.ts:14

    Properties

    _censusId

    Protected _censusId: string

    Inherited from

    Census._censusId

    Defined in

    types/census/census.ts:12


    _censusURI

    Protected _censusURI: string

    Inherited from

    Census._censusURI

    Defined in

    types/census/census.ts:13


    _type

    Protected _type: CensusType

    Inherited from

    Census._type

    Defined in

    types/census/census.ts:14

    Accessors

    censusId

    get censusId(): string

    Returns

    string

    Inherited from

    Census.censusId

    Defined in

    types/census/census.ts:35

    set censusId(value): void

    Parameters

    NameType
    valuestring

    Returns

    void

    Inherited from

    Census.censusId

    Defined in

    types/census/census.ts:39


    censusURI

    get censusURI(): string

    Returns

    string

    Inherited from

    Census.censusURI

    Defined in

    types/census/census.ts:43

    set censusURI(value): void

    Parameters

    NameType
    valuestring

    Returns

    void

    Inherited from

    Census.censusURI

    Defined in

    types/census/census.ts:47


    isPublished

    get isPublished(): boolean

    Returns

    boolean

    Inherited from

    Census.isPublished

    Defined in

    types/census/census.ts:75


    size

    get size(): number

    Returns

    number

    Inherited from

    Census.size

    Defined in

    types/census/census.ts:59

    set size(value): void

    Parameters

    NameType
    valuenumber

    Returns

    void

    Inherited from

    Census.size

    Defined in

    types/census/census.ts:63


    type

    get type(): CensusType

    Returns

    CensusType

    Inherited from

    Census.type

    Defined in

    types/census/census.ts:51

    set type(value): void

    Parameters

    NameType
    valueCensusType

    Returns

    void

    Inherited from

    Census.type

    Defined in

    types/census/census.ts:55


    weight

    get weight(): bigint

    Returns

    bigint

    Inherited from

    Census.weight

    Defined in

    types/census/census.ts:67

    set weight(value): void

    Parameters

    NameType
    valuebigint

    Returns

    void

    Inherited from

    Census.weight

    Defined in

    types/census/census.ts:71

    Methods

    censusTypeFromCensusOrigin

    censusTypeFromCensusOrigin(censusOrigin, anonymous?): CensusType

    Parameters

    NameTypeDefault value
    censusOriginstringundefined
    anonymousbooleanfalse

    Returns

    CensusType

    Inherited from

    Census.censusTypeFromCensusOrigin

    Defined in

    types/census/census.ts:81

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/sdk/reference/classes/CspService.html b/sdk/reference/classes/CspService.html index 5ffe0356f..d5873bf97 100644 --- a/sdk/reference/classes/CspService.html +++ b/sdk/reference/classes/CspService.html @@ -12,13 +12,13 @@ - +

    CspService

    @vocdoni/sdk / Exports / CspService

    Class: CspService

    Hierarchy

    Implements

    • CspServiceProperties

    Table of contents

    Constructors

    Properties

    Methods

    Constructors

    constructor

    new CspService(params): CspService

    Instantiate the CSP service.

    Parameters

    NameTypeDescription
    paramsPartial\<CspServiceParameters>The service parameters

    Returns

    CspService

    Overrides

    Service.constructor

    Defined in

    services/csp.ts:29

    Properties

    info

    info: ICspInfoResponse

    Implementation of

    CspServiceProperties.info

    Defined in

    services/csp.ts:22


    url

    url: string

    Inherited from

    Service.url

    Defined in

    services/service.ts:6

    Methods

    cspSign

    cspSign(electionId, address, token): Promise\<string>

    Parameters

    NameType
    electionIdstring
    addressstring
    tokenstring

    Returns

    Promise\<string>

    Defined in

    services/csp.ts:64


    cspStep

    cspStep(electionId, stepNumber, data, authToken?): Promise\<ICspIntermediateStepResponse | ICspFinalStepResponse>

    Parameters

    NameType
    electionIdstring
    stepNumbernumber
    dataany[]
    authToken?string

    Returns

    Promise\<ICspIntermediateStepResponse | ICspFinalStepResponse>

    Defined in

    services/csp.ts:49


    cspVote

    cspVote(vote, signature, proof_type?): CspVote

    Parameters

    NameType
    voteVote
    signaturestring
    proof_type?CspProofType

    Returns

    CspVote

    Defined in

    services/csp.ts:75


    setInfo

    setInfo(): Promise\<ICspInfoResponse>

    Returns

    Promise\<ICspInfoResponse>

    Defined in

    services/csp.ts:43


    setUrlFromElection

    setUrlFromElection(election): string

    Parameters

    NameType
    electionElection

    Returns

    string

    Defined in

    services/csp.ts:39


    cspVote

    cspVote(vote, signature, proof_type?): CspVote

    Parameters

    NameType
    voteVote
    signaturestring
    proof_type?CspProofType

    Returns

    CspVote

    Defined in

    services/csp.ts:79


    fetchUrlFromElection

    fetchUrlFromElection(election): string

    Parameters

    NameType
    electionElection

    Returns

    string

    Defined in

    services/csp.ts:34

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/sdk/reference/classes/CspVote.html b/sdk/reference/classes/CspVote.html index 2bee7e4e2..20dd50bd4 100644 --- a/sdk/reference/classes/CspVote.html +++ b/sdk/reference/classes/CspVote.html @@ -12,13 +12,13 @@ - +

    CspVote

    @vocdoni/sdk / Exports / CspVote

    Class: CspVote

    Represents a vote

    Hierarchy

    Table of contents

    Constructors

    Properties

    Accessors

    Constructors

    constructor

    new CspVote(votes, signature, proof_type?): CspVote

    Constructs a csp vote

    Parameters

    NameTypeDescription
    votes(number | bigint)[]The list of votes values
    signaturestringThe CSP signature
    proof_type?CspProofTypeThe CSP proof type

    Returns

    CspVote

    Overrides

    Vote.constructor

    Defined in

    types/vote/csp.ts:15

    Properties

    _proof_type

    Private _proof_type: CspProofType

    Defined in

    types/vote/csp.ts:6


    _signature

    Private _signature: string

    Defined in

    types/vote/csp.ts:5

    Accessors

    proof_type

    get proof_type(): CspProofType

    Returns

    CspProofType

    Defined in

    types/vote/csp.ts:29

    set proof_type(value): void

    Parameters

    NameType
    valueCspProofType

    Returns

    void

    Defined in

    types/vote/csp.ts:33


    signature

    get signature(): string

    Returns

    string

    Defined in

    types/vote/csp.ts:21

    set signature(value): void

    Parameters

    NameType
    valuestring

    Returns

    void

    Defined in

    types/vote/csp.ts:25


    votes

    get votes(): (number | bigint)[]

    Returns

    (number | bigint)[]

    Inherited from

    Vote.votes

    Defined in

    types/vote/vote.ts:16

    set votes(value): void

    Parameters

    NameType
    value(number | bigint)[]

    Returns

    void

    Inherited from

    Vote.votes

    Defined in

    types/vote/vote.ts:20

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/sdk/reference/classes/Election.html b/sdk/reference/classes/Election.html index 37833eec8..5c2005a07 100644 --- a/sdk/reference/classes/Election.html +++ b/sdk/reference/classes/Election.html @@ -12,13 +12,13 @@ - +

    Election

    @vocdoni/sdk / Exports / Election

    Class: Election

    Represents an election

    Hierarchy

    Table of contents

    Constructors

    Properties

    Accessors

    Methods

    Constructors

    constructor

    new Election(params?): Election

    Constructs an election

    Parameters

    NameTypeDescription
    params?IElectionParametersElection parameters

    Returns

    Election

    Defined in

    types/election/election.ts:182

    Properties

    _addSDKVersion

    Protected _addSDKVersion: boolean

    Defined in

    types/election/election.ts:175


    _census

    Protected _census: Census

    Defined in

    types/election/election.ts:172


    _description

    Protected _description: MultiLanguage\<string>

    Defined in

    types/election/election.ts:163


    _electionType

    Protected _electionType: IElectionType

    Defined in

    types/election/election.ts:169


    _endDate

    Protected _endDate: Date

    Defined in

    types/election/election.ts:168


    _header

    Protected _header: string

    Defined in

    types/election/election.ts:164


    _maxCensusSize

    Protected _maxCensusSize: number

    Defined in

    types/election/election.ts:173


    _meta

    Protected _meta: any

    Defined in

    types/election/election.ts:166


    _questions

    Protected _questions: IQuestion[]

    Defined in

    types/election/election.ts:171


    _startDate

    Protected _startDate: Date

    Defined in

    types/election/election.ts:167


    _streamUri

    Protected _streamUri: string

    Defined in

    types/election/election.ts:165


    _temporarySecretIdentity

    Protected _temporarySecretIdentity: boolean

    Defined in

    types/election/election.ts:174


    _title

    Protected _title: MultiLanguage\<string>

    Defined in

    types/election/election.ts:162


    _voteType

    Protected _voteType: IVoteType

    Defined in

    types/election/election.ts:170

    Accessors

    addSDKVersion

    get addSDKVersion(): boolean

    Returns

    boolean

    Defined in

    types/election/election.ts:262


    census

    get census(): Census

    Returns

    Census

    Defined in

    types/election/election.ts:250


    description

    get description(): MultiLanguage\<string>

    Returns

    MultiLanguage\<string>

    Defined in

    types/election/election.ts:214


    electionType

    get electionType(): IElectionType

    Returns

    IElectionType

    Defined in

    types/election/election.ts:238


    endDate

    get endDate(): Date

    Returns

    Date

    Defined in

    types/election/election.ts:234


    get header(): string

    Returns

    string

    Defined in

    types/election/election.ts:218


    maxCensusSize

    get maxCensusSize(): number

    Returns

    number

    Defined in

    types/election/election.ts:254


    meta

    get meta(): any

    Returns

    any

    Defined in

    types/election/election.ts:226


    questions

    get questions(): IQuestion[]

    Returns

    IQuestion[]

    Defined in

    types/election/election.ts:246


    startDate

    get startDate(): Date

    Returns

    Date

    Defined in

    types/election/election.ts:230


    streamUri

    get streamUri(): string

    Returns

    string

    Defined in

    types/election/election.ts:222


    temporarySecretIdentity

    get temporarySecretIdentity(): boolean

    Returns

    boolean

    Defined in

    types/election/election.ts:258


    title

    get title(): MultiLanguage\<string>

    Returns

    MultiLanguage\<string>

    Defined in

    types/election/election.ts:210


    voteType

    get voteType(): IVoteType

    Returns

    IVoteType

    Defined in

    types/election/election.ts:242

    Methods

    get

    get(dot): any

    Parameters

    NameType
    dotstring

    Returns

    any

    Defined in

    types/election/election.ts:266


    from

    from(params): UnpublishedElection

    Returns an unpublished election object

    Parameters

    NameTypeDescription
    paramsIElectionParametersUnpublished Election parameters

    Returns

    UnpublishedElection

    Defined in

    types/election/election.ts:206

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/sdk/reference/classes/ElectionAPI.html b/sdk/reference/classes/ElectionAPI.html index f5d476080..249232ada 100644 --- a/sdk/reference/classes/ElectionAPI.html +++ b/sdk/reference/classes/ElectionAPI.html @@ -12,13 +12,13 @@ - +

    ElectionAPI

    @vocdoni/sdk / Exports / ElectionAPI

    Class: ElectionAPI

    Hierarchy

    • API

      ElectionAPI

    Table of contents

    Constructors

    Methods

    Constructors

    constructor

    new ElectionAPI(): ElectionAPI

    Cannot be constructed.

    Returns

    ElectionAPI

    Overrides

    API.constructor

    Defined in

    api/election.ts:373

    Methods

    create

    create(url, payload, metadata): Promise\<IElectionCreateResponse>

    Creates a new election.

    Parameters

    NameTypeDescription
    urlstringAPI endpoint URL
    payloadstringThe set information info raw payload to be submitted to the chain
    metadatastringThe base64 encoded metadata JSON object

    Returns

    Promise\<IElectionCreateResponse>

    Defined in

    api/election.ts:413


    electionsList

    electionsList(url, page?, «destructured»?): Promise\<IElectionListResponse>

    Return list of all elections in the chain

    Parameters

    NameTypeDefault valueDescription
    urlstringundefinedAPI endpoint URL
    pagenumber0The page number
    «destructured»IElectionListFilter{}-

    Returns

    Promise\<IElectionListResponse>

    Defined in

    api/election.ts:487


    info

    info(url, electionId): Promise\<IElectionInfoResponse>

    Fetches info about the specified process.

    Parameters

    NameTypeDescription
    urlstringAPI endpoint URL
    electionIdstringThe identifier of the election

    Returns

    Promise\<IElectionInfoResponse>

    Defined in

    api/election.ts:384


    isApiError

    isApiError(error): never

    Parameters

    NameType
    errorAxiosError\<unknown, any>

    Returns

    never

    Inherited from

    API.isApiError

    Defined in

    api/api.ts:21


    isUndefinedError

    isUndefinedError(error, message?): never

    Parameters

    NameType
    errorAxiosError\<unknown, any>
    message?string

    Returns

    never

    Inherited from

    API.isUndefinedError

    Defined in

    api/api.ts:64


    keys

    keys(url, electionId): Promise\<IElectionKeysResponse>

    Fetches the encryption keys from the specified process.

    Parameters

    NameTypeDescription
    urlstringAPI endpoint URL
    electionIdstringThe identifier of the election

    Returns

    Promise\<IElectionKeysResponse>

    Defined in

    api/election.ts:398


    nextElectionId

    nextElectionId(url, organizationId, censusOrigin, envelopeType?): Promise\<IElectionNextIdResponse>

    Returns the next election id.

    Parameters

    NameTypeDescription
    urlstringAPI endpoint URL
    organizationIdstringThe identifier of the organization
    censusOriginnumberThe census origin
    envelopeType?Partial\<IVoteMode>The envelope type

    Returns

    Promise\<IElectionNextIdResponse>

    Defined in

    api/election.ts:429


    price

    price(url, maxCensusSize, electionDuration, encryptedVotes, anonymousVotes, maxVoteOverwrite): Promise\<IElectionCalculatePriceResponse>

    Calculates the election price.

    Parameters

    NameTypeDescription
    urlstringAPI endpoint URL
    maxCensusSizenumber
    electionDurationnumber
    encryptedVotesboolean
    anonymousVotesboolean
    maxVoteOverwritenumber

    Returns

    Promise\<IElectionCalculatePriceResponse>

    Defined in

    api/election.ts:520


    votesCount

    votesCount(url, electionId): Promise\<IElectionVotesCountResponse>

    Returns the number of votes of a given election

    Parameters

    NameTypeDescription
    urlstringAPI endpoint URL
    electionIdstringThe identifier of the election

    Returns

    Promise\<IElectionVotesCountResponse>

    Defined in

    api/election.ts:452


    votesList

    votesList(url, electionId, page?): Promise\<IElectionVoteListResponse>

    Returns the list of votes for a given election

    Parameters

    NameTypeDefault valueDescription
    urlstringundefinedAPI endpoint URL
    electionIdstringundefinedThe identifier of the election
    pagenumber0The page number

    Returns

    Promise\<IElectionVoteListResponse>

    Defined in

    api/election.ts:467

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/sdk/reference/classes/ElectionService.html b/sdk/reference/classes/ElectionService.html index 68cea65ee..822e89815 100644 --- a/sdk/reference/classes/ElectionService.html +++ b/sdk/reference/classes/ElectionService.html @@ -12,13 +12,13 @@ - +

    ElectionService

    @vocdoni/sdk / Exports / ElectionService

    Class: ElectionService

    Hierarchy

    Implements

    • ElectionServiceProperties

    Table of contents

    Constructors

    Properties

    Methods

    Constructors

    constructor

    new ElectionService(params): ElectionService

    Instantiate the election service.

    Parameters

    NameTypeDescription
    paramsPartial\<ElectionServiceParameters>The service parameters

    Returns

    ElectionService

    Overrides

    Service.constructor

    Defined in

    services/election.ts:69

    Properties

    censusService

    censusService: CensusService

    Implementation of

    ElectionServiceProperties.censusService

    Defined in

    services/election.ts:61


    chainService

    chainService: ChainService

    Implementation of

    ElectionServiceProperties.chainService

    Defined in

    services/election.ts:62


    url

    url: string

    Inherited from

    Service.url

    Defined in

    services/service.ts:6

    Methods

    buildCensus

    buildCensus(electionInfo): Promise\<PublishedCensus | ArchivedCensus>

    Parameters

    NameType
    electionInfoany

    Returns

    Promise\<PublishedCensus | ArchivedCensus>

    Defined in

    services/election.ts:100


    buildPublishedCensus

    buildPublishedCensus(electionInfo): Promise\<PublishedCensus>

    Parameters

    NameType
    electionInfoany

    Returns

    Promise\<PublishedCensus>

    Defined in

    services/election.ts:84


    calculateChoiceResults

    calculateChoiceResults(electionType, result, qIndex, cIndex): any

    Parameters

    NameType
    electionTypeany
    resultany
    qIndexany
    cIndexany

    Returns

    any

    Defined in

    services/election.ts:180


    calculateElectionCost

    calculateElectionCost(election): Promise\<number>

    Calculate the election cost

    Parameters

    NameType
    electionUnpublishedElection

    Returns

    Promise\<number>

    The cost in tokens.

    Defined in

    services/election.ts:338


    calculateMultichoiceAbstains

    calculateMultichoiceAbstains(electionType, result): string

    Parameters

    NameType
    electionTypeany
    resultany

    Returns

    string

    Defined in

    services/election.ts:203


    create

    create(payload, metadata): Promise\<IElectionCreateResponse>

    Creates a new election.

    Parameters

    NameTypeDescription
    payloadstringThe set information info raw payload to be submitted to the chain
    metadatastringThe base64 encoded metadata JSON object

    Returns

    Promise\<IElectionCreateResponse>

    The created election information

    Defined in

    services/election.ts:257


    estimateElectionCost

    estimateElectionCost(election): Promise\<number>

    Estimates the election cost

    Parameters

    NameType
    electionUnpublishedElection

    Returns

    Promise\<number>

    The cost in tokens.

    Defined in

    services/election.ts:325


    fetchElection

    fetchElection(electionId): Promise\<PublishedElection | ArchivedElection>

    Fetches info about an election.

    Parameters

    NameTypeDescription
    electionIdstringThe id of the election

    Returns

    Promise\<PublishedElection | ArchivedElection>

    Defined in

    services/election.ts:115


    fetchElections

    fetchElections(params): Promise\<(PublishedElection | ArchivedElection | InvalidElection)[]>

    Parameters

    NameType
    paramsPartial\<FetchElectionsParameters>

    Returns

    Promise\<(PublishedElection | ArchivedElection | InvalidElection)[]>

    Defined in

    services/election.ts:222


    getElectionSalt

    getElectionSalt(address, electionCount): Promise\<string>

    Returns an election salt for address

    Parameters

    NameTypeDescription
    addressstringThe address of the account
    electionCountnumberThe election count

    Returns

    Promise\<string>

    The election salt

    Defined in

    services/election.ts:288


    getNumericElectionId

    getNumericElectionId(electionId): number

    Returns a numeric election identifier

    Parameters

    NameTypeDescription
    electionIdstringThe identifier of the election

    Returns

    number

    The numeric identifier

    Defined in

    services/election.ts:302


    keys

    keys(electionId): Promise\<IElectionKeysResponse>

    Fetches the encryption keys from the specified process.

    Parameters

    NameTypeDescription
    electionIdstringThe identifier of the election

    Returns

    Promise\<IElectionKeysResponse>

    Defined in

    services/election.ts:315


    nextElectionId

    nextElectionId(address, election): Promise\<string>

    Returns the next election id.

    Parameters

    NameTypeDescription
    addressstringThe address of the account
    electionUnpublishedElectionThe unpublished election

    Returns

    Promise\<string>

    The next election identifier

    Defined in

    services/election.ts:269


    signTransaction

    signTransaction(tx, message, walletOrSigner): Promise\<string>

    Parameters

    NameType
    txUint8Array
    messagestring
    walletOrSignerWallet | Signer

    Returns

    Promise\<string>

    Defined in

    services/election.ts:74

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/sdk/reference/classes/FaucetAPI.html b/sdk/reference/classes/FaucetAPI.html index 4424f92f3..b52039281 100644 --- a/sdk/reference/classes/FaucetAPI.html +++ b/sdk/reference/classes/FaucetAPI.html @@ -12,13 +12,13 @@ - +

    FaucetAPI

    @vocdoni/sdk / Exports / FaucetAPI

    Class: FaucetAPI

    Hierarchy

    • API

      FaucetAPI

    Table of contents

    Constructors

    Methods

    Constructors

    constructor

    new FaucetAPI(): FaucetAPI

    Cannot be constructed.

    Returns

    FaucetAPI

    Overrides

    API.constructor

    Defined in

    api/faucet.ts:24

    Methods

    collect

    collect(url, address): Promise\<IFaucetCollectResponse>

    Calls the collect tokens method.

    Parameters

    NameTypeDescription
    urlstringAPI endpoint URL
    addressstringAddress to send the tokens to

    Returns

    Promise\<IFaucetCollectResponse>

    Defined in

    api/faucet.ts:35


    isApiError

    isApiError(error): never

    Parameters

    NameType
    errorAxiosError\<unknown, any>

    Returns

    never

    Inherited from

    API.isApiError

    Defined in

    api/api.ts:21


    isUndefinedError

    isUndefinedError(error, message?): never

    Parameters

    NameType
    errorAxiosError\<unknown, any>
    message?string

    Returns

    never

    Inherited from

    API.isUndefinedError

    Defined in

    api/api.ts:64

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/sdk/reference/classes/FaucetService.html b/sdk/reference/classes/FaucetService.html index 0b570d64e..792d48f87 100644 --- a/sdk/reference/classes/FaucetService.html +++ b/sdk/reference/classes/FaucetService.html @@ -12,13 +12,13 @@ - +

    FaucetService

    @vocdoni/sdk / Exports / FaucetService

    Class: FaucetService

    Hierarchy

    Implements

    • FaucetServiceProperties

    Table of contents

    Constructors

    Properties

    Methods

    Constructors

    constructor

    new FaucetService(params): FaucetService

    Instantiate the chain service.

    Parameters

    NameTypeDescription
    paramsPartial\<FaucetServiceParameters>The service parameters

    Returns

    FaucetService

    Overrides

    Service.constructor

    Defined in

    services/faucet.ts:38

    Properties

    token_limit

    token_limit: number

    Implementation of

    FaucetServiceProperties.token_limit

    Defined in

    services/faucet.ts:31


    url

    url: string

    Inherited from

    Service.url

    Defined in

    services/service.ts:6

    Methods

    fetchPayload

    fetchPayload(address): Promise\<string>

    Fetches a faucet payload. Only for development.

    Parameters

    NameTypeDescription
    addressstringThe address where to send the tokens

    Returns

    Promise\<string>

    The encoded faucet package

    Defined in

    services/faucet.ts:49


    parseFaucetPackage

    parseFaucetPackage(faucetPackage): FaucetPackage

    Parses a faucet package.

    Parameters

    NameType
    faucetPackagestring

    Returns

    FaucetPackage

    Defined in

    services/faucet.ts:59

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/sdk/reference/classes/FileAPI.html b/sdk/reference/classes/FileAPI.html index 8ca7e32b5..6b4fdab1c 100644 --- a/sdk/reference/classes/FileAPI.html +++ b/sdk/reference/classes/FileAPI.html @@ -12,13 +12,13 @@ - +

    FileAPI

    @vocdoni/sdk / Exports / FileAPI

    Class: FileAPI

    Hierarchy

    • API

      FileAPI

    Table of contents

    Constructors

    Methods

    Constructors

    constructor

    new FileAPI(): FileAPI

    Cannot be constructed.

    Returns

    FileAPI

    Overrides

    API.constructor

    Defined in

    api/file.ts:19

    Methods

    cid

    cid(url, payload): Promise\<IFileCIDResponse>

    CID generator method via API.

    Parameters

    NameTypeDescription
    urlstringAPI endpoint URL
    payloadstringFull payload string of which we want the CID of

    Returns

    Promise\<IFileCIDResponse>

    promised IFileCIDResponse

    Defined in

    api/file.ts:30


    isApiError

    isApiError(error): never

    Parameters

    NameType
    errorAxiosError\<unknown, any>

    Returns

    never

    Inherited from

    API.isApiError

    Defined in

    api/api.ts:21


    isUndefinedError

    isUndefinedError(error, message?): never

    Parameters

    NameType
    errorAxiosError\<unknown, any>
    message?string

    Returns

    never

    Inherited from

    API.isUndefinedError

    Defined in

    api/api.ts:64

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/sdk/reference/classes/FileService.html b/sdk/reference/classes/FileService.html index aa553b01e..b83849842 100644 --- a/sdk/reference/classes/FileService.html +++ b/sdk/reference/classes/FileService.html @@ -12,13 +12,13 @@ - +

    FileService

    @vocdoni/sdk / Exports / FileService

    Class: FileService

    Hierarchy

    Implements

    • FileServiceProperties

    Table of contents

    Constructors

    Properties

    Methods

    Constructors

    constructor

    new FileService(params): FileService

    Instantiate the election service.

    Parameters

    NameTypeDescription
    paramsPartial\<FileServiceParameters>The service parameters

    Returns

    FileService

    Overrides

    Service.constructor

    Defined in

    services/file.ts:16

    Properties

    url

    url: string

    Inherited from

    Service.url

    Defined in

    services/service.ts:6

    Methods

    calculateCID

    calculateCID(data): Promise\<string>

    Fetches the CID expected for the specified data content.

    Parameters

    NameTypeDescription
    datastringThe data of which we want the CID of

    Returns

    Promise\<string>

    Resulting CID

    Defined in

    services/file.ts:27

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/sdk/reference/classes/InvalidElection.html b/sdk/reference/classes/InvalidElection.html index 49bb98230..34cd7bd30 100644 --- a/sdk/reference/classes/InvalidElection.html +++ b/sdk/reference/classes/InvalidElection.html @@ -12,13 +12,13 @@ - +

    InvalidElection

    @vocdoni/sdk / Exports / InvalidElection

    Class: InvalidElection

    Represents an invalid election

    Table of contents

    Constructors

    Properties

    Accessors

    Constructors

    constructor

    new InvalidElection(params): InvalidElection

    Constructs an invalid election

    Parameters

    NameTypeDescription
    paramsIInvalidElectionParametersElection parameters

    Returns

    InvalidElection

    Defined in

    types/election/invalid.ts:16

    Properties

    _id

    Private Readonly _id: string

    Defined in

    types/election/invalid.ts:9

    Accessors

    id

    get id(): string

    Returns

    string

    Defined in

    types/election/invalid.ts:20


    isValid

    get isValid(): boolean

    Returns

    boolean

    Defined in

    types/election/invalid.ts:24

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/sdk/reference/classes/MultiChoiceElection.html b/sdk/reference/classes/MultiChoiceElection.html index 856693896..3b2fe16c2 100644 --- a/sdk/reference/classes/MultiChoiceElection.html +++ b/sdk/reference/classes/MultiChoiceElection.html @@ -12,13 +12,13 @@ - +

    MultiChoiceElection

    @vocdoni/sdk / Exports / MultiChoiceElection

    Class: MultiChoiceElection

    Represents a multi choice election

    Hierarchy

    Table of contents

    Constructors

    Properties

    Accessors

    Methods

    Constructors

    constructor

    new MultiChoiceElection(params): MultiChoiceElection

    Constructs a multi choice election

    Parameters

    NameTypeDescription
    paramsIMultiChoiceElectionParametersMulti choice election parameters

    Returns

    MultiChoiceElection

    Overrides

    UnpublishedElection.constructor

    Defined in

    types/election/multichoice.ts:24

    Properties

    _addSDKVersion

    Protected _addSDKVersion: boolean

    Inherited from

    UnpublishedElection._addSDKVersion

    Defined in

    types/election/election.ts:175


    _canAbstain

    Private _canAbstain: boolean

    Defined in

    types/election/multichoice.ts:17


    _census

    Protected _census: Census

    Inherited from

    UnpublishedElection._census

    Defined in

    types/election/election.ts:172


    _description

    Protected _description: MultiLanguage\<string>

    Inherited from

    UnpublishedElection._description

    Defined in

    types/election/election.ts:163


    _electionType

    Protected _electionType: IElectionType

    Inherited from

    UnpublishedElection._electionType

    Defined in

    types/election/election.ts:169


    _endDate

    Protected _endDate: Date

    Inherited from

    UnpublishedElection._endDate

    Defined in

    types/election/election.ts:168


    _header

    Protected _header: string

    Inherited from

    UnpublishedElection._header

    Defined in

    types/election/election.ts:164


    _maxCensusSize

    Protected _maxCensusSize: number

    Inherited from

    UnpublishedElection._maxCensusSize

    Defined in

    types/election/election.ts:173


    _meta

    Protected _meta: any

    Inherited from

    UnpublishedElection._meta

    Defined in

    types/election/election.ts:166


    _questions

    Protected _questions: IQuestion[]

    Inherited from

    UnpublishedElection._questions

    Defined in

    types/election/election.ts:171


    _startDate

    Protected _startDate: Date

    Inherited from

    UnpublishedElection._startDate

    Defined in

    types/election/election.ts:167


    _streamUri

    Protected _streamUri: string

    Inherited from

    UnpublishedElection._streamUri

    Defined in

    types/election/election.ts:165


    _temporarySecretIdentity

    Protected _temporarySecretIdentity: boolean

    Inherited from

    UnpublishedElection._temporarySecretIdentity

    Defined in

    types/election/election.ts:174


    _title

    Protected _title: MultiLanguage\<string>

    Inherited from

    UnpublishedElection._title

    Defined in

    types/election/election.ts:162


    _voteType

    Protected _voteType: IVoteType

    Inherited from

    UnpublishedElection._voteType

    Defined in

    types/election/election.ts:170

    Accessors

    addSDKVersion

    get addSDKVersion(): boolean

    Returns

    boolean

    Inherited from

    UnpublishedElection.addSDKVersion

    Defined in

    types/election/unpublished.ts:275

    set addSDKVersion(value): void

    Parameters

    NameType
    valueboolean

    Returns

    void

    Inherited from

    UnpublishedElection.addSDKVersion

    Defined in

    types/election/unpublished.ts:279


    canAbstain

    get canAbstain(): boolean

    Returns

    boolean

    Defined in

    types/election/multichoice.ts:124

    set canAbstain(value): void

    Parameters

    NameType
    valueboolean

    Returns

    void

    Defined in

    types/election/multichoice.ts:128


    canRepeatChoices

    get canRepeatChoices(): boolean

    Returns

    boolean

    Defined in

    types/election/multichoice.ts:116

    set canRepeatChoices(value): void

    Parameters

    NameType
    valueboolean

    Returns

    void

    Defined in

    types/election/multichoice.ts:120


    census

    get census(): Census

    Returns

    Census

    Inherited from

    UnpublishedElection.census

    Defined in

    types/election/unpublished.ts:249

    set census(value): void

    Parameters

    NameType
    valueCensus

    Returns

    void

    Inherited from

    UnpublishedElection.census

    Defined in

    types/election/unpublished.ts:253


    description

    get description(): MultiLanguage\<string>

    Returns

    MultiLanguage\<string>

    Inherited from

    UnpublishedElection.description

    Defined in

    types/election/unpublished.ts:173

    set description(value): void

    Parameters

    NameType
    valueMultiLanguage\<string>

    Returns

    void

    Inherited from

    UnpublishedElection.description

    Defined in

    types/election/unpublished.ts:177


    duration

    get duration(): number

    Returns

    number

    Inherited from

    UnpublishedElection.duration

    Defined in

    types/election/unpublished.ts:138


    electionType

    get electionType(): IElectionType

    Returns

    IElectionType

    Inherited from

    UnpublishedElection.electionType

    Defined in

    types/election/unpublished.ts:225

    set electionType(value): void

    Parameters

    NameType
    valueIElectionType

    Returns

    void

    Inherited from

    UnpublishedElection.electionType

    Defined in

    types/election/unpublished.ts:229


    endDate

    get endDate(): Date

    Returns

    Date

    Inherited from

    UnpublishedElection.endDate

    Defined in

    types/election/unpublished.ts:215

    set endDate(value): void

    Parameters

    NameType
    valueDate

    Returns

    void

    Inherited from

    UnpublishedElection.endDate

    Defined in

    types/election/unpublished.ts:219


    get header(): string

    Returns

    string

    Inherited from

    UnpublishedElection.header

    Defined in

    types/election/unpublished.ts:181

    set header(value): void

    Parameters

    NameType
    valuestring

    Returns

    void

    Inherited from

    UnpublishedElection.header

    Defined in

    types/election/unpublished.ts:185


    maxCensusSize

    get maxCensusSize(): number

    Returns

    number

    Inherited from

    UnpublishedElection.maxCensusSize

    Defined in

    types/election/unpublished.ts:258

    set maxCensusSize(value): void

    Parameters

    NameType
    valuenumber

    Returns

    void

    Inherited from

    UnpublishedElection.maxCensusSize

    Defined in

    types/election/unpublished.ts:262


    maxNumberOfChoices

    get maxNumberOfChoices(): number

    Returns

    number

    Defined in

    types/election/multichoice.ts:108

    set maxNumberOfChoices(value): void

    Parameters

    NameType
    valuenumber

    Returns

    void

    Defined in

    types/election/multichoice.ts:112


    meta

    get meta(): any

    Returns

    any

    Inherited from

    UnpublishedElection.meta

    Defined in

    types/election/unpublished.ts:197

    set meta(value): void

    Parameters

    NameType
    valueany

    Returns

    void

    Inherited from

    UnpublishedElection.meta

    Defined in

    types/election/unpublished.ts:201


    questions

    get questions(): IQuestion[]

    Returns

    IQuestion[]

    Inherited from

    UnpublishedElection.questions

    Defined in

    types/election/unpublished.ts:241

    set questions(value): void

    Parameters

    NameType
    valueIQuestion[]

    Returns

    void

    Inherited from

    UnpublishedElection.questions

    Defined in

    types/election/unpublished.ts:245


    startDate

    get startDate(): Date

    Returns

    Date

    Inherited from

    UnpublishedElection.startDate

    Defined in

    types/election/unpublished.ts:206

    set startDate(value): void

    Parameters

    NameType
    valueDate

    Returns

    void

    Inherited from

    UnpublishedElection.startDate

    Defined in

    types/election/unpublished.ts:210


    streamUri

    get streamUri(): string

    Returns

    string

    Inherited from

    UnpublishedElection.streamUri

    Defined in

    types/election/unpublished.ts:189

    set streamUri(value): void

    Parameters

    NameType
    valuestring

    Returns

    void

    Inherited from

    UnpublishedElection.streamUri

    Defined in

    types/election/unpublished.ts:193


    temporarySecretIdentity

    get temporarySecretIdentity(): boolean

    Returns

    boolean

    Inherited from

    UnpublishedElection.temporarySecretIdentity

    Defined in

    types/election/unpublished.ts:267

    set temporarySecretIdentity(value): void

    Parameters

    NameType
    valueboolean

    Returns

    void

    Inherited from

    UnpublishedElection.temporarySecretIdentity

    Defined in

    types/election/unpublished.ts:271


    title

    get title(): MultiLanguage\<string>

    Returns

    MultiLanguage\<string>

    Inherited from

    UnpublishedElection.title

    Defined in

    types/election/unpublished.ts:164

    set title(value): void

    Parameters

    NameType
    valueMultiLanguage\<string>

    Returns

    void

    Inherited from

    UnpublishedElection.title

    Defined in

    types/election/unpublished.ts:168


    voteType

    get voteType(): IVoteType

    Returns

    IVoteType

    Inherited from

    UnpublishedElection.voteType

    Defined in

    types/election/unpublished.ts:233

    set voteType(value): void

    Parameters

    NameType
    valueIVoteType

    Returns

    void

    Inherited from

    UnpublishedElection.voteType

    Defined in

    types/election/unpublished.ts:237

    Methods

    addQuestion

    addQuestion(title, description, choices): UnpublishedElection

    Parameters

    NameType
    titlestring | MultiLanguage\<string>
    descriptionstring | MultiLanguage\<string>
    choices({ title: string } | { title: MultiLanguage\<string> })[]

    Returns

    UnpublishedElection

    Overrides

    UnpublishedElection.addQuestion

    Defined in

    types/election/multichoice.ts:35


    generateEnvelopeType

    generateEnvelopeType(): object

    Returns

    object

    Overrides

    UnpublishedElection.generateEnvelopeType

    Defined in

    types/election/multichoice.ts:65


    generateMetadata

    generateMetadata(): ElectionMetadata

    Returns

    ElectionMetadata

    Overrides

    UnpublishedElection.generateMetadata

    Defined in

    types/election/multichoice.ts:75


    generateMode

    generateMode(): object

    Returns

    object

    Inherited from

    UnpublishedElection.generateMode

    Defined in

    types/election/unpublished.ts:154


    generateVoteOptions

    generateVoteOptions(): object

    Returns

    object

    Overrides

    UnpublishedElection.generateVoteOptions

    Defined in

    types/election/multichoice.ts:54


    get

    get(dot): any

    Parameters

    NameType
    dotstring

    Returns

    any

    Inherited from

    UnpublishedElection.get

    Defined in

    types/election/election.ts:266


    removeQuestion

    removeQuestion(questionNumber): UnpublishedElection

    Parameters

    NameType
    questionNumbernumber

    Returns

    UnpublishedElection

    Inherited from

    UnpublishedElection.removeQuestion

    Defined in

    types/election/unpublished.ts:60


    checkVote

    checkVote(vote, voteType): void

    Parameters

    NameType
    voteVote
    voteTypeIVoteType

    Returns

    void

    Defined in

    types/election/multichoice.ts:92


    from

    from(params): MultiChoiceElection

    Returns an unpublished election object

    Parameters

    NameTypeDescription
    paramsIMultiChoiceElectionParametersUnpublished Election parameters

    Returns

    MultiChoiceElection

    Overrides

    UnpublishedElection.from

    Defined in

    types/election/multichoice.ts:31

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/sdk/reference/classes/OffchainCensus.html b/sdk/reference/classes/OffchainCensus.html index 1539fde70..aa22445f0 100644 --- a/sdk/reference/classes/OffchainCensus.html +++ b/sdk/reference/classes/OffchainCensus.html @@ -12,13 +12,13 @@ - +

    OffchainCensus

    @vocdoni/sdk / Exports / OffchainCensus

    Class: OffchainCensus

    Represents an offchain census

    Hierarchy

    Table of contents

    Constructors

    Properties

    Accessors

    Methods

    Constructors

    constructor

    new OffchainCensus(): OffchainCensus

    Constructs an offchain census

    Returns

    OffchainCensus

    Overrides

    Census.constructor

    Defined in

    types/census/offchain.ts:19

    Properties

    _censusId

    Protected _censusId: string

    Inherited from

    Census._censusId

    Defined in

    types/census/census.ts:12


    _censusURI

    Protected _censusURI: string

    Inherited from

    Census._censusURI

    Defined in

    types/census/census.ts:13


    _participants

    Private _participants: ICensusParticipant[]

    Defined in

    types/census/offchain.ts:14


    _type

    Protected _type: CensusType

    Inherited from

    Census._type

    Defined in

    types/census/census.ts:14

    Accessors

    censusId

    get censusId(): string

    Returns

    string

    Inherited from

    Census.censusId

    Defined in

    types/census/census.ts:35

    set censusId(value): void

    Parameters

    NameType
    valuestring

    Returns

    void

    Inherited from

    Census.censusId

    Defined in

    types/census/census.ts:39


    censusURI

    get censusURI(): string

    Returns

    string

    Inherited from

    Census.censusURI

    Defined in

    types/census/census.ts:43

    set censusURI(value): void

    Parameters

    NameType
    valuestring

    Returns

    void

    Inherited from

    Census.censusURI

    Defined in

    types/census/census.ts:47


    isPublished

    get isPublished(): boolean

    Returns

    boolean

    Inherited from

    Census.isPublished

    Defined in

    types/census/census.ts:75


    participants

    get participants(): ICensusParticipant[]

    Returns

    ICensusParticipant[]

    Defined in

    types/census/offchain.ts:45

    set participants(value): void

    Parameters

    NameType
    valueICensusParticipant[]

    Returns

    void

    Defined in

    types/census/offchain.ts:49


    size

    get size(): number

    Returns

    number

    Inherited from

    Census.size

    Defined in

    types/census/census.ts:59

    set size(value): void

    Parameters

    NameType
    valuenumber

    Returns

    void

    Inherited from

    Census.size

    Defined in

    types/census/census.ts:63


    type

    get type(): CensusType

    Returns

    CensusType

    Inherited from

    Census.type

    Defined in

    types/census/census.ts:51

    set type(value): void

    Parameters

    NameType
    valueCensusType

    Returns

    void

    Inherited from

    Census.type

    Defined in

    types/census/census.ts:55


    weight

    get weight(): bigint

    Returns

    bigint

    Inherited from

    Census.weight

    Defined in

    types/census/census.ts:67

    set weight(value): void

    Parameters

    NameType
    valuebigint

    Returns

    void

    Inherited from

    Census.weight

    Defined in

    types/census/census.ts:71

    Methods

    addParticipants

    addParticipants(participants): void

    Parameters

    NameType
    participantsICensusParticipant | ICensusParticipant[]

    Returns

    void

    Defined in

    types/census/offchain.ts:25


    checkParticipant

    checkParticipant(participant): ICensusParticipant

    Parameters

    NameType
    participantICensusParticipant

    Returns

    ICensusParticipant

    Defined in

    types/census/offchain.ts:35


    removeParticipant

    removeParticipant(key): void

    Parameters

    NameType
    keystring

    Returns

    void

    Defined in

    types/census/offchain.ts:41


    censusTypeFromCensusOrigin

    censusTypeFromCensusOrigin(censusOrigin, anonymous?): CensusType

    Parameters

    NameTypeDefault value
    censusOriginstringundefined
    anonymousbooleanfalse

    Returns

    CensusType

    Inherited from

    Census.censusTypeFromCensusOrigin

    Defined in

    types/census/census.ts:81

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/sdk/reference/classes/PlainCensus.html b/sdk/reference/classes/PlainCensus.html index 820010e65..474c32751 100644 --- a/sdk/reference/classes/PlainCensus.html +++ b/sdk/reference/classes/PlainCensus.html @@ -12,13 +12,13 @@ - +

    PlainCensus

    @vocdoni/sdk / Exports / PlainCensus

    Class: PlainCensus

    Represents a plain census

    Hierarchy

    Table of contents

    Constructors

    Properties

    Accessors

    Methods

    Constructors

    constructor

    new PlainCensus(): PlainCensus

    Constructs a plain census

    Returns

    PlainCensus

    Overrides

    OffchainCensus.constructor

    Defined in

    types/census/plain.ts:10

    Properties

    _censusId

    Protected _censusId: string

    Inherited from

    OffchainCensus._censusId

    Defined in

    types/census/census.ts:12


    _censusURI

    Protected _censusURI: string

    Inherited from

    OffchainCensus._censusURI

    Defined in

    types/census/census.ts:13


    _type

    Protected _type: CensusType

    Inherited from

    OffchainCensus._type

    Defined in

    types/census/census.ts:14

    Accessors

    censusId

    get censusId(): string

    Returns

    string

    Inherited from

    OffchainCensus.censusId

    Defined in

    types/census/census.ts:35

    set censusId(value): void

    Parameters

    NameType
    valuestring

    Returns

    void

    Inherited from

    OffchainCensus.censusId

    Defined in

    types/census/census.ts:39


    censusURI

    get censusURI(): string

    Returns

    string

    Inherited from

    OffchainCensus.censusURI

    Defined in

    types/census/census.ts:43

    set censusURI(value): void

    Parameters

    NameType
    valuestring

    Returns

    void

    Inherited from

    OffchainCensus.censusURI

    Defined in

    types/census/census.ts:47


    isPublished

    get isPublished(): boolean

    Returns

    boolean

    Inherited from

    OffchainCensus.isPublished

    Defined in

    types/census/census.ts:75


    participants

    get participants(): ICensusParticipant[]

    Returns

    ICensusParticipant[]

    Inherited from

    OffchainCensus.participants

    Defined in

    types/census/offchain.ts:45

    set participants(value): void

    Parameters

    NameType
    valueICensusParticipant[]

    Returns

    void

    Inherited from

    OffchainCensus.participants

    Defined in

    types/census/offchain.ts:49


    size

    get size(): number

    Returns

    number

    Inherited from

    OffchainCensus.size

    Defined in

    types/census/census.ts:59

    set size(value): void

    Parameters

    NameType
    valuenumber

    Returns

    void

    Inherited from

    OffchainCensus.size

    Defined in

    types/census/census.ts:63


    type

    get type(): CensusType

    Returns

    CensusType

    Inherited from

    OffchainCensus.type

    Defined in

    types/census/census.ts:51

    set type(value): void

    Parameters

    NameType
    valueCensusType

    Returns

    void

    Inherited from

    OffchainCensus.type

    Defined in

    types/census/census.ts:55


    weight

    get weight(): bigint

    Returns

    bigint

    Inherited from

    OffchainCensus.weight

    Defined in

    types/census/census.ts:67

    set weight(value): void

    Parameters

    NameType
    valuebigint

    Returns

    void

    Inherited from

    OffchainCensus.weight

    Defined in

    types/census/census.ts:71

    Methods

    add

    add(participants): void

    Parameters

    NameType
    participantsstring | string[]

    Returns

    void

    Defined in

    types/census/plain.ts:14


    addParticipants

    addParticipants(participants): void

    Parameters

    NameType
    participantsICensusParticipant | ICensusParticipant[]

    Returns

    void

    Inherited from

    OffchainCensus.addParticipants

    Defined in

    types/census/offchain.ts:25


    checkParticipant

    checkParticipant(participant): ICensusParticipant

    Parameters

    NameType
    participantICensusParticipant

    Returns

    ICensusParticipant

    Inherited from

    OffchainCensus.checkParticipant

    Defined in

    types/census/offchain.ts:35


    remove

    remove(key): void

    Parameters

    NameType
    keystring

    Returns

    void

    Defined in

    types/census/plain.ts:30


    removeParticipant

    removeParticipant(key): void

    Parameters

    NameType
    keystring

    Returns

    void

    Inherited from

    OffchainCensus.removeParticipant

    Defined in

    types/census/offchain.ts:41


    censusTypeFromCensusOrigin

    censusTypeFromCensusOrigin(censusOrigin, anonymous?): CensusType

    Parameters

    NameTypeDefault value
    censusOriginstringundefined
    anonymousbooleanfalse

    Returns

    CensusType

    Inherited from

    OffchainCensus.censusTypeFromCensusOrigin

    Defined in

    types/census/census.ts:81

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/sdk/reference/classes/PublishedCensus.html b/sdk/reference/classes/PublishedCensus.html index 2e8fc0348..c690e6566 100644 --- a/sdk/reference/classes/PublishedCensus.html +++ b/sdk/reference/classes/PublishedCensus.html @@ -12,13 +12,13 @@ - +

    PublishedCensus

    @vocdoni/sdk / Exports / PublishedCensus

    Class: PublishedCensus

    Represents a published census

    Hierarchy

    Table of contents

    Constructors

    Properties

    Accessors

    Methods

    Constructors

    constructor

    new PublishedCensus(censusId, censusURI, type, size?, weight?): PublishedCensus

    Constructs a published census

    Parameters

    NameTypeDescription
    censusIdstringThe id of the census
    censusURIstringThe URI of the census
    typeCensusTypeThe type of the census
    size?numberThe size of the census
    weight?bigintThe weight of the census

    Returns

    PublishedCensus

    Overrides

    Census.constructor

    Defined in

    types/census/published.ts:17

    Properties

    _censusId

    Protected _censusId: string

    Inherited from

    Census._censusId

    Defined in

    types/census/census.ts:12


    _censusURI

    Protected _censusURI: string

    Inherited from

    Census._censusURI

    Defined in

    types/census/census.ts:13


    _type

    Protected _type: CensusType

    Inherited from

    Census._type

    Defined in

    types/census/census.ts:14

    Accessors

    censusId

    get censusId(): string

    Returns

    string

    Inherited from

    Census.censusId

    Defined in

    types/census/census.ts:35

    set censusId(value): void

    Parameters

    NameType
    valuestring

    Returns

    void

    Inherited from

    Census.censusId

    Defined in

    types/census/census.ts:39


    censusURI

    get censusURI(): string

    Returns

    string

    Inherited from

    Census.censusURI

    Defined in

    types/census/census.ts:43

    set censusURI(value): void

    Parameters

    NameType
    valuestring

    Returns

    void

    Inherited from

    Census.censusURI

    Defined in

    types/census/census.ts:47


    isPublished

    get isPublished(): boolean

    Returns

    boolean

    Inherited from

    Census.isPublished

    Defined in

    types/census/census.ts:75


    size

    get size(): number

    Returns

    number

    Inherited from

    Census.size

    Defined in

    types/census/census.ts:59

    set size(value): void

    Parameters

    NameType
    valuenumber

    Returns

    void

    Inherited from

    Census.size

    Defined in

    types/census/census.ts:63


    type

    get type(): CensusType

    Returns

    CensusType

    Inherited from

    Census.type

    Defined in

    types/census/census.ts:51

    set type(value): void

    Parameters

    NameType
    valueCensusType

    Returns

    void

    Inherited from

    Census.type

    Defined in

    types/census/census.ts:55


    weight

    get weight(): bigint

    Returns

    bigint

    Inherited from

    Census.weight

    Defined in

    types/census/census.ts:67

    set weight(value): void

    Parameters

    NameType
    valuebigint

    Returns

    void

    Inherited from

    Census.weight

    Defined in

    types/census/census.ts:71

    Methods

    censusTypeFromCensusOrigin

    censusTypeFromCensusOrigin(censusOrigin, anonymous?): CensusType

    Parameters

    NameTypeDefault value
    censusOriginstringundefined
    anonymousbooleanfalse

    Returns

    CensusType

    Inherited from

    Census.censusTypeFromCensusOrigin

    Defined in

    types/census/census.ts:81

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/sdk/reference/classes/PublishedElection.html b/sdk/reference/classes/PublishedElection.html index 29a7652bc..696869f63 100644 --- a/sdk/reference/classes/PublishedElection.html +++ b/sdk/reference/classes/PublishedElection.html @@ -12,13 +12,13 @@ - +

    PublishedElection

    @vocdoni/sdk / Exports / PublishedElection

    Class: PublishedElection

    Represents a published election

    Hierarchy

    Table of contents

    Constructors

    Properties

    Accessors

    Methods

    Constructors

    constructor

    new PublishedElection(params): PublishedElection

    Constructs a published election

    Parameters

    NameTypeDescription
    paramsIPublishedElectionParametersElection parameters

    Returns

    PublishedElection

    Overrides

    Election.constructor

    Defined in

    types/election/published.ts:65

    Properties

    _addSDKVersion

    Protected _addSDKVersion: boolean

    Inherited from

    Election._addSDKVersion

    Defined in

    types/election/election.ts:175


    _census

    Protected _census: Census

    Inherited from

    Election._census

    Defined in

    types/election/election.ts:172


    _chainId

    Private Readonly _chainId: string

    Defined in

    types/election/published.ts:53


    _creationTime

    Private Readonly _creationTime: Date

    Defined in

    types/election/published.ts:55


    _description

    Protected _description: MultiLanguage\<string>

    Inherited from

    Election._description

    Defined in

    types/election/election.ts:163


    _electionType

    Protected _electionType: IElectionType

    Inherited from

    Election._electionType

    Defined in

    types/election/election.ts:169


    _endDate

    Protected _endDate: Date

    Inherited from

    Election._endDate

    Defined in

    types/election/election.ts:168


    _finalResults

    Private Readonly _finalResults: boolean

    Defined in

    types/election/published.ts:50


    _fromArchive

    Private Readonly _fromArchive: boolean

    Defined in

    types/election/published.ts:52


    _header

    Protected _header: string

    Inherited from

    Election._header

    Defined in

    types/election/election.ts:164


    _id

    Private Readonly _id: string

    Defined in

    types/election/published.ts:46


    _manuallyEnded

    Private Readonly _manuallyEnded: boolean

    Defined in

    types/election/published.ts:51


    _maxCensusSize

    Protected _maxCensusSize: number

    Inherited from

    Election._maxCensusSize

    Defined in

    types/election/election.ts:173


    _meta

    Protected _meta: any

    Inherited from

    Election._meta

    Defined in

    types/election/election.ts:166


    _metadataURL

    Private Readonly _metadataURL: string

    Defined in

    types/election/published.ts:56


    _organizationId

    Private Readonly _organizationId: string

    Defined in

    types/election/published.ts:47


    _questions

    Protected _questions: IQuestion[]

    Inherited from

    Election._questions

    Defined in

    types/election/election.ts:171


    _raw

    Private Readonly _raw: object

    Defined in

    types/election/published.ts:58


    _results

    Private Readonly _results: string[][]

    Defined in

    types/election/published.ts:54


    _resultsType

    Private Readonly _resultsType: ElectionResultsType

    Defined in

    types/election/published.ts:57


    _startDate

    Protected _startDate: Date

    Inherited from

    Election._startDate

    Defined in

    types/election/election.ts:167


    _status

    Private Readonly _status: ElectionStatus

    Defined in

    types/election/published.ts:48


    _streamUri

    Protected _streamUri: string

    Inherited from

    Election._streamUri

    Defined in

    types/election/election.ts:165


    _temporarySecretIdentity

    Protected _temporarySecretIdentity: boolean

    Inherited from

    Election._temporarySecretIdentity

    Defined in

    types/election/election.ts:174


    _title

    Protected _title: MultiLanguage\<string>

    Inherited from

    Election._title

    Defined in

    types/election/election.ts:162


    _voteCount

    Private Readonly _voteCount: number

    Defined in

    types/election/published.ts:49


    _voteType

    Protected _voteType: IVoteType

    Inherited from

    Election._voteType

    Defined in

    types/election/election.ts:170

    Accessors

    addSDKVersion

    get addSDKVersion(): boolean

    Returns

    boolean

    Inherited from

    Election.addSDKVersion

    Defined in

    types/election/election.ts:262


    census

    get census(): PublishedCensus

    Returns

    PublishedCensus

    Overrides

    Election.census

    Defined in

    types/election/published.ts:179


    chainId

    get chainId(): string

    Returns

    string

    Defined in

    types/election/published.ts:219


    creationTime

    get creationTime(): Date

    Returns

    Date

    Defined in

    types/election/published.ts:223


    description

    get description(): MultiLanguage\<string>

    Returns

    MultiLanguage\<string>

    Overrides

    Election.description

    Defined in

    types/election/published.ts:147


    electionType

    get electionType(): IElectionType

    Returns

    IElectionType

    Overrides

    Election.electionType

    Defined in

    types/election/published.ts:167


    endDate

    get endDate(): Date

    Returns

    Date

    Overrides

    Election.endDate

    Defined in

    types/election/published.ts:163


    finalResults

    get finalResults(): boolean

    Returns

    boolean

    Defined in

    types/election/published.ts:203


    fromArchive

    get fromArchive(): boolean

    Returns

    boolean

    Defined in

    types/election/published.ts:215


    get header(): string

    Returns

    string

    Overrides

    Election.header

    Defined in

    types/election/published.ts:151


    id

    get id(): string

    Returns

    string

    Defined in

    types/election/published.ts:187


    isValid

    get isValid(): boolean

    Returns

    boolean

    Defined in

    types/election/published.ts:239


    manuallyEnded

    get manuallyEnded(): boolean

    Returns

    boolean

    Defined in

    types/election/published.ts:211


    maxCensusSize

    get maxCensusSize(): number

    Returns

    number

    Overrides

    Election.maxCensusSize

    Defined in

    types/election/published.ts:183


    meta

    get meta(): any

    Returns

    any

    Inherited from

    Election.meta

    Defined in

    types/election/election.ts:226


    metadataURL

    get metadataURL(): string

    Returns

    string

    Defined in

    types/election/published.ts:227


    organizationId

    get organizationId(): string

    Returns

    string

    Defined in

    types/election/published.ts:191


    questions

    get questions(): IQuestion[]

    Returns

    IQuestion[]

    Overrides

    Election.questions

    Defined in

    types/election/published.ts:175


    raw

    get raw(): object

    Returns

    object

    Defined in

    types/election/published.ts:235


    results

    get results(): string[][]

    Returns

    string[][]

    Defined in

    types/election/published.ts:207


    resultsType

    get resultsType(): ElectionResultsType

    Returns

    ElectionResultsType

    Defined in

    types/election/published.ts:231


    startDate

    get startDate(): Date

    Returns

    Date

    Overrides

    Election.startDate

    Defined in

    types/election/published.ts:159


    status

    get status(): ElectionStatus

    Returns

    ElectionStatus

    Defined in

    types/election/published.ts:195


    streamUri

    get streamUri(): string

    Returns

    string

    Overrides

    Election.streamUri

    Defined in

    types/election/published.ts:155


    temporarySecretIdentity

    get temporarySecretIdentity(): boolean

    Returns

    boolean

    Inherited from

    Election.temporarySecretIdentity

    Defined in

    types/election/election.ts:258


    title

    get title(): MultiLanguage\<string>

    Returns

    MultiLanguage\<string>

    Overrides

    Election.title

    Defined in

    types/election/published.ts:143


    voteCount

    get voteCount(): number

    Returns

    number

    Defined in

    types/election/published.ts:199


    voteType

    get voteType(): IVoteType

    Returns

    IVoteType

    Overrides

    Election.voteType

    Defined in

    types/election/published.ts:171

    Methods

    checkVote

    checkVote(vote): void

    Parameters

    NameType
    voteVote

    Returns

    void

    Defined in

    types/election/published.ts:113


    get

    get(dot): any

    Parameters

    NameType
    dotstring

    Returns

    any

    Inherited from

    Election.get

    Defined in

    types/election/election.ts:266


    build

    build(params): PublishedElection

    Returns a published election object

    Parameters

    NameTypeDescription
    paramsIPublishedElectionParametersPublished election parameters

    Returns

    PublishedElection

    Defined in

    types/election/published.ts:100


    checkVote

    checkVote(vote, voteType): void

    Parameters

    NameType
    voteVote
    voteTypeIVoteType

    Returns

    void

    Defined in

    types/election/published.ts:127


    from

    from(params): UnpublishedElection

    Returns an unpublished election object

    Parameters

    NameTypeDescription
    paramsIElectionParametersUnpublished Election parameters

    Returns

    UnpublishedElection

    Inherited from

    Election.from

    Defined in

    types/election/election.ts:206


    getStatus

    getStatus(status, startDate): ElectionStatus

    Parameters

    NameType
    statusAllElectionStatus
    startDateDate

    Returns

    ElectionStatus

    Defined in

    types/election/published.ts:104

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/sdk/reference/classes/Service.html b/sdk/reference/classes/Service.html index 33a513828..473d78e02 100644 --- a/sdk/reference/classes/Service.html +++ b/sdk/reference/classes/Service.html @@ -12,13 +12,13 @@ - +

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/sdk/reference/classes/TokenCensus.html b/sdk/reference/classes/TokenCensus.html index c50805657..fa6bade31 100644 --- a/sdk/reference/classes/TokenCensus.html +++ b/sdk/reference/classes/TokenCensus.html @@ -12,13 +12,13 @@ - +

    TokenCensus

    @vocdoni/sdk / Exports / TokenCensus

    Class: TokenCensus

    Represents a census3 census

    Hierarchy

    Table of contents

    Constructors

    Properties

    Accessors

    Methods

    Constructors

    constructor

    new TokenCensus(censusId, censusURI, anonymous, token, size?, weight?): TokenCensus

    Constructs a census3 census

    Parameters

    NameTypeDescription
    censusIdstringThe id of the census
    censusURIstringThe URI of the census
    anonymousbooleanIf the census is anonymous
    tokenTokenThe token of the census
    size?numberThe size of the census
    weight?bigintThe weight of the census

    Returns

    TokenCensus

    Overrides

    PublishedCensus.constructor

    Defined in

    types/census/census3.ts:21

    Properties

    _censusId

    Protected _censusId: string

    Inherited from

    PublishedCensus._censusId

    Defined in

    types/census/census.ts:12


    _censusURI

    Protected _censusURI: string

    Inherited from

    PublishedCensus._censusURI

    Defined in

    types/census/census.ts:13


    _token

    Private _token: Token

    Defined in

    types/census/census3.ts:9


    _type

    Protected _type: CensusType

    Inherited from

    PublishedCensus._type

    Defined in

    types/census/census.ts:14

    Accessors

    censusId

    get censusId(): string

    Returns

    string

    Inherited from

    PublishedCensus.censusId

    Defined in

    types/census/census.ts:35

    set censusId(value): void

    Parameters

    NameType
    valuestring

    Returns

    void

    Inherited from

    PublishedCensus.censusId

    Defined in

    types/census/census.ts:39


    censusURI

    get censusURI(): string

    Returns

    string

    Inherited from

    PublishedCensus.censusURI

    Defined in

    types/census/census.ts:43

    set censusURI(value): void

    Parameters

    NameType
    valuestring

    Returns

    void

    Inherited from

    PublishedCensus.censusURI

    Defined in

    types/census/census.ts:47


    isPublished

    get isPublished(): boolean

    Returns

    boolean

    Inherited from

    PublishedCensus.isPublished

    Defined in

    types/census/census.ts:75


    size

    get size(): number

    Returns

    number

    Inherited from

    PublishedCensus.size

    Defined in

    types/census/census.ts:59

    set size(value): void

    Parameters

    NameType
    valuenumber

    Returns

    void

    Inherited from

    PublishedCensus.size

    Defined in

    types/census/census.ts:63


    token

    get token(): Token

    Returns

    Token

    Defined in

    types/census/census3.ts:33

    set token(value): void

    Parameters

    NameType
    valueToken

    Returns

    void

    Defined in

    types/census/census3.ts:37


    type

    get type(): CensusType

    Returns

    CensusType

    Inherited from

    PublishedCensus.type

    Defined in

    types/census/census.ts:51

    set type(value): void

    Parameters

    NameType
    valueCensusType

    Returns

    void

    Inherited from

    PublishedCensus.type

    Defined in

    types/census/census.ts:55


    weight

    get weight(): bigint

    Returns

    bigint

    Inherited from

    PublishedCensus.weight

    Defined in

    types/census/census.ts:67

    set weight(value): void

    Parameters

    NameType
    valuebigint

    Returns

    void

    Inherited from

    PublishedCensus.weight

    Defined in

    types/census/census.ts:71

    Methods

    censusTypeFromCensusOrigin

    censusTypeFromCensusOrigin(censusOrigin, anonymous?): CensusType

    Parameters

    NameTypeDefault value
    censusOriginstringundefined
    anonymousbooleanfalse

    Returns

    CensusType

    Inherited from

    PublishedCensus.censusTypeFromCensusOrigin

    Defined in

    types/census/census.ts:81

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/sdk/reference/classes/UnpublishedElection.html b/sdk/reference/classes/UnpublishedElection.html index 4c19116ee..ec84c16ff 100644 --- a/sdk/reference/classes/UnpublishedElection.html +++ b/sdk/reference/classes/UnpublishedElection.html @@ -12,13 +12,13 @@ - +

    UnpublishedElection

    @vocdoni/sdk / Exports / UnpublishedElection

    Class: UnpublishedElection

    Represents an unpublished election

    Hierarchy

    Table of contents

    Constructors

    Properties

    Accessors

    Methods

    Constructors

    constructor

    new UnpublishedElection(params): UnpublishedElection

    Constructs an unpublished election

    Parameters

    NameTypeDescription
    paramsIElectionParametersElection parameters

    Returns

    UnpublishedElection

    Overrides

    Election.constructor

    Defined in

    types/election/unpublished.ts:23

    Properties

    _addSDKVersion

    Protected _addSDKVersion: boolean

    Inherited from

    Election._addSDKVersion

    Defined in

    types/election/election.ts:175


    _census

    Protected _census: Census

    Inherited from

    Election._census

    Defined in

    types/election/election.ts:172


    _description

    Protected _description: MultiLanguage\<string>

    Inherited from

    Election._description

    Defined in

    types/election/election.ts:163


    _electionType

    Protected _electionType: IElectionType

    Inherited from

    Election._electionType

    Defined in

    types/election/election.ts:169


    _endDate

    Protected _endDate: Date

    Inherited from

    Election._endDate

    Defined in

    types/election/election.ts:168


    _header

    Protected _header: string

    Inherited from

    Election._header

    Defined in

    types/election/election.ts:164


    _maxCensusSize

    Protected _maxCensusSize: number

    Inherited from

    Election._maxCensusSize

    Defined in

    types/election/election.ts:173


    _meta

    Protected _meta: any

    Inherited from

    Election._meta

    Defined in

    types/election/election.ts:166


    _questions

    Protected _questions: IQuestion[]

    Inherited from

    Election._questions

    Defined in

    types/election/election.ts:171


    _startDate

    Protected _startDate: Date

    Inherited from

    Election._startDate

    Defined in

    types/election/election.ts:167


    _streamUri

    Protected _streamUri: string

    Inherited from

    Election._streamUri

    Defined in

    types/election/election.ts:165


    _temporarySecretIdentity

    Protected _temporarySecretIdentity: boolean

    Inherited from

    Election._temporarySecretIdentity

    Defined in

    types/election/election.ts:174


    _title

    Protected _title: MultiLanguage\<string>

    Inherited from

    Election._title

    Defined in

    types/election/election.ts:162


    _voteType

    Protected _voteType: IVoteType

    Inherited from

    Election._voteType

    Defined in

    types/election/election.ts:170

    Accessors

    addSDKVersion

    get addSDKVersion(): boolean

    Returns

    boolean

    Overrides

    Election.addSDKVersion

    Defined in

    types/election/unpublished.ts:275

    set addSDKVersion(value): void

    Parameters

    NameType
    valueboolean

    Returns

    void

    Overrides

    Election.addSDKVersion

    Defined in

    types/election/unpublished.ts:279


    census

    get census(): Census

    Returns

    Census

    Overrides

    Election.census

    Defined in

    types/election/unpublished.ts:249

    set census(value): void

    Parameters

    NameType
    valueCensus

    Returns

    void

    Overrides

    Election.census

    Defined in

    types/election/unpublished.ts:253


    description

    get description(): MultiLanguage\<string>

    Returns

    MultiLanguage\<string>

    Overrides

    Election.description

    Defined in

    types/election/unpublished.ts:173

    set description(value): void

    Parameters

    NameType
    valueMultiLanguage\<string>

    Returns

    void

    Overrides

    Election.description

    Defined in

    types/election/unpublished.ts:177


    duration

    get duration(): number

    Returns

    number

    Defined in

    types/election/unpublished.ts:138


    electionType

    get electionType(): IElectionType

    Returns

    IElectionType

    Overrides

    Election.electionType

    Defined in

    types/election/unpublished.ts:225

    set electionType(value): void

    Parameters

    NameType
    valueIElectionType

    Returns

    void

    Overrides

    Election.electionType

    Defined in

    types/election/unpublished.ts:229


    endDate

    get endDate(): Date

    Returns

    Date

    Overrides

    Election.endDate

    Defined in

    types/election/unpublished.ts:215

    set endDate(value): void

    Parameters

    NameType
    valueDate

    Returns

    void

    Overrides

    Election.endDate

    Defined in

    types/election/unpublished.ts:219


    get header(): string

    Returns

    string

    Overrides

    Election.header

    Defined in

    types/election/unpublished.ts:181

    set header(value): void

    Parameters

    NameType
    valuestring

    Returns

    void

    Overrides

    Election.header

    Defined in

    types/election/unpublished.ts:185


    maxCensusSize

    get maxCensusSize(): number

    Returns

    number

    Overrides

    Election.maxCensusSize

    Defined in

    types/election/unpublished.ts:258

    set maxCensusSize(value): void

    Parameters

    NameType
    valuenumber

    Returns

    void

    Overrides

    Election.maxCensusSize

    Defined in

    types/election/unpublished.ts:262


    meta

    get meta(): any

    Returns

    any

    Overrides

    Election.meta

    Defined in

    types/election/unpublished.ts:197

    set meta(value): void

    Parameters

    NameType
    valueany

    Returns

    void

    Overrides

    Election.meta

    Defined in

    types/election/unpublished.ts:201


    questions

    get questions(): IQuestion[]

    Returns

    IQuestion[]

    Overrides

    Election.questions

    Defined in

    types/election/unpublished.ts:241

    set questions(value): void

    Parameters

    NameType
    valueIQuestion[]

    Returns

    void

    Overrides

    Election.questions

    Defined in

    types/election/unpublished.ts:245


    startDate

    get startDate(): Date

    Returns

    Date

    Overrides

    Election.startDate

    Defined in

    types/election/unpublished.ts:206

    set startDate(value): void

    Parameters

    NameType
    valueDate

    Returns

    void

    Overrides

    Election.startDate

    Defined in

    types/election/unpublished.ts:210


    streamUri

    get streamUri(): string

    Returns

    string

    Overrides

    Election.streamUri

    Defined in

    types/election/unpublished.ts:189

    set streamUri(value): void

    Parameters

    NameType
    valuestring

    Returns

    void

    Overrides

    Election.streamUri

    Defined in

    types/election/unpublished.ts:193


    temporarySecretIdentity

    get temporarySecretIdentity(): boolean

    Returns

    boolean

    Overrides

    Election.temporarySecretIdentity

    Defined in

    types/election/unpublished.ts:267

    set temporarySecretIdentity(value): void

    Parameters

    NameType
    valueboolean

    Returns

    void

    Overrides

    Election.temporarySecretIdentity

    Defined in

    types/election/unpublished.ts:271


    title

    get title(): MultiLanguage\<string>

    Returns

    MultiLanguage\<string>

    Overrides

    Election.title

    Defined in

    types/election/unpublished.ts:164

    set title(value): void

    Parameters

    NameType
    valueMultiLanguage\<string>

    Returns

    void

    Overrides

    Election.title

    Defined in

    types/election/unpublished.ts:168


    voteType

    get voteType(): IVoteType

    Returns

    IVoteType

    Overrides

    Election.voteType

    Defined in

    types/election/unpublished.ts:233

    set voteType(value): void

    Parameters

    NameType
    valueIVoteType

    Returns

    void

    Overrides

    Election.voteType

    Defined in

    types/election/unpublished.ts:237

    Methods

    addQuestion

    addQuestion(title, description, choices): UnpublishedElection

    Parameters

    NameType
    titlestring | MultiLanguage\<string>
    descriptionstring | MultiLanguage\<string>
    choices({ title: string ; value: number } | { title: MultiLanguage\<string> ; value: number })[]

    Returns

    UnpublishedElection

    Defined in

    types/election/unpublished.ts:41


    generateEnvelopeType

    generateEnvelopeType(): object

    Returns

    object

    Defined in

    types/election/unpublished.ts:144


    generateMetadata

    generateMetadata(metadata?): ElectionMetadata

    Parameters

    NameType
    metadata?ElectionMetadata

    Returns

    ElectionMetadata

    Defined in

    types/election/unpublished.ts:88


    generateMode

    generateMode(): object

    Returns

    object

    Defined in

    types/election/unpublished.ts:154


    generateVoteOptions

    generateVoteOptions(): object

    Returns

    object

    Defined in

    types/election/unpublished.ts:123


    get

    get(dot): any

    Parameters

    NameType
    dotstring

    Returns

    any

    Inherited from

    Election.get

    Defined in

    types/election/election.ts:266


    removeQuestion

    removeQuestion(questionNumber): UnpublishedElection

    Parameters

    NameType
    questionNumbernumber

    Returns

    UnpublishedElection

    Defined in

    types/election/unpublished.ts:60


    from

    from(params): UnpublishedElection

    Returns an unpublished election object

    Parameters

    NameTypeDescription
    paramsIElectionParametersUnpublished Election parameters

    Returns

    UnpublishedElection

    Inherited from

    Election.from

    Defined in

    types/election/election.ts:206


    fullElectionType

    fullElectionType(value): IElectionType

    Parameters

    NameType
    valueIElectionType

    Returns

    IElectionType

    Defined in

    types/election/unpublished.ts:66


    fullVoteType

    fullVoteType(value): IVoteType

    Parameters

    NameType
    valueIVoteType

    Returns

    IVoteType

    Defined in

    types/election/unpublished.ts:76

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/sdk/reference/classes/VocdoniCensus3Client.html b/sdk/reference/classes/VocdoniCensus3Client.html index b1885fa07..018c394a1 100644 --- a/sdk/reference/classes/VocdoniCensus3Client.html +++ b/sdk/reference/classes/VocdoniCensus3Client.html @@ -12,13 +12,13 @@ - +

    VocdoniCensus3Client

    @vocdoni/sdk / Exports / VocdoniCensus3Client

    Class: VocdoniCensus3Client

    Table of contents

    Constructors

    Properties

    Methods

    Constructors

    constructor

    new VocdoniCensus3Client(opts): VocdoniCensus3Client

    Instantiate new VocdoniCensus3 client.

    To instantiate the client just pass the ClientOptions you want or empty object to let defaults.

    const client = new VocdoniCensus3Client({EnvOptions.PROD})

    Parameters

    NameTypeDescription
    optsClientOptionsoptional arguments

    Returns

    VocdoniCensus3Client

    Defined in

    census3.ts:48

    Properties

    queueWait

    queueWait: Object

    Type declaration

    NameType
    attemptsnumber
    retryTimenumber

    Defined in

    census3.ts:37


    url

    url: string

    Defined in

    census3.ts:36

    Methods

    createCensus

    createCensus(strategyId, anonymous?): Promise\<ICensus3CensusResponse>

    Creates the census based on the given strategy

    Parameters

    NameTypeDefault valueDescription
    strategyIdnumberundefinedThe id of the strategy
    anonymousbooleanfalseIf the census has to be anonymous

    Returns

    Promise\<ICensus3CensusResponse>

    The census information

    Defined in

    census3.ts:358


    createStrategy

    createStrategy(alias, predicate, tokens): Promise\<number>

    Creates a new strategy based on the given tokens and predicate

    Parameters

    NameTypeDescription
    aliasstringThe alias of the strategy
    predicatestringThe predicate of the strategy
    tokensObjectThe token list for the strategy

    Returns

    Promise\<number>

    The strategy id

    Defined in

    census3.ts:275


    createToken

    createToken(address, type, chainId?, externalId?, tags?): Promise\<void>

    Creates a new token to be tracked in the service

    Parameters

    NameTypeDefault valueDescription
    addressstringundefinedThe address of the token
    typestringundefinedThe type of the token
    chainIdnumber1The chain id of the token
    externalIdstring''The identifier used by external provider
    tagsstring[][]The tag list to associate the token with

    Returns

    Promise\<void>

    Defined in

    census3.ts:163


    createTokenCensus

    createTokenCensus(address, chainId, anonymous?, externalId?): Promise\<TokenCensus>

    Returns the actual census based on the given token using the default strategy set

    Parameters

    NameTypeDefault valueDescription
    addressstringundefinedThe address of the token
    chainIdnumberundefinedThe id of the chain
    anonymousbooleanfalseIf the census has to be anonymous
    externalId?stringundefinedThe identifier used by external provider

    Returns

    Promise\<TokenCensus>

    The token census

    Defined in

    census3.ts:395


    getCensus

    getCensus(id): Promise\<ICensus3CensusResponse>

    Returns the census3 census based on the given identifier

    Parameters

    NameTypeDescription
    idnumberThe id of the census

    Returns

    Promise\<ICensus3CensusResponse>

    The census3 census

    Defined in

    census3.ts:346


    getCensuses

    getCensuses(strategyId): Promise\<ICensus3CensusResponse[]>

    Returns the census3 censuses

    Parameters

    NameTypeDescription
    strategyIdnumberThe strategy identifier

    Returns

    Promise\<ICensus3CensusResponse[]>

    The list of census3 censuses

    Defined in

    census3.ts:335


    getStrategies

    getStrategies(): Promise\<Census3Strategy[]>

    Returns the strategies

    Returns

    Promise\<Census3Strategy[]>

    The list of strategies

    Defined in

    census3.ts:181


    getStrategiesByToken

    getStrategiesByToken(id, chainId, externalId?): Promise\<Census3Strategy[]>

    Returns the strategies from the given token

    Parameters

    NameTypeDescription
    idstringThe id (address) of the token
    chainIdnumberThe id of the chain
    externalId?stringThe identifier used by external provider

    Returns

    Promise\<Census3Strategy[]>

    The list of strategies

    Defined in

    census3.ts:207


    getStrategy

    getStrategy(id): Promise\<Census3Strategy>

    Returns the information of the strategy based on the id

    Parameters

    NameTypeDescription
    idnumberThe id of the strategy

    Returns

    Promise\<Census3Strategy>

    The strategy information

    Defined in

    census3.ts:221


    getStrategyEstimation

    getStrategyEstimation(id, anonymous?): Promise\<{ accuracy: number ; size: number ; timeToCreateCensus: number }>

    Returns the estimation of size and time (in milliseconds) to create the census generated for the provided strategy

    Parameters

    NameTypeDefault valueDescription
    idnumberundefinedThe id of the strategy
    anonymousbooleanfalseIf the estimation should be done for anonymous census

    Returns

    Promise\<{ accuracy: number ; size: number ; timeToCreateCensus: number }>

    The strategy estimation

    Defined in

    census3.ts:233


    getStrategyHolders

    getStrategyHolders(id, pagination?): Promise\<StrategyHolders>

    Returns the strategy holders

    Parameters

    NameTypeDescription
    idnumberThe id of the strategy
    paginationCensus3PaginationPagination options

    Returns

    Promise\<StrategyHolders>

    The list strategy holders

    Defined in

    census3.ts:192


    getSupportedChains

    getSupportedChains(): Promise\<ICensus3SupportedChain[]>

    Returns a list of supported chain identifiers

    Returns

    Promise\<ICensus3SupportedChain[]>

    Supported chain list

    Defined in

    census3.ts:76


    getSupportedOperators

    getSupportedOperators(): Promise\<ICensus3StrategiesOperator[]>

    Returns a list of supported strategies operators

    Returns

    Promise\<ICensus3StrategiesOperator[]>

    Supported strategies operators list

    Defined in

    census3.ts:94


    getSupportedTokens

    getSupportedTokens(): Promise\<TokenSummary[]>

    Returns a list of summary tokens supported by the service

    Returns

    Promise\<TokenSummary[]>

    Token summary list

    Defined in

    census3.ts:61


    getSupportedTypes

    getSupportedTypes(): Promise\<string[]>

    Returns a list of supported tokens type

    Returns

    Promise\<string[]>

    Supported tokens type list

    Defined in

    census3.ts:85


    getToken

    getToken(id, chainId, externalId?): Promise\<Token>

    Returns the full token information based on the id (address)

    Parameters

    NameTypeDescription
    idstringThe id (address) of the token
    chainIdnumberThe id of the chain
    externalId?stringThe identifier used by external provider

    Returns

    Promise\<Token>

    The token information

    Defined in

    census3.ts:106


    importStrategy

    importStrategy(cid): Promise\<Census3Strategy>

    Imports a strategy from IPFS from the given cid.

    Parameters

    NameTypeDescription
    cidstringThe IPFS cid of the strategy to import

    Returns

    Promise\<Census3Strategy>

    The strategy information

    Defined in

    census3.ts:290


    isHolderInToken

    isHolderInToken(tokenId, chainId, holderId, externalId?): Promise\<boolean>

    Returns if the holder ID is already registered in the database as a holder of the token.

    Parameters

    NameTypeDescription
    tokenIdstringThe id (address) of the token
    chainIdnumberThe id of the chain
    holderIdstringThe identifier of the holder
    externalId?stringThe identifier used by external provider

    Returns

    Promise\<boolean>

    If the holder is in the token

    Defined in

    census3.ts:124


    tokenHolderBalance

    tokenHolderBalance(tokenId, chainId, holderId, externalId?): Promise\<bigint>

    Returns the balance of the holder based on the token and chain

    Parameters

    NameTypeDescription
    tokenIdstringThe id (address) of the token
    chainIdnumberThe id of the chain
    holderIdstringThe identifier of the holder
    externalId?stringThe identifier used by external provider

    Returns

    Promise\<bigint>

    The balance of the holder

    Defined in

    census3.ts:145


    validatePredicate

    validatePredicate(predicate): Promise\<ICensus3ValidatePredicateResponse>

    Validates a predicate

    Parameters

    NameTypeDescription
    predicatestringThe predicate of the strategy

    Returns

    Promise\<ICensus3ValidatePredicateResponse>

    The parsed predicate

    Defined in

    census3.ts:324

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/sdk/reference/classes/VocdoniSDKClient.html b/sdk/reference/classes/VocdoniSDKClient.html index a3edd9843..9eb4a3493 100644 --- a/sdk/reference/classes/VocdoniSDKClient.html +++ b/sdk/reference/classes/VocdoniSDKClient.html @@ -12,7 +12,7 @@ - + @@ -22,7 +22,7 @@ point.

    Table of contents

    Constructors

    Properties

    Methods

    Constructors

    constructor

    new VocdoniSDKClient(opts): VocdoniSDKClient

    Instantiate new VocdoniSDK client.

    To instantiate the client just pass the ClientOptions you want or empty object to let defaults.

    const client = new VocdoniSDKClient({EnvOptions.PROD})

    Parameters

    NameTypeDescription
    optsClientOptionsoptional arguments

    Returns

    VocdoniSDKClient

    Defined in

    client.ts:127

    Properties

    accountData

    Private accountData: AccountData | ArchivedAccountData = null

    Defined in

    client.ts:100


    accountService

    accountService: AccountService

    Defined in

    client.ts:111


    anonymousService

    anonymousService: AnonymousService

    Defined in

    client.ts:105


    censusService

    censusService: CensusService

    Defined in

    client.ts:103


    chainService

    chainService: ChainService

    Defined in

    client.ts:104


    cspService

    cspService: CspService

    Defined in

    client.ts:106


    election

    Private election: PublishedElection | UnpublishedElection = null

    Defined in

    client.ts:101


    electionId

    electionId: string

    Defined in

    client.ts:115


    electionService

    electionService: ElectionService

    Defined in

    client.ts:107


    explorerUrl

    explorerUrl: string

    Defined in

    client.ts:116


    faucetService

    faucetService: FaucetService

    Defined in

    client.ts:110


    fileService

    fileService: FileService

    Defined in

    client.ts:109


    url

    url: string

    Defined in

    client.ts:113


    voteService

    voteService: VoteService

    Defined in

    client.ts:108


    wallet

    wallet: Wallet | Signer

    Defined in

    client.ts:114

    Methods

    calcZKProofForWallet

    calcZKProofForWallet(election, wallet, signature, votePackage, password?): Promise\<ZkProof>

    Calculates ZK proof from given wallet.

    Parameters

    NameTypeDefault value
    electionPublishedElectionundefined
    walletWallet | Signerundefined
    signaturestringundefined
    votePackageBufferundefined
    passwordstring'0'

    Returns

    Promise\<ZkProof>

    Defined in

    client.ts:282


    calculateCID

    calculateCID(data): Promise\<string>

    Fetches the CID expected for the specified data content.

    Parameters

    NameTypeDescription
    datastringThe data of which we want the CID of

    Returns

    Promise\<string>

    Resulting CID

    Defined in

    client.ts:1041


    calculateElectionCost

    calculateElectionCost(election): Promise\<number>

    Calculate the election cost

    Parameters

    NameType
    electionUnpublishedElection

    Returns

    Promise\<number>

    The cost in tokens.

    Defined in

    client.ts:1031


    cancelElection

    cancelElection(electionId?): Promise\<void>

    Cancels an election.

    Parameters

    NameTypeDescription
    electionId?stringThe id of the election

    Returns

    Promise\<void>

    Defined in

    client.ts:620


    changeElectionCensus

    changeElectionCensus(electionId, censusId, censusURI): Promise\<void>

    Changes the census of an election.

    Parameters

    NameTypeDescription
    electionIdstringThe id of the election
    censusIdstringThe new census id (root)
    censusURIstringThe new census URI

    Returns

    Promise\<void>

    Defined in

    client.ts:666


    changeElectionStatus

    changeElectionStatus(electionId, newStatus): Promise\<void>

    Changes the status of an election.

    Parameters

    NameTypeDescription
    electionIdstringThe id of the election
    newStatusAllElectionStatusThe new status

    Returns

    Promise\<void>

    Defined in

    client.ts:641


    collectFaucetTokens

    collectFaucetTokens(faucetPackage?): Promise\<AccountData>

    Calls the faucet to get new tokens. Only under development.

    Parameters

    NameTypeDescription
    faucetPackage?stringThe faucet package

    Returns

    Promise\<AccountData>

    Account data information updated with new balance

    Defined in

    client.ts:480


    continueElection

    continueElection(electionId?): Promise\<void>

    Continues an election.

    Parameters

    NameTypeDescription
    electionId?stringThe id of the election

    Returns

    Promise\<void>

    Defined in

    client.ts:630


    createAccount

    createAccount(options?): Promise\<AccountData>

    Registers an account against vochain, so it can create new elections.

    Parameters

    NameTypeDescription
    options?ObjectAdditional options, like extra information of the account, or the faucet package string
    options.account?Account-
    options.faucetPackage?string-
    options.password?string-
    options.sik?boolean-

    Returns

    Promise\<AccountData>

    Defined in

    client.ts:412


    createAccountInfo

    createAccountInfo(options): Promise\<AccountData>

    Creates an account with information.

    Parameters

    NameTypeDescription
    optionsObjectAdditional options, like extra information of the account, or the faucet package string.
    options.accountAccount-
    options.faucetPackage?string-
    options.password?string-
    options.signedSikPayload?string-

    Returns

    Promise\<AccountData>

    Defined in

    client.ts:323


    createCensus

    createCensus(census): Promise\<void>

    Publishes the given census.

    Parameters

    NameTypeDescription
    censusPlainCensus | WeightedCensusThe census to be published.

    Returns

    Promise\<void>

    Defined in

    client.ts:940


    createElection

    createElection(election): Promise\<string>

    Creates a new voting election.

    Parameters

    NameTypeDescription
    electionUnpublishedElectionThe election object to be created.

    Returns

    Promise\<string>

    Resulting election id.

    Defined in

    client.ts:506


    createElectionSteps

    createElectionSteps(election): AsyncGenerator\<ElectionCreationStepValue, any, unknown>

    Creates a new voting election by steps with async returns.

    Parameters

    NameTypeDescription
    electionUnpublishedElectionThe election object to be created.

    Returns

    AsyncGenerator\<ElectionCreationStepValue, any, unknown>

    The async step returns.

    Defined in

    client.ts:522


    cspInfo

    cspInfo(): Promise\<ICspInfoResponse>

    Returns

    Promise\<ICspInfoResponse>

    Defined in

    client.ts:979


    cspSign

    cspSign(address, token): Promise\<string>

    Parameters

    NameType
    addressstring
    tokenstring

    Returns

    Promise\<string>

    Defined in

    client.ts:990


    cspStep

    cspStep(stepNumber, data, authToken?): Promise\<ICspIntermediateStepResponse | ICspFinalStepResponse>

    Parameters

    NameType
    stepNumbernumber
    dataany[]
    authToken?string

    Returns

    Promise\<ICspIntermediateStepResponse | ICspFinalStepResponse>

    Defined in

    client.ts:983


    cspUrl

    cspUrl(): Promise\<string>

    Returns

    Promise\<string>

    Defined in

    client.ts:974


    cspVote

    cspVote(vote, signature, proof_type?): CspVote

    Parameters

    NameType
    voteVote
    signaturestring
    proof_type?CspProofType

    Returns

    CspVote

    Defined in

    client.ts:995


    endElection

    endElection(electionId?): Promise\<void>

    Ends an election.

    Parameters

    NameTypeDescription
    electionId?stringThe id of the election

    Returns

    Promise\<void>

    Defined in

    client.ts:600


    estimateElectionCost

    estimateElectionCost(election): Promise\<number>

    Estimates the election cost

    Parameters

    NameType
    electionUnpublishedElection

    Returns

    Promise\<number>

    The cost in tokens.

    Defined in

    client.ts:1022


    fetchAccount

    fetchAccount(address?): Promise\<AccountData>

    Fetches account.

    Parameters

    NameTypeDescription
    address?stringThe account address to fetch the information

    Returns

    Promise\<AccountData>

    Defined in

    client.ts:196


    fetchAccountInfo

    fetchAccountInfo(address?): Promise\<AccountData | ArchivedAccountData>

    Fetches account information.

    Parameters

    NameTypeDescription
    address?stringThe account address to fetch the information

    Returns

    Promise\<AccountData | ArchivedAccountData>

    Defined in

    client.ts:177


    fetchCensusInfo

    fetchCensusInfo(censusId): Promise\<{ size: number ; type: CensusType ; weight: bigint }>

    Fetches the information of a given census.

    Parameters

    NameType
    censusIdstring

    Returns

    Promise\<{ size: number ; type: CensusType ; weight: bigint }>

    Defined in

    client.ts:950


    fetchChainCosts

    fetchChainCosts(): Promise\<IChainGetCostsResponse>

    Fetches blockchain costs information if needed.

    Returns

    Promise\<IChainGetCostsResponse>

    Defined in

    client.ts:1004


    fetchChainId

    fetchChainId(): Promise\<string>

    Fetches blockchain information if needed and returns the chain id.

    Returns

    Promise\<string>

    Defined in

    client.ts:1013


    fetchCircuits

    fetchCircuits(circuits?): Promise\<ChainCircuits>

    Fetches circuits for anonymous voting

    Parameters

    NameTypeDescription
    circuits?Omit\<ChainCircuits, "zKeyData" | "vKeyData" | "wasmData">Additional options for custom circuits

    Returns

    Promise\<ChainCircuits>

    Defined in

    client.ts:960


    fetchElection

    fetchElection(electionId?): Promise\<PublishedElection | ArchivedElection>

    Fetches info about an election.

    Parameters

    NameTypeDescription
    electionId?stringThe id of the election

    Returns

    Promise\<PublishedElection | ArchivedElection>

    Defined in

    client.ts:224


    fetchElections

    fetchElections(account?, page?): Promise\<(PublishedElection | ArchivedElection | InvalidElection)[]>

    Parameters

    NameTypeDefault value
    account?stringundefined
    pagenumber0

    Returns

    Promise\<(PublishedElection | ArchivedElection | InvalidElection)[]>

    Defined in

    client.ts:231


    fetchFaucetPayload

    fetchFaucetPayload(): Promise\<string>

    Fetches a faucet payload. Only for development.

    Returns

    Promise\<string>

    Defined in

    client.ts:1050


    fetchProof

    fetchProof(censusId, key): Promise\<CensusProof>

    Fetches proof that an address is part of the specified census.

    Parameters

    NameTypeDescription
    censusIdstringCensus we want to check the address against
    keystringThe address to be found

    Returns

    Promise\<CensusProof>

    Defined in

    client.ts:930


    fetchProofForWallet

    fetchProofForWallet(censusId, wallet): Promise\<CensusProof>

    Fetches proof that an address is part of the specified census.

    Parameters

    NameType
    censusIdstring
    walletWallet | Signer

    Returns

    Promise\<CensusProof>

    Defined in

    client.ts:245


    generateRandomWallet

    generateRandomWallet(): string

    Assigns a random Wallet to the client and returns its private key.

    Returns

    string

    The private key.

    Defined in

    client.ts:901


    hasAlreadyVoted

    hasAlreadyVoted(options?): Promise\<string>

    Checks if the user has already voted

    Parameters

    NameTypeDescription
    options?Partial\<WalletOption & ElectionIdOption & VoteIdOption>Options for has already voted

    Returns

    Promise\<string>

    The id of the vote

    Defined in

    client.ts:711


    isAbleToVote

    isAbleToVote(options?): Promise\<boolean>

    Checks if the user is able to vote

    Parameters

    NameTypeDescription
    options?Partial\<WalletOption & ElectionIdOption & VoteIdOption>Options for is able to vote

    Returns

    Promise\<boolean>

    Defined in

    client.ts:743


    isInCensus

    isInCensus(options?): Promise\<boolean>

    Checks if the user is in census.

    Parameters

    NameTypeDescription
    options?Partial\<WalletOption & ElectionIdOption>Options for is in census

    Returns

    Promise\<boolean>

    Defined in

    client.ts:690


    parseFaucetPackage

    parseFaucetPackage(faucetPackage): FaucetPackage

    Parses a faucet package.

    Parameters

    NameTypeDescription
    faucetPackagestringThe encoded faucet package

    Returns

    FaucetPackage

    Defined in

    client.ts:1061


    pauseElection

    pauseElection(electionId?): Promise\<void>

    Pauses an election.

    Parameters

    NameTypeDescription
    electionId?stringThe id of the election

    Returns

    Promise\<void>

    Defined in

    client.ts:610


    sendTokens

    sendTokens(options): Promise\<void>

    Send tokens from one account to another.

    Parameters

    NameTypeDescription
    optionsSendTokensOptionsOptions for send tokens

    Returns

    Promise\<void>

    Defined in

    client.ts:451


    setAccountInfo

    setAccountInfo(promAccountData): Promise\<AccountData>

    Updates an account with information

    Parameters

    NameTypeDescription
    promAccountDataPromise\<{ message: string ; metadata: string ; tx: Uint8Array }>Account data promise in Tx form.

    Returns

    Promise\<AccountData>

    Defined in

    client.ts:392


    setAccountSIK

    setAccountSIK(electionId, signature, password, censusProof, wallet): Promise\<void>

    Parameters

    NameType
    electionIdstring
    signaturestring
    passwordstring
    censusProofCensusProof
    walletWallet | Signer

    Returns

    Promise\<void>

    Defined in

    client.ts:249


    setCircuits

    setCircuits(circuits): ChainCircuits

    Sets circuits for anonymous voting

    Parameters

    NameTypeDescription
    circuitsChainCircuitsCustom circuits

    Returns

    ChainCircuits

    Defined in

    client.ts:970


    setElectionId

    setElectionId(electionId): void

    Sets an election id. Required by other methods like submitVote or createElection.

    Parameters

    NameTypeDescription
    electionIdstringElection id string

    Returns

    void

    Defined in

    client.ts:167


    submitVote

    submitVote(vote): Promise\<string>

    Submits a vote.

    Parameters

    NameTypeDescription
    voteVote | AnonymousVote | CspVoteThe vote (or votes) to be sent.

    Returns

    Promise\<string>

    Vote confirmation id.

    Defined in

    client.ts:790


    submitVoteSteps

    submitVoteSteps(vote): AsyncGenerator\<VoteStepValue, any, unknown>

    Submits a vote by steps.

    Parameters

    NameTypeDescription
    voteVote | AnonymousVote | CspVoteThe vote (or votes) to be sent.

    Returns

    AsyncGenerator\<VoteStepValue, any, unknown>

    Vote confirmation id.

    Defined in

    client.ts:806


    updateAccountInfo

    updateAccountInfo(account): Promise\<AccountData>

    Updates an account with information

    Parameters

    NameTypeDescription
    accountAccountAccount data.

    Returns

    Promise\<AccountData>

    Defined in

    client.ts:366


    votesLeftCount

    votesLeftCount(options?): Promise\<number>

    Checks how many times a user can submit their vote

    Parameters

    NameTypeDescription
    options?Partial\<WalletOption & ElectionIdOption & VoteIdOption>Options for votes left count

    Returns

    Promise\<number>

    Defined in

    client.ts:753


    waitForTransaction

    waitForTransaction(tx, wait?, attempts?): Promise\<void>

    A convenience method to wait for a transaction to be executed. It will loop trying to get the transaction information, and will retry every time it fails.

    Parameters

    NameTypeDescription
    txstringTransaction to wait for
    wait?numberThe delay in milliseconds between tries
    attempts?numberThe attempts to try before failing

    Returns

    Promise\<void>

    Defined in

    client.ts:1075


    generateWalletFromData

    generateWalletFromData(data): Wallet

    Returns a Wallet based on the inputs.

    Parameters

    NameTypeDescription
    datastring | string[]The data inputs which should generate the Wallet

    Returns

    Wallet

    The deterministic wallet.

    Defined in

    client.ts:913

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/sdk/reference/classes/Vote.html b/sdk/reference/classes/Vote.html index 6232c0cf0..d8a297faa 100644 --- a/sdk/reference/classes/Vote.html +++ b/sdk/reference/classes/Vote.html @@ -12,13 +12,13 @@ - +

    Vote

    @vocdoni/sdk / Exports / Vote

    Class: Vote

    Represents a vote

    Hierarchy

    Table of contents

    Constructors

    Properties

    Accessors

    Constructors

    constructor

    new Vote(votes): Vote

    Constructs a vote

    Parameters

    NameTypeDescription
    votes(number | bigint)[]The list of votes values

    Returns

    Vote

    Defined in

    types/vote/vote.ts:12

    Properties

    _votes

    Private _votes: (number | bigint)[]

    Defined in

    types/vote/vote.ts:5

    Accessors

    votes

    get votes(): (number | bigint)[]

    Returns

    (number | bigint)[]

    Defined in

    types/vote/vote.ts:16

    set votes(value): void

    Parameters

    NameType
    value(number | bigint)[]

    Returns

    void

    Defined in

    types/vote/vote.ts:20

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/sdk/reference/classes/VoteAPI.html b/sdk/reference/classes/VoteAPI.html index f65ada7b8..19a1f8cde 100644 --- a/sdk/reference/classes/VoteAPI.html +++ b/sdk/reference/classes/VoteAPI.html @@ -12,13 +12,13 @@ - +

    VoteAPI

    @vocdoni/sdk / Exports / VoteAPI

    Class: VoteAPI

    Hierarchy

    • API

      VoteAPI

    Table of contents

    Constructors

    Methods

    Constructors

    constructor

    new VoteAPI(): VoteAPI

    Cannot be constructed.

    Returns

    VoteAPI

    Overrides

    API.constructor

    Defined in

    api/vote.ts:78

    Methods

    info

    info(url, voteId): Promise\<IVoteInfoResponse>

    Vote info

    Parameters

    NameTypeDescription
    urlstringAPI endpoint URL
    voteIdstringThe identifier of the vote

    Returns

    Promise\<IVoteInfoResponse>

    Defined in

    api/vote.ts:105


    isApiError

    isApiError(error): never

    Parameters

    NameType
    errorAxiosError\<unknown, any>

    Returns

    never

    Inherited from

    API.isApiError

    Defined in

    api/api.ts:21


    isUndefinedError

    isUndefinedError(error, message?): never

    Parameters

    NameType
    errorAxiosError\<unknown, any>
    message?string

    Returns

    never

    Inherited from

    API.isUndefinedError

    Defined in

    api/api.ts:64


    submit

    submit(url, payload): Promise\<IVoteSubmitResponse>

    Voting

    Parameters

    NameTypeDescription
    urlstringAPI endpoint URL
    payloadstringThe base64 encoded vote transaction

    Returns

    Promise\<IVoteSubmitResponse>

    Defined in

    api/vote.ts:90


    verify

    verify(url, processId, voteId): Promise\<boolean>

    Verify vote. A vote exists in a process.

    Parameters

    NameTypeDescription
    urlstringAPI endpoint URL
    processIdstringThe process identifier
    voteIdstringThe identifier of the vote

    Returns

    Promise\<boolean>

    Return true if response has status 200

    Defined in

    api/vote.ts:121

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/sdk/reference/classes/VoteService.html b/sdk/reference/classes/VoteService.html index 7c69cd4a7..5d2656e17 100644 --- a/sdk/reference/classes/VoteService.html +++ b/sdk/reference/classes/VoteService.html @@ -12,13 +12,13 @@ - +

    VoteService

    @vocdoni/sdk / Exports / VoteService

    Class: VoteService

    Hierarchy

    Implements

    • VoteServiceProperties

    Table of contents

    Constructors

    Properties

    Methods

    Constructors

    constructor

    new VoteService(params): VoteService

    Instantiate the election service.

    Parameters

    NameTypeDescription
    paramsPartial\<VoteServiceParameters>The service parameters

    Returns

    VoteService

    Overrides

    Service.constructor

    Defined in

    services/vote.ts:45

    Properties

    chainService

    chainService: ChainService

    Implementation of

    VoteServiceProperties.chainService

    Defined in

    services/vote.ts:38


    url

    url: string

    Inherited from

    Service.url

    Defined in

    services/service.ts:6

    Methods

    encodeTransaction

    encodeTransaction(tx): string

    Parameters

    NameType
    txUint8Array

    Returns

    string

    Defined in

    services/vote.ts:58


    info

    info(voteId): Promise\<IVoteInfoResponse>

    Get the vote information

    Parameters

    NameTypeDescription
    voteIdstringThe identifier of the vote

    Returns

    Promise\<IVoteInfoResponse>

    Defined in

    services/vote.ts:69


    signTransaction

    signTransaction(tx, message, walletOrSigner): Promise\<string>

    Parameters

    NameType
    txUint8Array
    messagestring
    walletOrSignerWallet | Signer

    Returns

    Promise\<string>

    Defined in

    services/vote.ts:50


    vote

    vote(payload): Promise\<IVoteSubmitResponse>

    Submit the vote to the chain

    Parameters

    NameTypeDescription
    payloadstringThe base64 encoded vote transaction

    Returns

    Promise\<IVoteSubmitResponse>

    Defined in

    services/vote.ts:81

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/sdk/reference/classes/WalletAPI.html b/sdk/reference/classes/WalletAPI.html index 60338a3d0..c73caf772 100644 --- a/sdk/reference/classes/WalletAPI.html +++ b/sdk/reference/classes/WalletAPI.html @@ -12,13 +12,13 @@ - +

    WalletAPI

    @vocdoni/sdk / Exports / WalletAPI

    Class: WalletAPI

    Hierarchy

    • API

      WalletAPI

    Table of contents

    Constructors

    Methods

    Constructors

    constructor

    new WalletAPI(): WalletAPI

    Cannot be constructed.

    Returns

    WalletAPI

    Overrides

    API.constructor

    Defined in

    api/wallet.ts:25

    Methods

    add

    add(url, privateKey): Promise\<IWalletAddResponse>

    Parameters

    NameType
    urlstring
    privateKeystring

    Returns

    Promise\<IWalletAddResponse>

    Defined in

    api/wallet.ts:29


    isApiError

    isApiError(error): never

    Parameters

    NameType
    errorAxiosError\<unknown, any>

    Returns

    never

    Inherited from

    API.isApiError

    Defined in

    api/api.ts:21


    isUndefinedError

    isUndefinedError(error, message?): never

    Parameters

    NameType
    errorAxiosError\<unknown, any>
    message?string

    Returns

    never

    Inherited from

    API.isUndefinedError

    Defined in

    api/api.ts:64

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/sdk/reference/classes/WeightedCensus.html b/sdk/reference/classes/WeightedCensus.html index 7b705021e..d62c4d471 100644 --- a/sdk/reference/classes/WeightedCensus.html +++ b/sdk/reference/classes/WeightedCensus.html @@ -12,13 +12,13 @@ - +

    WeightedCensus

    @vocdoni/sdk / Exports / WeightedCensus

    Class: WeightedCensus

    Represents a weighted census

    Hierarchy

    Table of contents

    Constructors

    Properties

    Accessors

    Methods

    Constructors

    constructor

    new WeightedCensus(): WeightedCensus

    Constructs a weighted census

    Returns

    WeightedCensus

    Overrides

    OffchainCensus.constructor

    Defined in

    types/census/weighted.ts:10

    Properties

    _censusId

    Protected _censusId: string

    Inherited from

    OffchainCensus._censusId

    Defined in

    types/census/census.ts:12


    _censusURI

    Protected _censusURI: string

    Inherited from

    OffchainCensus._censusURI

    Defined in

    types/census/census.ts:13


    _type

    Protected _type: CensusType

    Inherited from

    OffchainCensus._type

    Defined in

    types/census/census.ts:14

    Accessors

    censusId

    get censusId(): string

    Returns

    string

    Inherited from

    OffchainCensus.censusId

    Defined in

    types/census/census.ts:35

    set censusId(value): void

    Parameters

    NameType
    valuestring

    Returns

    void

    Inherited from

    OffchainCensus.censusId

    Defined in

    types/census/census.ts:39


    censusURI

    get censusURI(): string

    Returns

    string

    Inherited from

    OffchainCensus.censusURI

    Defined in

    types/census/census.ts:43

    set censusURI(value): void

    Parameters

    NameType
    valuestring

    Returns

    void

    Inherited from

    OffchainCensus.censusURI

    Defined in

    types/census/census.ts:47


    isPublished

    get isPublished(): boolean

    Returns

    boolean

    Inherited from

    OffchainCensus.isPublished

    Defined in

    types/census/census.ts:75


    participants

    get participants(): ICensusParticipant[]

    Returns

    ICensusParticipant[]

    Inherited from

    OffchainCensus.participants

    Defined in

    types/census/offchain.ts:45

    set participants(value): void

    Parameters

    NameType
    valueICensusParticipant[]

    Returns

    void

    Inherited from

    OffchainCensus.participants

    Defined in

    types/census/offchain.ts:49


    size

    get size(): number

    Returns

    number

    Inherited from

    OffchainCensus.size

    Defined in

    types/census/census.ts:59

    set size(value): void

    Parameters

    NameType
    valuenumber

    Returns

    void

    Inherited from

    OffchainCensus.size

    Defined in

    types/census/census.ts:63


    type

    get type(): CensusType

    Returns

    CensusType

    Inherited from

    OffchainCensus.type

    Defined in

    types/census/census.ts:51

    set type(value): void

    Parameters

    NameType
    valueCensusType

    Returns

    void

    Inherited from

    OffchainCensus.type

    Defined in

    types/census/census.ts:55


    weight

    get weight(): bigint

    Returns

    bigint

    Inherited from

    OffchainCensus.weight

    Defined in

    types/census/census.ts:67

    set weight(value): void

    Parameters

    NameType
    valuebigint

    Returns

    void

    Inherited from

    OffchainCensus.weight

    Defined in

    types/census/census.ts:71

    Methods

    add

    add(participants): void

    Parameters

    NameType
    participantsICensusParticipant | ICensusParticipant[]

    Returns

    void

    Defined in

    types/census/weighted.ts:14


    addParticipants

    addParticipants(participants): void

    Parameters

    NameType
    participantsICensusParticipant | ICensusParticipant[]

    Returns

    void

    Inherited from

    OffchainCensus.addParticipants

    Defined in

    types/census/offchain.ts:25


    checkParticipant

    checkParticipant(participant): ICensusParticipant

    Parameters

    NameType
    participantICensusParticipant

    Returns

    ICensusParticipant

    Inherited from

    OffchainCensus.checkParticipant

    Defined in

    types/census/offchain.ts:35


    remove

    remove(key): void

    Parameters

    NameType
    keystring

    Returns

    void

    Defined in

    types/census/weighted.ts:18


    removeParticipant

    removeParticipant(key): void

    Parameters

    NameType
    keystring

    Returns

    void

    Inherited from

    OffchainCensus.removeParticipant

    Defined in

    types/census/offchain.ts:41


    censusTypeFromCensusOrigin

    censusTypeFromCensusOrigin(censusOrigin, anonymous?): CensusType

    Parameters

    NameTypeDefault value
    censusOriginstringundefined
    anonymousbooleanfalse

    Returns

    CensusType

    Inherited from

    OffchainCensus.censusTypeFromCensusOrigin

    Defined in

    types/census/census.ts:81

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/sdk/reference/enums/CensusOrigin.html b/sdk/reference/enums/CensusOrigin.html index a5ff5d6b6..887e7cb0c 100644 --- a/sdk/reference/enums/CensusOrigin.html +++ b/sdk/reference/enums/CensusOrigin.html @@ -12,13 +12,13 @@ - +

    CensusOrigin

    @vocdoni/sdk / Exports / CensusOrigin

    Enumeration: CensusOrigin

    Table of contents

    Enumeration Members

    Enumeration Members

    CENSUS_UNKNOWN

    CENSUS_UNKNOWN = 0

    Defined in

    api/chain/transactions.ts:234


    ERC1155

    ERC1155 = 13

    Defined in

    api/chain/transactions.ts:240


    ERC20

    ERC20 = 11

    Defined in

    api/chain/transactions.ts:238


    ERC721

    ERC721 = 12

    Defined in

    api/chain/transactions.ts:239


    ERC777

    ERC777 = 14

    Defined in

    api/chain/transactions.ts:241


    MINI_ME

    MINI_ME = 15

    Defined in

    api/chain/transactions.ts:242


    OFF_CHAIN_CA

    OFF_CHAIN_CA = 3

    Defined in

    api/chain/transactions.ts:237


    OFF_CHAIN_TREE

    OFF_CHAIN_TREE = 1

    Defined in

    api/chain/transactions.ts:235


    OFF_CHAIN_TREE_WEIGHTED

    OFF_CHAIN_TREE_WEIGHTED = 2

    Defined in

    api/chain/transactions.ts:236


    UNRECOGNIZED

    UNRECOGNIZED = -1

    Defined in

    api/chain/transactions.ts:243

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/sdk/reference/enums/CensusType.html b/sdk/reference/enums/CensusType.html index f7b3f3e83..d4aad9edc 100644 --- a/sdk/reference/enums/CensusType.html +++ b/sdk/reference/enums/CensusType.html @@ -12,13 +12,13 @@ - +

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/sdk/reference/enums/CensusTypeEnum.html b/sdk/reference/enums/CensusTypeEnum.html index 4b27c19fe..4f548a8cb 100644 --- a/sdk/reference/enums/CensusTypeEnum.html +++ b/sdk/reference/enums/CensusTypeEnum.html @@ -12,13 +12,13 @@ - +

    CensusTypeEnum

    @vocdoni/sdk / Exports / CensusTypeEnum

    Enumeration: CensusTypeEnum

    Table of contents

    Enumeration Members

    Enumeration Members

    CENSUS_UNKNOWN

    CENSUS_UNKNOWN = "CENSUS_UNKNOWN"

    Defined in

    api/election.ts:150


    ERC1155

    ERC1155 = "ERC1155"

    Defined in

    api/election.ts:156


    ERC20

    ERC20 = "ERC20"

    Defined in

    api/election.ts:154


    ERC721

    ERC721 = "ERC721"

    Defined in

    api/election.ts:155


    ERC777

    ERC777 = "ERC777"

    Defined in

    api/election.ts:157


    MINI_ME

    MINI_ME = "MINI_ME"

    Defined in

    api/election.ts:158


    OFF_CHAIN_CA

    OFF_CHAIN_CA = "OFF_CHAIN_CA"

    Defined in

    api/election.ts:153


    OFF_CHAIN_TREE

    OFF_CHAIN_TREE = "OFF_CHAIN_TREE"

    Defined in

    api/election.ts:151


    OFF_CHAIN_TREE_WEIGHTED

    OFF_CHAIN_TREE_WEIGHTED = "OFF_CHAIN_TREE_WEIGHTED"

    Defined in

    api/election.ts:152

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/sdk/reference/enums/CspProofType.html b/sdk/reference/enums/CspProofType.html index 598cb08f5..8a03cbb7e 100644 --- a/sdk/reference/enums/CspProofType.html +++ b/sdk/reference/enums/CspProofType.html @@ -12,13 +12,13 @@ - +

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/sdk/reference/enums/ElectionCreationSteps.html b/sdk/reference/enums/ElectionCreationSteps.html index 27b1549fd..124055e93 100644 --- a/sdk/reference/enums/ElectionCreationSteps.html +++ b/sdk/reference/enums/ElectionCreationSteps.html @@ -12,13 +12,13 @@ - +

    ElectionCreationSteps

    @vocdoni/sdk / Exports / ElectionCreationSteps

    Enumeration: ElectionCreationSteps

    Table of contents

    Enumeration Members

    Enumeration Members

    CENSUS_CREATED

    CENSUS_CREATED = "census-created"

    Defined in

    services/election.ts:41


    CREATING

    CREATING = "creating"

    Defined in

    services/election.ts:46


    DONE

    DONE = "done"

    Defined in

    services/election.ts:47


    GENERATE_TX

    GENERATE_TX = "generate-tx"

    Defined in

    services/election.ts:44


    GET_ACCOUNT_DATA

    GET_ACCOUNT_DATA = "get-account-data"

    Defined in

    services/election.ts:42


    GET_CHAIN_DATA

    GET_CHAIN_DATA = "get-chain-data"

    Defined in

    services/election.ts:40


    GET_DATA_PIN

    GET_DATA_PIN = "get-data-pin"

    Defined in

    services/election.ts:43


    SIGN_TX

    SIGN_TX = "sign-tx"

    Defined in

    services/election.ts:45

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/sdk/reference/enums/ElectionResultsTypeNames.html b/sdk/reference/enums/ElectionResultsTypeNames.html index 772b362c9..1f5fb9d90 100644 --- a/sdk/reference/enums/ElectionResultsTypeNames.html +++ b/sdk/reference/enums/ElectionResultsTypeNames.html @@ -12,13 +12,13 @@ - +

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/sdk/reference/enums/ElectionStatus.html b/sdk/reference/enums/ElectionStatus.html index a88542950..e15e6c3f9 100644 --- a/sdk/reference/enums/ElectionStatus.html +++ b/sdk/reference/enums/ElectionStatus.html @@ -12,13 +12,13 @@ - +

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/sdk/reference/enums/ElectionStatusReady.html b/sdk/reference/enums/ElectionStatusReady.html index 75d206867..cb3e02aa5 100644 --- a/sdk/reference/enums/ElectionStatusReady.html +++ b/sdk/reference/enums/ElectionStatusReady.html @@ -12,13 +12,13 @@ - +

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/sdk/reference/enums/EnvOptions.html b/sdk/reference/enums/EnvOptions.html index bc9f30c0c..40a67b798 100644 --- a/sdk/reference/enums/EnvOptions.html +++ b/sdk/reference/enums/EnvOptions.html @@ -12,13 +12,13 @@ - +

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/sdk/reference/enums/TransactionType.html b/sdk/reference/enums/TransactionType.html index 051472bec..5beb15447 100644 --- a/sdk/reference/enums/TransactionType.html +++ b/sdk/reference/enums/TransactionType.html @@ -12,13 +12,13 @@ - +

    TransactionType

    @vocdoni/sdk / Exports / TransactionType

    Enumeration: TransactionType

    Table of contents

    Enumeration Members

    Enumeration Members

    ADMIN_TX

    ADMIN_TX = "admin"

    Defined in

    api/chain.ts:168


    COLLECT_FAUCET_TX

    COLLECT_FAUCET_TX = "collectFaucet"

    Defined in

    api/chain.ts:175


    MINT_TOKENS_TX

    MINT_TOKENS_TX = "mintTokens"

    Defined in

    api/chain.ts:171


    NEW_PROCESS_TX

    NEW_PROCESS_TX = "newProcess"

    Defined in

    api/chain.ts:167


    REGISTER_KEY_TX

    REGISTER_KEY_TX = "registerKey"

    Defined in

    api/chain.ts:170


    SEND_TOKENS_TX

    SEND_TOKENS_TX = "sendTokens"

    Defined in

    api/chain.ts:172


    SET_ACCOUNT_TX

    SET_ACCOUNT_TX = "setAccount"

    Defined in

    api/chain.ts:174


    SET_KEYKEEPER_TX

    SET_KEYKEEPER_TX = "setKeykeeper"

    Defined in

    api/chain.ts:176


    SET_PROCESS_TX

    SET_PROCESS_TX = "setProcess"

    Defined in

    api/chain.ts:169


    SET_TRANSACTION_COSTS_TX

    SET_TRANSACTION_COSTS_TX = "setTransactionCosts"

    Defined in

    api/chain.ts:173


    VOTE_ENVELOPE

    VOTE_ENVELOPE = "vote"

    Defined in

    api/chain.ts:166

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/sdk/reference/enums/TxType.html b/sdk/reference/enums/TxType.html index 15f2fc98b..747506abf 100644 --- a/sdk/reference/enums/TxType.html +++ b/sdk/reference/enums/TxType.html @@ -12,13 +12,13 @@ - +

    TxType

    @vocdoni/sdk / Exports / TxType

    Enumeration: TxType

    Table of contents

    Enumeration Members

    Enumeration Members

    ADD_DELEGATE_FOR_ACCOUNT

    ADD_DELEGATE_FOR_ACCOUNT = 18

    Defined in

    api/chain/transactions.ts:331


    ADD_KEYKEEPER

    ADD_KEYKEEPER = 21

    Defined in

    api/chain/transactions.ts:334


    ADD_ORACLE

    ADD_ORACLE = 7

    Defined in

    api/chain/transactions.ts:320


    ADD_PROCESS_KEYS

    ADD_PROCESS_KEYS = 5

    Defined in

    api/chain/transactions.ts:318


    ADD_VALIDATOR

    ADD_VALIDATOR = 9

    Defined in

    api/chain/transactions.ts:322


    COLLECT_FAUCET

    COLLECT_FAUCET = 20

    Defined in

    api/chain/transactions.ts:333


    CREATE_ACCOUNT

    CREATE_ACCOUNT = 23

    Defined in

    api/chain/transactions.ts:336


    DELETE_KEYKEEPER

    DELETE_KEYKEEPER = 22

    Defined in

    api/chain/transactions.ts:335


    DEL_DELEGATE_FOR_ACCOUNT

    DEL_DELEGATE_FOR_ACCOUNT = 19

    Defined in

    api/chain/transactions.ts:332


    MINT_TOKENS

    MINT_TOKENS = 14

    Defined in

    api/chain/transactions.ts:327


    NEW_PROCESS

    NEW_PROCESS = 1

    Defined in

    api/chain/transactions.ts:314


    REGISTER_VOTER_KEY

    REGISTER_VOTER_KEY = 13

    Defined in

    api/chain/transactions.ts:326


    REMOVE_ORACLE

    REMOVE_ORACLE = 8

    Defined in

    api/chain/transactions.ts:321


    REMOVE_VALIDATOR

    REMOVE_VALIDATOR = 10

    Defined in

    api/chain/transactions.ts:323


    REVEAL_PROCESS_KEYS

    REVEAL_PROCESS_KEYS = 6

    Defined in

    api/chain/transactions.ts:319


    SEND_TOKENS

    SEND_TOKENS = 15

    Defined in

    api/chain/transactions.ts:328


    SET_ACCOUNT_INFO_URI

    SET_ACCOUNT_INFO_URI = 17

    Defined in

    api/chain/transactions.ts:330


    SET_PROCESS_CENSUS

    SET_PROCESS_CENSUS = 3

    Defined in

    api/chain/transactions.ts:316


    SET_PROCESS_QUESTION_INDEX

    SET_PROCESS_QUESTION_INDEX = 4

    Defined in

    api/chain/transactions.ts:317


    SET_PROCESS_RESULTS

    SET_PROCESS_RESULTS = 12

    Defined in

    api/chain/transactions.ts:325


    SET_PROCESS_STATUS

    SET_PROCESS_STATUS = 2

    Defined in

    api/chain/transactions.ts:315


    SET_TRANSACTION_COSTS

    SET_TRANSACTION_COSTS = 16

    Defined in

    api/chain/transactions.ts:329


    TX_UNKNOWN

    TX_UNKNOWN = 0

    Defined in

    api/chain/transactions.ts:313


    UNRECOGNIZED

    UNRECOGNIZED = -1

    Defined in

    api/chain/transactions.ts:337


    VOTE

    VOTE = 11

    Defined in

    api/chain/transactions.ts:324

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/sdk/reference/enums/VoteSteps.html b/sdk/reference/enums/VoteSteps.html index 1bcfd462f..4d9eb97cd 100644 --- a/sdk/reference/enums/VoteSteps.html +++ b/sdk/reference/enums/VoteSteps.html @@ -12,13 +12,13 @@ - +

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/sdk/reference/interfaces/AccountMetadata.html b/sdk/reference/interfaces/AccountMetadata.html index d3e593fc2..2e74d1584 100644 --- a/sdk/reference/interfaces/AccountMetadata.html +++ b/sdk/reference/interfaces/AccountMetadata.html @@ -12,14 +12,14 @@ - +

    AccountMetadata

    @vocdoni/sdk / Exports / AccountMetadata

    Interface: AccountMetadata

    JSON metadata. Intended to be stored on IPFS or similar. More info: https://vocdoni.io/docs/#/architecture/components/entity?id=meta

    Table of contents

    Properties

    Properties

    description

    description: MultiLanguage\<string>

    Defined in

    types/metadata/account.ts:53


    languages

    languages: string[]

    Defined in

    types/metadata/account.ts:50


    media

    media: Object

    Type declaration

    NameType
    avatarstring
    headerstring
    logostring

    Defined in

    types/metadata/account.ts:57


    meta

    Optional meta: Object

    Index signature

    [key: string]: any

    Defined in

    types/metadata/account.ts:62


    name

    name: MultiLanguage\<string>

    Defined in

    types/metadata/account.ts:52


    newsFeed

    newsFeed: MultiLanguage\<string>

    Defined in

    types/metadata/account.ts:55


    version

    version: "1.0"

    Defined in

    types/metadata/account.ts:49

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/sdk/reference/interfaces/AdminTx.html b/sdk/reference/interfaces/AdminTx.html index e30598f24..704abd59a 100644 --- a/sdk/reference/interfaces/AdminTx.html +++ b/sdk/reference/interfaces/AdminTx.html @@ -12,13 +12,13 @@ - +

    AdminTx

    @vocdoni/sdk / Exports / AdminTx

    Interface: AdminTx

    Table of contents

    Properties

    Properties

    address

    Optional address: Uint8Array

    Defined in

    api/chain/transactions.ts:92


    encryptionPrivateKey

    Optional encryptionPrivateKey: Uint8Array

    Defined in

    api/chain/transactions.ts:93


    encryptionPublicKey

    Optional encryptionPublicKey: Uint8Array

    Defined in

    api/chain/transactions.ts:94


    keyIndex

    Optional keyIndex: number

    Defined in

    api/chain/transactions.ts:95


    nonce

    nonce: number

    Defined in

    api/chain/transactions.ts:98


    power

    Optional power: number

    Defined in

    api/chain/transactions.ts:96


    processId

    processId: Uint8Array

    Defined in

    api/chain/transactions.ts:91


    publicKey

    Optional publicKey: Uint8Array

    Defined in

    api/chain/transactions.ts:97


    txtype

    txtype: TxType

    Defined in

    api/chain/transactions.ts:90

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/sdk/reference/interfaces/CircuitInputs.html b/sdk/reference/interfaces/CircuitInputs.html index 7154df9be..23dd93442 100644 --- a/sdk/reference/interfaces/CircuitInputs.html +++ b/sdk/reference/interfaces/CircuitInputs.html @@ -12,13 +12,13 @@ - +

    CircuitInputs

    @vocdoni/sdk / Exports / CircuitInputs

    Interface: CircuitInputs

    Table of contents

    Properties

    Properties

    address

    address: string

    Defined in

    services/anonymous.ts:43


    availableWeight

    availableWeight: string

    Defined in

    services/anonymous.ts:38


    censusRoot

    censusRoot: string

    Defined in

    services/anonymous.ts:41


    censusSiblings

    censusSiblings: string[]

    Defined in

    services/anonymous.ts:48


    electionId

    electionId: string[]

    Defined in

    services/anonymous.ts:36


    nullifier

    nullifier: string

    Defined in

    services/anonymous.ts:37


    password

    password: string

    Defined in

    services/anonymous.ts:44


    signature

    signature: string

    Defined in

    services/anonymous.ts:45


    sikRoot

    sikRoot: string

    Defined in

    services/anonymous.ts:40


    sikSiblings

    sikSiblings: string[]

    Defined in

    services/anonymous.ts:47


    voteHash

    voteHash: string[]

    Defined in

    services/anonymous.ts:39


    voteWeight

    voteWeight: string

    Defined in

    services/anonymous.ts:46

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/sdk/reference/interfaces/CollectFaucetTx.html b/sdk/reference/interfaces/CollectFaucetTx.html index 2c496d1d5..c03e3f58b 100644 --- a/sdk/reference/interfaces/CollectFaucetTx.html +++ b/sdk/reference/interfaces/CollectFaucetTx.html @@ -12,13 +12,13 @@ - +

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/sdk/reference/interfaces/ElectionMetadata.html b/sdk/reference/interfaces/ElectionMetadata.html index cc9e23d34..51ccc4a51 100644 --- a/sdk/reference/interfaces/ElectionMetadata.html +++ b/sdk/reference/interfaces/ElectionMetadata.html @@ -12,14 +12,14 @@ - +

    ElectionMetadata

    @vocdoni/sdk / Exports / ElectionMetadata

    Interface: ElectionMetadata

    JSON metadata. Intended to be stored on IPFS or similar. More info: https://vocdoni.io/docs/#/architecture/components/process?id=process-metadata-json

    Table of contents

    Properties

    Properties

    description

    description: MultiLanguage\<string>

    Defined in

    types/metadata/election.ts:127


    media

    media: Object

    Type declaration

    NameType
    header?string
    streamUri?string

    Defined in

    types/metadata/election.ts:128


    meta

    Optional meta: Object

    Arbitrary key/value data that specific applications can use for their own needs

    Index signature

    [key: string]: any

    Defined in

    types/metadata/election.ts:133


    questions

    questions: IQuestion[]

    Defined in

    types/metadata/election.ts:136


    title

    title: MultiLanguage\<string>

    Defined in

    types/metadata/election.ts:126


    type

    type: ElectionResultsType

    Defined in

    types/metadata/election.ts:137


    version

    version: ProtocolVersion

    Defined in

    types/metadata/election.ts:125

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/sdk/reference/interfaces/FetchElectionsParameters.html b/sdk/reference/interfaces/FetchElectionsParameters.html index cd1ec9387..eba7c9bab 100644 --- a/sdk/reference/interfaces/FetchElectionsParameters.html +++ b/sdk/reference/interfaces/FetchElectionsParameters.html @@ -12,13 +12,13 @@ - +

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/sdk/reference/interfaces/IAccount.html b/sdk/reference/interfaces/IAccount.html index 401ae085d..b42664e22 100644 --- a/sdk/reference/interfaces/IAccount.html +++ b/sdk/reference/interfaces/IAccount.html @@ -12,13 +12,13 @@ - +

    IAccount

    @vocdoni/sdk / Exports / IAccount

    Interface: IAccount

    Table of contents

    Properties

    Properties

    avatar

    Optional avatar: string

    Defined in

    types/account.ts:10


    description

    Optional description: string | MultiLanguage\<string>

    Defined in

    types/account.ts:7


    feed

    Optional feed: string | MultiLanguage\<string>

    Defined in

    types/account.ts:8


    Optional header: string

    Defined in

    types/account.ts:9


    languages

    Optional languages: string[]

    Defined in

    types/account.ts:5


    Optional logo: string

    Defined in

    types/account.ts:11


    meta

    Optional meta: { key: string ; value: any }[]

    Defined in

    types/account.ts:12


    name

    Optional name: string | MultiLanguage\<string>

    Defined in

    types/account.ts:6

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/sdk/reference/interfaces/IAccountTransfersCountResponse.html b/sdk/reference/interfaces/IAccountTransfersCountResponse.html index 7700c55c8..4cd3a1361 100644 --- a/sdk/reference/interfaces/IAccountTransfersCountResponse.html +++ b/sdk/reference/interfaces/IAccountTransfersCountResponse.html @@ -12,13 +12,13 @@ - +

    IAccountTransfersCountResponse

    @vocdoni/sdk / Exports / IAccountTransfersCountResponse

    Interface: IAccountTransfersCountResponse

    Table of contents

    Properties

    Properties

    count

    count: number

    Number of account's transfers

    Defined in

    api/account.ts:95

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/sdk/reference/interfaces/IAccountsCountResponse.html b/sdk/reference/interfaces/IAccountsCountResponse.html index 77687532a..fed554f3d 100644 --- a/sdk/reference/interfaces/IAccountsCountResponse.html +++ b/sdk/reference/interfaces/IAccountsCountResponse.html @@ -12,13 +12,13 @@ - +

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/sdk/reference/interfaces/IAccountsListResponse.html b/sdk/reference/interfaces/IAccountsListResponse.html index 765e9a22a..519886b40 100644 --- a/sdk/reference/interfaces/IAccountsListResponse.html +++ b/sdk/reference/interfaces/IAccountsListResponse.html @@ -12,13 +12,13 @@ - +

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/sdk/reference/interfaces/IApprovalElectionParameters.html b/sdk/reference/interfaces/IApprovalElectionParameters.html index 40e770754..83017cee3 100644 --- a/sdk/reference/interfaces/IApprovalElectionParameters.html +++ b/sdk/reference/interfaces/IApprovalElectionParameters.html @@ -12,7 +12,7 @@ - + @@ -22,7 +22,7 @@ Typically, this value should be equal to the size of the census. If the MaxCensusSize parameter is set to 0, an error will occur and the election cannot be created.

    If the number of votes exceeds this limit, will throw Max census size for the election is greater than allowed size error.

    Inherited from

    IElectionParameters.maxCensusSize

    Defined in

    types/election/election.ts:145


    meta

    Optional meta: any

    Metadata (anything added by the election creator)

    Inherited from

    IElectionParameters.meta

    Defined in

    types/election/election.ts:126


    questions

    Optional questions: IQuestion[]

    Inherited from

    IElectionParameters.questions

    Defined in

    types/election/election.ts:132


    startDate

    Optional startDate: string | number | Date

    Inherited from

    IElectionParameters.startDate

    Defined in

    types/election/election.ts:127


    streamUri

    Optional streamUri: string

    Election stream Uri (ex: a video url)

    Inherited from

    IElectionParameters.streamUri

    Defined in

    types/election/election.ts:122


    temporarySecretIdentity

    Optional temporarySecretIdentity: boolean

    Is used to remove the secret identities of the voters once the process is done.

    Inherited from

    IElectionParameters.temporarySecretIdentity

    Defined in

    types/election/election.ts:150


    title

    title: string | MultiLanguage\<string>

    Election title

    Inherited from

    IElectionParameters.title

    Defined in

    types/election/election.ts:110


    voteType

    Optional voteType: IVoteType

    Inherited from

    IElectionParameters.voteType

    Defined in

    types/election/election.ts:130

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/sdk/reference/interfaces/IBlockTransactionsResponse.html b/sdk/reference/interfaces/IBlockTransactionsResponse.html index 237b9f718..ab5a12250 100644 --- a/sdk/reference/interfaces/IBlockTransactionsResponse.html +++ b/sdk/reference/interfaces/IBlockTransactionsResponse.html @@ -12,13 +12,13 @@ - +

    IBlockTransactionsResponse

    @vocdoni/sdk / Exports / IBlockTransactionsResponse

    Interface: IBlockTransactionsResponse

    Table of contents

    Properties

    Properties

    blockNumber

    blockNumber: number

    Defined in

    api/chain.ts:312


    transactionCount

    transactionCount: number

    Defined in

    api/chain.ts:313


    transactions

    transactions: IChainTxReference[]

    Defined in

    api/chain.ts:314

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/sdk/reference/interfaces/IBudgetElectionParametersInfo.html b/sdk/reference/interfaces/IBudgetElectionParametersInfo.html index d0cb81a49..c29e0f36b 100644 --- a/sdk/reference/interfaces/IBudgetElectionParametersInfo.html +++ b/sdk/reference/interfaces/IBudgetElectionParametersInfo.html @@ -12,7 +12,7 @@ - + @@ -22,7 +22,7 @@ Typically, this value should be equal to the size of the census. If the MaxCensusSize parameter is set to 0, an error will occur and the election cannot be created.

    If the number of votes exceeds this limit, will throw Max census size for the election is greater than allowed size error.

    Inherited from

    IElectionParameters.maxCensusSize

    Defined in

    types/election/election.ts:145


    meta

    Optional meta: any

    Metadata (anything added by the election creator)

    Inherited from

    IElectionParameters.meta

    Defined in

    types/election/election.ts:126


    minStep

    Optional minStep: number

    Defined in

    types/election/budget.ts:8


    questions

    Optional questions: IQuestion[]

    Inherited from

    IElectionParameters.questions

    Defined in

    types/election/election.ts:132


    startDate

    Optional startDate: string | number | Date

    Inherited from

    IElectionParameters.startDate

    Defined in

    types/election/election.ts:127


    streamUri

    Optional streamUri: string

    Election stream Uri (ex: a video url)

    Inherited from

    IElectionParameters.streamUri

    Defined in

    types/election/election.ts:122


    temporarySecretIdentity

    Optional temporarySecretIdentity: boolean

    Is used to remove the secret identities of the voters once the process is done.

    Inherited from

    IElectionParameters.temporarySecretIdentity

    Defined in

    types/election/election.ts:150


    title

    title: string | MultiLanguage\<string>

    Election title

    Inherited from

    IElectionParameters.title

    Defined in

    types/election/election.ts:110


    voteType

    Optional voteType: IVoteType

    Inherited from

    IElectionParameters.voteType

    Defined in

    types/election/election.ts:130

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/sdk/reference/interfaces/IBudgetElectionParametersWithBudget.html b/sdk/reference/interfaces/IBudgetElectionParametersWithBudget.html index f346825aa..720c25ec8 100644 --- a/sdk/reference/interfaces/IBudgetElectionParametersWithBudget.html +++ b/sdk/reference/interfaces/IBudgetElectionParametersWithBudget.html @@ -12,7 +12,7 @@ - + @@ -22,7 +22,7 @@ Typically, this value should be equal to the size of the census. If the MaxCensusSize parameter is set to 0, an error will occur and the election cannot be created.

    If the number of votes exceeds this limit, will throw Max census size for the election is greater than allowed size error.

    Inherited from

    IBudgetElectionParametersInfo.maxCensusSize

    Defined in

    types/election/election.ts:145


    meta

    Optional meta: any

    Metadata (anything added by the election creator)

    Inherited from

    IBudgetElectionParametersInfo.meta

    Defined in

    types/election/election.ts:126


    minStep

    Optional minStep: number

    Inherited from

    IBudgetElectionParametersInfo.minStep

    Defined in

    types/election/budget.ts:8


    questions

    Optional questions: IQuestion[]

    Inherited from

    IBudgetElectionParametersInfo.questions

    Defined in

    types/election/election.ts:132


    startDate

    Optional startDate: string | number | Date

    Inherited from

    IBudgetElectionParametersInfo.startDate

    Defined in

    types/election/election.ts:127


    streamUri

    Optional streamUri: string

    Election stream Uri (ex: a video url)

    Inherited from

    IBudgetElectionParametersInfo.streamUri

    Defined in

    types/election/election.ts:122


    temporarySecretIdentity

    Optional temporarySecretIdentity: boolean

    Is used to remove the secret identities of the voters once the process is done.

    Inherited from

    IBudgetElectionParametersInfo.temporarySecretIdentity

    Defined in

    types/election/election.ts:150


    title

    title: string | MultiLanguage\<string>

    Election title

    Inherited from

    IBudgetElectionParametersInfo.title

    Defined in

    types/election/election.ts:110


    useCensusWeightAsBudget

    useCensusWeightAsBudget: false

    Defined in

    types/election/budget.ts:17


    voteType

    Optional voteType: IVoteType

    Inherited from

    IBudgetElectionParametersInfo.voteType

    Defined in

    types/election/election.ts:130

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/sdk/reference/interfaces/IBudgetElectionParametersWithCensusWeight.html b/sdk/reference/interfaces/IBudgetElectionParametersWithCensusWeight.html index c1026feae..edc6b60ab 100644 --- a/sdk/reference/interfaces/IBudgetElectionParametersWithCensusWeight.html +++ b/sdk/reference/interfaces/IBudgetElectionParametersWithCensusWeight.html @@ -12,7 +12,7 @@ - + @@ -22,7 +22,7 @@ Typically, this value should be equal to the size of the census. If the MaxCensusSize parameter is set to 0, an error will occur and the election cannot be created.

    If the number of votes exceeds this limit, will throw Max census size for the election is greater than allowed size error.

    Inherited from

    IBudgetElectionParametersInfo.maxCensusSize

    Defined in

    types/election/election.ts:145


    meta

    Optional meta: any

    Metadata (anything added by the election creator)

    Inherited from

    IBudgetElectionParametersInfo.meta

    Defined in

    types/election/election.ts:126


    minStep

    Optional minStep: number

    Inherited from

    IBudgetElectionParametersInfo.minStep

    Defined in

    types/election/budget.ts:8


    questions

    Optional questions: IQuestion[]

    Inherited from

    IBudgetElectionParametersInfo.questions

    Defined in

    types/election/election.ts:132


    startDate

    Optional startDate: string | number | Date

    Inherited from

    IBudgetElectionParametersInfo.startDate

    Defined in

    types/election/election.ts:127


    streamUri

    Optional streamUri: string

    Election stream Uri (ex: a video url)

    Inherited from

    IBudgetElectionParametersInfo.streamUri

    Defined in

    types/election/election.ts:122


    temporarySecretIdentity

    Optional temporarySecretIdentity: boolean

    Is used to remove the secret identities of the voters once the process is done.

    Inherited from

    IBudgetElectionParametersInfo.temporarySecretIdentity

    Defined in

    types/election/election.ts:150


    title

    title: string | MultiLanguage\<string>

    Election title

    Inherited from

    IBudgetElectionParametersInfo.title

    Defined in

    types/election/election.ts:110


    useCensusWeightAsBudget

    useCensusWeightAsBudget: true

    Defined in

    types/election/budget.ts:13


    voteType

    Optional voteType: IVoteType

    Inherited from

    IBudgetElectionParametersInfo.voteType

    Defined in

    types/election/election.ts:130

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/sdk/reference/interfaces/ICensus.html b/sdk/reference/interfaces/ICensus.html index ef3e5c06a..78808baff 100644 --- a/sdk/reference/interfaces/ICensus.html +++ b/sdk/reference/interfaces/ICensus.html @@ -12,13 +12,13 @@ - +

    ICensus

    @vocdoni/sdk / Exports / ICensus

    Interface: ICensus

    Table of contents

    Properties

    Properties

    censusOrigin

    censusOrigin: CensusTypeEnum

    The type of the census

    Defined in

    api/election.ts:21


    censusRoot

    censusRoot: string

    The root of the census

    Defined in

    api/election.ts:26


    censusURL

    censusURL: string

    The URL of the census

    Defined in

    api/election.ts:36


    maxCensusSize

    maxCensusSize: number

    Max size of the census. How many voters the census can have.

    Defined in

    api/election.ts:41


    postRegisterCensusRoot

    postRegisterCensusRoot: string

    The post register root of the census

    Defined in

    api/election.ts:31

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/sdk/reference/interfaces/ICensus3CensusListResponse.html b/sdk/reference/interfaces/ICensus3CensusListResponse.html index 1a7b78e3c..649cff880 100644 --- a/sdk/reference/interfaces/ICensus3CensusListResponse.html +++ b/sdk/reference/interfaces/ICensus3CensusListResponse.html @@ -12,13 +12,13 @@ - +

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/sdk/reference/interfaces/ICensus3CensusQueueResponse.html b/sdk/reference/interfaces/ICensus3CensusQueueResponse.html index f46827d3c..4d870a550 100644 --- a/sdk/reference/interfaces/ICensus3CensusQueueResponse.html +++ b/sdk/reference/interfaces/ICensus3CensusQueueResponse.html @@ -12,13 +12,13 @@ - +

    ICensus3CensusQueueResponse

    @vocdoni/sdk / Exports / ICensus3CensusQueueResponse

    Interface: ICensus3CensusQueueResponse

    Table of contents

    Properties

    Properties

    data

    data: ICensus3CensusResponse

    The census data

    Defined in

    api/census3/census.ts:84


    done

    done: boolean

    If the queue has been done

    Defined in

    api/census3/census.ts:64


    error

    error: Object

    The error of the queue

    Type declaration

    NameTypeDescription
    codenumberThe code of the error
    errorstringThe string of the error

    Defined in

    api/census3/census.ts:69


    progress

    progress: number

    The creation progress

    Defined in

    api/census3/census.ts:89

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/sdk/reference/interfaces/ICensus3CensusResponse.html b/sdk/reference/interfaces/ICensus3CensusResponse.html index 16f33930e..94ee95692 100644 --- a/sdk/reference/interfaces/ICensus3CensusResponse.html +++ b/sdk/reference/interfaces/ICensus3CensusResponse.html @@ -12,13 +12,13 @@ - +

    ICensus3CensusResponse

    @vocdoni/sdk / Exports / ICensus3CensusResponse

    Interface: ICensus3CensusResponse

    Table of contents

    Properties

    Properties

    ID

    ID: number

    The identifier of the census

    Defined in

    api/census3/census.ts:22


    accuracy

    accuracy: number

    The accuracy for an anonymous census

    Defined in

    api/census3/census.ts:57


    anonymous

    anonymous: boolean

    If the census is anonymous or not

    Defined in

    api/census3/census.ts:52


    merkleRoot

    merkleRoot: string

    The root of the census

    Defined in

    api/census3/census.ts:32


    size

    size: number

    The size of the census (number of token holders)

    Defined in

    api/census3/census.ts:42


    strategyID

    strategyID: number

    The identifier of the strategy of the built census

    Defined in

    api/census3/census.ts:27


    uri

    uri: string

    The URI of the census

    Defined in

    api/census3/census.ts:37


    weight

    weight: string

    The weight of the census (weight of all token holders)

    Defined in

    api/census3/census.ts:47

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/sdk/reference/interfaces/ICensus3ServiceInfoResponse.html b/sdk/reference/interfaces/ICensus3ServiceInfoResponse.html index b0e3e4d21..9bff3f378 100644 --- a/sdk/reference/interfaces/ICensus3ServiceInfoResponse.html +++ b/sdk/reference/interfaces/ICensus3ServiceInfoResponse.html @@ -12,13 +12,13 @@ - +

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/sdk/reference/interfaces/ICensus3StrategiesListResponse.html b/sdk/reference/interfaces/ICensus3StrategiesListResponse.html index 94ffd2216..5a420c45c 100644 --- a/sdk/reference/interfaces/ICensus3StrategiesListResponse.html +++ b/sdk/reference/interfaces/ICensus3StrategiesListResponse.html @@ -12,13 +12,13 @@ - +

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/sdk/reference/interfaces/ICensus3StrategiesListResponsePaginated.html b/sdk/reference/interfaces/ICensus3StrategiesListResponsePaginated.html index d33ff9645..b0d295c04 100644 --- a/sdk/reference/interfaces/ICensus3StrategiesListResponsePaginated.html +++ b/sdk/reference/interfaces/ICensus3StrategiesListResponsePaginated.html @@ -12,13 +12,13 @@ - +

    ICensus3StrategiesListResponsePaginated

    @vocdoni/sdk / Exports / ICensus3StrategiesListResponsePaginated

    Interface: ICensus3StrategiesListResponsePaginated

    Hierarchy

    Table of contents

    Properties

    Properties

    pagination

    pagination: Census3Pagination

    The pagination information

    Defined in

    api/census3/strategy.ts:29


    strategies

    strategies: Census3Strategy[]

    The list of the strategies identifiers

    Inherited from

    ICensus3StrategiesListResponse.strategies

    Defined in

    api/census3/strategy.ts:22

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/sdk/reference/interfaces/ICensus3StrategiesOperator.html b/sdk/reference/interfaces/ICensus3StrategiesOperator.html index 7224ea849..ab17aa8ea 100644 --- a/sdk/reference/interfaces/ICensus3StrategiesOperator.html +++ b/sdk/reference/interfaces/ICensus3StrategiesOperator.html @@ -12,13 +12,13 @@ - +

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/sdk/reference/interfaces/ICensus3StrategiesOperatorsResponse.html b/sdk/reference/interfaces/ICensus3StrategiesOperatorsResponse.html index 012e594c3..7410dae0e 100644 --- a/sdk/reference/interfaces/ICensus3StrategiesOperatorsResponse.html +++ b/sdk/reference/interfaces/ICensus3StrategiesOperatorsResponse.html @@ -12,13 +12,13 @@ - +

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/sdk/reference/interfaces/ICensus3StrategyCreateResponse.html b/sdk/reference/interfaces/ICensus3StrategyCreateResponse.html index f70c63cc1..5663284bd 100644 --- a/sdk/reference/interfaces/ICensus3StrategyCreateResponse.html +++ b/sdk/reference/interfaces/ICensus3StrategyCreateResponse.html @@ -12,13 +12,13 @@ - +

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/sdk/reference/interfaces/ICensus3StrategyEstimationQueueResponse.html b/sdk/reference/interfaces/ICensus3StrategyEstimationQueueResponse.html index 31898e33a..19dd3ef28 100644 --- a/sdk/reference/interfaces/ICensus3StrategyEstimationQueueResponse.html +++ b/sdk/reference/interfaces/ICensus3StrategyEstimationQueueResponse.html @@ -12,13 +12,13 @@ - +

    ICensus3StrategyEstimationQueueResponse

    @vocdoni/sdk / Exports / ICensus3StrategyEstimationQueueResponse

    Interface: ICensus3StrategyEstimationQueueResponse

    Table of contents

    Properties

    Properties

    data

    data: Object

    The estimation data of the strategy

    Type declaration

    NameTypeDescription
    accuracynumberThe accuracy for an anonymous census
    sizenumberThe estimation of the size
    timeToCreateCensusnumberThe estimation of the time to create the census

    Defined in

    api/census3/strategy.ts:126


    done

    done: boolean

    If the queue has been done

    Defined in

    api/census3/strategy.ts:106


    error

    error: Object

    The error of the queue

    Type declaration

    NameTypeDescription
    codenumberThe code of the error
    errorstringThe string of the error

    Defined in

    api/census3/strategy.ts:111


    progress

    progress: number

    The estimation progress

    Defined in

    api/census3/strategy.ts:146

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/sdk/reference/interfaces/ICensus3StrategyHoldersResponse.html b/sdk/reference/interfaces/ICensus3StrategyHoldersResponse.html index 2dfc90a36..290e53d18 100644 --- a/sdk/reference/interfaces/ICensus3StrategyHoldersResponse.html +++ b/sdk/reference/interfaces/ICensus3StrategyHoldersResponse.html @@ -12,13 +12,13 @@ - +

    ICensus3StrategyHoldersResponse

    @vocdoni/sdk / Exports / ICensus3StrategyHoldersResponse

    Interface: ICensus3StrategyHoldersResponse

    Hierarchy

    Table of contents

    Properties

    Properties

    holders

    holders: Object

    The list of the strategy holders

    Index signature

    [key: string]: string

    Defined in

    api/census3/strategy.ts:36

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/sdk/reference/interfaces/ICensus3StrategyHoldersResponsePaginated.html b/sdk/reference/interfaces/ICensus3StrategyHoldersResponsePaginated.html index 8c6316c2d..9e275274b 100644 --- a/sdk/reference/interfaces/ICensus3StrategyHoldersResponsePaginated.html +++ b/sdk/reference/interfaces/ICensus3StrategyHoldersResponsePaginated.html @@ -12,13 +12,13 @@ - +

    ICensus3StrategyHoldersResponsePaginated

    @vocdoni/sdk / Exports / ICensus3StrategyHoldersResponsePaginated

    Interface: ICensus3StrategyHoldersResponsePaginated

    Hierarchy

    Table of contents

    Properties

    Properties

    holders

    holders: Object

    The list of the strategy holders

    Index signature

    [key: string]: string

    Inherited from

    ICensus3StrategyHoldersResponse.holders

    Defined in

    api/census3/strategy.ts:36


    pagination

    pagination: Census3Pagination

    The pagination information

    Defined in

    api/census3/strategy.ts:43

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/sdk/reference/interfaces/ICensus3StrategyImportQueueResponse.html b/sdk/reference/interfaces/ICensus3StrategyImportQueueResponse.html index c62d00bd2..af0f293b1 100644 --- a/sdk/reference/interfaces/ICensus3StrategyImportQueueResponse.html +++ b/sdk/reference/interfaces/ICensus3StrategyImportQueueResponse.html @@ -12,13 +12,13 @@ - +

    ICensus3StrategyImportQueueResponse

    @vocdoni/sdk / Exports / ICensus3StrategyImportQueueResponse

    Interface: ICensus3StrategyImportQueueResponse

    Table of contents

    Properties

    Properties

    data

    data: Census3Strategy

    The imported data strategy

    Defined in

    api/census3/strategy.ts:173


    done

    done: boolean

    If the queue has been done

    Defined in

    api/census3/strategy.ts:153


    error

    error: Object

    The error of the queue

    Type declaration

    NameTypeDescription
    codenumberThe code of the error
    errorstringThe string of the error

    Defined in

    api/census3/strategy.ts:158


    progress

    progress: number

    The importing progress

    Defined in

    api/census3/strategy.ts:178

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/sdk/reference/interfaces/ICensus3StrategyToken.html b/sdk/reference/interfaces/ICensus3StrategyToken.html index 0fa1f8742..741642335 100644 --- a/sdk/reference/interfaces/ICensus3StrategyToken.html +++ b/sdk/reference/interfaces/ICensus3StrategyToken.html @@ -12,13 +12,13 @@ - +

    ICensus3StrategyToken

    @vocdoni/sdk / Exports / ICensus3StrategyToken

    Interface: ICensus3StrategyToken

    Table of contents

    Properties

    Properties

    id

    id: string

    The id (address) of the token.

    Defined in

    api/census3/strategy.ts:185


    method

    method: string

    The method used for checking balances.

    Defined in

    api/census3/strategy.ts:200


    minBalance

    minBalance: string

    The minimum balance.

    Defined in

    api/census3/strategy.ts:195


    name

    name: string

    The name of the token.

    Defined in

    api/census3/strategy.ts:190

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/sdk/reference/interfaces/ICensus3SupportedChain.html b/sdk/reference/interfaces/ICensus3SupportedChain.html index b7c6487cf..a85b055ea 100644 --- a/sdk/reference/interfaces/ICensus3SupportedChain.html +++ b/sdk/reference/interfaces/ICensus3SupportedChain.html @@ -12,13 +12,13 @@ - +

    ICensus3SupportedChain

    @vocdoni/sdk / Exports / ICensus3SupportedChain

    Interface: ICensus3SupportedChain

    Table of contents

    Properties

    Properties

    chainID

    chainID: number

    The identifier of the chain

    Defined in

    api/census3/service.ts:12


    name

    name: string

    The name of the chain

    Defined in

    api/census3/service.ts:22


    shortName

    shortName: string

    The short name of the chain

    Defined in

    api/census3/service.ts:17

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/sdk/reference/interfaces/ICensus3TokenHolderResponse.html b/sdk/reference/interfaces/ICensus3TokenHolderResponse.html index c353b4ba2..05179bb57 100644 --- a/sdk/reference/interfaces/ICensus3TokenHolderResponse.html +++ b/sdk/reference/interfaces/ICensus3TokenHolderResponse.html @@ -12,13 +12,13 @@ - +

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/sdk/reference/interfaces/ICensus3TokenListResponse.html b/sdk/reference/interfaces/ICensus3TokenListResponse.html index b8807cd24..478913f5f 100644 --- a/sdk/reference/interfaces/ICensus3TokenListResponse.html +++ b/sdk/reference/interfaces/ICensus3TokenListResponse.html @@ -12,13 +12,13 @@ - +

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/sdk/reference/interfaces/ICensus3TokenListResponsePaginated.html b/sdk/reference/interfaces/ICensus3TokenListResponsePaginated.html index 49b665199..c03142f04 100644 --- a/sdk/reference/interfaces/ICensus3TokenListResponsePaginated.html +++ b/sdk/reference/interfaces/ICensus3TokenListResponsePaginated.html @@ -12,13 +12,13 @@ - +

    ICensus3TokenListResponsePaginated

    @vocdoni/sdk / Exports / ICensus3TokenListResponsePaginated

    Interface: ICensus3TokenListResponsePaginated

    Hierarchy

    Table of contents

    Properties

    Properties

    pagination

    pagination: Census3Pagination

    The pagination information

    Defined in

    api/census3/token.ts:124


    tokens

    tokens: Census3SummaryToken[]

    The list of the tokens

    Inherited from

    ICensus3TokenListResponse.tokens

    Defined in

    api/census3/token.ts:110

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/sdk/reference/interfaces/ICensus3TokenTypesResponse.html b/sdk/reference/interfaces/ICensus3TokenTypesResponse.html index 7d95aea4d..f64beeffb 100644 --- a/sdk/reference/interfaces/ICensus3TokenTypesResponse.html +++ b/sdk/reference/interfaces/ICensus3TokenTypesResponse.html @@ -12,13 +12,13 @@ - +

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/sdk/reference/interfaces/ICensus3ValidatePredicateChild.html b/sdk/reference/interfaces/ICensus3ValidatePredicateChild.html index 7d1a93131..26f9b975c 100644 --- a/sdk/reference/interfaces/ICensus3ValidatePredicateChild.html +++ b/sdk/reference/interfaces/ICensus3ValidatePredicateChild.html @@ -12,13 +12,13 @@ - +

    ICensus3ValidatePredicateChild

    @vocdoni/sdk / Exports / ICensus3ValidatePredicateChild

    Interface: ICensus3ValidatePredicateChild

    Table of contents

    Properties

    Properties

    operator

    operator: string

    The operator used in the predicate

    Defined in

    api/census3/strategy.ts:221


    tokens

    tokens: (ICensus3ValidatePredicateToken | ICensus3ValidatePredicateChild)[]

    The list of tokens of the predicate

    Defined in

    api/census3/strategy.ts:226

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/sdk/reference/interfaces/ICensus3ValidatePredicateResponse.html b/sdk/reference/interfaces/ICensus3ValidatePredicateResponse.html index c2434bb9e..0f778996b 100644 --- a/sdk/reference/interfaces/ICensus3ValidatePredicateResponse.html +++ b/sdk/reference/interfaces/ICensus3ValidatePredicateResponse.html @@ -12,13 +12,13 @@ - +

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/sdk/reference/interfaces/ICensus3ValidatePredicateToken.html b/sdk/reference/interfaces/ICensus3ValidatePredicateToken.html index 1bdacd520..76eaa2b06 100644 --- a/sdk/reference/interfaces/ICensus3ValidatePredicateToken.html +++ b/sdk/reference/interfaces/ICensus3ValidatePredicateToken.html @@ -12,13 +12,13 @@ - +

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/sdk/reference/interfaces/ICensusExportResponse.html b/sdk/reference/interfaces/ICensusExportResponse.html index afdf23e0a..c902d43a0 100644 --- a/sdk/reference/interfaces/ICensusExportResponse.html +++ b/sdk/reference/interfaces/ICensusExportResponse.html @@ -12,13 +12,13 @@ - +

    ICensusExportResponse

    @vocdoni/sdk / Exports / ICensusExportResponse

    Interface: ICensusExportResponse

    Table of contents

    Properties

    Properties

    data

    data: string

    The data of the census

    Defined in

    api/census.ts:54


    maxLevels

    maxLevels: number

    The max levels of the census

    Defined in

    api/census.ts:59


    rootHash

    rootHash: string

    The root hash of the census

    Defined in

    api/census.ts:49


    type

    type: number

    The type of the census

    Defined in

    api/census.ts:44

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/sdk/reference/interfaces/ICensusImportResponse.html b/sdk/reference/interfaces/ICensusImportResponse.html index f464858d4..100872f08 100644 --- a/sdk/reference/interfaces/ICensusImportResponse.html +++ b/sdk/reference/interfaces/ICensusImportResponse.html @@ -12,13 +12,13 @@ - +

    ICensusImportResponse

    @vocdoni/sdk / Exports / ICensusImportResponse

    Interface: ICensusImportResponse

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/sdk/reference/interfaces/ICensusParticipant.html b/sdk/reference/interfaces/ICensusParticipant.html index 7965f3a68..aec178268 100644 --- a/sdk/reference/interfaces/ICensusParticipant.html +++ b/sdk/reference/interfaces/ICensusParticipant.html @@ -12,13 +12,13 @@ - +

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/sdk/reference/interfaces/ICensusProofResponse.html b/sdk/reference/interfaces/ICensusProofResponse.html index 42cc155b6..6303f9f9a 100644 --- a/sdk/reference/interfaces/ICensusProofResponse.html +++ b/sdk/reference/interfaces/ICensusProofResponse.html @@ -12,13 +12,13 @@ - +

    ICensusProofResponse

    @vocdoni/sdk / Exports / ICensusProofResponse

    Interface: ICensusProofResponse

    Table of contents

    Properties

    Properties

    censusProof

    censusProof: string

    The proof for the given key

    Defined in

    api/census.ts:83


    censusRoot

    censusRoot: string

    The root (id) of the census

    Defined in

    api/census.ts:78


    censusSiblings

    Optional censusSiblings: string[]

    The census siblings

    Defined in

    api/census.ts:93


    type

    type: CensusType

    The type of the census

    Defined in

    api/census.ts:68


    value

    value: string

    The value for the given key

    Defined in

    api/census.ts:88


    weight

    weight: string

    The weight as a string

    Defined in

    api/census.ts:73

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/sdk/reference/interfaces/ICensusPublishResponse.html b/sdk/reference/interfaces/ICensusPublishResponse.html index b1f9c450e..f738165de 100644 --- a/sdk/reference/interfaces/ICensusPublishResponse.html +++ b/sdk/reference/interfaces/ICensusPublishResponse.html @@ -12,13 +12,13 @@ - +

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/sdk/reference/interfaces/IChainBlockInfoResponse.html b/sdk/reference/interfaces/IChainBlockInfoResponse.html index 6c5af6a22..b256c10a1 100644 --- a/sdk/reference/interfaces/IChainBlockInfoResponse.html +++ b/sdk/reference/interfaces/IChainBlockInfoResponse.html @@ -12,13 +12,13 @@ - +

    IChainBlockInfoResponse

    @vocdoni/sdk / Exports / IChainBlockInfoResponse

    Interface: IChainBlockInfoResponse

    Table of contents

    Properties

    Properties

    data

    data: Object

    Type declaration

    NameType
    txsstring[]

    Defined in

    api/chain.ts:272


    evidence

    evidence: Object

    Type declaration

    NameType
    evidencestring[]

    Defined in

    api/chain.ts:275


    hash

    hash: string

    Defined in

    api/chain.ts:278


    header: Object

    Type declaration

    NameType
    appHashstring
    chainIdstring
    consensusHashstring
    dataHashstring
    evidenceHashstring
    heightnumber
    lastBlockIdBlockID
    lastCommitHashstring
    lastResultsHashstring
    nextValidatorsHashstring
    proposerAddressstring
    timestring
    validatorsHashstring
    version{ app: number ; block: number }
    version.appnumber
    version.blocknumber

    Defined in

    api/chain.ts:279


    lastCommit

    lastCommit: Object

    Type declaration

    NameType
    blockIdBlockID
    heightnumber
    roundnumber
    signatures{ blockIdFlag: number ; signature: string ; timestamp: string ; validatorAddress: string }[]

    Defined in

    api/chain.ts:298

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/sdk/reference/interfaces/IChainGetCircuitResponse.html b/sdk/reference/interfaces/IChainGetCircuitResponse.html index 4d0a89dcb..8b88a7090 100644 --- a/sdk/reference/interfaces/IChainGetCircuitResponse.html +++ b/sdk/reference/interfaces/IChainGetCircuitResponse.html @@ -12,13 +12,13 @@ - +

    IChainGetCircuitResponse

    @vocdoni/sdk / Exports / IChainGetCircuitResponse

    Interface: IChainGetCircuitResponse

    Table of contents

    Properties

    Properties

    circuitPath

    circuitPath: string

    The path of the circuit.

    Defined in

    api/chain.ts:127


    levels

    levels: number

    The circuit levels.

    Defined in

    api/chain.ts:132


    uri

    uri: string

    The base uri of the files.

    Defined in

    api/chain.ts:122


    vKeyFilename

    vKeyFilename: string

    The name of the verification key file.

    Defined in

    api/chain.ts:152


    vKeyHash

    vKeyHash: string

    The hash of the verification key file.

    Defined in

    api/chain.ts:147


    wasmFilename

    wasmFilename: string

    The name of the WASM file.

    Defined in

    api/chain.ts:162


    wasmHash

    wasmHash: string

    The hash of the WASM file.

    Defined in

    api/chain.ts:157


    zKeyFilename

    zKeyFilename: string

    The name of the proving key file.

    Defined in

    api/chain.ts:142


    zKeyHash

    zKeyHash: string

    The hash of the proving key file.

    Defined in

    api/chain.ts:137

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/sdk/reference/interfaces/IChainGetCostsResponse.html b/sdk/reference/interfaces/IChainGetCostsResponse.html index d4952503c..39831b573 100644 --- a/sdk/reference/interfaces/IChainGetCostsResponse.html +++ b/sdk/reference/interfaces/IChainGetCostsResponse.html @@ -12,13 +12,13 @@ - +

    IChainGetCostsResponse

    @vocdoni/sdk / Exports / IChainGetCostsResponse

    Interface: IChainGetCostsResponse

    Table of contents

    Properties

    Properties

    basePrice

    basePrice: number

    The base price.

    Defined in

    api/chain.ts:97


    capacity

    capacity: number

    The capacity of the chain.

    Defined in

    api/chain.ts:102


    factors

    factors: Object

    The factors.

    Type declaration

    NameType
    k1number
    k2number
    k3number
    k4number
    k5number
    k6number
    k7number

    Defined in

    api/chain.ts:107

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/sdk/reference/interfaces/IChainGetInfoResponse.html b/sdk/reference/interfaces/IChainGetInfoResponse.html index e26bfc4e3..2654e1398 100644 --- a/sdk/reference/interfaces/IChainGetInfoResponse.html +++ b/sdk/reference/interfaces/IChainGetInfoResponse.html @@ -12,13 +12,13 @@ - +

    IChainGetInfoResponse

    @vocdoni/sdk / Exports / IChainGetInfoResponse

    Interface: IChainGetInfoResponse

    Table of contents

    Properties

    Properties

    blockTime

    blockTime: number[]

    The different block times from the chain.

    Defined in

    api/chain.ts:35


    blockTimestamp

    blockTimestamp: number

    The timestamp of the actual block.

    Defined in

    api/chain.ts:65


    chainId

    chainId: string

    The id of the current chain

    Defined in

    api/chain.ts:30


    circuitConfigurationTag

    circuitConfigurationTag: string

    The circuit configuration tag.

    Defined in

    api/chain.ts:85


    electionCount

    electionCount: number

    The number of elections existing on the Vochain.

    Defined in

    api/chain.ts:40


    genesisTime

    genesisTime: string

    The time of the genesis block.

    Defined in

    api/chain.ts:50


    height

    height: number

    The height or actual block of the current chain.

    Defined in

    api/chain.ts:55


    maxCensusSize

    maxCensusSize: number

    The maximum size of a census.

    Defined in

    api/chain.ts:90


    organizationCount

    organizationCount: number

    The number of organizations existing on the Vochain.

    Defined in

    api/chain.ts:45


    syncing

    syncing: boolean

    Whether the blockchain is syncing.

    Defined in

    api/chain.ts:60


    transactionCount

    transactionCount: number

    The number of transactions.

    Defined in

    api/chain.ts:70


    validatorCount

    validatorCount: number

    The number of validators.

    Defined in

    api/chain.ts:75


    voteCount

    voteCount: number

    The number of votes.

    Defined in

    api/chain.ts:80

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/sdk/reference/interfaces/IChainOrganizationCountResponse.html b/sdk/reference/interfaces/IChainOrganizationCountResponse.html index 7b24210c0..fe3e82594 100644 --- a/sdk/reference/interfaces/IChainOrganizationCountResponse.html +++ b/sdk/reference/interfaces/IChainOrganizationCountResponse.html @@ -12,13 +12,13 @@ - +

    IChainOrganizationCountResponse

    @vocdoni/sdk / Exports / IChainOrganizationCountResponse

    Interface: IChainOrganizationCountResponse

    Table of contents

    Properties

    Properties

    count

    count: number

    The number of organizations

    Defined in

    api/chain.ts:241

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/sdk/reference/interfaces/IChainOrganizationListResponse.html b/sdk/reference/interfaces/IChainOrganizationListResponse.html index 9ad69670a..18cff51db 100644 --- a/sdk/reference/interfaces/IChainOrganizationListResponse.html +++ b/sdk/reference/interfaces/IChainOrganizationListResponse.html @@ -12,13 +12,13 @@ - +

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/sdk/reference/interfaces/IChainOrganizationResponse.html b/sdk/reference/interfaces/IChainOrganizationResponse.html index 7f23dce66..b7891968c 100644 --- a/sdk/reference/interfaces/IChainOrganizationResponse.html +++ b/sdk/reference/interfaces/IChainOrganizationResponse.html @@ -12,13 +12,13 @@ - +

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/sdk/reference/interfaces/IChainSubmitTxResponse.html b/sdk/reference/interfaces/IChainSubmitTxResponse.html index 936675e8a..e730c6f50 100644 --- a/sdk/reference/interfaces/IChainSubmitTxResponse.html +++ b/sdk/reference/interfaces/IChainSubmitTxResponse.html @@ -12,13 +12,13 @@ - +

    IChainSubmitTxResponse

    @vocdoni/sdk / Exports / IChainSubmitTxResponse

    Interface: IChainSubmitTxResponse

    Table of contents

    Properties

    Properties

    code

    code: number

    The response code

    Defined in

    api/chain.ts:227


    hash

    hash: string

    The hash of the transaction

    Defined in

    api/chain.ts:217


    response

    response: string

    The response data (can vary depending on the transaction type)

    Defined in

    api/chain.ts:222

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/sdk/reference/interfaces/IChainTxCountResponse.html b/sdk/reference/interfaces/IChainTxCountResponse.html index 7a10369c0..479d03ca6 100644 --- a/sdk/reference/interfaces/IChainTxCountResponse.html +++ b/sdk/reference/interfaces/IChainTxCountResponse.html @@ -12,13 +12,13 @@ - +

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/sdk/reference/interfaces/IChainTxListResponse.html b/sdk/reference/interfaces/IChainTxListResponse.html index 0a8aa82f4..6f32b8ec6 100644 --- a/sdk/reference/interfaces/IChainTxListResponse.html +++ b/sdk/reference/interfaces/IChainTxListResponse.html @@ -12,13 +12,13 @@ - +

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/sdk/reference/interfaces/IChainTxReference.html b/sdk/reference/interfaces/IChainTxReference.html index 07456cfbd..f4455ce57 100644 --- a/sdk/reference/interfaces/IChainTxReference.html +++ b/sdk/reference/interfaces/IChainTxReference.html @@ -12,13 +12,13 @@ - +

    IChainTxReference

    @vocdoni/sdk / Exports / IChainTxReference

    Interface: IChainTxReference

    Table of contents

    Properties

    Properties

    blockHeight

    blockHeight: number

    The number of the block where the transaction is.

    Defined in

    api/chain.ts:193


    transactionHash

    transactionHash: string

    The hash of the transaction.

    Defined in

    api/chain.ts:188


    transactionIndex

    transactionIndex: number

    The index of the transaction inside the block.

    Defined in

    api/chain.ts:198


    transactionNumber

    transactionNumber: number

    The number of the transaction.

    Defined in

    api/chain.ts:183


    transactionType

    transactionType: TransactionType

    The type of the transaction.

    Defined in

    api/chain.ts:203

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/sdk/reference/interfaces/IChainValidator.html b/sdk/reference/interfaces/IChainValidator.html index ee93754ee..685c86b24 100644 --- a/sdk/reference/interfaces/IChainValidator.html +++ b/sdk/reference/interfaces/IChainValidator.html @@ -12,13 +12,13 @@ - +

    IChainValidator

    @vocdoni/sdk / Exports / IChainValidator

    Interface: IChainValidator

    Table of contents

    Properties

    Properties

    address

    address: string

    Validator address

    Defined in

    api/chain.ts:339


    name

    name: string

    Validator name reference. Could be empty.

    Defined in

    api/chain.ts:344


    power

    power: number

    Current power of the validator

    Defined in

    api/chain.ts:329


    pubKey

    pubKey: string

    Validator public key

    Defined in

    api/chain.ts:334

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/sdk/reference/interfaces/IChainValidatorsListResponse.html b/sdk/reference/interfaces/IChainValidatorsListResponse.html index 92215d4e3..61945322a 100644 --- a/sdk/reference/interfaces/IChainValidatorsListResponse.html +++ b/sdk/reference/interfaces/IChainValidatorsListResponse.html @@ -12,13 +12,13 @@ - +

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/sdk/reference/interfaces/IChoice.html b/sdk/reference/interfaces/IChoice.html index de44b1520..a29d08969 100644 --- a/sdk/reference/interfaces/IChoice.html +++ b/sdk/reference/interfaces/IChoice.html @@ -12,13 +12,13 @@ - +

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/sdk/reference/interfaces/IElectionCreateResponse.html b/sdk/reference/interfaces/IElectionCreateResponse.html index aa1b51996..0d850f852 100644 --- a/sdk/reference/interfaces/IElectionCreateResponse.html +++ b/sdk/reference/interfaces/IElectionCreateResponse.html @@ -12,13 +12,13 @@ - +

    IElectionCreateResponse

    @vocdoni/sdk / Exports / IElectionCreateResponse

    Interface: IElectionCreateResponse

    Table of contents

    Properties

    Properties

    electionID

    electionID: string

    The election identifier

    Defined in

    api/election.ts:134


    metadataURL

    metadataURL: number

    The metadata URL

    Defined in

    api/election.ts:139


    txHash

    txHash: string

    The hash of the transaction

    Defined in

    api/election.ts:129

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/sdk/reference/interfaces/IElectionInfoResponse.html b/sdk/reference/interfaces/IElectionInfoResponse.html index 0c065161b..320c5583b 100644 --- a/sdk/reference/interfaces/IElectionInfoResponse.html +++ b/sdk/reference/interfaces/IElectionInfoResponse.html @@ -12,13 +12,13 @@ - +

    IElectionInfoResponse

    @vocdoni/sdk / Exports / IElectionInfoResponse

    Interface: IElectionInfoResponse

    Table of contents

    Properties

    Properties

    census

    census: ICensus

    The census of the election

    Defined in

    api/election.ts:220


    chainId

    chainId: string

    The chain identifier of the election

    Defined in

    api/election.ts:215


    creationTime

    creationTime: string

    The date of creation of the election

    Defined in

    api/election.ts:230


    electionId

    electionId: string

    The id of the election

    Defined in

    api/election.ts:165


    electionMode

    electionMode: IElectionMode

    The election mode of the election

    Defined in

    api/election.ts:240


    endDate

    endDate: string

    The end date of the election

    Defined in

    api/election.ts:185


    finalResults

    finalResults: boolean

    If the election has the final results

    Defined in

    api/election.ts:195


    fromArchive

    fromArchive: boolean

    If the election comes from the archive

    Defined in

    api/election.ts:210


    manuallyEnded

    manuallyEnded: boolean

    If the election has been ended manually

    Defined in

    api/election.ts:205


    metadata

    metadata: ElectionMetadata

    The metadata of the election

    Defined in

    api/election.ts:250


    metadataURL

    metadataURL: string

    The URL of the metadata

    Defined in

    api/election.ts:225


    organizationId

    organizationId: string

    The id of the organization that created the election

    Defined in

    api/election.ts:170


    result

    Optional result: string[][]

    The result of the election

    Defined in

    api/election.ts:200


    startDate

    startDate: string

    The start date of the election

    Defined in

    api/election.ts:180


    status

    status: PROCESS_UNKNOWN | ENDED | CANCELED | PAUSED | RESULTS | READY

    The status of the election

    Defined in

    api/election.ts:175


    tallyMode

    tallyMode: ITallyMode

    The tally mode of the vote

    Defined in

    api/election.ts:245


    voteCount

    voteCount: number

    The number of votes of the election

    Defined in

    api/election.ts:190


    voteMode

    voteMode: IVoteMode

    The voting mode of the election

    Defined in

    api/election.ts:235

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/sdk/reference/interfaces/IElectionKeysResponse.html b/sdk/reference/interfaces/IElectionKeysResponse.html index ca5f34121..f11e23ab5 100644 --- a/sdk/reference/interfaces/IElectionKeysResponse.html +++ b/sdk/reference/interfaces/IElectionKeysResponse.html @@ -12,13 +12,13 @@ - +

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/sdk/reference/interfaces/IElectionListFilter.html b/sdk/reference/interfaces/IElectionListFilter.html index 33bb3699b..cf1501b5e 100644 --- a/sdk/reference/interfaces/IElectionListFilter.html +++ b/sdk/reference/interfaces/IElectionListFilter.html @@ -12,13 +12,13 @@ - +

    IElectionListFilter

    @vocdoni/sdk / Exports / IElectionListFilter

    Interface: IElectionListFilter

    Table of contents

    Properties

    Properties

    electionId

    Optional electionId: string

    Defined in

    api/election.ts:364


    organizationId

    Optional organizationId: string

    Defined in

    api/election.ts:363


    status

    Optional status: PROCESS_UNKNOWN | ENDED | CANCELED | PAUSED | RESULTS | READY

    Defined in

    api/election.ts:366


    withResults

    Optional withResults: boolean

    Defined in

    api/election.ts:365

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/sdk/reference/interfaces/IElectionListResponse.html b/sdk/reference/interfaces/IElectionListResponse.html index bb8428b2e..78ba0ae6e 100644 --- a/sdk/reference/interfaces/IElectionListResponse.html +++ b/sdk/reference/interfaces/IElectionListResponse.html @@ -12,13 +12,13 @@ - +

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/sdk/reference/interfaces/IElectionMode.html b/sdk/reference/interfaces/IElectionMode.html index 16abcffbc..cb3965d91 100644 --- a/sdk/reference/interfaces/IElectionMode.html +++ b/sdk/reference/interfaces/IElectionMode.html @@ -12,13 +12,13 @@ - +

    IElectionMode

    @vocdoni/sdk / Exports / IElectionMode

    Interface: IElectionMode

    Table of contents

    Properties

    Properties

    autoStart

    autoStart: boolean

    If the election should start automatically

    Defined in

    api/election.ts:75


    dynamicCensus

    dynamicCensus: boolean

    If the election has a dynamic census

    Defined in

    api/election.ts:85


    encryptedMetaData

    encryptedMetaData: boolean

    If the election has encrypted metadata

    Defined in

    api/election.ts:90


    interruptible

    interruptible: boolean

    If the election is interruptible

    Defined in

    api/election.ts:80


    preRegister

    preRegister: boolean

    If the election has preregister phase

    Defined in

    api/election.ts:95

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/sdk/reference/interfaces/IElectionNextIdResponse.html b/sdk/reference/interfaces/IElectionNextIdResponse.html index 92e9a600d..e764c4c1f 100644 --- a/sdk/reference/interfaces/IElectionNextIdResponse.html +++ b/sdk/reference/interfaces/IElectionNextIdResponse.html @@ -12,13 +12,13 @@ - +

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/sdk/reference/interfaces/IElectionParameters.html b/sdk/reference/interfaces/IElectionParameters.html index 2385ba2f7..8f6e76b7d 100644 --- a/sdk/reference/interfaces/IElectionParameters.html +++ b/sdk/reference/interfaces/IElectionParameters.html @@ -12,7 +12,7 @@ - + @@ -22,7 +22,7 @@ Typically, this value should be equal to the size of the census. If the MaxCensusSize parameter is set to 0, an error will occur and the election cannot be created.

    If the number of votes exceeds this limit, will throw Max census size for the election is greater than allowed size error.

    Defined in

    types/election/election.ts:145


    meta

    Optional meta: any

    Metadata (anything added by the election creator)

    Defined in

    types/election/election.ts:126


    questions

    Optional questions: IQuestion[]

    Defined in

    types/election/election.ts:132


    startDate

    Optional startDate: string | number | Date

    Defined in

    types/election/election.ts:127


    streamUri

    Optional streamUri: string

    Election stream Uri (ex: a video url)

    Defined in

    types/election/election.ts:122


    temporarySecretIdentity

    Optional temporarySecretIdentity: boolean

    Is used to remove the secret identities of the voters once the process is done.

    Defined in

    types/election/election.ts:150


    title

    title: string | MultiLanguage\<string>

    Election title

    Defined in

    types/election/election.ts:110


    voteType

    Optional voteType: IVoteType

    Defined in

    types/election/election.ts:130

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/sdk/reference/interfaces/IElectionSummary.html b/sdk/reference/interfaces/IElectionSummary.html index cebbcddaa..3a84dd258 100644 --- a/sdk/reference/interfaces/IElectionSummary.html +++ b/sdk/reference/interfaces/IElectionSummary.html @@ -12,13 +12,13 @@ - +

    IElectionSummary

    @vocdoni/sdk / Exports / IElectionSummary

    Interface: IElectionSummary

    Table of contents

    Properties

    Properties

    electionId

    electionId: string

    The id of the election

    Defined in

    api/election.ts:322


    endDate

    endDate: string

    The end date of the election

    Defined in

    api/election.ts:342


    finalResults

    finalResults: boolean

    If the election has the final results

    Defined in

    api/election.ts:352


    organizationId

    organizationId: string

    The id of the organization

    Defined in

    api/election.ts:327


    startDate

    startDate: string

    The start date of the election

    Defined in

    api/election.ts:337


    status

    status: PROCESS_UNKNOWN | ENDED | CANCELED | PAUSED | RESULTS | READY

    The status of the election

    Defined in

    api/election.ts:332


    voteCount

    voteCount: number

    The number of votes of the election

    Defined in

    api/election.ts:347

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/sdk/reference/interfaces/IElectionType.html b/sdk/reference/interfaces/IElectionType.html index ef4f9dc5c..4570aeb8b 100644 --- a/sdk/reference/interfaces/IElectionType.html +++ b/sdk/reference/interfaces/IElectionType.html @@ -12,13 +12,13 @@ - +

    IElectionType

    @vocdoni/sdk / Exports / IElectionType

    Interface: IElectionType

    Table of contents

    Properties

    Properties

    anonymous

    Optional anonymous: boolean

    Enable anonymous voting.

    Defined in

    types/election/election.ts:92


    autoStart

    Optional autoStart: boolean

    If false, election will start PAUSED and will have to be resumed manually.

    Defined in

    types/election/election.ts:76


    dynamicCensus

    Optional dynamicCensus: boolean

    Can add more voters to the census tree during the election.

    Defined in

    types/election/election.ts:84


    interruptible

    Optional interruptible: boolean

    The process can be paused and resumed.

    Defined in

    types/election/election.ts:80


    secretUntilTheEnd

    Optional secretUntilTheEnd: boolean

    Protect the results until the end of the process if true. It will show live results otherwise.

    Defined in

    types/election/election.ts:88

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/sdk/reference/interfaces/IElectionVote.html b/sdk/reference/interfaces/IElectionVote.html index 20190e7ad..5c0ef0afd 100644 --- a/sdk/reference/interfaces/IElectionVote.html +++ b/sdk/reference/interfaces/IElectionVote.html @@ -12,13 +12,13 @@ - +

    IElectionVote

    @vocdoni/sdk / Exports / IElectionVote

    Interface: IElectionVote

    Table of contents

    Properties

    Properties

    blockHeight

    blockHeight: number

    Block containing the vote transaction

    Defined in

    api/election.ts:303


    transactionIndex

    transactionIndex: number

    Transaction number on the block

    Defined in

    api/election.ts:308


    txHash

    txHash: string

    Containing transaction hash

    Defined in

    api/election.ts:288


    voteID

    voteID: string

    Vote unique identifier also known as vote nullifier

    Defined in

    api/election.ts:293


    voterID

    voterID: string

    Account that emit the vote

    Defined in

    api/election.ts:298

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/sdk/reference/interfaces/IElectionVoteListResponse.html b/sdk/reference/interfaces/IElectionVoteListResponse.html index 593251a1f..a1a65294a 100644 --- a/sdk/reference/interfaces/IElectionVoteListResponse.html +++ b/sdk/reference/interfaces/IElectionVoteListResponse.html @@ -12,13 +12,13 @@ - +

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/sdk/reference/interfaces/IEncryptionKey.html b/sdk/reference/interfaces/IEncryptionKey.html index 4850700c5..521fc3718 100644 --- a/sdk/reference/interfaces/IEncryptionKey.html +++ b/sdk/reference/interfaces/IEncryptionKey.html @@ -12,13 +12,13 @@ - +

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/sdk/reference/interfaces/IInvalidElectionParameters.html b/sdk/reference/interfaces/IInvalidElectionParameters.html index 7656cc964..24b8ff3b8 100644 --- a/sdk/reference/interfaces/IInvalidElectionParameters.html +++ b/sdk/reference/interfaces/IInvalidElectionParameters.html @@ -12,13 +12,13 @@ - +

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/sdk/reference/interfaces/IMultiChoiceElectionParameters.html b/sdk/reference/interfaces/IMultiChoiceElectionParameters.html index 6769078ae..f0e51a4e6 100644 --- a/sdk/reference/interfaces/IMultiChoiceElectionParameters.html +++ b/sdk/reference/interfaces/IMultiChoiceElectionParameters.html @@ -12,7 +12,7 @@ - + @@ -22,7 +22,7 @@ Typically, this value should be equal to the size of the census. If the MaxCensusSize parameter is set to 0, an error will occur and the election cannot be created.

    If the number of votes exceeds this limit, will throw Max census size for the election is greater than allowed size error.

    Inherited from

    IElectionParameters.maxCensusSize

    Defined in

    types/election/election.ts:145


    maxNumberOfChoices

    maxNumberOfChoices: number

    Defined in

    types/election/multichoice.ts:8


    meta

    Optional meta: any

    Metadata (anything added by the election creator)

    Inherited from

    IElectionParameters.meta

    Defined in

    types/election/election.ts:126


    questions

    Optional questions: IQuestion[]

    Inherited from

    IElectionParameters.questions

    Defined in

    types/election/election.ts:132


    startDate

    Optional startDate: string | number | Date

    Inherited from

    IElectionParameters.startDate

    Defined in

    types/election/election.ts:127


    streamUri

    Optional streamUri: string

    Election stream Uri (ex: a video url)

    Inherited from

    IElectionParameters.streamUri

    Defined in

    types/election/election.ts:122


    temporarySecretIdentity

    Optional temporarySecretIdentity: boolean

    Is used to remove the secret identities of the voters once the process is done.

    Inherited from

    IElectionParameters.temporarySecretIdentity

    Defined in

    types/election/election.ts:150


    title

    title: string | MultiLanguage\<string>

    Election title

    Inherited from

    IElectionParameters.title

    Defined in

    types/election/election.ts:110


    voteType

    Optional voteType: IVoteType

    Inherited from

    IElectionParameters.voteType

    Defined in

    types/election/election.ts:130

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/sdk/reference/interfaces/IPublishedElectionParameters.html b/sdk/reference/interfaces/IPublishedElectionParameters.html index 394d081ed..12cd645e1 100644 --- a/sdk/reference/interfaces/IPublishedElectionParameters.html +++ b/sdk/reference/interfaces/IPublishedElectionParameters.html @@ -12,7 +12,7 @@ - + @@ -22,7 +22,7 @@ Typically, this value should be equal to the size of the census. If the MaxCensusSize parameter is set to 0, an error will occur and the election cannot be created.

    If the number of votes exceeds this limit, will throw Max census size for the election is greater than allowed size error.

    Inherited from

    IElectionParameters.maxCensusSize

    Defined in

    types/election/election.ts:145


    meta

    Optional meta: any

    Metadata (anything added by the election creator)

    Inherited from

    IElectionParameters.meta

    Defined in

    types/election/election.ts:126


    metadataURL

    metadataURL: string

    Defined in

    types/election/published.ts:37


    organizationId

    organizationId: string

    Defined in

    types/election/published.ts:28


    questions

    Optional questions: IQuestion[]

    Inherited from

    IElectionParameters.questions

    Defined in

    types/election/election.ts:132


    raw

    raw: object

    Defined in

    types/election/published.ts:39


    results

    results: string[][]

    Defined in

    types/election/published.ts:32


    resultsType

    resultsType: ElectionResultsType

    Defined in

    types/election/published.ts:38


    startDate

    Optional startDate: string | number | Date

    Inherited from

    IElectionParameters.startDate

    Defined in

    types/election/election.ts:127


    status

    status: AllElectionStatus

    Defined in

    types/election/published.ts:29


    streamUri

    Optional streamUri: string

    Election stream Uri (ex: a video url)

    Inherited from

    IElectionParameters.streamUri

    Defined in

    types/election/election.ts:122


    temporarySecretIdentity

    Optional temporarySecretIdentity: boolean

    Is used to remove the secret identities of the voters once the process is done.

    Inherited from

    IElectionParameters.temporarySecretIdentity

    Defined in

    types/election/election.ts:150


    title

    title: string | MultiLanguage\<string>

    Election title

    Inherited from

    IElectionParameters.title

    Defined in

    types/election/election.ts:110


    voteCount

    voteCount: number

    Defined in

    types/election/published.ts:30


    voteType

    Optional voteType: IVoteType

    Inherited from

    IElectionParameters.voteType

    Defined in

    types/election/election.ts:130

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/sdk/reference/interfaces/IQuestion.html b/sdk/reference/interfaces/IQuestion.html index 3a1fee841..c39344ae1 100644 --- a/sdk/reference/interfaces/IQuestion.html +++ b/sdk/reference/interfaces/IQuestion.html @@ -12,13 +12,13 @@ - +

    IQuestion

    @vocdoni/sdk / Exports / IQuestion

    Interface: IQuestion

    Table of contents

    Properties

    Properties

    choices

    choices: IChoice[]

    Defined in

    types/metadata/election.ts:34


    description

    Optional description: MultiLanguage\<string>

    Defined in

    types/metadata/election.ts:32


    numAbstains

    Optional numAbstains: string

    Defined in

    types/metadata/election.ts:33


    title

    title: MultiLanguage\<string>

    Defined in

    types/metadata/election.ts:31

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/sdk/reference/interfaces/ITallyMode.html b/sdk/reference/interfaces/ITallyMode.html index 8f3986a50..808b9b6fa 100644 --- a/sdk/reference/interfaces/ITallyMode.html +++ b/sdk/reference/interfaces/ITallyMode.html @@ -12,13 +12,13 @@ - +

    ITallyMode

    @vocdoni/sdk / Exports / ITallyMode

    Interface: ITallyMode

    Table of contents

    Properties

    Properties

    costExponent

    costExponent: number

    The cost exponent of the vote

    Defined in

    api/election.ts:122


    maxCount

    maxCount: number

    The max count of the vote's values sum

    Defined in

    api/election.ts:102


    maxTotalCost

    maxTotalCost: number

    The max total cost of the votes

    Defined in

    api/election.ts:117


    maxValue

    maxValue: number

    The max value of the vote's values

    Defined in

    api/election.ts:107


    maxVoteOverwrites

    maxVoteOverwrites: number

    The max number of votes overwrites

    Defined in

    api/election.ts:112

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/sdk/reference/interfaces/IVoteInfoResponse.html b/sdk/reference/interfaces/IVoteInfoResponse.html index f10632962..0bfeaacb2 100644 --- a/sdk/reference/interfaces/IVoteInfoResponse.html +++ b/sdk/reference/interfaces/IVoteInfoResponse.html @@ -12,13 +12,13 @@ - +

    IVoteInfoResponse

    @vocdoni/sdk / Exports / IVoteInfoResponse

    Interface: IVoteInfoResponse

    Table of contents

    Properties

    Properties

    blockHeight

    blockHeight: number

    The block number where the transaction is mined.

    Defined in

    api/vote.ts:56


    date

    date: string

    Date when the vote was emitted

    Defined in

    api/vote.ts:71


    electionID

    electionID: string

    The identifier of the election.

    Defined in

    api/vote.ts:51


    encryptionKeys

    Optional encryptionKeys: number[]

    Encryption key indexes used

    Defined in

    api/vote.ts:36


    overwriteCount

    overwriteCount: number

    The number of votes overwrites.

    Defined in

    api/vote.ts:66


    package

    package: string

    The stringified vote package JSON.

    Defined in

    api/vote.ts:41


    transactionIndex

    transactionIndex: number

    The index inside the block where the transaction is mined.

    Defined in

    api/vote.ts:61


    txHash

    txHash: string

    The hash of the transaction

    Defined in

    api/vote.ts:26


    voteID

    voteID: string

    The identifier of the vote, also called nullifier.

    Defined in

    api/vote.ts:31


    weight

    weight: string

    The weight of the vote.

    Defined in

    api/vote.ts:46

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/sdk/reference/interfaces/IVoteMode.html b/sdk/reference/interfaces/IVoteMode.html index d2e4a8ef2..dfa7cbf8f 100644 --- a/sdk/reference/interfaces/IVoteMode.html +++ b/sdk/reference/interfaces/IVoteMode.html @@ -12,13 +12,13 @@ - +

    IVoteMode

    @vocdoni/sdk / Exports / IVoteMode

    Interface: IVoteMode

    Table of contents

    Properties

    Properties

    anonymous

    anonymous: boolean

    If the vote is anonymous

    Defined in

    api/election.ts:53


    costFromWeight

    costFromWeight: boolean

    Cost from weight of the election

    Defined in

    api/election.ts:68


    encryptedVotes

    encryptedVotes: boolean

    If the vote is encrypted

    Defined in

    api/election.ts:58


    serial

    serial: boolean

    If the vote is serial

    Defined in

    api/election.ts:48


    uniqueValues

    uniqueValues: boolean

    If the vote values are unique

    Defined in

    api/election.ts:63

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/sdk/reference/interfaces/IVoteSubmitResponse.html b/sdk/reference/interfaces/IVoteSubmitResponse.html index 3e6cbd99b..f7a05608a 100644 --- a/sdk/reference/interfaces/IVoteSubmitResponse.html +++ b/sdk/reference/interfaces/IVoteSubmitResponse.html @@ -12,13 +12,13 @@ - +

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/sdk/reference/interfaces/IVoteType.html b/sdk/reference/interfaces/IVoteType.html index 4c48c006f..42425b25b 100644 --- a/sdk/reference/interfaces/IVoteType.html +++ b/sdk/reference/interfaces/IVoteType.html @@ -12,7 +12,7 @@ - + @@ -28,7 +28,7 @@ this value should match the total number of choices available for voting.

    Defined in

    types/election/election.ts:62


    maxTotalCost

    Optional maxTotalCost: number

    Specifies the maximum limit on the total sum of all ballot fields' values, if applicable. For instance, if the vote array is [0,0,3,2], the maxTotalCost should be set to 3.

    A value of 0 implies no maximum limit or that this parameter is not applicable in the current voting context.

    Defined in

    types/election/election.ts:69


    maxValue

    Optional maxValue: number

    Defines the maximum acceptable value for all fields in the voting process. By default, this value corresponds to the total number of choices available in a question.

    In the context of a quadratic voting system, this value should typically be set to 0.

    Defined in

    types/election/election.ts:53


    maxVoteOverwrites

    Optional maxVoteOverwrites: number

    The number of times a voter con overwrite its vote (change vote option).

    Defined in

    types/election/election.ts:15


    uniqueChoices

    Optional uniqueChoices: boolean

    Voter can only select one answer for question

    Defined in

    types/election/election.ts:11

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/sdk/reference/interfaces/MintTokensTx.html b/sdk/reference/interfaces/MintTokensTx.html index fa09dee98..1b0d30398 100644 --- a/sdk/reference/interfaces/MintTokensTx.html +++ b/sdk/reference/interfaces/MintTokensTx.html @@ -12,13 +12,13 @@ - +

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/sdk/reference/interfaces/NewProcessTx.html b/sdk/reference/interfaces/NewProcessTx.html index 5a0f4ae8a..14912e14b 100644 --- a/sdk/reference/interfaces/NewProcessTx.html +++ b/sdk/reference/interfaces/NewProcessTx.html @@ -12,13 +12,13 @@ - +

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/sdk/reference/interfaces/Process.html b/sdk/reference/interfaces/Process.html index 28015a508..dedb07004 100644 --- a/sdk/reference/interfaces/Process.html +++ b/sdk/reference/interfaces/Process.html @@ -12,7 +12,7 @@ - + @@ -23,7 +23,7 @@ true and the StartBlock has been reached.

    Defined in

    api/chain/transactions.ts:215


    sourceBlockHeight

    Optional sourceBlockHeight: number

    SourceBlockHeight is the block height of the origin blockchain (if any)

    Defined in

    api/chain/transactions.ts:197


    sourceNetworkContractAddr

    Optional sourceNetworkContractAddr: Uint8Array

    sourceNetworkContractAddr is used for EVM token based voting and it is the contract address of the token that is going to define the census

    Defined in

    api/chain/transactions.ts:225


    sourceNetworkId

    sourceNetworkId: SourceNetworkId

    SourceNetworkId is the identifier of the network origin (where the process have been created)

    Defined in

    api/chain/transactions.ts:203


    startBlock

    startBlock: number

    StartBlock represents the tendermint block where the process goes from scheduled to active

    Defined in

    api/chain/transactions.ts:172


    status

    status: ProcessStatus

    Defined in

    api/chain/transactions.ts:184


    tokenDecimals

    Optional tokenDecimals: number

    tokenDecimals represents the number of decimals of the token (i.e ERC20) used for voting. It is normally used for processes with on-chain census

    Defined in

    api/chain/transactions.ts:230


    voteOptions

    voteOptions: ProcessVoteOptions

    Defined in

    api/chain/transactions.ts:191

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/sdk/reference/interfaces/Proof.html b/sdk/reference/interfaces/Proof.html index 790c48589..1f2108a0c 100644 --- a/sdk/reference/interfaces/Proof.html +++ b/sdk/reference/interfaces/Proof.html @@ -12,13 +12,13 @@ - +

    Proof

    @vocdoni/sdk / Exports / Proof

    Interface: Proof

    Table of contents

    Properties

    Properties

    payload

    Optional payload: { $case: "graviton" ; graviton: { siblings: Uint8Array } } | { $case: "iden3" ; iden3: { siblings: Uint8Array } } | { $case: "ethereumStorage" ; ethereumStorage: { key: Uint8Array ; siblings: Uint8Array[] ; value: Uint8Array } } | { $case: "ethereumAccount" ; ethereumAccount: { balance: Uint8Array ; codeHash: Uint8Array ; nonce: Uint8Array ; siblings: Uint8Array[] ; storageHash: Uint8Array } } | { $case: "ca" ; ca: { bundle: { address: Uint8Array ; processId: Uint8Array } ; signature: Uint8Array ; type: ProofCA_Type } } | { $case: "arbo" ; arbo: { keyType: ProofArbo_KeyType ; siblings: Uint8Array ; type: ProofArbo_Type ; value: Uint8Array } } | { $case: "zkSnark" ; zkSnark: { a: string[] ; b: string[] ; c: string[] ; circuitParametersIndex: number ; publicInputs: string[] } } | { $case: "minimeStorage" ; minimeStorage: { proofNextBlock?: { key: Uint8Array ; siblings: Uint8Array[] ; value: Uint8Array } ; proofPrevBlock: { key: Uint8Array ; siblings: Uint8Array[] ; value: Uint8Array } } }

    Defined in

    api/chain/transactions.ts:341

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/sdk/reference/interfaces/RegisterKeyTx.html b/sdk/reference/interfaces/RegisterKeyTx.html index bd0d79a1f..06e93ecc9 100644 --- a/sdk/reference/interfaces/RegisterKeyTx.html +++ b/sdk/reference/interfaces/RegisterKeyTx.html @@ -12,13 +12,13 @@ - +

    RegisterKeyTx

    @vocdoni/sdk / Exports / RegisterKeyTx

    Interface: RegisterKeyTx

    Table of contents

    Properties

    Properties

    newKey

    newKey: Uint8Array

    New key to register

    Defined in

    api/chain/transactions.ts:121


    nonce

    nonce: number

    Unique number per vote attempt, so that replay attacks can't reuse this payload

    Defined in

    api/chain/transactions.ts:115


    processId

    processId: Uint8Array

    The process for which the vote is casted

    Defined in

    api/chain/transactions.ts:117


    proof

    proof: Proof

    Franchise proof

    Defined in

    api/chain/transactions.ts:119


    weight

    weight: string

    Weight to delegate to newKey

    Defined in

    api/chain/transactions.ts:123

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/sdk/reference/interfaces/SendTokensTx.html b/sdk/reference/interfaces/SendTokensTx.html index 4cd7ce593..65de9ac6e 100644 --- a/sdk/reference/interfaces/SendTokensTx.html +++ b/sdk/reference/interfaces/SendTokensTx.html @@ -12,13 +12,13 @@ - +

    SendTokensTx

    @vocdoni/sdk / Exports / SendTokensTx

    Interface: SendTokensTx

    Table of contents

    Properties

    Properties

    from

    from: Uint8Array

    Defined in

    api/chain/transactions.ts:136


    nonce

    nonce: number

    Defined in

    api/chain/transactions.ts:135


    to

    to: Uint8Array

    Defined in

    api/chain/transactions.ts:137


    txtype

    txtype: TxType

    Defined in

    api/chain/transactions.ts:134


    value

    value: number

    Defined in

    api/chain/transactions.ts:138

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/sdk/reference/interfaces/ServiceProperties.html b/sdk/reference/interfaces/ServiceProperties.html index 9de93abd9..b147b3779 100644 --- a/sdk/reference/interfaces/ServiceProperties.html +++ b/sdk/reference/interfaces/ServiceProperties.html @@ -12,13 +12,13 @@ - +

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/sdk/reference/interfaces/SetAccountTx.html b/sdk/reference/interfaces/SetAccountTx.html index a5c125c77..a525610fc 100644 --- a/sdk/reference/interfaces/SetAccountTx.html +++ b/sdk/reference/interfaces/SetAccountTx.html @@ -12,13 +12,13 @@ - +

    SetAccountTx

    @vocdoni/sdk / Exports / SetAccountTx

    Interface: SetAccountTx

    Table of contents

    Properties

    Properties

    account

    Optional account: Uint8Array

    Defined in

    api/chain/transactions.ts:151


    delegates

    delegates: Uint8Array[]

    Defined in

    api/chain/transactions.ts:153


    faucetPackage

    Optional faucetPackage: FaucetPackage

    Defined in

    api/chain/transactions.ts:152


    infoURI

    Optional infoURI: string

    Defined in

    api/chain/transactions.ts:150


    nonce

    Optional nonce: number

    Defined in

    api/chain/transactions.ts:149


    txtype

    txtype: TxType

    Defined in

    api/chain/transactions.ts:148

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/sdk/reference/interfaces/SetProcessTx.html b/sdk/reference/interfaces/SetProcessTx.html index ccb9619d6..75aa45c47 100644 --- a/sdk/reference/interfaces/SetProcessTx.html +++ b/sdk/reference/interfaces/SetProcessTx.html @@ -12,13 +12,13 @@ - +

    SetProcessTx

    @vocdoni/sdk / Exports / SetProcessTx

    Interface: SetProcessTx

    Table of contents

    Properties

    Properties

    censusRoot

    Optional censusRoot: Uint8Array

    Defined in

    api/chain/transactions.ts:107


    censusURI

    Optional censusURI: string

    Defined in

    api/chain/transactions.ts:108


    nonce

    nonce: number

    Defined in

    api/chain/transactions.ts:103


    processId

    processId: Uint8Array

    Defined in

    api/chain/transactions.ts:104


    proof

    Optional proof: Proof

    Defined in

    api/chain/transactions.ts:109


    questionIndex

    Optional questionIndex: number

    Defined in

    api/chain/transactions.ts:106


    results

    Optional results: ProcessResult

    Defined in

    api/chain/transactions.ts:110


    status

    Optional status: ProcessStatus

    Defined in

    api/chain/transactions.ts:105


    txtype

    txtype: TxType

    Defined in

    api/chain/transactions.ts:102

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/sdk/reference/interfaces/SetTransactionCostsTx.html b/sdk/reference/interfaces/SetTransactionCostsTx.html index 344365d7a..518955b7a 100644 --- a/sdk/reference/interfaces/SetTransactionCostsTx.html +++ b/sdk/reference/interfaces/SetTransactionCostsTx.html @@ -12,13 +12,13 @@ - +

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/sdk/reference/interfaces/Tx.html b/sdk/reference/interfaces/Tx.html index fd4887627..052631f80 100644 --- a/sdk/reference/interfaces/Tx.html +++ b/sdk/reference/interfaces/Tx.html @@ -12,13 +12,13 @@ - +

    Tx

    @vocdoni/sdk / Exports / Tx

    Interface: Tx

    Table of contents

    Properties

    Properties

    tx

    Optional tx: { $case: "vote" ; vote: VoteEnvelope } | { $case: "newProcess" ; newProcess: NewProcessTx } | { $case: "admin" ; admin: AdminTx } | { $case: "setProcess" ; setProcess: SetProcessTx } | { $case: "registerKey" ; registerKey: RegisterKeyTx } | { $case: "mintTokens" ; mintTokens: MintTokensTx } | { $case: "sendTokens" ; sendTokens: SendTokensTx } | { $case: "setTransactionCosts" ; setTransactionCosts: SetTransactionCostsTx } | { $case: "setAccount" ; setAccountInfo: SetAccountTx } | { $case: "collectFaucet" ; collectFaucet: CollectFaucetTx }

    Defined in

    api/chain/transactions.ts:4


    txInfo

    txInfo: IChainTxReference

    Defined in

    api/chain/transactions.ts:53

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/sdk/reference/interfaces/VoteEnvelope.html b/sdk/reference/interfaces/VoteEnvelope.html index 4da1c7a08..2fcefc417 100644 --- a/sdk/reference/interfaces/VoteEnvelope.html +++ b/sdk/reference/interfaces/VoteEnvelope.html @@ -12,13 +12,13 @@ - +

    VoteEnvelope

    @vocdoni/sdk / Exports / VoteEnvelope

    Interface: VoteEnvelope

    Table of contents

    Properties

    Properties

    encryptionKeyIndexes

    encryptionKeyIndexes: number[]

    On encrypted votes, contains the (sorted) indexes of the keys used to encrypt

    Defined in

    api/chain/transactions.ts:80


    nonce

    nonce: string

    Unique number per vote attempt, so that replay attacks can't reuse this payload

    Defined in

    api/chain/transactions.ts:60


    nullifier

    nullifier: string

    Hash of the private key + processId

    Defined in

    api/chain/transactions.ts:76


    processId

    processId: string

    The process for which the vote is casted

    Defined in

    api/chain/transactions.ts:64


    proof

    proof: Proof

    Franchise proof

    Defined in

    api/chain/transactions.ts:68


    votePackage

    votePackage: string

    JSON string of the Vote Package (potentially encrypted), encoded as bytes.

    Defined in

    api/chain/transactions.ts:72

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/sdk/reference/modules.html b/sdk/reference/modules.html index 4c6597d63..2dae3d25f 100644 --- a/sdk/reference/modules.html +++ b/sdk/reference/modules.html @@ -12,7 +12,7 @@ - + @@ -22,7 +22,7 @@ Throws an exception if it is not.

    Parameters

    NameType
    accountMetadataAccountMetadata

    Returns

    AccountMetadata

    Defined in

    types/metadata/account.ts:8


    checkValidElectionMetadata

    checkValidElectionMetadata(electionMetadata): ElectionMetadata

    Asserts that the given metadata is valid. Throws an exception if it is not.

    Parameters

    NameType
    electionMetadataElectionMetadata

    Returns

    ElectionMetadata

    Defined in

    types/metadata/election.ts:8


    delay

    delay(ms): Promise\<unknown>

    Parameters

    NameType
    msany

    Returns

    Promise\<unknown>

    Defined in

    util/common.ts:6


    dotobject

    dotobject(obj, dot): any

    Dot notation to object conversion. Takes any object as first argument and uses the string dot notation from the second argument (i.e. 'a.child.node') to access that given object value.

    Parameters

    NameTypeDescription
    objanyObject to be accessed by dot notation
    dotstringDot notation string to extract object data

    Returns

    any

    Return the object data

    Defined in

    util/common.ts:61


    ensure0x

    ensure0x(value): string

    Parameters

    NameType
    valuestring

    Returns

    string

    Defined in

    util/common.ts:12


    formatUnits

    formatUnits(value, decimals?): string

    Returns a string representation of value formatted with decimals digits

    Parameters

    NameTypeDefault valueDescription
    valueBigNumberishundefinedThe value in native BigInt
    decimalsnumber18The number of decimals

    Returns

    string

    The formatted string

    Defined in

    util/common.ts:49


    getBytes

    getBytes(count): Uint8Array

    Parameters

    NameType
    countnumber

    Returns

    Uint8Array

    Defined in

    util/common.ts:16


    getHex

    getHex(): string

    Generates a random seed and returns a 32 byte keccak256 hash of it (starting with "0x")

    Returns

    string

    Defined in

    util/common.ts:23


    strip0x

    strip0x(value): string

    Parameters

    NameType
    valuestring

    Returns

    string

    Defined in

    util/common.ts:8

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/sdk/tutorial.html b/sdk/tutorial.html index d0140fc8f..0a8e7e704 100644 --- a/sdk/tutorial.html +++ b/sdk/tutorial.html @@ -12,7 +12,7 @@ - + @@ -23,7 +23,7 @@ @vocdoni/sdk it will choose a version based on your current environment (commonjs or esm). There's also another UMD version which can be accessed via @vocdoni/sdk/umd in case you need it.

    Overview

    The following are the main steps we need to implement:

    • Connecting a client to the Vocdoni network
    • Creating a census with some random members
    • Creating an election
    • Sending votes
    • Checking the election results

    Client

    The first step will be connecting to a Vocdoni Gateway Node. We can do this easily with the VocdoniSDKClient. The client allows us to access all of the Vocdoni API calls.

    In order to create a client, we need a wallet, an envelope that holds a cryptographic key and enables our client to sign transactions for the blockchain. We'll be generating a random wallet with the ethers signer.

    We also need to define which Vocdoni environment we will connect to. Staging is the recommended environment for most testing use cases, since the dev environment is more subject to blockchain resets and downtimes than the stg one.

    src/client.ts

    export const getDefaultClient = () => {
    const wallet = Wallet.createRandom();
    const client = new VocdoniSDKClient({
    env: EnvOptions.STG,
    wallet: wallet,
    });

    return { wallet, client };
    };

    Now that we have a client connected to the STG environment, we need to register its wallet to the blockchain with createAccount(). Parameters here are optional, but let's define a name and description.

    tip

    An Account can represent an organization hosting a voting process. There are many parameters we can optionally add, like logo or even arbitrary meta. This can all be displayed on a custom frontend implementation. Using createAccount() on an account that already exists will fetch the account info from the blockchain.

    src/account.ts

    export const createAccount = (client: VocdoniSDKClient) => {
    return client
    .createAccount({
    account: new Account({
    languages: ['en'],
    name: {
    default: 'Account name',
    },
    description: 'Description of the account',
    logo: 'https://logo.io',
    }),
    })
    .then(() => client.fetchAccountInfo().then(info => console.log(info)));
    };

    Census

    With our client created and registered to the Vochain, the next step is to create a census of voters. The protocol enables many types of census and you can see how to implement each of them here. For our purposes it's easiest to use a plain census, the simplest form of off-chain tree census.

    We can create a random wallet to represent each voter just like we did for the client, and then we can register each voter's address to the census. The voter wallets have to be saved in order to sign their individual votes.

    src/census.ts

    export async function createCensus () {
    const census = new PlainCensus()

    // Create a list of random voters, register them to the census
    let voters: Wallet[] = []
    for (let i = 0; i < 5; i++) {
    voters.push(Wallet.createRandom())
    census.add(await voters[i].getAddress())
    }

    return { census, voters }
    }

    Election

    Creating a basic election is easy with Election.from(). We just need to specify the title and description, a header photo, an end date, and the census we created earlier. We can specify some electionType options, but this is not necessary as our election is using the default options.

    src/election.ts

    export const createElection = (census: PlainCensus): UnpublishedElection => {
    const election: UnpublishedElection = Election.from({
    title: 'Election title',
    description: 'Election description',
    header: 'https://source.unsplash.com/random',
    endDate: new Date().getTime() + 100000,
    census,
    });
    ...

    Questions can be added to an election with addQuestion. This is a single-choice (binary) election with only one question.

    src/election.ts

    ...
    election.addQuestion('This is a title', 'This is a description', [
    {
    title: 'Option 1',
    value: 0
    },
    {
    title: 'Option 2',
    value: 1
    }
    ])

    return election
    }

    Once our election is defined, it has to be officially created on the blockchain with client.CreateElection(). This will also provide us with a unique electionID. We want to use client.SetElectionID() so that the client knows which voting process to submit votes to.

    info

    Now that we have the electionId, we can also print out a link to view our voting process on the Vocdoni blockchain explorer! The explorer unlocks the universal verifiability of Vocdoni's protocol- even for this small example, the results of this election are verifiable by any observer and cannot be altered.

    src/election.ts

    const waitForElectionReady = (client: VocdoniSDKClient, electionId: string): Promise<string> => {
    return new Promise(f => setTimeout(f, 5000))
    .then(() => client.fetchElection(electionId))
    .then(election => {
    if (election.status !== ElectionStatus.ONGOING) {
    return waitForElectionReady(client, electionId);
    }
    return Promise.resolve(electionId);
    });
    };

    Publishing an election registers a transaction to the blockchain. This means we have to wait for the next block to process in order to ensure the transaction was successful. Here we use client.fetchElection() to fetch the election info from the blockchain, given our electionId. This allows us to wait until the election status is ONGOING, which means the election has been successfully published and has begun.

    src/election.ts

    export const publishElection = (client: VocdoniSDKClient, election: UnpublishedElection): Promise<string> => {
    return client.createElection(election).then(electionId => {
    client.setElectionId(electionId);
    console.log('Election created!', electionId);
    console.log('View this election at ' + client.explorerUrl + '/processes/show/#/' + electionId);
    console.log('Waiting for election to be published...');
    return waitForElectionReady(client, electionId);
    });
    };

    Voting

    With the election published, it's time to vote. We can use each of the wallets that we saved earlier to cast a unique vote for that imaginary voter. We do this by first setting client.wallet = voter, telling the client which wallet to use for bundling and submitting this vote.

    The we create the vote itself. A Vote is simply a list of values whose form depends on the type and number of questions in the election.

    tip

    For more info on vote types, see our section on the Ballot Protocol

    Then we can simply call client.submitVote(), and the SDK handles the creation, signing, and submission of the vote package. It returns a voteId which can be used to ensure the vote was correctly counted.

    src/vote.ts

    export const castVotes = (electionId: string, voters: Wallet[]) => {
    var votePromises = [];
    for (const voter of voters) {
    const client = new VocdoniSDKClient({ env: EnvOptions.STG, wallet: voter, electionId: electionId });
    // Create a vote for option 0 or 1
    const vote = new Vote([Math.round(Math.random())]);
    votePromises.push(
    client.submitVote(vote).then(voteId => {
    console.log('Vote sent! Vote id: ', voteId);
    console.log('Verify vote at ' + client.explorerUrl + '/verify/#/' + voteId);
    })
    );
    }
    return Promise.all(votePromises);
    };

    Results

    All that's left is checking the results of this election! client.fetchElection() returns an object with a simple array of results values- it's up to you to decide how to display them.

    tip

    Note that the results are available immediately because this election was configured with secretUntilTheEnd=false

    src/vote.ts

    export const countVotes = (client: VocdoniSDKClient) => {
    return client.fetchElection().then(election => {
    console.log('Election results: ');
    election.questions.forEach(question => {
    question.choices.forEach(choice => {
    console.log(choice.title.default + ': ' + choice.results);
    });
    });
    });
    };

    Running the code

    Here's a program that combines all the above functions into a working prototype:

    src/index.ts

    async function main () {
    console.log('Initializing client...');
    const { client } = getDefaultClient();

    console.log('Creating account...');
    await createAccount(client);

    console.log('Creating census with some random wallets...');
    const { census, voters } = await createCensus();

    console.log('Creating election...');
    const election = createElection(census);
    const electionId = await publishElection(client, election);

    console.log('Voting...');
    await castVotes(electionId, voters);

    console.log('Getting results...');
    await countVotes(client);
    }
    main();

    All we have to do is run

    tutorial $ yarn start
    yarn run v1.22.17
    $ ts-node src/index.ts
    Initializing client...
    Creating account...
    {
    account: Account {
    _languages: [ 'en' ],
    _name: { default: 'Account name' },
    _description: { default: 'Description of the account' },
    _feed: { default: '' },
    _header: '',
    _avatar: '',
    _logo: 'https://logo.io',
    _meta: []
    },
    address: '73b3e1ff1602c6ece34f9b75aa86f5f90b41a209',
    nonce: 0,
    balance: 50,
    electionIndex: 0,
    infoURL: 'ipfs://bafybeif5mbhhwuju2pyd54bxhn3tdsj6m5cukx6f5xvchqfh2wvzkpbjpy',
    metadata: {
    version: '1.0',
    languages: [ 'en' ],
    name: { default: 'Account name' },
    description: { default: 'Description of the account' },
    newsFeed: { default: '' },
    media: { logo: 'https://logo.io' },
    meta: {}
    },
    sik: 'c5321163e98108424f5c25e55980a1ea4811029c1ff72cae95f113dfc95fac22'
    }
    Creating census with some random wallets...
    Creating election...
    Election created! 4ae20a8eb4ca73b3e1ff1602c6ece34f9b75aa86f5f90b41a209020000000000
    View this election at https://stg.explorer.vote/processes/show/#/4ae20a8eb4ca73b3e1ff1602c6ece34f9b75aa86f5f90b41a209020000000000
    Waiting for election to be published...
    Voting...
    Vote sent! Vote id: 2fae8af3b02ec78af5a3bf06ec4aff1b7c000a1356a0aff1c07163da23f3d771
    Verify vote at https://stg.explorer.vote/verify/#/2fae8af3b02ec78af5a3bf06ec4aff1b7c000a1356a0aff1c07163da23f3d771
    Vote sent! Vote id: 8af200d25a159c9d862e84064a4d977df2b10ea23ffb32ddc2de18b9142df0b6
    Verify vote at https://stg.explorer.vote/verify/#/8af200d25a159c9d862e84064a4d977df2b10ea23ffb32ddc2de18b9142df0b6
    Vote sent! Vote id: 3cae37ec5c49ce338bcbc40b5102cf33bf9304c19c3f5e650c7c469b72664fc8
    Verify vote at https://stg.explorer.vote/verify/#/3cae37ec5c49ce338bcbc40b5102cf33bf9304c19c3f5e650c7c469b72664fc8
    Vote sent! Vote id: 937911458a52393b75f1428ec1613d3a481112491c51bfcc033e2f0009341022
    Verify vote at https://stg.explorer.vote/verify/#/937911458a52393b75f1428ec1613d3a481112491c51bfcc033e2f0009341022
    Vote sent! Vote id: a6e4f4fe0f0e56d41fc21c62473718c9fbbe4c451a6fd9c19dbfca1fef0dac8c
    Verify vote at https://stg.explorer.vote/verify/#/a6e4f4fe0f0e56d41fc21c62473718c9fbbe4c451a6fd9c19dbfca1fef0dac8c
    Getting results...
    Election results:
    Option 1: 2
    Option 2: 3
    ✨ Done in 45.08s.

    You can even check out the election I created on the blockchain explorer.

    Now that you've created a basic example with the SDK, you can integrate this functionality into your own applications. For more details, check out the integration details section and the more extensive examples

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/search.html b/search.html index 41d8d390b..fe8a8cb80 100644 --- a/search.html +++ b/search.html @@ -12,13 +12,13 @@ - +

    Search the documentation

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/ui-components.html b/ui-components.html index c28c453ab..bed91a481 100644 --- a/ui-components.html +++ b/ui-components.html @@ -12,7 +12,7 @@ - + @@ -49,7 +49,7 @@ their theme files.

    i18n

    In order to change any of the texts contained in @vocdoni/chakra-components, you must specify the translations for each language in the ClientProvider:

    const translationsObject = {
    en: {
    // all english translations
    },
    ca: {
    // catalan translations
    }
    }
    <ClientProvider translations={translationsObject} />

    Check out the translations file in order to see all the available keys.

    LICENSE

    This components library is licensed under the GNU Affero General Public License v3.0.

    Vocdoni UI React Components
    Copyright (C) 2023 Vocdoni Roots MCU

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU Affero General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
    GNU Affero General Public License for more details.

    You should have received a copy of the GNU Affero General Public License
    along with this program. If not, see <https://www.gnu.org/licenses/>.

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/ui-components/Election.html b/ui-components/Election.html index e75e01b0f..b01dcc38a 100644 --- a/ui-components/Election.html +++ b/ui-components/Election.html @@ -12,7 +12,7 @@ - + @@ -177,7 +177,7 @@ } }
    Result
    Loading...

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/ui-components/Organization.html b/ui-components/Organization.html index 8e49b34b2..d8ecc6831 100644 --- a/ui-components/Organization.html +++ b/ui-components/Organization.html @@ -12,7 +12,7 @@ - + @@ -126,7 +126,7 @@ } }
    Result
    Loading...

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/vocdoni-api/accounts.html b/vocdoni-api/accounts.html index 9d9a33e1e..5684687dd 100644 --- a/vocdoni-api/accounts.html +++ b/vocdoni-api/accounts.html @@ -12,13 +12,13 @@ - +

    Accounts

    Related to account metadata (additional account information like balance, storage URI, process count...)

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/vocdoni-api/add-account.html b/vocdoni-api/add-account.html index 1c72ba074..b1ec65428 100644 --- a/vocdoni-api/add-account.html +++ b/vocdoni-api/add-account.html @@ -12,13 +12,13 @@ - +

    Add account

    Add a new account to the local store. It returns a token used to manage this account on the future.

    Path Parameters
    • privateKey string required

      Private key to add

    Responses

    OK


    Schema
    • address string
    • token string
    Loading...

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/vocdoni-api/add-participants-to-census.html b/vocdoni-api/add-participants-to-census.html index de5c3d803..a3229d729 100644 --- a/vocdoni-api/add-participants-to-census.html +++ b/vocdoni-api/add-participants-to-census.html @@ -12,7 +12,7 @@ - + @@ -20,7 +20,7 @@

    Add participants to census

    Add list of public key/address with its weight to an unpublished census and returns the resulting Merkle Root.

    Each addition will modify the census merkle root creating a new "snapshot" of the census at this moment. This root identifies the census at this point and can be used to publish the census at this specific state.

    For example, supposing a census with id 0x1234 (random hex string generated during census creation), add 10 keys will generate specific root for this state, ex 0xabcd.

    If we add 5 keys more, the resulting root changes, the keys are added and the new census have the first 10 keys plus the last 5, with a resulting root of 0xffff.

    So, at publishing moment, you could specify no root to publish census on the last state (0xffff), which will publish the first 10 plus the last 5. Or either specify the snapshot point which you want to publish the census, for example 0x1234, which will publish just the first 10th.

    • Requires Bearer token
    • Adds a list of wallet public key or wallet address to a census with a specific weight
    • If the weight parameter is missing, weight=1 is considered
    Path Parameters
    • censusID string required

      Census id

    Request Body required

    PublicKey - weight array

    • participants object[]
    • key string
    • weight object
    Responses

    (empty body)

    Loading...

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/vocdoni-api/census-merkle-root.html b/vocdoni-api/census-merkle-root.html index c48bf7d85..4645a0e88 100644 --- a/vocdoni-api/census-merkle-root.html +++ b/vocdoni-api/census-merkle-root.html @@ -16,13 +16,13 @@ - +

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/vocdoni-api/census-size.html b/vocdoni-api/census-size.html index c87674d64..ad2ab96b4 100644 --- a/vocdoni-api/census-size.html +++ b/vocdoni-api/census-size.html @@ -12,13 +12,13 @@ - +

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/vocdoni-api/census-total-weight.html b/vocdoni-api/census-total-weight.html index 1a8880372..1ffbdc296 100644 --- a/vocdoni-api/census-total-weight.html +++ b/vocdoni-api/census-total-weight.html @@ -12,13 +12,13 @@ - +

    Census total weight

    It sums all weights added to the census. Weight is a stringified bigInt

    Path Parameters
    • censusID string required

      Census id

    Responses

    Sum of weight son a stringfied big int format


    Schema
    • weight string
    Loading...

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/vocdoni-api/censuses.html b/vocdoni-api/censuses.html index 5c18c3c4a..f9793b352 100644 --- a/vocdoni-api/censuses.html +++ b/vocdoni-api/censuses.html @@ -12,7 +12,7 @@ - + @@ -21,7 +21,7 @@
    • Bearer token not required

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/vocdoni-api/chain.html b/vocdoni-api/chain.html index 6913124fd..f22e060df 100644 --- a/vocdoni-api/chain.html +++ b/vocdoni-api/chain.html @@ -12,14 +12,14 @@ - +

    Chain

    Everything about internal Vochain information (transactions, organizations, blocks, stats...)

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/vocdoni-api/circuit-info.html b/vocdoni-api/circuit-info.html index 0c301fa9f..d971c1d48 100644 --- a/vocdoni-api/circuit-info.html +++ b/vocdoni-api/circuit-info.html @@ -12,7 +12,7 @@ - + @@ -23,7 +23,7 @@ current circuit configuration artifacts has

  • publicSignals object

    PublicSignals indicates the index of each public signal

  • property name* integer
  • uri string

    URI defines the URI from where to download the files

  • vKeyFilename string

    FilenameVerificationKey defines the name of the file of the circom VerificationKey

  • vKeyHash string

    VerificationKeyHash contains the expected hash for the file filenameVK

  • version string

    Version of the published circuit

  • wasmFilename string

    FilenameWasm defines the name of the file of the circuit wasm compiled version

  • wasmHash string

    WasmHash contains the expected hash for the file filenameWasm

  • zKeyFilename string

    FilenameProvingKey defines the name of the file of the circom ProvingKey

  • zKeyHash string

    ProvingKeyHash contains the expected hash for the file filenameZKey

  • Loading...

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/vocdoni-api/compute-election-price.html b/vocdoni-api/compute-election-price.html index b62be2006..b34ba5ca8 100644 --- a/vocdoni-api/compute-election-price.html +++ b/vocdoni-api/compute-election-price.html @@ -12,13 +12,13 @@ - +

    Compute election price

    Helper endpoint to get the election price.

    Request Body required

    5 election parameters that are required for calculating the price

    • anonymousVotes boolean
    • electionBlocks integer
    • electionDuration integer
    • encryptedVotes boolean
    • maxCensusSize integer
    • maxVoteOverwrite integer
    Responses

    OK


    Schema
    • price number
    Loading...

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/vocdoni-api/compute-ipfs-ci-dv-1-of-file.html b/vocdoni-api/compute-ipfs-ci-dv-1-of-file.html index 8e28afc2b..c2640f224 100644 --- a/vocdoni-api/compute-ipfs-ci-dv-1-of-file.html +++ b/vocdoni-api/compute-ipfs-ci-dv-1-of-file.html @@ -12,13 +12,13 @@ - +

    Compute IPFS CIDv1 of file

    Helper endpoint to get the IPFS CIDv1 hash of a file

    Request Body required

    File bytes base64 encoded

    • payload string
    Responses

    OK


    Schema
    • cid string
    Loading...

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/vocdoni-api/count-election-votes.html b/vocdoni-api/count-election-votes.html index 1974499de..b3785c497 100644 --- a/vocdoni-api/count-election-votes.html +++ b/vocdoni-api/count-election-votes.html @@ -12,13 +12,13 @@ - +

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/vocdoni-api/count-organization-elections.html b/vocdoni-api/count-organization-elections.html index fbc091837..0f580b8d1 100644 --- a/vocdoni-api/count-organization-elections.html +++ b/vocdoni-api/count-organization-elections.html @@ -12,13 +12,13 @@ - +

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/vocdoni-api/count-organizations.html b/vocdoni-api/count-organizations.html index 42b859e2e..67b3d3b7b 100644 --- a/vocdoni-api/count-organizations.html +++ b/vocdoni-api/count-organizations.html @@ -12,13 +12,13 @@ - + - + \ No newline at end of file diff --git a/vocdoni-api/create-a-new-census.html b/vocdoni-api/create-a-new-census.html index ce3813ec9..a362d54df 100644 --- a/vocdoni-api/create-a-new-census.html +++ b/vocdoni-api/create-a-new-census.html @@ -12,13 +12,13 @@ - +

    Create a new census

    Create a new census on the backend side. The census is still unpublished until publish is called.

    To create the census it require a Bearer token created on the user side using a UUID. This token should we stored for the user to perform operations to this census such add participants or publish.

    It return a new random censusID (a random 32 bytes hex string), which are used (along with the Bearer token) to add participant keys to the census. Once the census is published no more keys can be added.

    To use a census on an election, it must be published.

    • Available types are: weighted and zkindexed
    • Require header Bearer token created user side
    Path Parameters
    • type string required

      Possible values: [weighted, zkweighted, csp]

      Census type

    Responses

    OK


    Schema
    • censusId string
    Loading...

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/vocdoni-api/create-election-for-wallet.html b/vocdoni-api/create-election-for-wallet.html index eb0d8aa48..247f49873 100644 --- a/vocdoni-api/create-election-for-wallet.html +++ b/vocdoni-api/create-election-for-wallet.html @@ -12,13 +12,13 @@ - +

    Create election for wallet

    Creates an election. Requires the bearer token of the account you want to create the election.

    Request Body required

    Election description

    • census object
    • publicKey string
    • rootHash string
    • size integer
    • type string
    • url string
    • description object
    • property name* string
    • electionType object
    • anonymous boolean
    • autostart boolean
    • dynamicCensus boolean
    • interruptible boolean
    • secretUntilTheEnd boolean
    • endDate string
    • header string
    • questions object[]
    • choices object[]
    • title object
    • property name* string
    • value integer
    • description object
    • property name* string
    • title object
    • property name* string
    • startDate string
    • streamUri string
    • tempSIKs boolean
    • title object
    • property name* string
    • voteType object
    • costExponent integer
    • costFromWeight boolean
    • maxCount integer
    • maxValue integer
    • maxVoteOverwrites integer
    • uniqueChoices boolean
    Responses

    OK


    Schema
    • code integer
    • hash string
    • response base64
    Loading...

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/vocdoni-api/create-election.html b/vocdoni-api/create-election.html index fe3898b95..d4c22e601 100644 --- a/vocdoni-api/create-election.html +++ b/vocdoni-api/create-election.html @@ -12,7 +12,7 @@ - + @@ -21,7 +21,7 @@ signature is only required in those transactions that actually need signature. I.e zk-Snarks based transactions won't needed, however the transaction should use this message type in order to preserve consistency on the Vochain

  • tx integer[]

    The bytes produced by Marshaling a Tx{} message

  • Responses

    It return txId, electionId and the metadataURL for the newly created election. If metadataURL is returned empty, means that there is some issue with the storage provider.


    Schema
    • electionID string
    • metadata integer[]
    • metadataURL string
    • txHash string
    • txPayload integer[]
    Loading...

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/vocdoni-api/delete-census.html b/vocdoni-api/delete-census.html index 363c1aa16..97b0ac103 100644 --- a/vocdoni-api/delete-census.html +++ b/vocdoni-api/delete-census.html @@ -14,13 +14,13 @@ - +

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/vocdoni-api/election-information.html b/vocdoni-api/election-information.html index 87ac97dd9..e764a9301 100644 --- a/vocdoni-api/election-information.html +++ b/vocdoni-api/election-information.html @@ -12,13 +12,13 @@ - +

    Election information

    Get full election information

    Path Parameters
    • electionID string required

      Election id

    Responses

    OK


    Schema
    • census object
    • censusOrigin string
    • censusRoot string
    • censusURL string
    • maxCensusSize integer
    • postRegisterCensusRoot string
    • chainId string
    • creationTime string
    • electionId string
    • electionMode object
    • autoStart boolean
    • dynamicCensus boolean
    • encryptedMetaData boolean
    • interruptible boolean
    • preRegister boolean
    • endDate string
    • finalResults boolean
    • fromArchive boolean
    • manuallyEnded boolean
    • metadata object
    • description object
    • property name* string
    • media object
    • header string
    • streamUri string
    • meta
    • questions object[]
    • choices object[]
    • title object
    • property name* string
    • value integer
    • description object
    • property name* string
    • title object
    • property name* string
    • title object
    • property name* string
    • type object
    • name string
    • properties
    • version string
    • metadataURL string
    • organizationId string
    • result array[]
    • startDate string
    • status string
    • tallyMode object
    • costExponent integer
    • maxCount integer
    • maxTotalCost integer
    • maxValue integer
    • maxVoteOverwrites integer
    • voteCount integer
    • voteMode object
    • anonymous boolean
    • costFromWeight boolean
    • encryptedVotes boolean
    • serial boolean
    • uniqueValues boolean
    Loading...

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/vocdoni-api/election-results.html b/vocdoni-api/election-results.html index c96c92382..18fcdf848 100644 --- a/vocdoni-api/election-results.html +++ b/vocdoni-api/election-results.html @@ -12,13 +12,13 @@ - +

    Election results

    Returns a given election consensus results and useful information about the results. Results represented with BigInt strings.

    This method can be used by anyone, but it is also used by Chainlink for fetching Vochain results and store it to the Results contract on an EVM network.

    For discovering more about the on-chain results, please refer to chainlink-tally repository.

    Path Parameters
    • electionID string required

      Election id

    Responses

    OK


    Schema
    • censusRoot string

      CensusRoot is the root of the census tree

    • electionId string

      ElectionID is the ID of the election

    • organizationId string

      OrganizationID is the ID of the organization that created the election

    • results array[]

      Results is the list of votes

    • sourceContractAddress string

      SourceContractAddress is the address of the smart contract containing the census

    Loading...

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/vocdoni-api/elections.html b/vocdoni-api/elections.html index 92c1aef22..312a8b745 100644 --- a/vocdoni-api/elections.html +++ b/vocdoni-api/elections.html @@ -12,13 +12,13 @@ - +

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/vocdoni-api/estimate-block-to-date.html b/vocdoni-api/estimate-block-to-date.html index c57e24687..1158a8c4d 100644 --- a/vocdoni-api/estimate-block-to-date.html +++ b/vocdoni-api/estimate-block-to-date.html @@ -12,13 +12,13 @@ - +

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/vocdoni-api/estimate-date-to-block.html b/vocdoni-api/estimate-date-to-block.html index 43eaff6c6..b04ce5955 100644 --- a/vocdoni-api/estimate-date-to-block.html +++ b/vocdoni-api/estimate-date-to-block.html @@ -12,13 +12,13 @@ - +

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/vocdoni-api/export-census-database.html b/vocdoni-api/export-census-database.html index 693bdb569..66af4c849 100644 --- a/vocdoni-api/export-census-database.html +++ b/vocdoni-api/export-census-database.html @@ -12,13 +12,13 @@ - +

    Export census database

    Export the whole census database to a JSON file. Requires Admin Bearer token.

    Path Parameters
    • ipfs string required

      Export to IPFS. Blank to return the JSON file

    Responses

    OK


    Schema
    • valid boolean
    Loading...

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/vocdoni-api/export-census.html b/vocdoni-api/export-census.html index 003222ff9..c406b0012 100644 --- a/vocdoni-api/export-census.html +++ b/vocdoni-api/export-census.html @@ -12,14 +12,14 @@ - +

    Export census

    Export census to JSON format. Requires Bearer token

    Path Parameters
    • censusID string required

      Census id

    Responses

    OK


    Schema
    • censusID string
    • data integer[]
    • maxLevels integer

      MaxLevels is required to load the census with the original size because it could be different according to the election (and census) type.

    • rootHash string
    • size integer
    • token string
    • type integer

      Possible values: [0, 1, 2, 3, 4, 5, 6]

    • uri string
    Loading...

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/vocdoni-api/exports-the-indexer-database.html b/vocdoni-api/exports-the-indexer-database.html index d366a8910..061d8e2a8 100644 --- a/vocdoni-api/exports-the-indexer-database.html +++ b/vocdoni-api/exports-the-indexer-database.html @@ -12,13 +12,13 @@ - +

    Exports the indexer database

    Exports the indexer SQL database in raw format

    Responses

    OK


    Schema
    • string
    Loading...

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/vocdoni-api/get-account.html b/vocdoni-api/get-account.html index 2a1eb175e..b4be6ea9a 100644 --- a/vocdoni-api/get-account.html +++ b/vocdoni-api/get-account.html @@ -12,14 +12,14 @@ - +

    Get account

    Get account information by its address or public key. The infoURI parameter contain where account metadata is uploaded (like avatar, name...). It return also an already parsed "metadata" object from this infoUri. The meta object inside the metadata property is left to the user to add random information about the account.

    Path Parameters
    • address string required

      Account address

    Responses

    OK


    Schema
    • actions
    • description object
    • property name* string
    • languages string[]
    • media object
    • avatar string
    • header string
    • logo string
    • meta
    • name object
    • property name* string
    • newsFeed object
    • property name* string
    • version string
    Loading...

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/vocdoni-api/get-block-by-hash.html b/vocdoni-api/get-block-by-hash.html index f63dcc996..b2ead9111 100644 --- a/vocdoni-api/get-block-by-hash.html +++ b/vocdoni-api/get-block-by-hash.html @@ -12,7 +12,7 @@ - + @@ -24,7 +24,7 @@ ValidatorSet order. Any peer with a block can gossip signatures by index with a peer without recalculating the active ValidatorSet.

  • round integer
  • signatures object[]
  • block_id_flag integer

    Possible values: [1, 2, 3]

  • signature integer[]
  • timestamp string
  • validator_address integer[]
  • Loading...

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/vocdoni-api/get-block-by-height.html b/vocdoni-api/get-block-by-height.html index 44f423c91..c94458ec1 100644 --- a/vocdoni-api/get-block-by-height.html +++ b/vocdoni-api/get-block-by-height.html @@ -12,7 +12,7 @@ - + @@ -24,7 +24,7 @@ ValidatorSet order. Any peer with a block can gossip signatures by index with a peer without recalculating the active ValidatorSet.

  • round integer
  • signatures object[]
  • block_id_flag integer

    Possible values: [1, 2, 3]

  • signature integer[]
  • timestamp string
  • validator_address integer[]
  • Loading...

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/vocdoni-api/get-next-election-id.html b/vocdoni-api/get-next-election-id.html index 8149d2306..7a6e7b088 100644 --- a/vocdoni-api/get-next-election-id.html +++ b/vocdoni-api/get-next-election-id.html @@ -12,13 +12,13 @@ - +

    Get next election ID

    nextElectionIDHandler

    Request Body required

    OrganizationID, CensusOrigin and EnvelopeType

    • censusOrigin integer
    • envelopeType object
    • anonymous boolean
    • costFromWeight boolean
    • encryptedVotes boolean
    • serial boolean
    • uniqueValues boolean
    • organizationId string
    Responses

    OK


    Schema
    • electionID string
    Loading...

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/vocdoni-api/get-type-of-census.html b/vocdoni-api/get-type-of-census.html index 1312b2224..b6d30613f 100644 --- a/vocdoni-api/get-type-of-census.html +++ b/vocdoni-api/get-type-of-census.html @@ -12,13 +12,13 @@ - +

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/vocdoni-api/get-vote.html b/vocdoni-api/get-vote.html index 25949b88c..6d8cb9644 100644 --- a/vocdoni-api/get-vote.html +++ b/vocdoni-api/get-vote.html @@ -12,13 +12,13 @@ - +

    Get vote

    Get the content of an existing Vote. If is an encrypted election it return the encryptionKeys indexes and the package will be codified.

    The Vote is identified by its voteId, also called nullifier. The nullifier is deterministic and its hash could be computed as following (using Keccak256):

    • For signature based elections, is the hash of the voterAddress + processId
    • For anonymous elections, the privateKey + processId

    As well, on the response, the voterId won't be returned for anonymous elections, and the encryptionKeyIndexes only for finished encrypted elections.

    Height and txIndex refer to the block height and the index of the transaction where vote is registered.

    The overwriteCount refers to the number of vote overwrites already executed by the user. At election creation time, you can specify the maxVoteOverwrites parameter, which defines how many times a voter can submit a vote. Only last vote will be taken into election final results.

    Path Parameters
    • voteID string required

      Nullifier of the vote

    Responses

    OK


    Schema
    • blockHeight integer
    • date string

      Date when the vote was emitted

    • electionID string
    • encryptionKeys integer[]

      Sent only for encrypted elections (no results until the end)

    • number integer
    • overwriteCount integer
    • package integer[]

      For encrypted elections this will be codified

    • transactionIndex integer
    • txHash string
    • voteID string
    • voterID string
    • weight string
    Loading...

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/vocdoni-api/import-census-database.html b/vocdoni-api/import-census-database.html index 2627db40f..a8bdbf217 100644 --- a/vocdoni-api/import-census-database.html +++ b/vocdoni-api/import-census-database.html @@ -12,13 +12,13 @@ - +

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/vocdoni-api/import-census.html b/vocdoni-api/import-census.html index 24049d364..119935c13 100644 --- a/vocdoni-api/import-census.html +++ b/vocdoni-api/import-census.html @@ -12,13 +12,13 @@ - +

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/vocdoni-api/list-account-received-and-sent-token-transfers.html b/vocdoni-api/list-account-received-and-sent-token-transfers.html index af525699c..3cb62fd5c 100644 --- a/vocdoni-api/list-account-received-and-sent-token-transfers.html +++ b/vocdoni-api/list-account-received-and-sent-token-transfers.html @@ -12,13 +12,13 @@ - +

    List account received and sent token transfers

    Returns the token transfers for an account. A transfer is a token transference from one account to other (excepting the burn address).

    Path Parameters
    • accountID string required

      Specific accountID

    • page string required

      Paginator page

    Responses

    OK


    Schema
    • transfers object
    • received object[]
    • amount integer
    • from integer[]
    • height integer
    • timestamp string
    • to integer[]
    • txHash integer[]
    • sent object[]
    • amount integer
    • from integer[]
    • height integer
    • timestamp string
    • to integer[]
    • txHash integer[]
    Loading...

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/vocdoni-api/list-account-token-fees.html b/vocdoni-api/list-account-token-fees.html index c96c91979..7c4552c51 100644 --- a/vocdoni-api/list-account-token-fees.html +++ b/vocdoni-api/list-account-token-fees.html @@ -12,13 +12,13 @@ - +

    List account token fees

    Returns the token fees for an account. A spending is an amount of tokens burnt from one account for executing transactions.

    Path Parameters
    • accountID string required

      Specific accountID

    • page string required

      Paginator page

    Responses

    OK


    Schema
    • fees object[]
    • cost integer
    • from integer[]
    • height integer
    • reference string
    • timestamp string
    • txType string
    Loading...

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/vocdoni-api/list-all-census-references.html b/vocdoni-api/list-all-census-references.html index 373030681..50d581f6d 100644 --- a/vocdoni-api/list-all-census-references.html +++ b/vocdoni-api/list-all-census-references.html @@ -12,13 +12,13 @@ - +

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/vocdoni-api/list-all-token-fees-by-reference.html b/vocdoni-api/list-all-token-fees-by-reference.html index 0d46a2674..dc71b3817 100644 --- a/vocdoni-api/list-all-token-fees-by-reference.html +++ b/vocdoni-api/list-all-token-fees-by-reference.html @@ -12,13 +12,13 @@ - +

    List all token fees by reference

    Returns the token fees list filtered by reference and ordered by date. A spending is an amount of tokens burnt from one account for executing transactions.

    Path Parameters
    • reference string required

      Reference filter

    • page string required

      Paginator page

    Responses

    OK


    Schema
    • fees object[]
    • cost integer
    • from integer[]
    • height integer
    • reference string
    • timestamp string
    • txType string
    Loading...

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/vocdoni-api/list-all-token-fees-by-type.html b/vocdoni-api/list-all-token-fees-by-type.html index 4c7a77fcd..889a50a39 100644 --- a/vocdoni-api/list-all-token-fees-by-type.html +++ b/vocdoni-api/list-all-token-fees-by-type.html @@ -12,13 +12,13 @@ - +

    List all token fees by type

    Returns the token fees list filtered by type and ordered by date. A spending is an amount of tokens burnt from one account for executing transactions.

    Path Parameters
    • type string required

      Type filter

    • page string required

      Paginator page

    Responses

    OK


    Schema
    • fees object[]
    • cost integer
    • from integer[]
    • height integer
    • reference string
    • timestamp string
    • txType string
    Loading...

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/vocdoni-api/list-all-token-fees.html b/vocdoni-api/list-all-token-fees.html index 9acf2e145..85bfe7224 100644 --- a/vocdoni-api/list-all-token-fees.html +++ b/vocdoni-api/list-all-token-fees.html @@ -12,13 +12,13 @@ - +

    List all token fees

    Returns the token fees list ordered by date. A spending is an amount of tokens burnt from one account for executing transactions.

    Path Parameters
    • page string required

      Paginator page

    Responses

    OK


    Schema
    • fees object[]
    • cost integer
    • from integer[]
    • height integer
    • reference string
    • timestamp string
    • txType string
    Loading...

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/vocdoni-api/list-election-votes.html b/vocdoni-api/list-election-votes.html index 1a71c3bdc..9d402bf4b 100644 --- a/vocdoni-api/list-election-votes.html +++ b/vocdoni-api/list-election-votes.html @@ -12,13 +12,13 @@ - +

    List election votes

    Returns the list of voteIDs for an election (paginated)

    Path Parameters
    • electionID string required

      Election id

    • page number required

      Page

    Responses

    OK


    Schema
    • blockHeight integer
    • date string

      Date when the vote was emitted

    • electionID string
    • encryptionKeys integer[]

      Sent only for encrypted elections (no results until the end)

    • number integer
    • overwriteCount integer
    • package integer[]

      For encrypted elections this will be codified

    • transactionIndex integer
    • txHash string
    • voteID string
    • voterID string
    • weight string
    Loading...

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/vocdoni-api/list-elections-filtered.html b/vocdoni-api/list-elections-filtered.html index e5d0377dd..386ba9479 100644 --- a/vocdoni-api/list-elections-filtered.html +++ b/vocdoni-api/list-elections-filtered.html @@ -12,13 +12,13 @@ - +

    List elections (filtered)

    Return a filtered elections list, the available filters have to be sent on the request body. Available are:

    {
    "organizationId": "hexString",
    "electionId": "hexString",
    "withResults": false,
    "status": "READY",
    }

    electionId can be partial.

    See elections list

    Path Parameters
    • page number required

      Page to paginate

    Request Body required

    Filtered by partial organizationID, partial processID, process status and with results available or not

    • electionId string
    • organizationId string
    • status string
    • withResults boolean
    Responses

    OK


    Schema
    • chainId string
    • electionId string
    • endDate string
    • finalResults boolean
    • fromArchive boolean
    • manuallyEnded boolean
    • organizationId string
    • result array[]
    • startDate string
    • status string
    • voteCount integer
    Loading...

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/vocdoni-api/list-elections.html b/vocdoni-api/list-elections.html index 5fec179a4..2bf9c6c6d 100644 --- a/vocdoni-api/list-elections.html +++ b/vocdoni-api/list-elections.html @@ -12,13 +12,13 @@ - +

    List elections

    Get a list of elections summaries.

    Path Parameters
    • page number required

      Page

    Responses

    OK


    Schema
    • chainId string
    • electionId string
    • endDate string
    • finalResults boolean
    • fromArchive boolean
    • manuallyEnded boolean
    • organizationId string
    • result array[]
    • startDate string
    • status string
    • voteCount integer
    Loading...

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/vocdoni-api/list-encryption-keys.html b/vocdoni-api/list-encryption-keys.html index 6e700959a..91bb8ec6e 100644 --- a/vocdoni-api/list-encryption-keys.html +++ b/vocdoni-api/list-encryption-keys.html @@ -12,13 +12,13 @@ - +

    List encryption keys

    Returns the list of public/private encryption keys

    Path Parameters
    • electionID string required

      Election id

    Responses

    OK


    Schema
    • privateKeys string
    • publicKeys string
    Loading...

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/vocdoni-api/list-of-the-existing-accounts.html b/vocdoni-api/list-of-the-existing-accounts.html index ca7056402..6cc3ca958 100644 --- a/vocdoni-api/list-of-the-existing-accounts.html +++ b/vocdoni-api/list-of-the-existing-accounts.html @@ -12,13 +12,13 @@ - +

    List of the existing accounts

    Returns information (address, balance and nonce) of the existing accounts

    Path Parameters
    • page string required

      Paginator page

    Responses

    OK


    Schema
    • accounts object[]
    • address integer[]
    • balance integer
    • nonce integer
    Loading...

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/vocdoni-api/list-of-valid-sik-roots.html b/vocdoni-api/list-of-valid-sik-roots.html index fb9f476c6..91c4d87c9 100644 --- a/vocdoni-api/list-of-valid-sik-roots.html +++ b/vocdoni-api/list-of-valid-sik-roots.html @@ -12,13 +12,13 @@ - +

    List of valid SIK roots

    Returns the list of currently valid roots of the merkle tree where the vochain account SIK's are stored.

    Responses

    OK


    Schema
    • sikroot string
    • siksiblings string[]
    • sikproof string
    Loading...

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/vocdoni-api/list-organization-elections-by-status.html b/vocdoni-api/list-organization-elections-by-status.html index 6d4968880..ef8c36dde 100644 --- a/vocdoni-api/list-organization-elections-by-status.html +++ b/vocdoni-api/list-organization-elections-by-status.html @@ -12,13 +12,13 @@ - +

    List organization elections by status

    List the elections of an organization by status

    Path Parameters
    • organizationID string required

      Specific organizationID

    • status string required

      Possible values: [ready, paused, canceled, ended, results]

      Status of the election

    • page number required

      Define de page number

    Responses

    OK


    Schema
    • elections object[]
    • chainId string
    • electionId string
    • endDate string
    • finalResults boolean
    • fromArchive boolean
    • manuallyEnded boolean
    • organizationId string
    • result array[]
    • startDate string
    • status string
    • voteCount integer
    Loading...

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/vocdoni-api/list-organization-elections.html b/vocdoni-api/list-organization-elections.html index 49056dfd2..ba71585e1 100644 --- a/vocdoni-api/list-organization-elections.html +++ b/vocdoni-api/list-organization-elections.html @@ -12,13 +12,13 @@ - +

    List organization elections

    List the elections of an organization

    Path Parameters
    • organizationID string required

      Specific organizationID

    • page number required

      Define de page number

    Responses

    OK


    Schema
    • elections object[]
    • chainId string
    • electionId string
    • endDate string
    • finalResults boolean
    • fromArchive boolean
    • manuallyEnded boolean
    • organizationId string
    • result array[]
    • startDate string
    • status string
    • voteCount integer
    Loading...

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/vocdoni-api/list-organizations-filtered.html b/vocdoni-api/list-organizations-filtered.html index c528916f1..516cfcc7c 100644 --- a/vocdoni-api/list-organizations-filtered.html +++ b/vocdoni-api/list-organizations-filtered.html @@ -12,13 +12,13 @@ - +

    List organizations (filtered)

    Returns a list of organizations filtered by its partial id, paginated by the given page

    Path Parameters
    • page integer required

      Current page

    Request Body required

    Partial organizationId to filter by

    • organizationId string
    Responses

    OK


    Schema
    • organizations object[]
    • electionCount integer
    • organizationID string
    Loading...

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/vocdoni-api/list-organizations.html b/vocdoni-api/list-organizations.html index f2c23bb19..182c1d5d6 100644 --- a/vocdoni-api/list-organizations.html +++ b/vocdoni-api/list-organizations.html @@ -12,14 +12,14 @@ - +

    List organizations

    An Organizations is an account with infoUri that contains organization associated metadata. An Account instead could be a validator, an oracle, a voter or just someone who wants to transfer tokens.

    The /chain/organizations endpoints are related only to the Organization account type.

    • Return list of organizations ids.
    • If no page is defined, will assume page 0.
    Path Parameters
    • page integer required

      Page number

    Responses

    OK


    Schema
    • organizations object[]
    • electionCount integer
    • organizationID string
    Loading...

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/vocdoni-api/list-transactions.html b/vocdoni-api/list-transactions.html index 6db8ecf68..564739ca6 100644 --- a/vocdoni-api/list-transactions.html +++ b/vocdoni-api/list-transactions.html @@ -14,13 +14,13 @@ - +

    List Transactions

    To get full transaction information use /chain/transaction/{blockHeight}/{txIndex}.\nWhere transactionIndex is the index of the transaction on the containing block.

    Path Parameters
    • page integer required

      Page number

    Responses

    It return a list of transactions references


    Schema
    • transactions object[]
    • blockHeight int32
    • transactionHash string
    • transactionIndex int32
    • transactionNumber int64
    • transactionType string

      Possible values: [vote, newProcess, admin, setProcess, registerKey, mintTokens, sendTokens, setTransactionCosts, setAccount, collectFaucet, setKeykeeper]

    Loading...

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/vocdoni-api/list-validators.html b/vocdoni-api/list-validators.html index a9dee9c11..7e41aebad 100644 --- a/vocdoni-api/list-validators.html +++ b/vocdoni-api/list-validators.html @@ -12,13 +12,13 @@ - +

    List validators

    Returns the list of validators

    Responses

    OK


    Schema
    • validators object[]
    • address string
    • joinHeight integer
    • name string
    • power integer
    • proposals integer
    • pubKey string
    • score integer
    • validatorAddress string
    • votes integer
    Loading...

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/vocdoni-api/price-factors-information.html b/vocdoni-api/price-factors-information.html index 100edf7f6..a9acdf61d 100644 --- a/vocdoni-api/price-factors-information.html +++ b/vocdoni-api/price-factors-information.html @@ -12,13 +12,13 @@ - +

    Price factors information

    Package electionprice provides a mechanism for calculating the price of an election based on its characteristics.

    The formula used to calculate the price for creating an election on the Vocdoni blockchain is designed to take into account various factors that impact the cost and complexity of conducting an election. The price is determined by combining several components, each reflecting a specific aspect of the election process.

    1. Base Price: This is a fixed cost that serves as a starting point for the price calculation. It represents the minimal price for creating an election, regardless of its size or duration.
    2. Size Price: As the number of voters (maxCensusSize) in an election increases, the resources required to manage the election also grow. To account for this, the size price component is directly proportional to the maximum number of votes allowed in the election. Additionally, it takes into consideration the blockchain's maximum capacity (capacity) and the maximum capacity the blockchain administrators can set (maxCapacity). This ensures that the price is adjusted based on the current capacity of the blockchain.
    3. Duration Price: The length of the election (electionDuration) also affects the price, as longer elections occupy more resources over time. The duration price component is directly proportional to the election duration and inversely proportional to the maximum number of votes. This means that if the election lasts longer, the price increases, and if there are more votes in a shorter time, the price also increases to reflect the higher demand for resources.
    4. Encrypted Votes: If an election requires encryption for maintaining secrecy until the end (encryptedVotes), it demands additional resources and computational effort. Therefore, the encrypted price component is added to the total price when this feature is enabled.
    5. Anonymous Votes: Similarly, if an election must be anonymous (anonymousVotes), it requires additional measures to ensure voter privacy. As a result, the anonymous price component is added to the total price when this option is chosen.
    6. Overwrite Price: Allowing voters to overwrite their votes (maxVoteOverwrite) can increase the complexity of managing the election, as it requires additional resources to handle vote updates. The overwrite price component accounts for this by being proportional to the maximum number of vote overwrites and the maximum number of votes allowed in the election. It also takes into account the blockchain's capacity to ensure the price reflects the current resource constraints.

    The constant factors in the price formula play a crucial role in determining the price of an election based on its characteristics. Each factor is associated with a specific component of the price formula and helps to weigh the importance of that component in the final price calculation. The rationale beind these constant factors is to provide a flexible mechanism to adjust the pricing model based on the system's needs and requirements.

    • k1 (Size price factor): This constant factor affects the size price component of the formula. By adjusting k1, you can control the impact of the maximum number of votes (maxCensusSize) on the overall price. A higher k1 value would make the price increase more rapidly as the election size grows, while a lower k1 value would make the price less sensitive to the election size. The rationale behind k1 is to ensure that the pricing model can be adapted to accommodate different election sizes while considering the resource requirements.
    • k2 (Duration price factor): This constant factor influences the duration price component of the formula. By adjusting k2, you can control how the duration of the election (electionDuration) affects the price. A higher k2 value would make the price increase more quickly as the election duration extends, while a lower k2 value would make the price less sensitive to the election duration. The rationale behind k2 is to reflect the resource consumption over time and ensure that longer elections are priced accordingly.
    • k3 (Encrypted price factor): This constant factor affects the encrypted price component of the formula. By adjusting k3, you can control the additional cost associated with encrypted elections (encryptedVotes). A higher k3 value would make the price increase more significantly for elections that require encryption, while a lower k3 value would make the price less sensitive to the encryption requirement. The rationale behind k3 is to account for the extra computational effort and resources needed to ensure secrecy in encrypted elections.
    • k4 (Anonymous price factor): This constant factor influences the anonymous price component of the formula. By adjusting k4, you can control the additional cost associated with anonymous elections (anonymousVotes). A higher k4 value would make the price increase more significantly for elections that require anonymity, while a lower k4 value would make the price less sensitive to the anonymity requirement. The rationale behind k4 is to account for the extra measures and resources needed to ensure voter privacy in anonymous elections.
    • k5 (Overwrite price factor): This constant factor affects the overwrite price component of the formula. By adjusting k5, you can control the additional cost associated with allowing vote overwrites (maxVoteOverwrite). A higher k5 value would make the price increase more significantly for elections that permit vote overwrites, while a lower k5 value would make the price less sensitive to the overwrite allowance. The rationale behind k5 is to account for the increased complexity and resources needed to manage vote overwrites in the election process.
    • k6 (Non-linear growth factor): This constant factor determines the rate of price growth for elections with a maximum number of votes (maxCensusSize) exceeding the k7 threshold. By adjusting k6, you can control the non-linear growth rate of the price for larger elections. A higher k6 value would result in a more rapid increase in the price as the election size grows beyond the k7 threshold, while a lower k6 value would result in a slower increase in the price for larger elections. The rationale behind k6 is to provide a mechanism for controlling the pricing model's sensitivity to large elections. This factor ensures that the price accurately reflects the increased complexity, resource consumption, and management effort associated with larger elections, while maintaining a more affordable price for smaller elections. By fine-tuning k6, the pricing model can be adapted to balance accessibility for smaller elections with the need to cover costs and resource requirements for larger elections.
    • k7 (Size non-linear trigger): This constant factor represents a threshold value for the maximum number of votes (maxCensusSize) in an election. When the election size exceeds k7, the price growth becomes non-linear, increasing more rapidly beyond this point. The rationale behind k7 is to create a pricing model that accommodates a "freemium" approach, where smaller elections (under the k7 threshold) are priced affordably, while larger elections are priced more significantly due to their increased resource requirements and complexity. By adjusting k7, you can control the point at which the price transition from linear to non-linear growth occurs. A higher k7 value would allow for more affordable pricing for a larger range of election sizes, while a lower k7 value would result in more rapid price increases for smaller election sizes. This flexibility enables the pricing model to be tailored to the specific needs and goals of the Vocdoni blockchain, ensuring that small elections remain accessible and affordable,while larger elections are priced to reflect their higher resource demands.
    Responses

    OK


    Schema
    • basePrice integer

      base price for an election

    • capacity integer

      capacity of the blockchain

    • factors object
    • k1 number

      sizePriceFactor

    • k2 number

      durationPriceFactor

    • k3 number

      encryptedPriceFactor

    • k4 number

      anonymousPriceFactor

    • k5 number

      overwritePriceFactor

    • k6 number

      Size scaling factor for maxCensusSize

    • k7 integer

      Threshold for maxCensusSize scaling

    Loading...

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/vocdoni-api/prove-key-to-census.html b/vocdoni-api/prove-key-to-census.html index e13df0204..ac584a624 100644 --- a/vocdoni-api/prove-key-to-census.html +++ b/vocdoni-api/prove-key-to-census.html @@ -12,13 +12,13 @@ - +

    Prove key to census

    Prove the key and weight belong to the census root hash.

    If the key exists on the census returns Merkle root information. Proof property is referred to the siblings of Merkle tree, the value points to the leaf of the Merkle Tree for this key (on this case, the weight), and weight is just the key weight for this census.

    Further reading

    • Requires Bearer token
    • Returns a merkle proof, proving the key and weight belongs to the census root hash
    Path Parameters
    • censusID string required

      Census id

    • key string required

      Key to proof

    Responses

    where proof is Merkle tree siblings and value is Merkle tree leaf value


    Schema
    • proof string
    • value string
    • weight number
    Loading...

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/vocdoni-api/publish-census-at-root.html b/vocdoni-api/publish-census-at-root.html index 2f7421bad..21d4349a6 100644 --- a/vocdoni-api/publish-census-at-root.html +++ b/vocdoni-api/publish-census-at-root.html @@ -12,13 +12,13 @@ - +

    Publish census at root

    Register a census to the storage (IPFS in our case). After this, the census can't be edited.

    You could provide the census Merkle root to specify census publication at specific snapshot. See censuses/{censusId}/participants

    • Requires Bearer token
    • The census is copied to a new census identified by its Merkle Root
    • The new census cannot be modified
    • The census is published to the storage provided (IPFS in our case)
    • The new census ID is returned and can be used for querying
    • If a censusID with the same root has been already published, the request will fail
    • If root is specified as path parameter, it publish the census at specific root (append the census to existing one).
    Path Parameters
    • censusID string required

      Census id

    • root string required

      Specific root where to publish the census. Not required

    Responses

    It return published censusID and the ipfs uri where its uploaded


    Schema
    • census object
    • censusID string
    • uri string
    Loading...

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/vocdoni-api/publish-census.html b/vocdoni-api/publish-census.html index b11f115c0..73989cb0d 100644 --- a/vocdoni-api/publish-census.html +++ b/vocdoni-api/publish-census.html @@ -12,13 +12,13 @@ - +

    Publish census

    Register a census to the storage (IPFS in our case). After this, the census can't be edited.

    You could provide the census Merkle root to specify census publication at specific snapshot. See censuses/{censusId}/participants

    • Requires Bearer token
    • The census is copied to a new census identified by its Merkle Root
    • The new census cannot be modified
    • The census is published to the storage provided (IPFS in our case)
    • The new census ID is returned and can be used for querying
    • If a censusID with the same root has been already published, the request will fail
    • If root is specified as path parameter, it publish the census at specific root (append the census to existing one).
    Path Parameters
    • censusID string required

      Census id

    Responses

    It return published censusID and the ipfs uri where its uploaded


    Schema
    • census object
    • censusID string
    • uri string
    Loading...

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/vocdoni-api/returns-if-the-address-provided-has-a-valid-sik.html b/vocdoni-api/returns-if-the-address-provided-has-a-valid-sik.html index cac8bbbff..394b1b28a 100644 --- a/vocdoni-api/returns-if-the-address-provided-has-a-valid-sik.html +++ b/vocdoni-api/returns-if-the-address-provided-has-a-valid-sik.html @@ -12,13 +12,13 @@ - +

    Returns if the address provided has a valid SIK

    Returns if the address provided, associated to an a registered account or not, has a valid SIK already registered or not.

    Responses

    OK


    Schema
    • sik string
    Loading...

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/vocdoni-api/set-account.html b/vocdoni-api/set-account.html index c44c9acf3..c6d7fcf6d 100644 --- a/vocdoni-api/set-account.html +++ b/vocdoni-api/set-account.html @@ -12,14 +12,14 @@ - +

    Set account

    It register an account to the blockchain including IPFS metadata upload.

    • Requires a signed protobuf transaction on the body to perform the operation.
    • Metadata is not required, but if no metadata is provided the account won't be listed on /chain/organizations endpoint. Check there to read about differences between an account and a organization.
    Request Body required

    Transaction payload and metadata object encoded using base64

    • metadata string
    • txPayload string
    Responses

    OK


    Schema
    • metadataURL string
    • txHash string
    Loading...

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/vocdoni-api/set-wallet-account.html b/vocdoni-api/set-wallet-account.html index b65515696..564a42afd 100644 --- a/vocdoni-api/set-wallet-account.html +++ b/vocdoni-api/set-wallet-account.html @@ -12,13 +12,13 @@ - +

    Set wallet account

    Set a new account. Needed the bearer token associated the account.

    Responses

    OK


    Schema
    • code integer
    • hash string
    • response base64
    Loading...

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/vocdoni-api/sik.html b/vocdoni-api/sik.html index 8cab358fa..ac98324bf 100644 --- a/vocdoni-api/sik.html +++ b/vocdoni-api/sik.html @@ -12,13 +12,13 @@ - + - + \ No newline at end of file diff --git a/vocdoni-api/submit-a-vote.html b/vocdoni-api/submit-a-vote.html index 4fb62dacf..eabf3d61b 100644 --- a/vocdoni-api/submit-a-vote.html +++ b/vocdoni-api/submit-a-vote.html @@ -12,13 +12,13 @@ - +

    Submit a vote

    Submit a vote using a protobuf signed transaction. The corresponding result are the vote id and transaction hash where the vote is registered.

    Request Body required

    Requires a protobuf signed transaction

    • txPayload string
    Responses

    OK


    Schema
    • voteID string
    • txHash string
    Loading...

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/vocdoni-api/submit-transaction.html b/vocdoni-api/submit-transaction.html index d52c7d28a..7536fa190 100644 --- a/vocdoni-api/submit-transaction.html +++ b/vocdoni-api/submit-transaction.html @@ -12,13 +12,13 @@ - +

    Submit transaction

    It submit a transaction. Depending of transaction type will return different kinds of responses:

    • For a NewElection transaction, response will be the newElectionId
    • For a Vote transaction, response will be the voteID

    Once the transaction is mined on the Vochain you can use chain/transactions/reference/{hash} to find the block height and its index on the block to get the transaction index using chain/transactions/{blockHeight}/{txIndex}.

    Request Body required

    Base64 payload string containing transaction data and signature

    • payload string
    Responses

    Return blockchain response. response could differ depending of transaction type.


    Schema
    • code integer
    • hash string
    • response base64
    Loading...

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/vocdoni-api/total-number-of-accounts.html b/vocdoni-api/total-number-of-accounts.html index af547d3af..824cc1ea1 100644 --- a/vocdoni-api/total-number-of-accounts.html +++ b/vocdoni-api/total-number-of-accounts.html @@ -12,13 +12,13 @@ - +

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/vocdoni-api/total-number-of-sent-and-received-transactions.html b/vocdoni-api/total-number-of-sent-and-received-transactions.html index 8db5f5c44..c768a5ae3 100644 --- a/vocdoni-api/total-number-of-sent-and-received-transactions.html +++ b/vocdoni-api/total-number-of-sent-and-received-transactions.html @@ -12,13 +12,13 @@ - +

    Total number of sent and received transactions

    Returns the count of total number of sent and received transactions for an account. A transaction is a token transfer from one account to another existing account

    Path Parameters
    • accountID string required

      Specific accountID

    Responses

    Number of transaction sent and received for the account


    Schema
    • count integer
    Loading...

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/vocdoni-api/transaction-by-block-height-and-index.html b/vocdoni-api/transaction-by-block-height-and-index.html index 867bd24ad..46d6a203a 100644 --- a/vocdoni-api/transaction-by-block-height-and-index.html +++ b/vocdoni-api/transaction-by-block-height-and-index.html @@ -12,7 +12,7 @@ - + @@ -22,7 +22,7 @@
    *Proof_EthereumStorage
    *Proof_EthereumAccount
    *Proof_Ca
    *Proof_Arbo
    *Proof_ZkSnark
    *Proof_MinimeStorage
    *Proof_FarcasterFrame
  • questionIndex integer
  • results object
  • votes object[]
  • question array[]
  • status integer

    Possible values: [0, 1, 2, 3, 4, 5]

  • tempSIKs boolean

    tempSIKs flag decides if when the process has finished, the SIKs related to it will be removed or not

  • txtype integer

    Possible values: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 15, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28]

  • txInfo object
  • blockHeight int32
  • transactionHash string
  • transactionIndex int32
  • transactionNumber int64
  • transactionType string

    Possible values: [vote, newProcess, admin, setProcess, registerKey, mintTokens, sendTokens, setTransactionCosts, setAccount, collectFaucet, setKeykeeper]

  • Loading...

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/vocdoni-api/transaction-by-hash.html b/vocdoni-api/transaction-by-hash.html index 4fdb1eb78..ef8266ad0 100644 --- a/vocdoni-api/transaction-by-hash.html +++ b/vocdoni-api/transaction-by-hash.html @@ -12,13 +12,13 @@ - +

    Transaction by hash

    Using transaction hash it return the block and index containing that contains the transaction. After, you could use this block and index to retrieve transaction full info using transaction by block and index

    Path Parameters
    • hash string required

      Transaction hash

    Responses

    OK


    Schema
    • blockHeight int32
    • transactionHash string
    • transactionIndex int32
    • transactionNumber int64
    • transactionType string

      Possible values: [vote, newProcess, admin, setProcess, registerKey, mintTokens, sendTokens, setTransactionCosts, setAccount, collectFaucet, setKeykeeper]

    Loading...

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/vocdoni-api/transaction-by-index.html b/vocdoni-api/transaction-by-index.html index 3caa2c38b..0c6fa1c36 100644 --- a/vocdoni-api/transaction-by-index.html +++ b/vocdoni-api/transaction-by-index.html @@ -12,13 +12,13 @@ - +

    Transaction by index

    Get transaction by its index. This is not transaction reference (hash), and neither the block height and block index. The transaction index is an incremental counter for each transaction. You could use the transaction block and index to retrieve full info using transaction by block and index.

    Path Parameters
    • index integer required

      Index of the transaction

    Responses

    OK


    Schema
    • blockHeight int32
    • transactionHash string
    • transactionIndex int32
    • transactionNumber int64
    • transactionType string

      Possible values: [vote, newProcess, admin, setProcess, registerKey, mintTokens, sendTokens, setTransactionCosts, setAccount, collectFaucet, setKeykeeper]

    Loading...

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/vocdoni-api/transaction-costs.html b/vocdoni-api/transaction-costs.html index 02d7eb4b5..af63f5585 100644 --- a/vocdoni-api/transaction-costs.html +++ b/vocdoni-api/transaction-costs.html @@ -12,13 +12,13 @@ - +

    Transaction costs

    Returns the list of transactions and its cost

    Responses

    OK


    Schema
    • Tx_AddDelegateForAccount integer
    • Tx_CollectFaucet integer
    • Tx_CreateAccount integer
    • Tx_DelDelegateForAccount integer
    • Tx_DelSik integer
    • Tx_NewProcess integer
    • Tx_RegisterKey integer
    • Tx_SendTokens integer
    • Tx_SetAccountInfoURI integer
    • Tx_SetAccountValidator integer
    • Tx_SetProcessCensus integer
    • Tx_SetProcessQuestionIndex integer
    • Tx_SetProcessStatus integer
    • Tx_SetSik integer
    Loading...

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/vocdoni-api/transactions-count.html b/vocdoni-api/transactions-count.html index f0185d4f4..279fa2782 100644 --- a/vocdoni-api/transactions-count.html +++ b/vocdoni-api/transactions-count.html @@ -12,13 +12,13 @@ - + - + \ No newline at end of file diff --git a/vocdoni-api/transactions-in-a-block.html b/vocdoni-api/transactions-in-a-block.html index b9307a2f9..7fed8d3b3 100644 --- a/vocdoni-api/transactions-in-a-block.html +++ b/vocdoni-api/transactions-in-a-block.html @@ -12,13 +12,13 @@ - +

    Transactions in a block

    Given a block returns the list of transactions for that block

    Path Parameters
    • height number required

      Block height

    • page number required

      Page to paginate

    Responses

    OK


    Schema array
    • transactionHash string
    • transactionIndex integer
    • transactionNumber integer
    • transactionType string
    Loading...

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/vocdoni-api/transfer-tokens.html b/vocdoni-api/transfer-tokens.html index 0f260ebb1..5220265c0 100644 --- a/vocdoni-api/transfer-tokens.html +++ b/vocdoni-api/transfer-tokens.html @@ -12,13 +12,13 @@ - +

    Transfer tokens

    Transfer balance to another account. Needed the bearer token associated the account.

    Path Parameters
    • dstAddress string required

      Destination address

    • amount string required

      Amount of tokens to transfer

    Responses

    OK


    Schema
    • code integer
    • hash string
    • response base64
    Loading...

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/vocdoni-api/verify-merkle-proof.html b/vocdoni-api/verify-merkle-proof.html index 156ce7e2d..9f94f97c6 100644 --- a/vocdoni-api/verify-merkle-proof.html +++ b/vocdoni-api/verify-merkle-proof.html @@ -12,13 +12,13 @@ - +

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/vocdoni-api/verify-vote.html b/vocdoni-api/verify-vote.html index 6840f243f..ca885e954 100644 --- a/vocdoni-api/verify-vote.html +++ b/vocdoni-api/verify-vote.html @@ -12,13 +12,13 @@ - +

    Verify vote

    Check if vote is registered on the blockchain on specific election. Just return Ok status code

    Path Parameters
    • electionID string required

      Election id

    • voteID string required

      Nullifier of the vote

    Responses

    (empty body)

    Loading...

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/vocdoni-api/vocdoni-api.html b/vocdoni-api/vocdoni-api.html index a278fd334..86da97bc7 100644 --- a/vocdoni-api/vocdoni-api.html +++ b/vocdoni-api/vocdoni-api.html @@ -12,13 +12,13 @@ - +
    Version: 2.0.0

    Vocdoni API

    The Vocdoni API is a REST API that substitutes the previous RPCs in order to make it easier for developers/integrators to build on top of the voting protocol. This API facilitates creating votings using Vocdoni, without the hassle of learning a complex blockchain platform, allowing to perform all the features that enable the voting protocol such as creating an account, entity, voting process, census & vote, abstracting as much as possible the complexity and offering simple and straightforward methods to perform those actions.

    You can review the API endpoints documentation in this section, the main entities are:

    • Chain: The Vocdoni blockchain is named Vochain. It is a Byzantine fault-tolerant network based on Tendermint that executes the Vocdoni Protocol logic represented as a state machine. Its main purpose is to register votes in a decentralized and verifiable format. In those endpoints, you can consult the state of the chain, transactions costs, list organizations and get more Vochain info.
    • Accounts: Identified by an Ethereum like address. An account can create and manage elections, transfer tokens, give power to other accounts on his behalf (delegates) and manage its metadata.
    • Elections: Is a rule-set of options and requirements for creating a process in which people vote a series of options. To know more about the params of an election and its lifecycle go here. In this section you will find all information related to an election as its information, election keys, submitted votes & how to create a new election.
    • Censuses: The census is a key component of any voting process. It specifies the set of users (identified by a public key or address) eligible for participating in an election. To understand more about the Censuses you can check here. Here you will be able to get censuses information like the Merkle root, total weight & size, import/export the censuses and create new ones.
    • Votes: All the information related to the vote issued by a participant in a vote, you can check the validity of the vote, consult your information and send a vote.
    • SIK: The Secret Identity Key is a user-generated piece of information that proves the user's identity without revealing it. It is the hash of the user's address, the signature of a public message and an optional secret part. It is used to ensure anonymous voting. All registered accounts or anonymous voters must register a SIK, and they are all stored in a Merkle tree. The /siks endpoints help to generate a proof of membership, get the current valid SIK roots, or check if an account has a valid SIK.

    Errors

    Backend error messages list are defined here: https://github.com/vocdoni/vocdoni-node/blob/master/api/errors.go

    About the 204 no content error: this message will be returned only if the asset being queried cannot be found but no other errors have occurred. This response is commonly used to prevent Javascript errors that may arise when a client is waiting for a transaction to be published. During this waiting period, the client can repeatedly query the endpoint until a successful response with a status code of 200 is received, thereby avoiding any errors that may occur due to the transaction not being published yet.

    Authentication

    Security Scheme Type:http
    HTTP Authorization Scheme:basic
    Bearer format:

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/vocdoni-api/vochain-information.html b/vocdoni-api/vochain-information.html index d09099340..5bbf06af5 100644 --- a/vocdoni-api/vochain-information.html +++ b/vocdoni-api/vochain-information.html @@ -12,13 +12,13 @@ - +

    Vochain information

    Return basic Vocdoni Blockchain (Vochain) information like blockTime, chainId, current height...

    blockTime: each array position return average time for 1 minute, 10 minutes, 1 hour, 6 hours and 24 hours.

    blockTime: every array position represents the average for 1 minute, 10m, 1h, 6h, 24h

    MaxCensusSize: is a new feature introduced in the blockchain that is used to limit the number of votes that can be registered for an election. This feature helps to prevent any potential overflow of the blockchain when the number of votes goes beyond the maximum limit. This is the maximum value that an election creation can allow.

    In order to create an election, the creator is required to set the MaxCensusSize parameter to a proper value. Typically, this value should be equal to the size of the census. If the MaxCensusSize parameter is set to 0, an error will occur and the election cannot be created.

    The MaxCensusSize parameter determines the maximum number of votes that can be registered by the blockchain. If the number of votes exceeds this limit, the vote transaction will fail (overwrite votes does not count).

    See MaxCensusSize attribute on the VocdoniSDK to add the maximum census size to a single election. Will throw an error if is superior than the allowed on the Vochain: Max census size for the election is greater than allowed size.

    networkCapacity indicates how many votes per block is the blockchain supposed to achieve. As bigger the capacity as cheaper the elections.

    Responses

    OK


    Schema
    • blockTime integer[]
    • blockTimestamp date-time
    • chainId string
    • circuitVersion string
    • electionCount integer
    • genesisTime date-time
    • height integer
    • maxCensusSize integer
    • networkCapacity integer
    • organizationCount integer
    • syncing boolean
    • transactionCount integer
    • validatorCount integer
    • voteCount integer
    Loading...

    Resources

    Guides
    Soon

    Tutorials
    Soon

    Copyright © 2024 Vocdoni, Inc. All rights reserved.
    - + \ No newline at end of file diff --git a/vocdoni-api/votes.html b/vocdoni-api/votes.html index 5d931053a..3fbc27cb7 100644 --- a/vocdoni-api/votes.html +++ b/vocdoni-api/votes.html @@ -12,13 +12,13 @@ - + - + \ No newline at end of file diff --git a/vocdoni-api/wallet.html b/vocdoni-api/wallet.html index df8939985..0dffa2eed 100644 --- a/vocdoni-api/wallet.html +++ b/vocdoni-api/wallet.html @@ -12,13 +12,13 @@ - + - + \ No newline at end of file