*Operating System

FHE State OS*

"Privacy is necessary for an open society in the electronic age."

TRUSTED BY LEADING NETWORK STATES LIKE PRAXIS & VITALIA
TRUSTED BY LEADING NETWORK STATES LIKE PRAXIS & VITALIA
TRUSTED BY LEADING NETWORK STATES LIKE PRAXIS & VITALIA
TRUSTED BY LEADING NETWORK STATES LIKE PRAXIS & VITALIA

Introducing the FHE State OS

Running a fully-fledged community onchain requires strong confidentiality to preserve democracy. This is why Fully Homomorphic Encryption (FHE) has the power to play a crucial role in the development of network states, and ultimately any government infrastructure running on the blockchain.

Get started

Why Network States Need Confidentiality

Zama Concrete ML enables the handling of sensitive data in a secure manner, so data scientists can leverage the power of Machine Learning for new use cases where the data needs to be protected.

What is a network state?
Why confidentiality is needed for a network state?
Why is FHE the perfect solution for network states?

The Building Blocks of a Network State

Discover the essential components of a network state and how Fully Homomorphic Encryption can help ensure privacy and trust at every layer.Democracy and Governance

Democracy and Governance
Identity and Property Management
Financial and Economix System

Build Your First Confidential dApp
With These Step-By-Step Demos

Ease of use for data-scientists Use familiar APIs from scikit-learn
and PyTorch to automatically convert machine learning models into their FHE equivalent.  

Confidential ERC-20 Transfer

A variation of the standard ERC-20 smart contract incorporates encrypted balances, providing additional privacy for token holders.

contract EncryptedERC20{
    // ...
    function transfer(address to, einput encryptedAmount, bytes calldata inputProof) public {
        ebool canTransfer = TFHE.le(amount, _balances[msg.sender]); // Ensure owner has enough tokens
        euint64 transferValue = TFHE.select(isTransferable, amount, TFHE.asEuint64(0));
        euint64 newBalanceTo = TFHE.add(_balances[to], transferValue); // Add to the balance of `to`
        _balances[to] = newBalanceTo;
        TFHE.allowThis(newBalanceTo);
        TFHE.allow(newBalanceTo, to);
        euint64 newBalanceFrom = TFHE.sub(_balances[from], transferValue); // Subtract to the balance of `for`
        _balances[from] = newBalanceFrom;
        TFHE.allowThis(newBalanceFrom);
        TFHE.allow(newBalanceFrom, from);
    }
}
# Example for Tree-based Models
from concrete.ml.sklearn import XGBClassifier

model = XGBClassifier(n_bits=8)
model.fit(X_train, y_train)
model.predict(X_test)
model.compile(X_train)
model.predict(Xtest, fhe="simulate")
model.predict(X_test, fhe="execute")

# Example for Linear Models
from concrete.ml.sklearn import LogisticRegression

model = LogisticRegression(n_bits=12)
model.fit(X_train, y_train)
model.predict(X_test)
model.compile(X_train)
model.predict(X_test, fhe="simulate")
model.predict(X_test, fhe="execute")

Confidential Voting System

DAO smart contract that faciliates governance deicsions through encrypted voting.

Confidential Decentralized Identity System

A blockchain-based identity management system using smart contracts to store and manage encrypted personal data.

contract DID is Ownable {
    struct Identity {
        euint128 id; // Encrypted unique ID
        ebytes64 name; // Encrypted name
        euint64 birthdate; // Encrypted birthdate for age verification
    }
    mapping(address user => Identity) private citizenIdentities;
    // ...

    /// @dev Owner is able to add new identity for a specific user addres
    function registerIdentity(
        address user, einput name_, einput birthdate_, bytes calldata inputProof
    ) public onlyOwner {
        euint64 newId = TFHE.randEuint128(); // Generate a new encrypted random unique ID
        citizenIdentities[user] = Identity({
            id: newId,
            name: TFHE.asEbytes64(name_, inputProof),
            birthdate: TFHE.asEuint64(birthdate_, inputProof)
        });
        /// @dev Allow the user to access their own data
        TFHE.allow(citizenIdentities[user].id, addressToBeAllowed);
        TFHE.allow(citizenIdentities[user].name, addressToBeAllowed);
        TFHE.allow(citizenIdentities[user].birthdate, addressToBeAllowed);

        /// @dev Allow the contract to access the data
        TFHE.allowThis(citizenIdentities[user].id);
        TFHE.allowThis(citizenIdentities[user].name);
        TFHE.allowThis(citizenIdentities[user].birthdate);
    }

    /// @dev Grants claim contract access to encrypted birth date
    function generateAgeClaim(address claimAddress, string memory claimFn) public {
        TFHE.allowTransient(citizenIdentities[msg.sender].birthdate, claimAddress);
        (bool success, bytes memory data) = claimAddress.call(abi.encodeWithSignature(claimFn, msg.sender));
        if (!success) revert ClaimGenerationFailed(data);
    }

    function getBirthdate(address user) public view returns (euint64) {
        return citizenIdentities[user].birthdate;
    }
}

contract EmployerClaim {
  mapping(address user => ebool isAdult) private adultClaims;
  // ...

  /// @dev Generates an encrypted claim verifying if a user is above 18 years old
  function generateAdultClaim(address user) public {
      if (msg.sender != address(didContract)) revert NotAuthorized();
      euint64 birthdate = didContract.getBirthdate(user); // Retrieve user's encrypted birthdate from the DID contract
      ebool isAdult = TFHE.le(birthdate, _AGE_THRESHOLD); // Check if user is adult
      adultClaims[user] = isAdult; // Store claim result
      TFHE.allowThis(isAdult);
      TFHE.allow(isAdult, user);
  }
}