# Identity Structure

Each identity consists of Three Sparse Merkle Trees:

• ClT: A Claims tree that contains the claims issued by that particular identity
• ReT: A Revocation tree that contains the revocation nonces of the claims that have been revoked by that particular identity
• RoT: A Roots tree that contains the history of the tree roots from the Claims tree

Claims issued by an identity are added to the Claims tree (we'll see in a while why that's not always the case). The position of a claim inside the Sparse Merkle Tree is determined by the hash of the claim's Index while the value stored inside the leaf will be the hash of the claim's Value.

An identity must issue at least one Auth Claim to operate properly. This is the first claim that is issued by an identity and that must be added to the ClT.

Create identity trees and add authClaim

package main

import (
"github.com/iden3/go-merkletree-sql"
)

// Generate the three identity trees
func main() {

// Create empty Claims tree
clt, _ := merkletree.NewMerkleTree(ctx, memory.NewMemoryStorage(), 32)

// Create empty Revocation tree
ret, _ := merkletree.NewMerkleTree(ctx, memory.NewMemoryStorage(), 32)

// Create empty Roots tree
rot, _ := merkletree.NewMerkleTree(ctx, memory.NewMemoryStorage(), 32)

// Get the Index and the Value of the authClaim
hIndex, hValue, _ := authClaim.HiHv()

// add auth claim to claims tree with value hValue at index hIndex

We just generated the three identity trees! For now, we only added a leaf correponding to the authClaim to the Claims tree ClT. The Revocation tree ReT and the RoT remain empty. In particular: