Back to Fhevm

KMSGeneration contract

gateway-contracts/docs/getting-started/contracts/kms_generation.md

0.12.31.5 KB
Original Source

KMSGeneration contract

This section describes the KMSGeneration contract. It is used to orchestrate public KMS-related materials for the fhevm Gateway protocol. More information about can be found in the KMS documentation.

The contract is used to:

All non-view functions are restricted to either the owner of the contract or the KMS nodes' transaction senders.

Public material generation

The KMSGeneration contract is used to generate different public materials needed by the fhevm protocol.

Generate FHE keys

A new public key is generated by the KMS with privately shared key shares for FHE keys. The private key shares are used by the KMS to decrypt ciphertexts. The public key is used by the coprocessors in order to be able to perform homomorphic operations on ciphertexts.

To trigger its generation, the owner needs to call the keygen function available in the KMSGeneration contract. A public FHE key is then identified by a unique keyId.

Generate CRSs

A powers-of-tau Common Reference String (CRS) is a correlated random material generated by the KMS in a secure manner that is required to construct certain ZKPoKs. In particular, it is used for proving knowledge of a plaintext encrypted under FHE keys.

To trigger its generation, the owner needs to call the crsgen function available in the KMSGeneration contract. A CRS is then identified by a unique crsId.