> ## 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-evm-sdk/blob/main/example/](https://github.com/Privacy-Cash/privacy-cash-evm-sdk/blob/main/example/)

## Installation

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

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

## Signing In

The SDK uses a wallet signature to derive your private encryption key and UTXO keypair. Ask the user to sign a fixed message:

```typescript theme={null}
import { ethers } from 'ethers'
import { BASE_NETWORK, ETH_NETWORK } from 'privacycash-evm'

const network = ETH_NETWORK // or BASE_NETWORK
const SIGN_MESSAGE = 'Privacy Money account sign in'

const provider = new ethers.providers.JsonRpcProvider(network.rpcUrl, {
  name: network.chainKey,
  chainId: network.chainId,
})
const signer = new ethers.Wallet(process.env.PRIVATE_KEY!, provider)

const signature = await signer.signMessage(SIGN_MESSAGE)
const address = await signer.getAddress()
```

The resulting `signature` and `address` strings are passed directly to each SDK function. Pass the selected `network` to read from and submit to the correct EVM deployment.

## Sending Transactions

`deposit()` requires a `txSender` callback that signs and submits the raw transaction:

```typescript theme={null}
const txSender = async (unsignedTx: any) => {
  const tx = await signer.sendTransaction(unsignedTx)
  await tx.wait()
  return tx.hash
}
```

## Interacting with Privacy Cash

Once the above steps are done, you can check [balance](/evmsdk/balance), make [deposits](/evmsdk/deposit) and [withdrawals](/evmsdk/withdraw).

## Supported Networks

Privacy Cash EVM currently supports mainnet deployments only:

| Network  | Chain ID | SDK constant   | Supported tokens |
| -------- | -------- | -------------- | ---------------- |
| Base     | `8453`   | `BASE_NETWORK` | ETH, USDC        |
| Ethereum | `1`      | `ETH_NETWORK`  | ETH, USDT        |

```typescript theme={null}
import {
  BASE_NETWORK,
  ETH_NETWORK,
  deposit,
  withdraw,
  getBalance,
} from 'privacycash-evm'

await getBalance({ signature, address, network: BASE_NETWORK })
await getBalance({ signature, address, network: ETH_NETWORK })
```

If `network` is omitted, the SDK reads `NEXT_PUBLIC_CHAIN_ID` and falls back to Base (`8453`).

## Key Path

All functions accept a `keyBasePath` parameter pointing to the circuit zkey file (without extension):

```typescript theme={null}
keyBasePath: './circuits/transaction'  // loads ./circuits/transaction2.zkey
```

For Next.js projects, place the `.zkey` file in the `public/` folder:

```typescript theme={null}
keyBasePath: '/circuit'  // loads /circuit2.zkey from public/
```
