> For the complete documentation index, see [llms.txt](https://docs.iotex.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.iotex.io/blockchain/build/reference-docs/native-iotex-development/calling-any-rpc-method.md).

# Calling any RPC method

The `rpc-method` package allows you to make direct gRPC calls to the IoTeX blockchain. The complete gRPC API can be found in the [iotex-proto ](https://github.com/iotexproject/iotex-proto/blob/master/proto/api/api.proto)GitHub repository, and all calls can be made both using the *umbrella* `antenna.iotex` object or using the `rpc-method` as a standalone package.

### **Using `antenna.iotx`**

{% tabs %}
{% tab title="Javascript" %}

```javascript
import Antenna from "iotex-antenna";

(async () => {
  const antenna = new Antenna("https://api.testnet.iotex.one");

  const account = await antenna.iotx.getAccount({
    address: "io1cl6rl2ev5dfa988qmgzg2x4hfazmp9vn2g66ng"
  });
  const chainMeta = await antenna.iotx.getChainMeta();
  const actions = await antenna.iotx.getActions({
    byIndex: { start: 1, count: 5 }
  });
  const blocks = await antenna.iotx.getBlockMetas({
    byIndex: { start: 1, count: 5 }
  });
})();
```

{% endtab %}

{% tab title="Golang" %}

```
package main

import (
	"log"

	"github.com/iotexproject/iotex-core/protogen/iotexapi"

	"github.com/iotexproject/iotex-antenna-go/antenna"
)

func main() {
	wallet, err := antenna.NewAntenna("api.testnet.iotex.one")
	if err != nil {
		log.Fatalf("create antenna error: %v", err)
	}

	account, err := wallet.Iotx.GetAccount(&iotexapi.GetAccountRequest{Address: "io1cl6rl2ev5dfa988qmgzg2x4hfazmp9vn2g66ng"})
	chainMeta, err := wallet.Iotx.GetChainMeta(&iotexapi.GetChainMetaRequest{})
	actions, err := wallet.Iotx.GetActions(&iotexapi.GetActionsRequest{
		Lookup: &iotexapi.GetActionsRequest_ByIndex{
			ByIndex: &iotexapi.GetActionsByIndexRequest{
				Start: 1,
				Count: 5,
			},
		},
	})
	blocks, err := wallet.Iotx.GetBlockMetas(&iotexapi.GetBlockMetasRequest{
		Lookup: &iotexapi.GetBlockMetasRequest_ByIndex{
			ByIndex: &iotexapi.GetBlockMetasByIndexRequest{
				Start: 1,
				Count: 5,
			},
		},
	})
}
```

{% endtab %}
{% endtabs %}

### **Using `rpc-methods` a standalone package:**

{% tabs %}
{% tab title="Javascript" %}

```javascript
simport RpcMethod from "iotex-antenna/lib/rpc-method";

(async () => {
  const provider = new RpcMethod("https://api.testnet.iotex.one");

  const account = await provider.getAccount({
    address: "io1cl6rl2ev5dfa988qmgzg2x4hfazmp9vn2g66ng"
  });
  const chainMeta = await provider.getChainMeta();
  const actions = await provider.getActions({
    byIndex: { start: 1, count: 5 }
  });
  const blocks = await provider.getBlockMetas({
    byIndex: { start: 1, count: 5 }
  });
})();
```

{% endtab %}

{% tab title="Golang" %}

```go
package main

import (
	"log"

	"github.com/iotexproject/iotex-antenna-go/rpcmethod"

	"github.com/iotexproject/iotex-core/protogen/iotexapi"
)

func main() {
	provider, err := rpcmethod.NewRPCMethod("api.testnet.iotex.one")
	if err != nil {
		log.Fatalf("create antenna error: %v", err)
	}

	account, err := provider.GetAccount(&iotexapi.GetAccountRequest{Address: "io1cl6rl2ev5dfa988qmgzg2x4hfazmp9vn2g66ng"})
	chainMeta, err := provider.GetChainMeta(&iotexapi.GetChainMetaRequest{})
	actions, err := provider.GetActions(&iotexapi.GetActionsRequest{
		Lookup: &iotexapi.GetActionsRequest_ByIndex{
			ByIndex: &iotexapi.GetActionsByIndexRequest{
				Start: 1,
				Count: 5,
			},
		},
	})
	blocks, err := provider.GetBlockMetas(&iotexapi.GetBlockMetasRequest{
		Lookup: &iotexapi.GetBlockMetasRequest_ByIndex{
			ByIndex: &iotexapi.GetBlockMetasByIndexRequest{
				Start: 1,
				Count: 5,
			},
		},
	})
}
```

{% endtab %}
{% endtabs %}


---

# 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 dynamically by asking a question.

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

```
GET https://docs.iotex.io/blockchain/build/reference-docs/native-iotex-development/calling-any-rpc-method.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
