mirror of
https://github.com/luxfhe/fhevm.git
synced 2026-10-30 18:13:08 +00:00
main
Built on github.com/luxfi/tfhe and lux/evm precompiles. NO Zama fhevm code. NO third-party FHE dependencies. © 2020-2025 Lux Industries Inc.
LuxFHE VM
Confidential Smart Contract Execution Environment
⚠️ Important IP Notice
This is Lux's independent fhEVM implementation:
- ✅ Built on
github.com/luxfi/tfhe(our Go TFHE library) - ✅ Uses
lux/evm/precompile/contracts/fhe/(our precompiles) - ✅ Threshold decryption via
lux/node/vms/kmsvm/(our KMS VM) - ✅ NO code derived from Zama fhevm, tfhe-rs, or any third-party FHE library
- ✅ Protected by Lux Industries patent portfolio (9 FHE patents pending)
Overview
LuxFHE VM enables fully confidential smart contracts on Lux Network. Contracts can operate on encrypted data without ever decrypting it, enabling:
- Private DeFi: Hidden balances, amounts, and transactions
- Confidential Voting: Secret ballots with verifiable tallies
- Private Identity: Zero-knowledge credential verification
- Encrypted AI: Inference on encrypted data
Architecture
┌─────────────────────────────────────────────────────────────────┐
│ LuxFHE VM Architecture │
├─────────────────────────────────────────────────────────────────┤
│ Application Layer │
│ ├── @luxfhe/sdk - JavaScript/TypeScript SDK │
│ ├── @luxfhe/solidity - Solidity contract library │
│ └── @luxfhe/hardhat - Development plugin │
├─────────────────────────────────────────────────────────────────┤
│ Smart Contract Layer │
│ ├── FHE.sol - High-level encrypted types │
│ ├── FheOS.sol - Precompile interface │
│ └── Tokens, Governance - Ready-to-use contracts │
├─────────────────────────────────────────────────────────────────┤
│ Precompile Layer (lux/evm/precompile/contracts/fhe/) │
│ ├── FheAdd (0x0080) - Encrypted addition │
│ ├── FheMul (0x0082) - Encrypted multiplication │
│ ├── FheDecrypt (0x00A0) - Threshold decryption request │
│ └── ... - Full FHE operation set │
├─────────────────────────────────────────────────────────────────┤
│ Crypto Layer (github.com/luxfi/tfhe) │
│ ├── Encryptor - Public key encryption │
│ ├── Evaluator - Homomorphic operations │
│ ├── Decryptor - Secret key decryption │
│ └── Built on github.com/luxfi/lattice │
├─────────────────────────────────────────────────────────────────┤
│ Key Management (lux/node/vms/kmsvm/) │
│ ├── Threshold Sharing - N-of-M key distribution │
│ ├── ML-KEM - Post-quantum key encapsulation │
│ └── Consensus Integration- Decryption via validator votes │
└─────────────────────────────────────────────────────────────────┘
Key Features
1. Native EVM Integration
FHE operations are available as precompiles, callable from any Solidity contract:
import "@luxfhe/solidity/FHE.sol";
contract ConfidentialTransfer {
mapping(address => euint256) private balances;
function transfer(address to, inEuint256 calldata encAmount) public {
euint256 amount = FHE.asEuint256(encAmount);
// All operations on encrypted data
ebool hasBalance = FHE.ge(balances[msg.sender], amount);
balances[msg.sender] = FHE.select(
hasBalance,
FHE.sub(balances[msg.sender], amount),
balances[msg.sender]
);
balances[to] = FHE.add(balances[to], amount);
}
}
2. Threshold Decryption
Decryption requires consensus among validators:
// Request decryption (async)
uint256 requestId = FHE.requestDecrypt(encryptedValue);
// Callback receives plaintext after threshold met
function onDecryptionResult(uint256 requestId, uint256 value) external {
// Process decrypted value
}
3. Permit System
Users control access to their encrypted data:
// Generate permit (signs EIP-712 message)
const permit = await fhe.generatePermit(contractAddress);
// Contract can now decrypt user's data
const balance = await fhe.decrypt.uint256(encBalance, permit);
Supported Operations
| Category | Operations |
|---|---|
| Arithmetic | add, sub, mul, div, rem, neg |
| Comparison | eq, ne, lt, le, gt, ge, min, max |
| Bitwise | and, or, xor, not, shl, shr, rotl, rotr |
| Control | select (encrypted ternary) |
| Random | randBool, randUint8, randUint32, ... |
| Decrypt | requestDecrypt (threshold) |
Performance
| Operation | Gas Cost | Latency |
|---|---|---|
| FHE Add | 50,000 | ~5ms |
| FHE Mul | 150,000 | ~15ms |
| FHE Compare | 30,000 | ~3ms |
| FHE Decrypt | 500,000 | ~500ms (threshold) |
Development
Local Setup
# Start local Lux network with FHE
lux network start --fhe
# Deploy FHE contract
npx hardhat run scripts/deploy.ts --network local
# Run tests
npx hardhat test
Hardhat Configuration
// hardhat.config.ts
import "@luxfhe/hardhat";
export default {
solidity: "0.8.24",
networks: {
luxTestnet: {
url: "https://api.testnet.lux.network",
chainId: 8888,
fhe: true, // Enable FHE support
},
},
};
Academic Foundation
Built on peer-reviewed research:
- Chillotti et al. (2020) - TFHE scheme
- Ducas & Micciancio (2015) - FHEW bootstrapping
- Original innovations protected by 9 patent applications
License
Lux Research License with Patent Reservation
- ✅ Free for research and academic use
- ✅ Free on Lux Network (mainnet/testnet)
- 📧 Commercial license required for other networks
Contact: [email protected]
Related Repositories
| Repository | Description |
|---|---|
| luxfi/tfhe | Go TFHE library |
| luxfi/lattice | Lattice cryptography |
| luxfi/standard | Smart contracts |
| luxfi/node | Lux node with FHE precompiles |
© 2020-2025 Lux Industries Inc. All rights reserved.