Skip to main content

Using the NEAR CLI

Calimero works with all the NEAR tooling including the NEAR CLI.

You can install the NEAR CLI using:

npm install -g near-cli

You can always check your current version by running:

near --version  # version info appears on the last line of output

All methods from NEAR CLI are compatible with Calimero Private Shards and the documentation can be found on the official NEAR docs:


To use NEAR CLI with Calimero you will need to:

  • generate an Authentication token on the Security page inside the Calimero Console
  • set the custom RPC endpoint for the CLI tool to use from your Dashboard
  • set the API token for the CLI to use

Set up the NEAR CLI to access the Shard via CLI

To interact with Calimero shard using near-cli, you need to set the token value using near set-api-key command.

 near set-api-key <AUTH_TOKEN>   

Replace <AUTH_TOKEN> with your token value


The value is currently ignored by the CLI. However, this issue is fixed and will be released in the next version of the CLI.

To verify, run the following command

near state <MAIN_ACCOUNT_ID> --nodeUrl<SHARD_ID>/neard-rpc/ --networkId <SHARD_ID>
  • Replace <MAIN_ACCOUNT_ID> with your shard name + the suffix calimero.testnet (SHARD_NAME.calimero.testnet)
  • Replace <SHARD_ID> with your shard name + the suffix calimero-testnet (SHARD_NAME-calimero-testnet)
  • Replace the <SHARD_ID> in the URL

Here is an example:

near state demo.calimero.testnet --nodeUrl --networkId demo-calimero-testnet

Interacting with the RPC Server URL

The RPC server allows you to communicate directly with the NEAR network.

By default NEAR CLI is sending requests to the testnet

However, to interact with the shard the user needs to put the URL of the shard RPC node


Run near --help to see all options

Usage: near <command> [options]


To minimize repetitive typing, a shell alias can be defined for using the NEAR CLI with Calimero. Here is one suggestion on how to define it for zsh:

alias calimero='(){near ${@:1} --nodeUrl <RPC_URL> --networkId <SHARD_ID>;}'

Using the values from this article:

alias calimero='(){near ${@:1} --nodeUrl --networkId demo-calimero-testnet;}'

Here's the previous example, but this time using the alias:

$ calimero state demo.calimero.testnet