A multiple-choice voting system implemented in Rust for the Stellar network using Soroban.
- β Multiple-choice voting
- β Admin control for managing elections
- β Unique vote verification per address
- β Real-time results
- β Simple and intuitive interface
- Rust (version 1.70+)
- Cargo
- Soroban CLI
- Stellar Testnet account
cargo install --locked soroban-clisoroban --version# Make executable
chmod +x deploy.sh
# Execute deployment
./deploy.shcargo build --target wasm32-unknown-unknown --releasesoroban contract optimize --wasm target/wasm32-unknown-unknown/release/voting.wasmsoroban keys generate alicesoroban network add testnet \
--rpc-url https://soroban-testnet.stellar.org:443 \
--network-passphrase "Test SDF Network ; September 2015"soroban contract deploy \
--wasm target/wasm32-unknown-unknown/release/voting.wasm \
--source alice \
--network testnet# Replace [CONTRACT_ID] with the ID returned from deployment
soroban contract invoke \
--id [CONTRACT_ID] \
--source alice \
--network testnet \
-- initialize \
--admin [ADMIN_ADDRESS]soroban contract invoke \
--id [CONTRACT_ID] \
--source alice \
--network testnet \
-- create_election \
--title "Presidential Election 2024" \
--description "Presidential voting" \
--end_time 1735689600soroban contract invoke \
--id [CONTRACT_ID] \
--source alice \
--network testnet \
-- add_party \
--name "Candidate A" \
--description "Liberal Party"soroban contract invoke \
--id [CONTRACT_ID] \
--source [VOTER_ADDRESS] \
--network testnet \
-- vote \
--election_id 0 \
--party_id 0soroban contract invoke \
--id [CONTRACT_ID] \
--source alice \
--network testnet \
-- get_results \
--election_id 0initialize(admin: Address)- Initialize the contractcreate_election(title: String, description: String, end_time: u64)- Create new electionadd_party(name: String, description: String)- Add candidate/partyvote(election_id: u32, party_id: u32)- Cast voteget_results(election_id: u32)- Get election results
Election- Election informationParty- Candidate/party informationVote- Individual vote record
- RPC URL: https://soroban-testnet.stellar.org:443
- Network Passphrase: "Test SDF Network ; September 2015"
- Explorer: https://stellar.expert/explorer/testnet/
- RPC URL: https://soroban-mainnet.stellar.org:443
- Network Passphrase: "Public Global Stellar Network ; September 2015"
To obtain XLM on testnet:
- Friendbot: https://friendbot.stellar.org/
- Stellar Laboratory: https://laboratory.stellar.org/
- Problem: Incorrect command
- Solution: Use
soroban contract optimize
- Problem: Incorrect WASM path
- Solution: Verify the file is at
target/wasm32-unknown-unknown/release/voting.wasm
- Problem: CLI not installed
- Solution: Run
cargo install --locked soroban-cli
- Fork the project
- Create a feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is licensed under the MIT License. See the LICENSE file for more details.
If you encounter problems:
- Check error logs
- Consult the documentation
- Open an issue on GitHub
- Contact the development team
Developed with β€οΈ for the Stellar community