FHE & encryption
How Fully Homomorphic Encryption protects balances and transfers.
Fully Homomorphic Encryption (FHE) is the piece of cryptography that lets Raycash keep balances and transfer amounts private while still running onchain. This page covers what FHE is, where we get it from, and how we use it.
What FHE is
Imagine you have two sealed envelopes, each with a number inside. FHE is the mathematical trick that lets someone who never opens the envelopes produce a third envelope containing the sum of those two numbers. They don't know what they added. The math works on the sealed values directly.
That property — "compute on data without seeing it" — is what makes a confidential stablecoin possible. A smart contract can check "is your balance big enough?", add, subtract, and update encrypted values, all without ever decrypting them.
Where we get it from — Zama
FHE is a deep cryptographic tool. We don't build it ourselves; we use Zama's FHEVM, a production-grade FHE scheme designed for the EVM. Zama provides:
- The cryptographic primitives (encryption, decryption, homomorphic arithmetic).
- EVM precompiles that run FHE operations efficiently onchain.
- A decryption oracle that releases values only when the right access-control conditions are met.
We're betting on Zama's construction being cryptographically sound, in the same way every HTTPS site bets on TLS being sound.
For the upstream picture, see the Zama FHEVM documentation.
How Raycash uses it
- Balances are stored as encrypted 64-bit integers. Each account's balance onchain is a ciphertext.
- Transfer amounts are encrypted on your device before they hit the chain.
- Arithmetic (add, subtract, compare) happens on the encrypted values through FHE precompiles. The result is itself encrypted.
- Access control determines who can decrypt a given value. You hold decryption authority over your own balance. Specific contracts can be granted decryption rights for specific operations (for example, the withdrawal finalizer needs to decrypt an amount to send cleartext tokens out).
The combination gives the privacy property we want: the chain enforces the rules (solvency, compliance), no third-party observer learns the numbers, and only authorized parties can ever see them in cleartext.
Where to dig deeper
- Zama FHEVM documentation — the primitives
- Protocol → Confidential ERC-20 — how ERC-7984 layers FHE onto a token
Was this page helpful?