Protocol Concepts
Attestation

Attestation

An attestation is the truth value of a statement when all the variables are given a value. For example, the statement "Over 18 years old" is true if the assigned value of the variable age is 22, and false if it is 14 (by using the logic rule age > 18 of the statement).

Formalisation

Jump to Implementation if you are only looking for the code.

Please refer to Statement for the formalisation of a statement before reading this section.

We note a(s,v)a_{(s,v)} the attestation of a statement ss with the given values vv.
a(s,v)s(V)a_{(s,v)} \in s(V), with VV the set of all possible vectors of values of the variables of ss.

We say that an attestation a(s,v)a_{(s,v)} is the truth value of ss for the values vv, and aa is either:

  • valid if s(v)=trues(v) = \text{true}
  • invalid otherwise (if s(v)=falses(v) = \text{false})

In logic, an attestation is the realization/instantiation of a predicate (a statement).

Example:
Let consider the following statement again:

n=1,V={age},R={ "age>18" }n = 1, V = \{\text{age}\}, \cal R = \{ ~"\text{age} > 18"~ \}

We have the following attestations:

s({age: 22})=trues({age: 14})=falses(\{\text{age: } 22\}) = \text{true} \\ s(\{\text{age: } 14\}) = \text{false}

Some observations:

  • With no restriction on VV, there's an infinite number of attestations for a statement.

Zero-knowledge attestation

We declared the following statement function ss in Zero-knowledge Statement:

s:(Vprivate,Vpublic)Ps: (V_{private}, V_{public}) \rightarrow P, with PP the set of all possible proofs of the statement ss.

We can define a function that acts as the verifier: (P,Vpublic){true,false}(P, V_{public}) \rightarrow \{true, false\}

We can note that PP is nothing else than the set of all possible attestations s(Vprivate,Vpublic)s(V_{private}, V_{public}), so we can represent an attestation as a zero-knowledge proof.

We then have:

verify:(s(Vpublic,Vprivate),Vpublic){true,false}\large \text{verify}: (s(V_{public}, V_{private}), V_{public}) \rightarrow \{true, false\}

In other word, to verify the validity of an attestation, we just need to have the attestation proof with its public variables.

Example:
We redefine the previous statement as a zero-knowledge statement with the age variable as a private variable:

n=1,Vprivate={age},Vpublic=,R={ "age>18" }n = 1, V_{private} = \{\text{age}\}, V_{public} = \emptyset, \cal R = \{ ~"\text{age} > 18"~\}

We can generate one valid proof p=s({age: 22},)p = s(\{ \text{age: } 22 \}, \emptyset ).
Note that having pp don't reveal VprivateV_{private}.
A prover can verify the validity with verify(p,)=true\text{verify}(p, \emptyset) = true.

Similarly, verify(s({age: 14},),)=false\text{verify}(s(\{ \text{age: } 14 \}, \emptyset ), \emptyset) = false

Combining attestations and statements together for modularity and scalability

We can combine multiple statements together to create more complex statements. For example, the statement "Over 18 years old and living in France" is the combination of the two statements "Over 18 years old" and "Living in France".

With s1,s2s_1, s_2 two statements, Vs1,Vs2V_{s1}, V_{s2} the set of possible vectors of values of the variables of s1,s2s_1, s_2 respectively, and vs1,vs2v_{s1}, v_{s2} two vectors such that vs1Vs1v_{s1} \in V_{s1} and vs2Vs2v_{s2} \in V_{s2}, we define the combination of s1s_1 and s2s_2 as the statement s3s_3 such that:

s3(vs1vs2)=s1(vs1)s2(vs2)s_3(v_{s1} \cup v_{s2}) = s_1(v_{s1}) \land s_2(v_{s2})

This is useful because if we have a statement that is composed of multiple statements, then we can use the partial attestation of these statements that compose the statement to determine the truth value of the statement without having to reverify the validity of the partial attestation as long as they are still valid.

In other words, with a1,a2a_1, a_2 the attestations of s1,s2s_1, s_2 respectively, and a3a_3 the attestation of s3s_3, then we can determine the truth value of s3s_3 with just a3=a1a2a_3 = a_1 \land a_2

Partial attestation

When only parts of the variables are given a value, then we call it a partial attestation. If the statement is "Over 18 years old and living in France", then the assigned value 22 to the variable age is not enough to determine the truth value of the statement, we also need to know the value of the variable country (or isLivingInFrance). However, this gives us the partial attestation "living in France" knowing that the person is "age 22".