> ## Documentation Index
> Fetch the complete documentation index at: https://privacycash.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Backend Integration

## Sample Project

[https://github.com/Privacy-Cash/privacy-cash-sdk/blob/main/example/](https://github.com/Privacy-Cash/privacy-cash-sdk/blob/main/example/)

## Installation

```bash theme={null}
npm install privacycash --save
```

<Info>
  Requires **Node.js 24+**. The SDK is written in TypeScript and includes type definitions.
</Info>

## Initialization

```typescript theme={null}
import { PrivacyCash } from 'privacycash'

const client = new PrivacyCash({
  RPC_url: 'YOUR_SOLANA_MAINNET_RPC_URL',
  owner: 'YOUR_PRIVATE_KEY',
  enableDebug: false // optional
})
```

### Supported Private Key Formats

```typescript theme={null}
// Base58 encoded string
const client1 = new PrivacyCash({
  RPC_url: 'https://...',
  owner: '5Jd7...' // Base58 string
})

// Byte array
const client2 = new PrivacyCash({
  RPC_url: 'https://...',
  owner: [1, 2, 3, ...] // number[]
})

// Uint8Array
const client3 = new PrivacyCash({
  RPC_url: 'https://...',
  owner: new Uint8Array([1, 2, 3, ...])
})

// Solana Keypair object
import { Keypair } from '@solana/web3.js'
const client4 = new PrivacyCash({
  RPC_url: 'https://...',
  owner: Keypair.generate()
})
```

## Interacting with Privacy Cash

Once above steps are done, client can query [balance](/sdk/balance), make [deposits](/sdk/deposit) and [withdrawals](/sdk/withdraw).

## Warnings

Privacy Cash SDK requires consistent signature generation, otherwise the deposited tokens might be lost forever since the encrypted UTXO can't be decrypted. For frontend, please make sure deriveEncryptionKeyFromSignature() generates the same result for the same params passed in, and for backend, please make sure deriveEncryptionKeyFromWallet() generates the same result. Most wallets returns the same result, but some non major wallets might generate different result.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.