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

  • Polymarket adds new Olympics category

    Predicting market Polymarket adds "Olympics" category, including:Currently, among the countries predicted to win the most gold medals at the Paris Olympics, the United States accounts for 79% and China accounts for 20%. The amount of the prediction market project has reached 1.2 million US dollars; among the countries predicted to win the most medals, the United States accounts for 94% and China accounts for 6%. The amount of the prediction market project has reached 1.3 million US dollars.

  • Robert Kennedy Jr.'s four Bitcoin policies, including that BTC-USD transactions do not need to be reported or taxed to the IRS

    US presidential candidate Robert Kennedy praised the role that Bitcoin could play in improving the US economy at the Bitcoin 2024 conference. He proposed a comprehensive reform of US monetary policy and added that BTC could restore the US economy to its pre-Nixon era. He promised to issue four executive orders related to Bitcoin if elected:

  • Hong Kong Legislative Council Member Tam Yue-heng: Accelerate the issuance and trading of stablecoins that match the characteristics of the linked exchange rate system

    Tan Yueheng, a member of the National Committee of the Chinese People's Political Consultative Conference and the Legislative Council, published an article entitled "Consolidating the Status of Financial Center and Sharing the Dividend of Deepening Reform". In it, he pointed out that in the field of digital finance, the SAR government must continue to develop digital finance and qualified virtual products, explore new beneficial financial formats, and promote the new productive forces of the financial industry. Hong Kong must promote the participation of financial technology companies in the stable coin sandbox mechanism, accelerate the issuance and trading of stable coins with the characteristics of matching linked exchange rate system, expand the testing scope and landing scenarios of digital RMB as a cross-border payment tool, and focus on developing products that are linked to virtual assets and underlying real assets, transforming art, real estate, equity, and carbon emissions into digital tokens through blockchain technology.

  • Hong Kong’s virtual asset ETF market has established a mature structure including exchanges, market makers, primary and secondary custodians, etc.

    Wang Long, Chairman of the Greater Bay Area Financial Professionals Association, pointed out in an article published in Ta Kung Pao entitled "Web3.0 Promotes Diversification of Financial Products" that although Hong Kong's ETF market is still in its development stage compared to the United States, it has established a mature architecture, including exchanges, market makers, primary and secondary custodians, etc. The Hong Kong Securities and Futures Commission has approved six virtual asset spot ETFs and 14 virtual asset spot ETFs, including Hong Kong dollars, US dollars, and renminbi categories, for trading on platforms holding the Hong Kong Securities and Futures Commission license. Nowadays, more and more global investors are paying attention to how to invest in virtual assets, and both the United States and Hong Kong, China have approved the listing of ETF funds for virtual assets, and the investment scale is rapidly increasing.

  • Bloomberg ETF Analyst: XRP ETF may be the next exchange-traded fund product to be launched

    Bloomberg ETF analyst James Seyffart forwarded market news on X platform, stating that during the Bitcoin 2024 conference, Discover Crypto CEO Joshua Jake was interviewed and he said that XRP ETF could be the next possible exchange-traded fund product to launch.

  • Hong Kong's financial industry may study launching stablecoin trading desks and institutional custody services

    Hong Kong Monetary Authority recently announced the list of participants in the stablecoin issuer sandbox, including JD Coin Chain, Circle Coin Innovation, Standard Chartered Bank, Anni Group, Hong Kong Telecom and other institutions. Research reports released by Zeng Shengjun, a researcher at the Greater Bay Area Financial Research Institute of the Shenzhen Branch of Bank of China, and Guan Zhenqiu, a researcher at the Hong Kong Financial Research Institute of Bank of China, analyzed that the Hong Kong dollar stablecoin can improve the efficiency and inclusiveness of the Hong Kong financial system. Its stability, free convertibility, high security, high open source and cross-border mobility can provide support for a wider range of financial innovations.

  • Bitcoin scaling network Mezo completes $7.5 million in financing, led by Ledger Cathay Fund

    Bitcoin scaling network Mezo has completed a $7.5 million financing round, with Ledger Cathay Fund leading the investment and Mantle EcoFund ecosystem projects from ArkStream Capital, Aquarius Fund, Flowdesk, GSR, Origin Protocol, and Bybit participating. This round of financing brings its total funding to $30 million.The new funds will be used for Mezo's plan to expand the adoption of its network, including integrating more products into its network, such as its Bitcoin staking platform Acre.

  • As of July 25, BlackRock IBIT held more than 338,000 bitcoins, an increase of more than 1,092 bitcoins from the previous day.

    BlackRock's official update on the Bitcoin ETF shows that as of July 25th, the market value of IBIT has reached $21,890,121,436.41, and the position has increased to 338,128.5551 BTC, an increase of 1,092.7881 BTC from the previous trading day.

  • The U.S. core PCE price index rose 0.2% in June, compared with expectations of 0.1% and the previous value of 0.10%.

    The US core PCE price index for June was 0.2%, exceeding expectations of 0.1% and the previous value of 0.10%; the US core PCE price index for June recorded a year-on-year increase of 2.6%, higher than expected. The US core PCE price index for June recorded a monthly rate of 0.1%, unchanged from the previous month and in line with expectations.

  • LayerPixel Completes $2 Million Seed Round Led by Kenetic Capital

    LayerPixel, a DeFi solution based on TON, announced the completion of a $2 million seed round of financing, led by Kenetic Capital, with participation from Foresight Ventures, Waterdrip Capital, VentureSouq, Web3 Port Foundation, Microcosm Research, TMM Club, and dozens of angel investors. It is reported that this funding will help LayerPixel accelerate the development and integration of its DeFi solution suite in the Telegram Mini App ecosystem, fundamentally changing the way users interact with decentralized finance in the Telegram environment.