This directory contains example code demonstrating various features of the Hivemind Protocol.
-
basic_voting.py
- Basic example of creating and managing a simple voting issue
- Demonstrates core functionality like creating issues, options, and opinions
- Shows how to calculate results and find consensus
-
advanced_features.py
- Examples of advanced protocol features
- Shows how to use constraints and restrictions
- Demonstrates auto-ranking functionality
- Includes examples of different voting mechanisms
-
protocol_upgrade.py
- Real-world example of using Hivemind for governance
- Shows how to create and manage protocol upgrade proposals
- Demonstrates proper setup of voting requirements
- Includes complete voting workflow
Each example can be run independently. Before running, make sure to:
- Install the hivemind-python package
- Replace placeholder values (addresses, signatures) with real ones
- Have IPFS running locally or specify your IPFS gateway
Example:
python basic_voting.py
These examples are for demonstration purposes. In a production environment, you should:
- Properly handle signatures and addresses
- Implement proper error handling
- Use secure methods for managing private keys
- Consider adding logging and monitoring
- Implement proper access controls