This is a demo or light weight version of opl-secret-ballot.
There are two key smart contracts that we will deploy, one interacting with a host chain such as Binance and one interacting with OPL or an enclave on Sapphire.
This repo is set up for pnpm but other NodeJS package managers should work.
Install dependencies
pnpm installBuild smart contracts
pnpm run buildInstall dependencies
pnpm installCompile and Hot-Reload for Development
pnpm run devBuild assets for deployment
pnpm run buildWe will use Hardhat and Hardhat-deploy to simplify development.
Start local Hardhat network
npx hardhat nodeDeploy smart contracts locally
npx hardhat deploy-local --network localhostWe can now reference the deployed contracts in our frontend Vue app.
Modify the .env.development file with the appropriate addresses:
VITE_BALLOT_BOX_V1_ADDR=0x5FbDB2315678afecb367f032d93F642f64180aa3and
VITE_DAO_V1_ADDR=0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512Additionally, we will need a Pinata API key to access the pinning service with which we store our ballots as JSON.
VITE_PINATA_JWT=Start Vue app
npm run devNavigate to http://localhost:5173, and you should be able to create a new poll.
You can use one of the pre-funded test accounts and associated private key with MetaMask, use 'Add a network manually' with these parameters to connect to your local Hardhat node:
- Network name:
Hardhat - New RPC URL:
http://127.0.0.1:8545/ - Chain ID:
1337(or leave blank to auto-detect) - Currency symbol:
TEST(or leave blank)
If you prefer to run everything safely inside inside a Docker container, a Makefile is provided for your convenience:
make docker-shell # Bash shell inside container
node@opl:~$ make build
node@opl:~$ make backend-node & # Run local Hardhat node
node@opl:~$ make backend-deploy # Deploy contracts to local node
node@opl:~$ make frontend-dev & # Run VITE development server