wallet/votewitnessaccount - Vote for Super Repr...
Vote for TRON Super Representatives using frozen TRX voting power via Dwellir's high-performance RPC endpoint.
Vote for Super Representatives using TRX voting power from frozen balance.
Endpoint
POST /wallet/votewitnessaccountRequest Parameters
Required parameter: Voter's account address (base58)
Required parameter: Array of vote objects with SR address and vote count
Optional parameter: Permission ID for multi-signature (default: 0)
Optional parameter: Return base58 addresses (default: false returns hex)
Response Body
`txID` - Transaction hash `raw_data` - Transaction raw data `contract` - Voting contract details `expiration` - Transaction expiration timestamp `timestamp` - Transaction creation timestamp `visible` - Address format indicator
Important Notes
Voting Rules
- Voting Power: 1 frozen TRX = 1 vote
- Vote Distribution: Can split votes among multiple SRs
- Vote Persistence: Votes remain until changed or TRX unfrozen
- Immediate Effect: Votes count immediately after confirmation
- Rewards: Voting rewards distributed daily based on SR performance
Implementation Examples
# Vote for single SR
curl -X POST https://api-tron-mainnet.n.dwellir.com/YOUR_API_KEY/wallet/votewitnessaccount \
-H "Content-Type: application/json" \
-d '{
"owner_address": "TVoterAddress...",
"votes": [
{
"vote_address": "TSRAddress...",
"vote_count": 1000000
}
],
"visible": true
}'
# Vote for multiple SRs
curl -X POST https://api-tron-mainnet.n.dwellir.com/YOUR_API_KEY/wallet/votewitnessaccount \
-H "Content-Type: application/json" \
-d '{
"owner_address": "TVoterAddress...",
"votes": [
{
"vote_address": "TSR1Address...",
"vote_count": 500000
},
{
"vote_address": "TSR2Address...",
"vote_count": 300000
},
{
"vote_address": "TSR3Address...",
"vote_count": 200000
}
],
"visible": true
}'
# Clear all votes
curl -X POST https://api-tron-mainnet.n.dwellir.com/YOUR_API_KEY/wallet/votewitnessaccount \
-H "Content-Type: application/json" \
-d '{
"owner_address": "TVoterAddress...",
"votes": [],
"visible": true
}'Voting Strategies
class VotingStrategy {
constructor(apiKey) {
this.apiKey = apiKey;
this.baseUrl = `https://api-tron-mainnet.n.dwellir.com/${apiKey}`;
}
// Get available voting power
async getVotingPower(address) {
const response = await fetch(`${this.baseUrl}/wallet/getaccount`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ address, visible: true })
});
const account = await response.json();
const frozenTRX = account.frozen?.[0]?.frozen_balance || 0;
return frozenTRX / 1000000; // Convert to TRX
}
// Calculate optimal vote distribution
async optimizeVotes(voterAddress, srAddresses, strategy = 'balanced') {
const votingPower = await this.getVotingPower(voterAddress);
if (strategy === 'balanced') {
// Equal distribution
const votePerSR = Math.floor(votingPower / srAddresses.length);
return srAddresses.map(sr => ({
vote_address: sr,
vote_count: votePerSR
}));
} else if (strategy === 'weighted') {
// Weighted by SR performance
const witnesses = await this.getWitnesses();
const selectedSRs = witnesses.filter(w => srAddresses.includes(w.address));
// Weight by reliability
const totalReliability = selectedSRs.reduce((sum, sr) => {
const reliability = sr.totalProduced / (sr.totalProduced + sr.totalMissed);
return sum + reliability;
}, 0);
return selectedSRs.map(sr => {
const reliability = sr.totalProduced / (sr.totalProduced + sr.totalMissed);
const weight = reliability / totalReliability;
return {
vote_address: sr.address,
vote_count: Math.floor(votingPower * weight)
};
});
}
}
// Get current votes
async getCurrentVotes(address) {
const response = await fetch(`${this.baseUrl}/wallet/getaccount`, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ address, visible: true })
});
const account = await response.json();
return account.votes || [];
}
// Estimate voting rewards
async estimateRewards(voterAddress) {
const votes = await this.getCurrentVotes(voterAddress);
const witnesses = await this.getWitnesses();
let estimatedDaily = 0;
for (const vote of votes) {
const sr = witnesses.find(w => w.address === vote.vote_address);
if (sr && sr.brokerage) {
// SR shares (100 - brokerage)% of rewards with voters
const rewardShare = (100 - sr.brokerage) / 100;
const srDailyReward = 16 * 20 * 60 * 24; // 16 TRX per block
const voterShare = (vote.vote_count / sr.voteCount) * srDailyReward * rewardShare;
estimatedDaily += voterShare;
}
}
return {
daily: estimatedDaily,
monthly: estimatedDaily * 30,
yearly: estimatedDaily * 365,
apy: (estimatedDaily * 365 / (votes.reduce((sum, v) => sum + v.vote_count, 0) / 1000000)) * 100
};
}
}
// Example usage
async function manageVoting() {
const strategy = new VotingStrategy('YOUR_API_KEY');
// Check voting power
const power = await strategy.getVotingPower('TVoterAddress...');
console.log(`Available voting power: ${power} TRX`);
// Optimize vote distribution
const srList = ['TSR1...', 'TSR2...', 'TSR3...'];
const optimizedVotes = await strategy.optimizeVotes(
'TVoterAddress...',
srList,
'weighted'
);
console.log('Optimized vote distribution:', optimizedVotes);
// Estimate rewards
const rewards = await strategy.estimateRewards('TVoterAddress...');
console.log(`Estimated APY: ${rewards.apy.toFixed(2)}%`);
}Best Practices
1. Research Before Voting
- Check SR reliability (>99.5% uptime)
- Review SR contributions to ecosystem
- Verify reward distribution policies
2. Vote Management
- Regularly review and update votes
- Monitor SR performance changes
- Rebalance votes based on performance
3. Security
- Use multi-signature for large voting accounts
- Verify SR addresses before voting
- Keep voting transactions records
4. Optimization
- Diversify votes across multiple reliable SRs
- Consider both rewards and network health
- Participate in governance discussions
Common Errors
| Error | Description | Solution |
|---|---|---|
Insufficient frozen balance | Not enough voting power | Freeze more TRX first |
Invalid witness address | SR address not found | Verify SR address from listwitnesses |
Total votes exceed frozen balance | Votes > available power | Reduce total vote count |
Contract validate error | Invalid transaction format | Check parameter structure |
Use Cases
- Governance Participation: Vote for network validators
- Reward Earning: Earn passive income from voting
- SR Support: Support specific Super Representatives
- Network Decentralization: Distribute voting power
- Strategic Voting: Optimize rewards through vote management
Related Methods
- wallet/listwitnesses - Get list of Super Representatives
- wallet/freezebalancev2 - Freeze TRX for voting power
- wallet/getaccount - Check current votes
wallet/listwitnesses
Get list of all TRON Super Representatives (witnesses) including votes, URLs, and block production stats via Dwellir's RPC endpoint.
TRC20 Transfers
Complete guide to TRC20 token transfers on TRON - from USDT to custom tokens. Learn balance checking, approvals, transfers, and error handling with Dwellir RPC.