# metashrew-view-rs

## Overview

Parallelizable view layer for metashrew. Exposes the metashrew\_view JSON-RPC method and can be reverse proxied by the complete RPC provider to surface data for a single index.

The concept is simple: we do not scale up the r/w performance of the rocksdb instance that owns the index we care about, but we can scale up the amount of WebAssembly instances that run the index to compute a view result.

### Install

```
git clone https://github.com/sandshrew/metashrew-view-rs
cd metashrew-view-rs
cargo
```

### Usage

Set environment variables HOST, PORT, DB\_LOCATION and PROGRAM\_PATH then run the command

```
metashrew-view-rs
```

This will run the HTTP service and can be reverse proxied.

The remote rocksdb database must be mounted over FUSE, nfs, or something similar that exposes native filesystem access to the remote index. The database is opened in read-only mode and a handle is instantiated for every call to metashrew\_view. It is expected that a metashrew process will own the rocksdb volume where the index is built. This same filesystem mount is intended to be provided over the network to metashrew-view such that it may be opened in read-only mode.

### metashrew\_view

The metashrew\_view RPC call takes three params:

```
[ programHash, functionName, inputHexString, blockTag ]
```

It returns a hex encoded byte string as the JSON-RPC result.


---

# 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.sandshrew.io/metashrew-open-source-repositories/metashrew-view-rs.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.
