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

  • Hong Kong Ethereum ETF has shown net redemption or zero net flow for 9 consecutive trading days. This morning, it showed a positive premium for a short period of time and the trading volume was

    According to SoSo Value data, the net flow of Hong Kong Ethereum spot ETF was zero on May 20, with a total holding of 1332 Ethereum and a daily turnover of 243,000 US dollars. The total net assets were 41.14 million US dollars. From May 7 to the present, the net flow of Hong Kong Ethereum ETF has been zero or net redemption for 9 trading days.In terms of asset size, Bosera Hashkey ETF holds 6300 Ethereum, ranking first, while Huaxia and Jiashi ETF hold 4640 and 2390 Ethereum respectively. In terms of intraday discount rate, Bosera HashKey ETF and Jiashi ETF had a positive premium rate this morning, and the trading volume has also increased. As of the time of publication, the total intraday trading volume has exceeded 1.489 million US dollars, and Huaxia Ethereum ETF has reached 883,000 US dollars, exceeding the full-day trading volume of yesterday.(Note: ETF net flow of zero is normal, indicating a balance between buying and selling quantities. Bloomberg ETF analyst James Seyffart pointed out that among approximately 3,500 US ETFs, 2,903 had a net flow of zero on a certain day.)

  • 62 crypto projects raised $474 million so far in May

    According to the latest data, in the past 20 days of May, 62 blockchain or cryptocurrency projects raised a total of $474 million. The blockchain project Sophon, which focuses on entertainment, raised $60 million in node sales, followed closely by Securitize with a funding amount of $47 million. (Bitcoin.com)

  • The open interest of Ethereum futures contracts across the network is nearly $14.7 billion, a record high

    On May 21st, Coinglass data showed that the total open position of Ethereum futures contracts on the network rose to 4.01 million ETH (approximately $14.69 billion), an increase of 25.48% in the past 24 hours, reaching a historic high when calculated in USD (there is still a gap from the peak of 5 million ETH in 2022). Among them, Binance's open position for Ethereum contracts was 1.5 million ETH (approximately $5.48 billion), ranking first; the increase in holdings in the past 24 hours was 32.37%. Bybit's open position for Ethereum contracts was 840,490 ETH (approximately $3.08 billion), ranking second, with an increase in holdings of 38.82% in the past 24 hours.

  • Yuga Labs co-founder: The company will no longer touch Cryptopunks, it will be completely decentralized

    On May 21st, Garga.eth, co-founder of Yuga Labs, announced on X platform that Yuga Labs will no longer be involved with Cryptopunks. Cryptopunks will be fully decentralized and stored on the blockchain. When the company acquired Cryptopunks and other collectibles a few years ago, the intention was to preserve them as heritage. Yuga Labs only intends to support some museums and institutions in obtaining Cryptopunks. In addition, the current plan is to randomly airdrop Nina's latest NFT collection to Super Cool World holders.

  • The U.S. SEC responds to Ripple’s sealed motion: objecting to some evidence in certain documents related to the application for remedial measures

    On May 21st, according to legal documents shared by former US federal prosecutor James K. Filan, the US Securities and Exchange Commission (SEC) has submitted a response to Ripple's sealed motion. The SEC stated its opposition to certain evidence in some of the documents submitted by Ripple related to its application for remedies.

  • Chairman of the Hong Kong Institute of International Finance: Using Hong Kong's digital financial infrastructure to explore the RMB-pegged "Greater Bay Area Stablecoin"

    Professor Xiao Geng, Chairman of the Hong Kong International Finance Association, Professor of the Advanced Finance Research Institute of the Chinese University of Hong Kong (Shenzhen), and Director of the Policy and Practice Research Institute, stated that Hong Kong has always been a testing ground for cutting-edge financial innovation, with a good tradition of innovation, a good system for implementing experiments, and a good market foundation. Creating a stablecoin linked to the renminbi based on stablecoins, limited memory blockchains, and digital smart contracts can consolidate and enhance Hong Kong's status as an international financial center.

  • The Hong Kong Insurance Authority is considering changing its name to “virtual insurance”, which may be consistent with the logic of changing the name of virtual banks

    According to Li Jiada, CEO of Hong Kong virtual bank WeLab Bank, the Hong Kong Insurance Authority is considering renaming "virtual insurance". If virtual banks and virtual insurance are renamed with the same logic, it is believed that further synergies can be achieved. Li Jiada said that "digital" can more accurately highlight the core characteristics of providing digital financial services through technology, clearly defining the service model and characteristics of such banks. "Licensed" highlights regulatory compliance, helps strengthen customer confidence in local virtual banks, and is beneficial for virtual banks to attract new customers and continue to develop.

  • Gala Games attackers have exchanged 599 million GALA for about 5,900 ETH

    According to PeckShield monitoring, the attacker of Gala Games has exchanged 599 million GALA tokens for approximately 5,900 ETH (worth about $21.8 million).

  • OKX Ventures invests in Web3 ‘play ARPG to train AI’ game Blade of God X

    The game is currently available in early access on the Epic Games Store.

  • Barcelona-based Web3 Video Games Startup GFAL Raises $3.2M in Seed Funding to Expand Team and Accelerate Production Plans

    Barcelona-based startup GFAL has secured $3.2 million in seed funding from investors including Supercell Ltd and Mitch Lasky. The company plans to use the funds to expand its team and accelerate its game production plans, which leverage AI and Web3 technology for immersive gameplay. GFAL's Elemental Raiders mobile game soft-launched in March 2023, with plans to build on this for a 2024 launch. CEO Manel Sort expressed gratitude for the investment and excitement to work with former colleagues from Digital Chocolate.