SDK Reference
@maze/solidity
The official Solidity library for building confidential smart contracts with Fully Homomorphic Encryption on EVM-compatible blockchains.
URL-Based Imports — No npm Required
The @maze/solidity library is served directly from mazedapp.org/maze-solidity. Import via URL in Remix or download locally for Foundry / Hardhat projects. No package registry needed.
Installation
Choose your development environment
# Add as a dependency via URL remapping
# In your foundry.toml:
[profile.default]
remappings = [
"@maze/solidity/=maze-solidity/"
]
# Then download the library:
mkdir -p maze-solidity
curl -sL https://mazedapp.org/maze-solidity/lib/FHE.sol -o maze-solidity/lib/FHE.sol
curl -sL https://mazedapp.org/maze-solidity/lib/MazeACL.sol -o maze-solidity/lib/MazeACL.sol
curl -sL https://mazedapp.org/maze-solidity/config/MazeConfig.sol -o maze-solidity/config/MazeConfig.solQuick Example
A minimal confidential contract
pragma solidity ^0.8.20;
import {FHE, euint32, externalEuint32} from "@maze/solidity/lib/FHE.sol";
import {MazeEthereumConfig} from "@maze/solidity/config/MazeConfig.sol";
contract SecretCounter is MazeEthereumConfig {
euint32 private _count;
function increment(
externalEuint32 calldata input,
bytes calldata proof
) external {
euint32 value = FHE.fromExternal(input, proof);
_count = FHE.add(_count, value);
FHE.allowThis(_count);
FHE.allow(_count, msg.sender);
}
function getCount() external view returns (euint32) {
return _count;
}
}lib/FHE.sol
Core library with all encrypted types, arithmetic, comparison, bitwise, conditional operations, and access control.
config/MazeConfig.sol
Network configuration contracts with Gateway, ACL, and KMS addresses for Mainnet, Sepolia, and local dev.
Reference Contracts
Production-ready examples: EncryptedERC20 (confidential tokens) and EncryptedBallot (confidential voting).
| Type | Equivalent | Description | External Input |
|---|---|---|---|
ebool | bool | Encrypted boolean | externalEbool |
euint8 | uint8 | Encrypted 8-bit unsigned integer | externalEuint8 |
euint16 | uint16 | Encrypted 16-bit unsigned integer | externalEuint16 |
euint32 | uint32 | Encrypted 32-bit unsigned integer | externalEuint32 |
euint64 | uint64 | Encrypted 64-bit unsigned integer | externalEuint64 |
euint128 | uint128 | Encrypted 128-bit unsigned integer | externalEuint128 |
euint256 | uint256 | Encrypted 256-bit unsigned integer | externalEuint256 |
eaddress | address | Encrypted Ethereum address | externalEaddress |
Browse Source Code
Explore the complete @maze/solidity library
Files
Select a file to view source
Network Configurations
Available deployment targets for MAZE contracts
MazeEthereumConfig
Ethereum Mainnet
MazeSepoliaConfig
Sepolia Testnet
MazeLocalConfig
Hardhat / Anvil