# Cleanup IPFS and Oracle Entries

Sometimes IPFS or Oracle entries are not evicted from a developer’s contract due to the DSP experiencing unpredictable behavior. This causes the developer’s smart contract RAM supply to increase as the `ipfsentry` / `oracleentry` table rows are not evicted. If this happens, you may run the [cleanup.js](https://github.com/liquidapps-io/zeus-sdk/blob/master/boxes/groups/services/ipfs-dapp-service/utils/ipfs-service/cleanup.js) file with the following environment variables:

The cleanup script will auto detect which table to cleanup `ipfsentry` or `oracleentry` depending on which one is present on the contract. If both are set, you can use the `TABLE` env variable to specify which to cleanup.

### Mandatory:

* `CONTRACT` contract to clean IPFS / oracle entries
* `DSP_ENDPOINT` the DSP’s endpoint that you staked to for IPFS and/or Oracle services
* `TABLE` specify table name to be cleaed: (ipfs (vRAM) table: `ipfsentry` or oracle table: `oracleentry`)
* `DSP_ALLOW_API_NON_BROADCAST` enables the `/event` DSP API endpoint to accept non-blocking service events such as xcommits.

```
export CONTRACT=lqdportfolio
export DSP_ENDPOINT=http://kylin-dsp-2.liquidapps.io
export TABLE=ipfsentry
export DSP_ALLOW_API_NON_BROADCAST=true
```

### Sidechain:

If cleaning an account on a sidechain, must add the following environment variables.

* `SIDECHAIN` if using a sidechain, must specify sidechain name (sidechain names can be found [here](https://docs.liquidapps.io/en/master/liquidx/example-chains.html))
* `SIDECHAIN_DSP_PORT` if using a sidechain, must specify sidechain DSP’s port
* `DSP_LIQUIDX_CONTRACT` the liquidx contract name must be set `liquidx.dsp` on mainnet if cleaning a sidechain
* `NODEOS_MAINNET_ENDPOINT` set mainnet nodeos endpoint

### Optional:

* `CHUNK_SIZE` represents the number of async requests for cleanups to send to the DSP at a time

```
export CHUNK_SIZE= # defaults to 5
export TABLE= # defaults to ipfsentry or oracleentry by detecting from contract
# if using dfuse
export DFUSE_PUSH_ENABLE=true
export DFUSE_API_KEY="" # long-lived API key, see https://docs.dfuse.io/guides/core-concepts/authentication/, e.g. (server_abcdef123123123000000000000000000)
export DFUSE_PUSH_GUARANTEE="in-block" # handoff:1, handoffs:2, handoffs:3, irreversible
export DFUSE_NETWORK="mainnet"
```

Then run with:

```
sudo find / -name cleanup.js
cd /root/.nvm/versions/node/v10.16.3/lib/node_modules/@liquidapps/dsp
node zeus_boxes/seed-utils-cleanup/utils/cleanup.js
```


---

# 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.liquidapps.io/liquidapps-documentation/dapp-service-providers/dsps/dsp-maintenance/cleanup-ipfs-and-oracle-entries.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.
