# Zero Knowledge Proofs - An example

By [Airesh Bhat](https://paragraph.com/@airesh-bhat) · 2024-10-31

---

In this article, we’ll dive into an example of [Zero Knowledge Proofs](https://a16zcrypto.com/posts/videos/zero-knowledge-made-simple/) in the identity realm. The aim or goal is to provide the user with an intuition on how we can think of Zero Knowledge Proofs and their real-world applications. This article was written while working on the project, [Chiti](https://github.com/AireshBhat/Chiti).

### Identity

Decentralized networks require decentralized Identities. Most identity solutions today use OAuth2.0 or OpenID Connect to authenticate users. These solutions however don't have a way to allow the user to update their personality, features, and attributes of themselves on these systems to truly reflect the nature of an identity that is dynamic and comprised of multiple aspects.

Identity is made up of Human personality, soul, and character, all distinct from one another. The soul Identity constitutes the Chiti. It is generally made up of the ideals that make up an individual soul or a nation. Chiti, the soul identity or innate nature of an identity is constant. Or we can say, alterations to one’s idea’s ideals rarely change over a given lifetime. As we can see in our society, changing the nature of an individual is a tough task!

Personality results from a cumulative effect of an individual's actions, thoughts, and impressions. To store this personality as a digital identity requires the use of new-age digital storage tools such as CIDs as identifiers for data, Consensus protocols that decide on an agreed time tracking mechanism for the network, Data Finalisation protocols to store an immutable of the latest version of an identity, Public-Private Keys and signing protocols for accessing the digital identity.

How is this stored in code?

The entire identity is essentially like a key value database stored in a [Merkle “Trie”](https://github.com/paritytech/trie). This data is identified by a root CID ([Content Identifier](https://en.wikipedia.org/wiki/Content-addressable_storage)). CID is essentially a form of hash of the data(plain or encrypted). The only requirement is that the metadata that describes this CID stores the schema used to understand the hashed data. Whenever this root CID is updated with a new feature/attribute, a new hash of the data is calculated. The hashed data includes the parents’ block hash in its data, forming an unbreakable link to its previous hashes. When storing the parents’ entries hash, the data of known verifiers and attestors of the features/attributes are also stored, acting as Proof of Personhood. The identity can choose whom to broadcast this new CID to. Data encryption can be done by using a password(generally a term that defines the event/attribute) to derive a public-private key pair and using the private key to encrypt the corresponding data. The [Willow Protocol](https://willowprotocol.org/specs/data-model/index.html#data_model) is used to define a network data model.

    /// The base `Identity` trait that all identities should implement.
    pub trait Identity {
        type Id;
        pub fn get_id(&self) -> &Self::Id;
        fn update_id(&self) -> &Self::Id; // Re-calculates the root hash of the identity merkle trie upon updating a feature/facet (Emits Update Identity event that peers can subscribe to)
    }
    

### Identity is a two-way street

The individual, I, is inseparable from its relation to the plural We. Identity is strengthened by the networks it’s connected to, a.k.a, its peers.

Each Identity is responsible for maintaining their relationships, a.k.a, their Web Of Trust. Every identity stores the latest feature they know about their peers, defining the relation using the [Social Identity](https://papers.ssrn.com/sol3/papers.cfm?abstract_id=3375436#:~:text=Outside%20of%20digital%20life%2C%20however,are%20shared%20with%20different%20others\).) protocol. Intersectional Social Data is a data structure to store the identity of an individual to truly reflect the nature of identity. Its sociality and intersectionality(the We). Information about what you know about your peers and a data format that allows one to calculate a trust score or reputation score of the peers you score. This is like reading the feedback reviews of the identities(which could be a place like a hotel/restaurant or the personality of an individual) your relationships have posted about.

These relations the identity claims to be part of their identity now take the form of “[Zero Knowledge Proofs](https://a16zcrypto.com/posts/videos/zero-knowledge-made-simple/)”. For Identity A, attestations and proofs that Identity B has provided of other peers are essential of the form “zero knowledge”. Identity A “believes” or trusts the score Identity B has provided to other peers to determine its own notion of a peer related to B. This is done very widely in blockchains when a private key is used to sign a message or transaction. A user would then trust a blockchain that houses proof of this transaction which is generally stored as a Root Hash of the Merkle Trie in its [block](https://spec.polkadot.network/chap-state#sect-block-format).

Features/attributes you attest to are used as verification by those who trust your identity, without needing to read the actual data/proof.

Applications
------------

*   **Attribute Verification**: A participant can verify specific attributes (e.g., location, credentials) without disclosing full identity details. For instance, to prove location history to a peer, they could use ZKP to confirm that attribute without revealing unnecessary location points or other unrelated personal information.
    
*   **Sybil Resistance**: For one-person-one-vote systems or democratic participation, ZKPs help verify the uniqueness of participants without needing complete identity disclosure. By randomly selecting verifiable points in a participant's past activity (e.g., locations), ZKPs allow peers to confirm non-duplicated identities, reducing vulnerability to identity spoofing and duplicate voting.
    
*   **Social Authentication**: Instead of relying on static passwords or biometrics, social authentication in ISD can leverage ZKPs. Peers use a networked memory approach where users authenticate by proving knowledge of shared past interactions or connections, without sharing direct identifiers. This supports adaptive, context-sensitive authentication based on known relationships.
    
*   **Credit and Trust System Integrity**: ZKPs also enable secure verification within the ISD credit network (trust and lending relationships). They allow peers to confirm trustworthiness without showing exact credit scores, ensuring system integrity and preventing credit overuse or abuse.
    
*   **Partial Identity Disclosure**: ZKPs help verify specific identity attributes (e.g., professional credentials) based on selective disclosure, where only necessary attributes are revealed for a particular interaction, preserving anonymity in other contexts.
    

Links:

*   Cover Photo: Image by [Albrecht Fietz](https://pixabay.com/users/fietzfotos-6795508/?utm_source=link-attribution&utm_medium=referral&utm_campaign=image&utm_content=6704764) from [Pixabay](https://pixabay.com//?utm_source=link-attribution&utm_medium=referral&utm_campaign=image&utm_content=6704764)
    
*   [Chiti](https://github.com/AireshBhat/Chiti): An implementation of Dynamic Identity
    
*   Parity Tech - [Merkle Trie implementation](https://github.com/paritytech/trie)
    
*   [Intersectional Social Data paper](https://papers.ssrn.com/sol3/papers.cfm?abstract_id=3375436#:~:text=Outside%20of%20digital%20life%2C%20however,are%20shared%20with%20different%20others\).)
    
*   [Content Addressable Storage](https://en.wikipedia.org/wiki/Content-addressable_storage)
    
*   [Willow Protocol Data Model](https://willowprotocol.org/specs/data-model/index.html#data_model): An instance defines the parameters mentioned in this protocol to allow for data storage of truly dynamic identities.
    
*   [Zero Knowledge Made Simple](https://a16zcrypto.com/posts/videos/zero-knowledge-made-simple/)

---

*Originally published on [Airesh Bhat](https://paragraph.com/@airesh-bhat/zero-knowledge-proofs-an-example)*
