githubEdit

Call

If you run pop call without a subcommand, Pop CLI uses pop call chain unless it detects a contract project in the current directory. If chain support is disabled and no contract project is detected, it returns an error.

What Can You Do?

The pop call chain command supports three types of operations:

1. Execute Extrinsics

Submit transactions to the chain by calling dispatchable functions. These require signing and will modify chain state.

2. Query Storage

Read storage items from the chain's state. Storage queries don't require signing and can read:

  • Plain storage values (e.g., System::Number - the current block number)

  • Storage maps (e.g., System::Account - account information by address)

3. Read Constants

Access constant values defined in the runtime metadata (e.g., System::Version, System::BlockHashCount).

Interact with a chain using Pop CLI's interactive guidance by simply entering:

pop call chain

First, you will be prompted to select which chain you want to interact with from a list of available chains. You can type to filter the list and quickly find your desired chain. If you want to connect to a custom RPC endpoint, select the "Custom" option, which allows you to manually type the chain URL.

After selecting your chain, you will be prompted to select a pallet, then choose what you want to do with that pallet:

  • Execute an extrinsic (function that modifies state, e.g. balance transfer)

  • Query storage

  • Read constants

After making your selection, you'll be guided through providing any required arguments and (for extrinsics) the account to sign the transaction.

Manual (non-interactive)

If you prefer not to use interactive prompts, you can call the chain by specifying all the required arguments directly:

Executing an Extrinsic

You can execute an extrinsic by specifying the pallet and function (dispatchable function name) and any arguments.

[!TIP] If you receive "Pallet not found" or "Function not found" errors, double-check the case of your pallet and function names. Common examples: use "Balances" (not "balances"), "transfer_keep_alive" (not "transferKeepAlive").

To submit directly without the final "submit extrinsic?" prompt, add --execute:

Querying Storage

You can query storage items by specifying the pallet and function (storage item name). Storage queries return the current value immediately without requiring transaction signing. You do not need --skip-confirm for read-only calls. If the storage item is a map, provide a key with --args. In interactive mode, leave the key blank to query all entries. For composite map keys, you can pass tuple-style arguments (for example (ASSET_ID,ACCOUNT)), or provide each key part in order.

Reading Constants

Query constant values from the runtime. Constants are read directly from metadata and don't require signing or keys.

Additional Options

When do you need signing?

You need a signer for extrinsics only. Storage queries and constants never require signing.

View Metadata

Use --metadata to inspect runtime metadata. If you omit --pallet, Pop CLI lists all pallets. If you include --pallet, it lists calls, storage, and constants for that pallet.

--metadata conflicts with --function, --args, --suri, --use-wallet, --call, and --sudo.

Sudo Calls

To dispatch a call with Root origin when the chain's runtime includes pallet-sudo, you can wrap the call in a sudo.sudo() call by using the --sudo flag:

Using Wallet for Signing

You can use a browser extension wallet to sign extrinsics instead of providing a secret URI:

Or use the shorthand -w:

Direct Call Data Submission

If you already have the SCALE-encoded call data and want to directly submit the extrinsic:

--call conflicts with --pallet, --function, and --args.

Skip Confirmation

Use the --skip-confirm or -y flag to automatically submit extrinsics without prompting for confirmation. This also prevents the prompt to perform another call:

If you use --skip-confirm with an extrinsic, you must provide a signer with --suri or --use-wallet.

This is particularly useful for scripting and automation.

If you only want to skip the submit confirmation (but keep other interactive prompts), use --execute.

Exit Codes for Automation

pop call chain exits with a non-zero code when a call fails (for example RPC errors, invalid pallet/function names, or failed submission). This makes shell scripting and CI checks reliable.

Upcoming: JSON mode (#993, pending merge)

pop call chain is planned to support global --json with structured envelopes once #993arrow-up-right merges.

Planned usage:

Planned behavior:

  • Interactive prompts are disabled in JSON mode; required inputs must be passed via flags.

  • Errors are returned with typed codes for automation (INVALID_INPUT, PROMPT_REQUIRED, NETWORK_ERROR, INTERNAL).

Quick URL Entry

When prompted for a chain, you can select "Custom" to quickly type the chain URL manually, accelerating the process when you already know the endpoint.

Examples

Example 1: Query Current Block Number

Example 2: Check an Account Balance

Example 3: Read Runtime Version

Example 4: Transfer with Wallet

Example 5: Sudo Call with Auto-confirm

Need help?

Ask on Polkadot Stack Exchangearrow-up-right (tag it poparrow-up-right) or drop by our Telegramarrow-up-right. We're here to help!

Last updated