Storage

EVM

परिभाषा

Storage वह permanent data location है जहां state variables store होते हैं। Storage data blockchain पर persist करता है और सबसे expensive है (gas terms में)। Storage को efficiently use करना gas optimization का critical part है। हर contract की अपनी isolated storage होती है।

English version

Storage is the permanent data location where state variables are stored. Storage data persists on the blockchain and is the most expensive (in gas terms). Using storage efficiently is a critical part of gas optimization. Each contract has its own isolated storage.

Code Example

contract StorageExample {
    // Variables d'état = storage
    uint256 public value;
    mapping(address => uint256) public balances;

    function updateValue(uint256 newValue) public {
        value = newValue; // SSTORE opcode (20,000 gas)
    }

    // Optimisation : lecture unique
    function optimized() public view returns (uint256) {
        uint256 cached = value; // SLOAD (2100 gas)
        return cached * 2; // Calcul en memory
    }
}

संबंधित शब्द

Solingo पर इस concept को practice करें

Storage को interactive exercises और integrated IDE के साथ master करें।

मुफ्त में शुरू करें