> For the complete documentation index, see [llms.txt](https://unirep.gitbook.io/unirep/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://unirep.gitbook.io/unirep/getting-started/start-with-typescript/2.-user-signs-up.md).

# 2. User signs up

Should connect to a deployed contract first.

```typescript
import { getUnirepContract } from '@unirep/contracts'

// user can connect the Unirep smart contract with getUnirepContract
const contract = await getUnirepContract(
    UNIREP_CONTRACT_ADDRESS,
    signer
)
```

Use the semaphore identity commitment to sign up in UniRep smart contract.

```typescript
import { ZkIdentity } from '@unirep/crypto'

// generate a semaphore identity
const identity = new ZkIdentity()
// sign up in UniRep smart contract with semaphore identity commitment
const tx = await contract.userSignUp(
    identity.genIdentityCommitment()
)
```

Save the serialized semaphore identity.

```typescript
// print the semaphore identity and save it
console.log(identity.serializeIdentity())
// Example output:
// {"identityNullifier":"27d1ae5c98aab64b851a9c668a7eec0d835867a17d4b9454a8bf9824836271d6","identityTrapdoor":"2596ecc2a1e1f6a8f279e097464e6edc3b18b946d934398dfe52a34c4e414e67","secret":["27d1ae5c98aab64b851a9c668a7eec0d835867a17d4b9454a8bf9824836271d6","2596ecc2a1e1f6a8f279e097464e6edc3b18b946d934398dfe52a34c4e414e67"]}
```
