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

Foundry Setupbash
# 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.sol

Quick 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).

TypeEquivalentDescriptionExternal Input
eboolboolEncrypted booleanexternalEbool
euint8uint8Encrypted 8-bit unsigned integerexternalEuint8
euint16uint16Encrypted 16-bit unsigned integerexternalEuint16
euint32uint32Encrypted 32-bit unsigned integerexternalEuint32
euint64uint64Encrypted 64-bit unsigned integerexternalEuint64
euint128uint128Encrypted 128-bit unsigned integerexternalEuint128
euint256uint256Encrypted 256-bit unsigned integerexternalEuint256
eaddressaddressEncrypted Ethereum addressexternalEaddress

Browse Source Code

Explore the complete @maze/solidity library

Files

Select a file to view source

Network Configurations

Available deployment targets for MAZE contracts

Production

MazeEthereumConfig

Ethereum Mainnet

Active

MazeSepoliaConfig

Sepolia Testnet

Development

MazeLocalConfig

Hardhat / Anvil