Governance Voting
** This is included for reference only. It's likely not going to work anymore. **
This page covers authenticating and submitting governance votes on Starknet mainnet using starkli.
Prerequisites
starkliinstalled and configured for mainnet (see Starkli Installation and Configuration)- Your account keystore and descriptor set up
- Environment variables configured:
export STARKNET_NETWORK="mainnet"
export STARKNET_KEYSTORE="$HOME/.starkli-wallets/keystore.json"
export STARKNET_ACCOUNT="$HOME/.starkli-wallets/account.json"
Verify Setup
Before submitting a vote, verify that your account and signing are working:
starkli invoke $STARKNET_ACCOUNT getVersion
Submitting a Vote
The authenticate_vote function is called on the governance space contract. The function signature is:
authenticate_vote(
space: ContractAddress,
voter: EthAddress,
proposal_id: u256,
choice: Choice,
user_voting_strategies: Array,
metadata_uri: Array<felt252>
)
Parameters
| Parameter | Description |
|---|---|
space | The governance space contract address |
voter | Your account address |
proposal_id | The ID of the proposal being voted on |
choice | Your vote choice |
user_voting_strategies | Voting strategy configuration array |
metadata_uri | IPFS metadata URI encoded as a felt252 array |
Example Transaction
starkli invoke \
0x0687b57bc5459d05d9575483be8ed8e623c379484fdb1aad18b073ffd4602099 \
authenticate_vote \
$STARKNET_ACCOUNT \
8 \
0 \
'[(2, [20, 0, 26, 21, 0, '$STARKNET_ACCOUNT', 0x3860e639d806400000])]' \
'[0x697066733a2f2f6261666b726569647069706974746770376b326473786b35, 0x3371636f653570356f6e7577376f336b347432356a763572706166356c6564, 0x73327661]'
The metadata_uri field contains an IPFS URI encoded as felt252 values. The example above decodes to:
ipfs://bafkreidpipittgp7k2dsxk53qcoe5p5onuw7o3k4t25jv5rpaf5leds2va
Monitoring the Transaction
After submitting, check the transaction status:
starkli transaction-receipt TRANSACTION_HASH
Replace TRANSACTION_HASH with the hash returned from your invoke.
Troubleshooting
-
"Failed to create Felt from string" error:
- Remove
u256:prefix from account addresses and numbers - Ensure hexadecimal values start with
0x - For arrays, use single quotes for the outer array and double quotes for nested values if needed
- Remove
-
Transaction rejected:
- Verify you are on mainnet (
STARKNET_NETWORK=mainnet) - Confirm the proposal is still open for voting
- Check that your account has sufficient ETH for gas
- Verify you are on mainnet (