Duplication Counting : Ensuring one proof is used only once, without doxxing the user
Introduction
For many applications, it will be critical that multiple users are not able to claim the same credential, at least without being detected. For example, suppose a user proves they own some funds in a certain bank account, and then later shares that their banking login to another user who then proves the same credential. An application that requires users t have some minimum collateral will need to be able to detect if the same bank account is being claimed multiple times.
Furthermore, the two users may be using their duplicated credentials for different applications, but these applications may still want to know that these users' credentials are duplicated. Note that detecting duplicate credentials is trivial if all users must post their credentials to a public chain in an unencrypted format. However, for many kinds of credentials this public chain would leak sensitive information.
Model
We now fix some notation. Consider a single kind of credential, where each user proves their credential using data . We divide the (useful) parts of each into the triple where:
- is data that users are comfortable sharing publicly.
- is data that users are comfortable sharing to specific applications, but not publicly.
- is data that users either want to keep secret, or is irrelevant for the credential in question.
For example, if the data is returned from a banking website, then could be the amount of money in the bank account, the name of the account owner, and the routing number of the account. This is because users might be comfortable with the amount of money in their account being public, as nobody can link that information to them personally. Additionally, users might be comfortable sharing their name to specific applications that need this information, but will not want to share the routing number of their account to anyone.
Finally, we denote the set of all possible values as .
Problem
We will assume that users are not required to have continued interaction with the system after they prove and share their credentials with applications. We will call this the non-interactive assumption. Therefore, all information about a user's credential that will be used for future duplication counting must be saved to a public database at the time that the credential is created. So, without loss of generality we can assume that for some fixed function , when a user creates a credential using data , they must post to a public chain the data
as well as the signature of the attestor. When a user shows a credential to an application, they will also have to share the true value of .
For to work as a feasible solution, it must satisfy the following two conditions:
(1) sufficiently obscures and so that no sensitive information is leaked.
(2) outputs enough information so that distinct credentials are not counted as duplicates. That is, if then .
Later in this article, we consider relaxing the non-interactive assumption. That is, users can be asked at a future date to cooperate in a protocol to show that some new credential is not a duplicate. We discuss how multi-party computation (MPC), at least theoretically, could be used to solve the problem given this relaxation. However, since MPCs of this size are not currently practical, we otherwise will keep the non-interactive assumption.
Entropy
For a given function to satisfy condition (1) is the entropy in the space of possible credentials. Informally, the entropy of this space is a measure of how much random variation there will be between credentials.
Let be the set of all possible values. If it is reasonably inexpensive for someone to compute the hashed value of every (likely) element of , then they can determine the value of every (likely) credential that has been posted on the chain. Condition (1) is then violated. So, the entropy of is critical for the security: if it is too low relative to the computational cost of then the scheme will not be secure. Letting be the average cost (in time or memory) of computing the hashed value of some input, the cost to compute the hashed value of all elements of will be
The two ways to alleviate this problem is to either increase the entropy of by expanding the scope of the data that must be used to create credentials (i.e. increasing ), or to increase the computational cost of (i.e. increasing ). We will further discuss both of these strategies below in the Solutions section.
Credential Uniqueness
Condition (2) on says that credentials that are actually unique must not be erroneously counted as being duplicates. For example, suppose users are proving credentials using data from a government website, and multiple users have proven the credential that just says ‘My government login says I am at least 18.' These credentials do not contain enough information to positively confirm that they are not duplicates. Enough information needs to be added to the credentials so that:
- Unique credentials appear as unique
- A credential cannot be duplicated by modifying a choice of the additional information
- The additional information does not leak sensitive data
Individual Applications
The problem becomes somewhat simpler when, for some kind of credential, each application is only concerned with detecting duplicates among the credentials that are used for it. This is because the credentials do not need to be posted to a public chain, and so users share credentials of the form to applications. Otherwise, the same two conditions still apply to .
Solutions
Recall that is the set of all possible values. If is sufficiently large, then we claim that setting to be any reasonable hash function with unknown inverse will satisfy condition (1). This is because it is too expensive for someone to find inverse values of through brute force. Secondly, if every user credential will have a unique values, then this choice of will also satisfy condition (2) as long as the probability of collisions of is sufficiently low.
But what if does not contain enough entropy, or the will not be all unique? We now explores different strategies to overcome this problem.
Trusted Entity or TEEs
More options become available if there is an entity that can be trusted to participate in the protocol honestly, or a trusted execution environment (TEE) can be used to emulate a trusted entity. We will assume that the entity is trusted to respond honestly to certain requests, but still is not allowed to learn the private data (i.e values) of the users.
Consider using the trusted entity in the following scheme. The entity manages a database, and when a user proves a credential, they submit the credential to the entity's database in the form , as they would in the Individual Application case discussed above. Now, when the user shows to an application, the application can query the trusted entity with and the entity will respond with the number of times appears in the database. See that this will achieve similar security and privacy as the Individual Applications case.
Importantly, the entity must only respond to a query from an application if the application provides evidence of knowledge of a legitimate credential. This is because if people can make arbitrary queries to the entity's database, and the entropy of the credential space is low, then they can discover some or all of the credentials in the database by brute force querying.
Secondary Data Source
For some data sources it may be possible to increase the entropy of or the uniqueness of values by incorporating another piece of data from the source. This secondary data source will have to be found on a case-by-case basis, and must satisfy the following two conditions:
- To allow for duplication detection the secondary data must persistent and cannot be changed by the user. Otherwise, users could prove a credential using one value of the secondary data source, change the value of this data, then prove the credential again, and it would not appear as a duplicate.
- The secondary data must not be publicly available data. Otherwise, if someone wants to check what credentials are on chain through brute force searching, they can look up the secondary data for each credentials they compute the hashed value for.
Here are some examples.
Suppose the type of credential that users are proving is ownership of an email account, where is the address of the email account and is empty. Since many email addresses have fewer than eight characters (before the domain name), there may not be enough entropy to satisfy condition (1). Depending on what data is available on the email client, the secondary data source could be the date the email account was created, for example.
Now suppose the type of credential that users are proving is that they are over 18, using data from their government login. The data fields could be that is just a Boolean value of whether the user is over 18 or not, and is the user's birthday. Since the number of possible birthdays is low, a secondary data source is needed. Possible data that could be added that may be available on the government website is the user's social security number, or other private identifier.
Memory-Expensive Hashing
To make brute force searching more difficult, a memory-expensive hash function can be chosen for . One standard choice for this hash is Argon2, which takes as input parameters the execution time and memory required to compute each output. These parameters can be tuned to be as low as possible while still making brute force searching infeasible.
MPC
This last solution would be an entirely different method of duplication counting. Multi-party computation (MPC) allows parties to ‘jointly compute a function over their inputs while keeping those inputs private'. That is, each user has some private data, and the users perform a protocol together that outputs a function of all the private data, but no user learns the private data of any other user.
Current MPC implementations are too computationally expensive for our purposes. Furthermore, the use of MPCs would require use to lose to non-interactive assumption we described in the Problem section. However, theoretically MPCs could be used achieve stronger privacy guarantees for users.
Consider the following scheme. When a user proves a credential, they post the credential on chain but encrypted with their private key. The user then engages in an MPC protocol with each other user who has proven a credential previously. This protocol outputs the number of credentials that are duplicates of the new credential, as well as a ZK-proof that the output is correct.