Code Monkey home page Code Monkey logo

pp-vote's Introduction

PeskyVote

This is a Next.js project that has been augmented to work on the Solana blockchain and styled with TailwindCSS and DaisyUI .

Proposal information is stored in public/proposals/, and all votes are stored on the Blockchain.

Getting Started

First, npm install to download all dependencies.

To run on devnet, simply

npm start

Open http://localhost:3000 with your browser, and you'll be online!

ENVVARS

If you want to run on mainnet, you must set the NEXT_PUBLIC_SOL_NETWORK environment variable, like so:

NEXT_PUBLIC_SOL_NETWORK=mainnet-beta npm start

Next, you must define a list of one or more RPC nodes to use, and encode them as a JSON array in the NEXT_PUBLIC_RPC_NODES envvar, like so:

NEXT_PUBLIC_RPC_NODES='["https://my-node-1.quicknode.com", "https://my-node-2.genesysgo.com"]'

Users will be randomly assigned a node on each visit, which can help overcome rate limits during bouts of high traffic.

Creating Proposals

This application uses a slightly modified version of solana-daovote. By "slightly modified," I mean maybe a 4 line delta to look for our Update Authority in a different position in the creators array.

Collections whose update authority is position 0 of the creators array should use the solana-daovote program, and those whose update authority is in position 1 are welcome to use the PeskyVote spl program.

  • Update auth in pos 0: Daovoteq2Y28gJyme6TNUXT9TxXrePiouFuHezkiozci
  • Update auth in pos 1: pVote9oe2CcmLxQTNHbF1eLQTQXNkh5XLNPR9ZuQjBf

Once you've decided which program to use, you can follow the instructions on the solana-daovote README to create proposals on-chain.

To create our proposal, we ran the following command (in our forked repo):

npm run create -- HLMv2cTyTYD8JJbqbgZ9Yuv3BG9mw98utiQQW7EV1kLx 1 pEsKYABNARLiDFYrjbjHDieD5h6gHrvYf9Vru62NX9k 1

Explanation:

  • Pesky Penguin HLMv2cTyTYD8JJbqbgZ9Yuv3BG9mw98utiQQW7EV1kLx submitted the proposal
  • The proposal is number 1
  • The update authority for the collection is pEsKYABNARLiDFYrjbjHDieD5h6gHrvYf9Vru62NX9k
  • Placeholder data

PeskyVote does not use the final argument in the create command; we store our proposals on GitHub rather than on-chain. This streamlines the user experience while still allowing for a distributed history of all proposals.

Important files

  • Please set your constants in lib/constants.js
  • Please set your RPC endpoints in lib/config.js
  • Please add your proposals to public/proposals/
  • Please designate valid proposals in components/VoteProvider.js
  • Please add your NFT metadata in the data/ folder, and add the references to it in pages/api/

Et voila, you have on-chain voting!

pp-vote's People

Contributors

nonfungible-dev avatar

Stargazers

Nahar avatar Edgar Jr. San Martin avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.