explosionShielded Types

A handle on stype unlocks all shielded computation and storage

Operations on shielded types return shielded types. For example, comparing two suint256 values produces an sbool, not a bool. Arithmetic on sint256 returns sint256, and so on.

Shielded Integers

All comparisons and operators for shielded integers are functionally identical to their unshielded counterparts.

suint - Shielded Unsigned Integer

suint256 a = suint256(10);
suint256 b = suint256(3);

// == EXAMPLES
a > b   // sbool(true)
a | b   // suint256(11)
a << 2  // suint256(40)
a % b   // suint256(1)

sint - Shielded Signed Integer

sint256 a = sint256(-10);
sint256 b = sint256(3);

// == EXAMPLES
a < b   // sbool(true)
a + b   // sint256(-7)
a * b   // sint256(-30)

sbool - Shielded Boolean

All comparisons and operators for sbool function identically to bool.

We recommend reading the point on conditional execution prior to using sbool since it's easy to accidentally leak information with this type.

saddress - Shielded Address

An saddress variable supports code and codehash members only. Members like call, delegatecall, staticcall, balance, and transfer are not available — you must cast to address first.

sbytes - Shielded Bytes

Fixed-size: sbytes1 through sbytes32

Fixed-size shielded bytes mirror the standard bytes1bytes32 types.

Dynamic: sbytes

Dynamic shielded bytes mirror the standard bytes type. The length is stored as shielded — like dynamic shielded arrays, observers cannot read it directly but may infer an upper bound from gas costs.

Shielded Literals

circle-exclamation

Last updated