Confidential ERC-20
ERC-20-compatible token whose balances and transfer amounts are FHE ciphertexts, with sufficiency checked homomorphically and decryption available only to the holder
Abstract
This LP defines an ERC-20-compatible token where balances and transfer amounts are encrypted under the FHE runtime (LP-4650). The contract stores euint64 encrypted balances. Transfers operate on ciphertexts — the contract verifies the sender has sufficient balance via homomorphic comparison without ever seeing the plaintext values. Only the token holder can decrypt their own balance.
Motivation
Every payroll, treasury movement, and supplier payment made in a public ERC-20 is legible to competitors in real time. Encrypting the balance rather than hiding the transfer keeps the token an ordinary ERC-20 — same interface, same integrations — while removing the amounts from public view. The holder keeps a decryption path to their own balance, and can grant one to a regulator, without making it public.
Specification
Storage
mapping(address => euint64) private encBalances;
euint64 private encTotalSupply;
All balances are encrypted under the global FHE public key. The contract never stores or processes plaintext amounts.
Transfer
function transfer(address to, einput encryptedAmount, bytes calldata inputProof) external;
- Caller submits an encrypted amount with a ZK proof that the ciphertext encrypts a valid uint64.
- Contract computes:
ebool sufficient = FHE.le(encryptedAmount, encBalances[msg.sender]). - Contract computes:
encBalances[msg.sender] = FHE.sub(encBalances[msg.sender], encryptedAmount). - Contract computes:
encBalances[to] = FHE.add(encBalances[to], encryptedAmount). - If
sufficientis false, the subtraction underflows and the transaction reverts.
Balance Query
Only the balance owner can decrypt:
function balanceOf(address owner) external returns (euint64);
function decryptBalance() external; // triggers threshold decryption callback to msg.sender
Third parties see only ciphertexts. Threshold decryption delivers the plaintext only to the requesting address via an encrypted callback channel.
Compliance Integration
For regulated tokens, the compliance registry can be granted a decryption permission by the token holder, enabling KYC-gated balance visibility without making balances public. Pool-level enforcement of transfer restrictions is LP-9030.
Rationale
Sufficiency is enforced by underflow rather than by branching on sufficient, because a branch taken on encrypted data would have to reveal which way it went. Letting the homomorphic subtraction fail keeps the failure signal at transaction granularity — the transaction reverted — which discloses only what the sender already knew.
Security Considerations
- Transfer amounts are never visible on-chain. Only ciphertexts appear in transaction data.
- The input proof prevents submitting malformed ciphertexts (e.g., encrypting a negative number).
- Metadata leakage: sender, receiver, and timing are still visible. Where the parties must also be hidden, combine with the shielded pool (LP-9404) or private execution on Z-Chain (LP-8000).
- Gas costs are higher than plaintext ERC-20 (approximately 10x for transfers due to FHE operations).
Reference
| Resource | Location |
|---|---|
| ConfidentialERC20 contract | github.com/luxfi/standard/contracts/privacy/ConfidentialERC20.sol |
| FHE precompile | github.com/luxfi/evm/precompile/contracts/fhe.go |
Related LPs
- LP-4650 — FHE runtime, parameter sets, and threshold decryption
- LP-8200 — encrypted EVM execution
- LP-9401 — lending over confidential balances
- LP-9404 — the commitment-based privacy model
Copyright
Copyright (C) 2025-2026, Lux Industries Inc. All rights reserved.
Licensed under the MIT License.