githubEdit

Call

The pop call contract command enables interaction with deployed ink! smart contracts. If you run pop call without a subcommand, Pop CLI uses pop call contract when it detects a contract project in the current directory.

What Can You Do?

The pop call contract command supports three types of operations:

1. Execute Messages

Submit transactions that modify contract state. These operations require signing, consume gas, and wait for on-chain finalization.

2. Query Messages

Read contract state without making changes. These read-only calls require no signing, incur no gas costs, and return values instantly.

3. Read Storage

Access contract storage fields directly using the storage layout. No signing required and no gas costs.

Interact with your contract using Pop CLI's interactive guidance by simply entering:

pop call contract

First, you will be prompted to select or enter your contract project path. You can type to filter the list and quickly find your desired contract. After selecting your contract, you will be prompted to choose a chain from the list or enter a custom RPC endpoint. 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 specify the deployed contract address, then select a message or storage item to call:

  • Execute a message (function that modifies state, e.g. flip, transfer)

  • Query a message (read-only function that returns state)

  • Read storage (direct storage access)

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

Manual (non-interactive)

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

Executing a Message

You can execute a message by specifying the contract path (or the metadata file), contract address, message name, and any arguments.

Querying Messages

You can query messages by specifying the contract path, contract address, and message name. Query messages return the current value immediately without requiring transaction signing.

Reading Storage

Access contract storage fields directly using the storage layout. Storage queries return the current value immediately without requiring transaction signing. For direct storage access, pass the storage field name with --message.

Additional Options

Execute vs Dry-Run

If you omit --execute, Pop CLI performs a dry run and returns the result without submitting a transaction. Use --execute to submit the call on-chain.

If you provide --gas, you must also provide --proof-size. If you do not provide them, Pop CLI estimates them during execution.

When do you need signing?

You need a signer only for executable messages. Read-only queries and storage reads run without signing. If you make a read-only call, Pop CLI ignores --use-wallet and runs without a signer.

Gas Estimation

Use --dry-run to estimate gas consumption before execution without submitting the transaction:

Using Wallet for Signing

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

Or use the shorthand -w:

Storage Mapping Keys

If you read a storage map, use --storage-mapping-key to query a specific key. In interactive mode, leave the key blank to fetch all entries.

Skip Confirmation

Use --skip-confirm or -y to submit an executable message without additional prompts.

Exit Codes for Automation

pop call contract exits with a non-zero code when a call fails (for example RPC failures, bad inputs, or execution errors). This makes it safe to use in scripts and CI pipelines.

Upcoming: JSON mode (#993, pending merge)

pop call contract 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).

Developer Mode

Use --dev for rapid testing during development. This skips gas prompts and confirmation dialogs:

--dev is deprecated (since 0.12.0) and will be removed in 0.13.0. Use --skip-confirm instead.

Note on Addresses

If you're using ink! v6, contract addresses are displayed as 20-byte H160 hashes (for example, 0x48550a4bb374727186c55365b7c9c0a1a31bdafe).

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