multiversx-cross-contract-storage

Read same-shard contract storage variables using storage_mapper_from_address.

12|5|Updated Jan 28, 2026
One-click install
npx skills add https://github.com/multiversx/mx-ai-skills --skill multiversx-cross-contract-storage
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: multiversx-cross-contract-storage
Source: https://github.com/multiversx/mx-ai-skills/tree/main/skills/multiversx-cross-contract-storage
Command: npx skills add https://github.com/multiversx/mx-ai-skills --skill multiversx-cross-contract-storage

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill enables your smart contract to read the storage state of another same-shard contract directly, bypassing the overhead and complexity of asynchronous proxy calls.

Core Features & Use Cases

  • Direct Storage Access: Read state variables from other contracts using storage_mapper_from_address.
  • Gas Efficiency: Significantly reduces gas costs compared to traditional proxy calls for read operations.
  • Use Case: A central aggregator contract needs to display the total supply of various tokens. Instead of making a proxy call to each token contract, it can directly read the total_supply storage variable from each, saving gas.

Quick Start

Use the multiversx-cross-contract-storage skill to read the 'balance' storage key from the address 'erd1...' for the token 'MYTOKEN-123456'.

Frequently Asked Questions about multiversx-cross-contract-storage

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I read another contract's storage directly in MultiversX Rust without async proxy calls?

You can read another contract's storage directly by using the `storage_mapper_from_address` function. This bypasses async proxy calls for read-only state retrieval, reducing gas costs and complexity.

What is the best way to optimize gas costs for cross-contract read operations on MultiversX?

The best way to optimize gas for cross-contract reads is to use `storage_mapper_from_address` to access another same-shard contract's storage variables directly. This avoids the high gas overhead of traditional asynchronous view calls.

Does direct cross-contract storage reading work for contracts on different shards?

No, direct cross-contract storage reading works exclusively for same-shard contracts. You must ensure both the calling contract and the target contract reside in the same shard to successfully retrieve state variables.

How do I handle composite and module-prefixed storage keys when reading from another contract?

To read composite or module-prefixed keys, you must have precise knowledge of the target contract's storage key names. The direct read mechanism requires exact key mapping to successfully fetch the desired state variables.

When should I not use direct storage reads for cross-contract data retrieval?

You should not use direct storage reads if contracts are on different shards or if you lack exact knowledge of the target contract's storage key names. Traditional async proxy calls remain necessary for cross-shard read operations.