Cointime

Download App
iOS & Android

How we achieved anonymity on Web3 token-based elections

From Vocdoni by Vocdoni and Lucas Menendez

At the heart of Vocdoni's mission there is to innovate secure and anonymous voting mechanisms, as we believe it's a primitive for fair and legitimate participation in many scenarios.

Voter's anonymity can be easily preserved in 1Person-1Vote scenarios, as we already offer with our SDK and UIs using zk-Snarks. However, for token-based elections, separating identities from votes is not enough because token holders have a unique balance for a token, making them easy to identify as the weight of a vote can be correlated with an address.

In this article, we'll detail our approach to resolving this issue.

Introduction

A key part of the Vocdoni stack is Census3. Census3 is a service that checks for updates to a list of tokens or other crypto assets, and maintains an updated list of holders for each registered token. This service allows users to create a census based on a token, or combining censuses using strategies, in a way compatible with Vocdoni's blockchain (Vochain).

Census3 allows creating public or anonymous-compatible censuses and publishes them on IPFS, allowing for a transparent use and public auditing. But when the election is configured to be anonymous, we must consider not only the addresses of the holders, but also their balances because depending on the token holder distribution it could be easy to identify voters.

In the context of public blockchain technology where balances are public, preserving voter anonymity on token-based elections is a big challenge. To address this, we have been considered different approaches:

  • Find a way or mechanism to keep the balance secret. ❌ Balances are public, and the Vochain needs to know the weight value to perform some checks and to calculate the results.
  • Find a way to hide the balances. ✅ Modifying the balances as little as possible to make them difficult to correlate with identities and achieving sufficient anonymity.

The Vocdoni protocol is very flexible on how to configure and process elections. That includes weighted voting. In this type of election, not all voters wield the same power; instead, their voting power is determined by their token holdings as defined in the census.

Rounding censuses

To ensure that the balances of token-based censuses remain private, we must alter them in some way. However, any change must meet two requirements:

  1. The resulting balance must be less than or equal to the original one.
  2. The resulting balance should stay as close to the original as possible.

We explored two approaches:

  • Statistical approach: Using a classification algorithm based on k-means but introducing the minimum number of members in a cluster requirement. ❌ Unfortunately, this approach required too many iterations to converge.
  • Logical approach: Sorting participants by their balance and then grouping them, with some data cleaning techniques.✅ This approach proved sufficient to provide a solution.

Logical approach

We have developed an algorithm to meet these requirements, rounding balances to the nearest one, forming groups of at least 3 (privacyThreshold) equal balances. This process obscures individual holder's balances. The algorithm optimizes the number of members in a group, taking in account the difference between balances, to reduce the accuracy loss.

Basic steps

  1. Identify and exclude outliers: Participants balances are analyzed to detect outliers using z-score algorithm.
  2. Forming groups: Participants are initially grouped based on the privacy threshold. A group can extend to include participants with identical balances or with balances differences falling below the groupBalanceDiff criteria.
  3. Balancing groups: For each group, we adjust the balances, rounding them down to the smallest amount within the group to obscure individual values.
  4. Accuracy loop: The algorithm tries to find the highest accuracy possible while maintaining a minimum privacy threshold. It starts with the minimum privacy threshold and increases it by a small amount until the accuracy is maximized.

For example, here is the pseudocode of the core part, grouping participants (2):

Function groupAndRoundCensus Input: participants (array of Participant), privacyThreshold (integer), groupBalanceDiff (pointer to big integer) Output: array of Participant Sort participants by balance Initialize groups as an empty array of array of Participant Initialize currentGroup as an empty array of Participant For each participant in participants If currentGroup is empty Add participant to currentGroup Else Set lastParticipant to the last element in currentGroup Calculate balanceDiff as the absolute difference between participant's balance and lastParticipant's balance If the length of currentGroup is less than privacyThreshold OR balanceDiff is less than or equal to groupBalanceDiff Add participant to currentGroup Else Add currentGroup to groups Set currentGroup to a new array containing only participant If it's the last iteration Add currentGroup to groups Set roundedCensus to the result of flattening and rounding groups to the minimun balance Return roundedCensus End Function

Results accuracy

To measure accuracy, we compare the total of the adjusted balances from the census against the sum of the original balances, incorporating outliers in both calculations for consistency.

Our tests covered censuses involving 21 different tokens, showcasing various holder counts and token formats, including ERC20, ERC721, and POAP. This comprehensive testing ensures our approach is robust across different Web3 assets.

Our test results with different tokens

Initial conclusions

Our algorithm has several advantages, such as simplicity and speed. However, there's room for refinement. For example, tokens characterized by uneven distribution among holders present a challenge, as outliers not fitting into any group maintain their original balances, potentially revealing their identity.

Another problem identified is the loss of accuracy. The algorithm allows for parameter adjustments to enhance precision, and these can certainly be used to improve accuracy, but we didn't find any pattern in our test to do so. We've established parameter settings that generally perform well across various token types and distributions, so we consider this to be sufficient for now.

