An AI-organized voting demonstration using DAVINCI (privacy-preserving voting protocol) and Self.xyz (passport-based human verification with zero-knowledge proofs).
A single TypeScript script (src/selfxyz-demo.ts) that an AI agent can run autonomously to:
- Initialize a wallet on Celo Mainnet
- Build & deploy an
OpenCitizenCensussmart contract — only real humans with valid passports from specified countries can join - Bootstrap the on-chain census indexer (subgraph-style GraphQL endpoint)
- Create a DAVINCI voting process through the sequencer API
- Verify the process is live and ready to accept votes
The result: a live voting URL where verified humans can scan a QR code with the Self app, hold their passport to the phone's NFC reader, generate a ZK proof of humanity, and cast their vote.
- Node.js 18+
- A Celo Mainnet wallet with ~2 CELO for gas
PRIVATE_KEYenvironment variable set (see.env.example)
npm installCopy .env.example to .env and fill in your private key.
npm run demo| Step | Action | Output |
|---|---|---|
| 1 | Initialize wallet on Celo | Address + balance |
| 2 | Load OpenCitizenCensus artifact | Contract bytecode + ABI |
| 3 | Build census configuration | Scope seed, countries, age requirements |
| 4 | Deploy census contract | Contract address on Celo |
| 5 | Bootstrap on-chain indexer | GraphQL census URI |
| 6 | Wait for indexer readiness | Confirmed indexed |
| 7 | Create DAVINCI process | Process ID + transaction hash |
| 8 | Wait for process indexing | Ready to accept votes |
| Variable | Required | Description |
|---|---|---|
PRIVATE_KEY |
Yes | Celo wallet private key (must have CELO) |
Hardcoded in the script:
- Network: Celo Mainnet (chainId 42220)
- Sequencer: https://sequencer4.davinci.vote
- Census Indexer: https://onchain-census-indexer.k7z7z.cc
- Process Registry: 0x68daC70AF68aa0bED8cEf36C523243941D7D7876
- Hub: 0xe57F4773bd9c9d8b6Cd70431117d353298B9f5BF
- 1 human = 1 vote — nullifier prevents duplicate voting
- Zero-knowledge — passport data never leaves the phone
- Country gating — only specified passport nationalities can join
- Self-sovereign — user controls their own identity proof
┌─────────────┐ ┌─────────────┐ ┌─────────────┐
│ AI Agent │────▶│ DavinciSDK │────▶│ Sequencer │
│ (Node.js) │ │ (library) │ │ (API) │
└─────────────┘ └─────────────┘ └──────┬──────┘
│ │
│ ┌─────────────┐ │
└────────▶│ Self.xyz │◀──────────────┘
│ ZK Proof │
└─────────────┘
│
┌──────┴──────┐
│ Passport │
│ NFC │
└─────────────┘
MIT