HideMeToken stores balances as euint64 FHE ciphertexts. When you transfer tokens, the amount moves through the EVM entirely encrypted — no observer can determine how much was sent by reading on-chain state or events.
HideMe supports two transfer modes depending on your integration environment:
Client-side FHE
You encrypt the amount in the browser using Zama’s TFHE WASM library, then submit an encrypted handle and an input proof. The on-chain verifier checks the proof before processing the transfer.
On-chain Encryption
You pass a plaintext
uint64 amount. The EVM encrypts it via FHE.asEuint64() inside the contract. No browser WASM required.Transfer Functions
Client-side FHE transfer
encryptedAmount (the ciphertext handle) and inputProof using the Zama Relayer SDK.
On-chain encryption transfer
FHE.asEuint64(amount) to encrypt the value inside the EVM. The plaintext amount is visible in the calldata, but the resulting ciphertext stored on-chain is fully encrypted.
Encrypting an Amount Client-side
TheencryptAmount() TypeScript helper in fhevm.ts wraps the Zama Relayer SDK to produce the handle and proof you need for a client-side FHE transfer:
handle and inputProof directly to transfer():
How the FHE Transfer Works
Under the hood,_transfer() never decrypts any value. All arithmetic happens on ciphertexts:
Verify the encrypted input
FHE.fromExternal(encryptedAmount, inputProof) decodes the client-side ciphertext and verifies the zero-knowledge input proof against the on-chain InputVerifier contract.Check balance without leaking it
FHE.le(amount, balance) computes an encrypted boolean canTransfer — true if the sender has enough funds. This comparison never reveals the balance or the transfer amount.Select the actual transfer value
FHE.select(canTransfer, amount, FHE.asEuint64(0)) returns amount if canTransfer is true, otherwise 0. Insufficient balance transfers silently send nothing rather than reverting — preventing balance probing through revert analysis.Encrypted Allowances (approve / transferFrom)
You can grant a spender an encrypted allowance using the same client-side FHE pattern:transferFrom verifies both amount <= allowance and amount <= balance as encrypted booleans before executing, so neither the allowance nor the balance is ever revealed on-chain.
Contract-to-contract Transfers
When another smart contract holds aeuint64 balance handle (e.g., a router or wrapper contract), it can transfer using the overloaded transfer(address to, euint64 amount) variant:
amount handle via FHE.allow() before calling this function.