Opcodes
CSTORE
CSTOREcontract PrivateCounter {
suint256 private count; // shielded type → compiler uses CSTORE
function increment() external {
count = count + suint256(1);
// Compiler generates:
// CLOAD slot(count) → read current value
// CSTORE slot(count), new → write new value, slot marked is_private=true
}
}function cstoreExample(uint256 slot, uint256 value) internal {
assembly {
// 0xB1 = CSTORE opcode
// Writes `value` to `slot` and sets is_private = true
cstore(slot, value)
}
}CLOAD
CLOADSSTORE / SLOAD (Standard)
SSTORE / SLOAD (Standard)TIMESTAMP_MS
TIMESTAMP_MSFlaggedStorage Access Rules
Operation
Result
Example: Mixed Public and Private Storage
Gas
Related
Last updated

