Types and operations
How Bubble represents values as encrypted handles, how they enter the system, and what you can compute on them.
Bubble provides privacy by representing values in encrypted form, ensuring that sensitive user data is never exposed on-chain. A secure value may enter the system in two ways: either the user encrypts their input locally using the Bubble SDK before submitting it to the contract, or the value is generated internally by the MPC network as the output of a private computation. In both cases, the blockchain never sees the plaintext.
The encrypted value in the contract is actually a handle, an opaque reference pointing to encrypted data stored and managed off-chain by the MPC network. This allows user data to remain private even while being actively used inside smart contract logic.
Once data is represented in the encrypted form, the contract can perform privacy-preserving computations using MPC-powered operations such as arithmetic, comparisons, logical checks, and conditional selection (mux). These operations execute securely in the MPC network and return new encrypted handles, enabling multi-step computation without revealing intermediate results. The contract continues to process these encrypted values just like normal state variables, but without ever learning the underlying data. Only when a public result is intentionally required, for example, to emit an event, finalize a settlement, or enforce an access rule, does the contract request a controlled decryption, which is validated and returned via callback. This model preserves confidentiality while still enabling expressive, stateful smart contract behavior over private data.
The upcoming pages describe the various encrypted types, along with instructions for their creation and application.