This DAO protocol allows for on-chain voting with BLS aggregate signature verification. It follows the OpenZeppelin standards for smart contract development and uses the elliptic curve 'alt_bn128' for BLS.
- On-chain voting: Allows for transparent and verifiable voting on the blockchain.
- BLS aggregate signature verification: Uses BLS aggregate signatures to verify votes on chain. This approach allows multiple signatures to be combined into a single signature, which can be verified more efficiently than verifying each signature individually.
- OpenZeppelin standards: Follows the best practices and standards set by OpenZeppelin for secure and reliable smart contract development.
- Elliptic curve 'alt_bn128': Uses the elliptic curve 'alt_bn128' for BLS, which provides a balance of security and efficiency.
This project uses the following dependencies:
@nomiclabs/hardhat-ethers
: For Ethereum development tasks.@openzeppelin/contracts
: For reusable smart contracts following best practices.ethers
: For interacting with the Ethereum blockchain.mcl-wasm
: For BLS signature operations.
- Clone the repository.
- Install the dependencies with
yarn install
. - Generate key pairs with
npx hardhat run scripts/generate-pairs.ts
. - Start a local Ethereum network with
npx hardhat node
.
To test the full DAO process, run the following scripts in order:
- Propose a new proposal with
npx hardhat run scripts/propose.ts --network localhost
. - Vote on the proposal with
npx hardhat run scripts/vote.ts --network localhost
. - Queue and execute the proposal with
npx hardhat run scripts/queue-and-execute.ts --network localhost
.
Run the tests with npx hardhat test
.
This protocol uses the elliptic curve 'alt_bn128' which works on a 254 bit prime field, hence also referred to as 'bn254'.
- We use 𝐺2 for public keys, and 𝐺1 for signatures and messages.
- 𝐺1 Uncompressed is 64 bytes.
- 𝐺2 Uncompressed is 128 bytes.
Contributions are welcome! Please open an issue or submit a pull request.
This project is licensed under the MIT license.
For more information on the implementation of BLS in Solidity, you can refer to this guide.
A special thanks to Kobi Gurkan for his pioneering work on implementing BLS in Solidity for the alt-bn128 (also known as bn254) elliptic curve. You can refer to his implementation here.
Parts of this project are based on the work done in this repository. I have used some of their code and adapted it for my purposes. I am grateful for their contribution to the open source community.