Skip to content

Latest commit

 

History

History
84 lines (61 loc) · 3.18 KB

README.md

File metadata and controls

84 lines (61 loc) · 3.18 KB

Off-chain Conviction Voting

Submission to GitCoin GR9 Hackathon

An off-chain implementation of Conviction Voting where organization members can vote on proposals by allocating a percentage of their tokens to the proposal. Conviction is calculated with a snapshot service that runs regularly. Instead of staking tokens, it is implemented using off-chain, verifiable data structures managed by Ceramic and IDX.

Related repositories:

contract: https://github.com/dynamiculture/offchain-cv-contract

snapshot service: https://github.com/dynamiculture/offchain-cv-snapshot

Diagram

Diagram

Screenshot

Screenshot

Technologies

  • Ceramic HTTP Client: Provides access to the Ceramic Network via a remote node running Ceramic.
  • 3ID Connect: Provides authentication to a DID (used by Ceramic) from a blockchain wallet, and stores a link from this blockchain account to your DID in IDX.
  • IDX: Provides a way to create identity records for a DID. Records are stored on Ceramic and can represent links to blockchain accounts or other user data.
  • Angular: Web application framework.
  • NgRx: Reactive state management.

Run Dev Server with Ceramic's Clay Testnet Network

Uses Ceramic's Clay testnet network to store Ceramic and IDX documents. Clone project and run:

cd offchain-cv-dapp
npm i
ng serve

Navigate to http://localhost:4200/. The app will automatically reload if you change any of the source files.

Run Dev Server on local Ceramic Network

Clone project and install packages:

cd offchain-cv-dapp
npm i

Run npm run ceramic for the local ceramic server.

Switch to local Ceramic Network by updating path in bootstrap.js and ceramic-token.ts to:

const CERAMIC_URL = 'http://localhost:7007'

Create Ceramic Schema and Definition

run to create seed for IDX identity:

node -e "console.log(require('crypto').randomBytes(32).toString('hex'))"

Save the seed value, you will need it to initialize snapshot service:

https://github.com/dynamiculture/offchain-cv-contract

then run:

SEED=<your seed from above> npm run bootstrap

Test setting IDX user convictions

from config.json get definitions->convictions definitionID

idx index:set local <definitionID from above> '{"context":"blank", "proposals":[], "convictions":[]}'

Build dapp

Run ng build to build the project. The build artifacts will be stored in the dist/ directory. Use the --prod flag for a production build.

References