> For the complete documentation index, see [llms.txt](https://docs.taco.build/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.taco.build/for-developers/conditions/rpccondition.md).

# RpcCondition

`RpcCondition` is based on the evaluation of a JSON-RPC call.

Below, we can see an example of using `RpcCondition` to restrict based on a native asset balance.

```typescript
import { conditions } from '@nucypher/taco';

const ownsETH = new conditions.base.rpc.RpcCondition({
  method: 'eth_getBalance',
  parameters: [':userAddress'],
  chain: 1,
  returnValueTest: {
    comparator: '>=',
    value: 1,
  },
});

```

Knowing the [signature of this method](https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getbalance), we need to pass a wallet address parameter into the `parameters` field (the default block used is `latest`).

```typescript
 method: 'eth_getBalance',
 parameters: [':userAddress'],
```

`':userAddress'` is a reserved [context variable](/for-developers/authentication/conditioncontext-and-context-variables.md) that denotes the address of the operation requester. Before the attempt is made, the `':userAddress'` value will be replaced with the actual wallet address.

Now that we've specified our contract call, we need to figure out what to do with the contract call results. Let's take a look at the `returnValueTest` field:

```typescript
returnValueTest: {
  comparator: '>=',
  value: 1,
},
```

`returnValueTest` is going to evaluate the contract call result according to the following logic:

* Since the RPC call returns only one value, we don't need to specify the `index` field
* Compare it using the following comparator, `comparator: '>='`
* Compare the value returned by the RPC call to the following value, `value: 1`

Combining these three, we can see that the `returnValueTest` will "trigger" if the value returned by the RPC call is greater than one.

In other words, our condition is only satisfied if `eth_getBalance(:userAddress) >= 1` i.e. only if the user's wallet has a native balance greater than or equal to 1.

### Learn more

* [Broken mention](broken://pages/3qufTlyKsrLICoyVGk9J)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

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

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.taco.build/for-developers/conditions/rpccondition.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

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.
