> For the complete documentation index, see [llms.txt](https://lita.gitbook.io/lita-documentation/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://lita.gitbook.io/lita-documentation/quick-start/valida-compiler-toolchain/client-side-api.md).

# Client-side API

The Valida client-side API enables creating and verifying Valida proofs of execution within the browser. This enables use cases which require proofs to run on the client side in web apps.

To use the Valida client-side API, you can start by copying the example project which is located in the installed toolchain at `/valida-toolchain/examples/wasm/client-side-example`.

You will need to embed your guest program (the one whose execution you wish to prove) in your client-side code. You can do this by taking the compiled guest program, base64 encoding it, and ingesting it using Webpack. The compiled guest program is located in `target/valida-unknown-baremetal-gnu`. For example, after you run `cargo +valida build --release` on your guest program called `program`, the compiled guest program is located at `target/valida-unknown-baremetal-gnu/release/program`.

Supposing the compiled program is located at `./program`, to base64 encode it, you could run the following command: `base64 program >program.base64`.

The example project illustrates how to ingest the compiled, base64-encoded program into a client-side app. This is accomplished using the following rule in `webpack.config.js`:

```javascript
  module: {
    rules: [
      {
        test: /\.base64/,
        type: 'asset/source',
      }
    ]
  }
```

With this rule in place, the base64-encoded program can be imported as simply as:

```javascript
import programBase64 from "./program.base64";
```

To import the Valida prover, use a line like:

```javascript
import * as valida from "valida-basic-api-wasm";
```

For this to work, `valida-basic-api-wasm` will need to be included in your `package.json`. Once you have done this, `valida` is an object containing methods with the following type signatures:

```typescript
export function run(program_bytes: Uint8Array, stdin: Uint8Array, max_trace_height: number): Uint8Array;
export function prove(program_bytes: Uint8Array, stdin: Uint8Array, max_trace_height: number): Uint8Array;
export function verify(program_bytes: Uint8Array, stdout: Uint8Array, proof: Uint8Array, max_trace_height: number): void;
```
