# Contract Operations

We do not immediately provide contract operations from the package; however, if you are to clone the repository, we have prepared some utility scripts that allows you to build, deploy, and evolve a HollowDB contract.

## Building the Contract

```bash
yarn contract:build
```

This command will build the contract from source. The contract is written in TypeScript, but to deploy using Warp you require the contract code in JS. We use ESBuild to compile & bundle the TS contract into a concise single-file JS code. This will generate the bundled contract under `build/hollowdb.js`.

Note that this requires Node version at least 18.

## Deploying a new Contract

```bash
yarn contract:deploy <wallet-name> [<plonk | groth16>]
```

This will deploy your contract which you have just built and is stored under `build/hollowDB/contract.js`. As for the actual wallet to be used, it will look for an Arweave wallet at `./config/wallets/wallet-name.json`.

The optional `groth16` or `plonk` argument, if given, will also provide the verification key in the initial state, so that you don't have to manually set it on deployment.

{% hint style="danger" %}
Always `.gitignore` your wallet files!
{% endhint %}

## Evolving the Contract

```bash
yarn contract:evolve <wallet-name> <contract-tx-id>
```

This command will evolve your contract, it takes a wallet name and the contract transaction id of the old contract. To learn more about evolving, check [Warp docs](https://academy.warp.cc/docs/sdk/basic/evolve).


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.hollowdb.xyz/hollowdb/contract-operations.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