We've also detected potential vulnerabilities to specific attacks. For example, acquiring a certain amount of a token to manipulate the algorithm into grouping an address with others could theoretically expose that address. However, such strategies are impractical and unlikely to significantly impact election outcomes. This type of attack also requires an analysis of balance distributions, complicating its execution.

Additionally, among other possible enhancements, there is also the possibility of improving the algorithm's performance.

This is our first implementation to token-based anonymous elections. But we'll be pleased to hear about better approaches, or suggestions, to achieve anonymous voting on these and other types of elections. We warmly invite you to share them with us at chat.vocdoni.io or info[at]vocdoni.org

Comments

All Comments

Recommended for you

  • BTC Surpasses $84,000

    Market data shows that BTC has surpassed $84,000, currently priced at $84,004, with a 24-hour decline of 0.25%. The market is experiencing significant volatility, so please ensure proper risk management.

  • BTC Falls Below $84,000

    Market data shows that BTC has fallen below $84,000, currently priced at $83,988.06, with a 24-hour increase of 0.52%. The market is experiencing significant volatility, so please ensure proper risk management.

  • ETH Falls Below $2700

    Market data shows that ETH has fallen below $2700, currently priced at $2699.7, with a 24-hour increase of 1.95%. The market is experiencing significant volatility, so please ensure proper risk management.

  • BTC Surpasses $85,000

    Market data shows that BTC has surpassed $85,000, currently priced at $85,000.02, with a 24-hour increase of 1.72%. The market is highly volatile, so please ensure proper risk management.

  • ETH Surpasses $2700

    Market data shows that ETH has surpassed $2700, currently priced at $2700.14, with a 24-hour increase of 1.23%. The market is experiencing significant fluctuations, so please ensure proper risk management.

  • Yushu Technology's Wang Xingxing: Key to Breakthrough in Embodied Intelligence Lies in Solving Millimeter-Level Error Issues

    On September 25, the 5th Global Digital Trade Expo was held in Hangzhou, where Wang Xingxing, founder of Yushu Technology, delivered a keynote speech titled "From Machinery to Intelligence - The Evolutionary Theory of Embodied Future." Wang stated that the embodied intelligence industry may soon experience a critical breakthrough similar to that of ChatGPT. He believes that when robots can complete approximately 80% of tasks through voice interaction and embodied intelligence capabilities in about 80% of unfamiliar environments, the industry will enter a critical phase of large-scale application. He pointed out that the ability for robots to understand and execute specific tasks based on voice commands has already made breakthroughs last year, but the industry still faces a core technological bottleneck, namely the precise matching issue between artificial intelligence models and the real physical world. Wang noted that currently, robots still have a few millimeters of error during actual operations, which limits their stability and reliability in complex environments. "In the future, whoever can solve this problem will fundamentally resolve the issues with robots."

  • Swissquote Analyst Warns AI Narrative is a Core Pillar of US Stocks, Potential Break Could Trigger Significant Correction

    On September 25, Ipek Ozkardeskaya, a senior analyst at Swissquote Bank, stated that broad market indices and retirement funds are now deeply tied to the AI wave, with technology stocks accounting for about 40% of the S&P 500 index. She pointed out that the market capitalization weight of just three chip manufacturers makes up over 25% of the MSCI Emerging Markets Index. Ozkardeskaya indicated that AI has become the 'core pillar' of the market, and this pillar 'must not show any cracks.' She believes that, in the short term, the US stock market will continue to be supported by seasonal factors, and the current market uptrend may extend until the end of the year. However, she also warned that the worst-case scenario would be a shake in the investment logic surrounding AI, which could undermine market confidence in the AI narrative, potentially triggering a significant market correction.

  • U.S. Stock Index Futures Turn Positive; Chip Stocks Rally in After-Hours Trading

    On September 25, U.S. stock index futures rose into positive territory, with Nasdaq futures up 0.36%. In after-hours trading, storage and semiconductor stocks saw widespread gains, with AMD, Intel, and SanDisk all rising by 2%.

  • NEAR Partners with Ondo to Launch 20 Tokenized US Stocks and ETFs

    On September 25, according to Cryptonews, NEAR Protocol and Ondo Finance have launched trading for tokenized US stocks and ETFs on near.com, with an initial offering of 20 assets including Nvidia, Tesla, Apple, Microsoft, Amazon, as well as SPY and QQQ. Eligible users can deposit using over 30 supported stablecoins or other crypto assets, with NEAR Intents serving as the cross-chain distribution layer, allowing similar assets to be routed to connected wallets and DeFi protocols in the future. Purchases are settled in USDon, which is backed 1:1 by US dollars in brokerage accounts, and completed via atomic swaps. This product is not available to US persons; the overall Ondo platform has launched over 100 assets, with NEAR initially offering only one-fifth of that.

  • Web3 data and AI company Validation Cloud completes $10 million in new round of financing

     Web3 data and AI company Validation Cloud announced a $10 million financing round from True Global Ventures. The company plans to use the funds to expand its AI products and achieve seamless access to Web3 data.