# Setup Environment

The SDK is written in TypeScript and is available in the form of a set of npm packages. It is available to use within both Node and browser environments.

### Installation

Make sure you have Node (>v18) and npm installed on your machine. Then install the SDK packages by adding the following node modules to your `package.json` file:

```json
dependencies": {
    "@veilnyx-sdk/account": "^1.0.0",
    "@veilnyx-sdk/babyjubjub": "^1.0.0",
    "@veilnyx-sdk/core": "^1.0.0",
    "@veilnyx-sdk/shared-types": "^1.0.0",
    "@veilnyx-sdk/transaction": "^1.0.0",
    "@veilnyx-sdk/utils": "^1.0.0",
    "@veilnyx-sdk/zk-prover": "^1.0.0",
    "fixed-merkle-tree": "^0.7.3"
}
```

```bash
# pnpm
pnpm install

# yarn
yarn install

# npm
npm install
```

### Installing SnarkJs

The SDK depends on the [`snarkjs`](https://github.com/iden3/snarkjs) package for ZK proof generation. You need to install it separately from the SDK, depending on the environment you are working in:

#### Node

For the node, you can install `snarkjs` Simply as an npm package and make it a globally available variable:

```bash
# pnpm
pnpm add snarkjs

# yarn
yarn add snarkjs

# npm 
npm i snarkjs
```

Set as global variable:

```typescript
import * as snarkjs from 'snarkjs';

globalThis.snarkjs = snarkjs;
```

#### Browser

For the browser, you need to include it as a JavaScript script. You can get the minified script from the official `snarkjs` repo [here](https://github.com/iden3/snarkjs/blob/master/build/snarkjs.min.js). After downloading and including the script in your project, put a script tag in your HTML:

```html
<script src="/<path-to-snarkjs>/snarkjs.min.js"></script>
```

Including this script automatically makes `snarkjs` a globally available variable. Make sure this variable is available before you invoke transaction proof generation.

Alright, setup done!
