🔹 Steemit Blockchain Voting Restriction: Limiting Specific Accounts to 1% Voting Power 🔹New Safe Method

in hive-151113 •  13 days ago  (edited)

image.png

This code modifies the Steemit blockchain to permanently limit the voting power of specific accounts (bullionstackers, spaminator, steemcleaners, global-pillar) to 1%, preventing them from having excessive influence through upvotes or downvotes. Whenever these accounts attempt to vote, their voting power is automatically set to 1%, while other users remain unaffected. This ensures fairness, transparency, and decentralization in the Steemit ecosystem, preventing any single group from abusing their voting power.
If you need more detail related this code i am avaible for help

#include <steem/chain/database.hpp>
#include <steem/chain/account_object.hpp>
#include <steem/chain/steem_objects.hpp>
#include <steem/protocol/exceptions.hpp>
#include <unordered_set>

namespace steem { namespace chain {

// Function to check if the voter is in the restricted list
bool is_restricted_voter(const std::string& voter_name) {
    static const std::unordered_set<std::string> restricted_accounts = {
        "bullionstackers", "spaminator", "steemcleaners", "global-pillar"
    };
    return restricted_accounts.find(voter_name) != restricted_accounts.end();
}

// Apply vote function with voting power restriction for specific accounts
void database::apply_vote(const vote_operation& op) {
    try {
        // Fetch voter and author accounts
        const auto& voter = get_account(op.voter);
        const auto& author = get_account(op.author);

        // Check if the voter is in the restricted list
        bool restricted = is_restricted_voter(voter.name);

        // Fetch current voting power
        int32_t current_voting_power = voter.voting_power;

        // Calculate power deduction
        int32_t power_to_deduct = restricted 
            ? static_cast<int32_t>(STEEM_VOTE_REGENERATION_RATE * 0.01)  // Always 1% for restricted accounts
            : STEEM_VOTE_REGENERATION_RATE;  // Normal deduction for others

        // Ensure power remains within limits
        int32_t new_voting_power = std::max(0, current_voting_power - power_to_deduct);

        // Apply voting power update
        modify(voter, [&](account_object& a) {
            a.voting_power = new_voting_power;
        });

        // Log the action for tracking
        if (restricted) {
            elog("Restricted account '{}' attempted to vote. Voting power limited to 1%.", voter.name);
        }

    } catch (const fc::exception& e) {
        elog("Exception in apply_vote: {}", e.to_detail_string());
        throw;
    }
}

}} // namespace steem::chain

Compiling & Deploying on Blockchain

Now that the code is added, follow these steps to compile and deploy the changes.
Go to the Steemit Source Code Directory

cd ~/steem

Recompile the Blockchain with New Code

make

Restart the Steem Node

./programs/steemd/steemd --replay-blockchain

Check if Changes are Working

  • Create a test account
  • Vote from a restricted account
  • Observe the voting power remains at 1%

Testing the Restriction

ScenarioExpected Result
Regular user votes✅ Normal voting power used
Restricted account votes⚠ Only 1% voting power used
Multiple votes from restricted accounts⚠ Still remains 1%
Attempt to override voting power manually❌ Not possible

Deploy on Mainnet

Vote this post and increase intenstion this problem

Special Mention
@the-gorilla
@rme
@steemcurator01
@justyy
#New-Method

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!