DVoteJS aims to provide utility classes and methods to invoke decentralized operations within a voting process. It covers the typical functionality of Client applications, as well as the Process Manager or the Census Manager.
The intended functionality is to interact with a public Ethereum blockchain, to fetch data from a decentralized filesystem, to enforce data schema validity, to prepare vote packages and using decentralized messaging networks through Gateways.
This library implements the protocol defined on https://docs.vocdoni.io/architecture/components.html
npm install dvote-js ethers
DVoteJS is a superset of smaller NPM packages that can be installed individually:
@vocdoni/client
@vocdoni/voting
@vocdoni/census
@vocdoni/contract-wrappers
@vocdoni/common
@vocdoni/data-models
@vocdoni/encryption
@vocdoni/wallets
@vocdoni/signing
@vocdoni/hashing
If you are developing a frontend application using React, you can check out @vocdoni/react-hooks.
Ethers
The library is tightly coupled with ethers.js in order to sign payloads, communicate with Web3 endpoints and attach to physical/virtual wallets.
Signers and Wallets are both used to sign Web3 transactions, as well as authenticating DVote requests
Ethers.js providers can connect using different sources.
Generating a wallet from a mnemonic (and an optional path and Web3 provider):
Generating a standalone deterministic wallet from a passphrase and a (non-private) seed. They are intended to provide wallets where the private key can be accessed.
Accessing the browser wallet or MetaMask:
The entity API allows reading and managing the metadata of an organization. On top of a key-value store, lies a link to the entity's metadata, which is the human readable information about it.
A Voting process contains a group of settings defining how an L2 governance process is conducted on the Vochain.
In addition to the flags there is also the process metadata, which is the human readable content that voters will be prompted for making a choice.
Provides utility functions to fetch data from decentralized filesystems, sending messages and adding files to IPFS.
See the examples for different use cases:
Run npm run build
to compile the whole library or the individual packages. Run npm run test
on each one of the packages.
When adding new test suites, don't forget to add a call to addCompletionHooks()
. Otherwise, the NodeJS process will keep up indefinitely when testing.