@stacksnpmv/stacks-voting
v1.0.0
Published
Decentralized on-chain polls on Stacks blockchain - create and vote on proposals
Downloads
1,503
Maintainers
Readme
🗳️ Stacks Voting
Decentralized on-chain polls and governance on Stacks (Bitcoin L2)
🚀 Try Demo · 📜 View Contract · 📖 Docs
✨ Features
| Feature | Description | |---------|-------------| | 🗳️ Create Polls | Set up polls with up to 6 options and custom duration | | 🔐 Sybil Resistant | One wallet = one vote, enforced on-chain | | ⚡ Real-time Results | Live vote counting directly from blockchain | | ⏰ Time-based Expiry | Polls automatically close after set duration | | 🔗 Fully Decentralized | All votes stored permanently on Stacks | | 💼 Governance Ready | Use for DAOs, communities, or project decisions |
🚀 Quick Start
# Clone the repo
git clone https://github.com/giwaov/stacks-voting.git
cd stacks-voting
# Install dependencies
npm install
# Start development server
npm run devOpen http://localhost:3000 to view.
🛠️ Tech Stack
- Smart Contract: Clarity on Stacks
- Frontend: Next.js 14, React 18, TypeScript
- Wallet:
@stacks/connectv7.7.1 - Transactions:
@stacks/transactionsv6.13.0 - Styling: Tailwind CSS
📜 Smart Contracts (Mainnet)
| Contract | Address | Explorer |
|----------|---------|----------|
| voting-v2 | SP3E0DQAHTXJHH5YT9TZCSBW013YXZB25QFDVXXWY.voting-v2 | View → |
| poll-analytics | SP3E0DQAHTXJHH5YT9TZCSBW013YXZB25QFDVXXWY.poll-analytics | View → |
| voter-reputation | SP3E0DQAHTXJHH5YT9TZCSBW013YXZB25QFDVXXWY.voter-reputation | View → |
📈 Stats: 3,900+ votes cast | 88+ unique voters | Live on mainnet
📝 Contract Functions
;; Create a new poll
(create-poll (title (string-utf8 100)) (description (string-utf8 500)) (options (list 6 (string-utf8 50))) (duration uint))
;; Cast your vote
(vote (poll-id uint) (option-index uint))
;; Read functions
(get-poll (id uint))
(get-vote-count (poll-id uint) (option-index uint))
(has-voted (poll-id uint) (voter principal))🤝 Contributing
Contributions welcome! Please:
- Fork the repo
- Create your feature branch (
git checkout -b feature/amazing) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing) - Open a Pull Request
📄 License
MIT License - see LICENSE for details.
Built for Stacks Builder Rewards 🏗️
⭐ Star this repo if you find it useful!
