Adventures in Fully Homomorphic Encryption: Ethereum flavor

A deep dive into the current state of FHE with Zama’s Concrete library and the challenges of implementing secp256k1 signatures for Ethereum transactions

Johannes Pfeffer
Corpus
2 min readMay 5, 2023

--

Imagine being able to perform computations on encrypted data without ever needing to decrypt it. This is the power of fully homomorphic encryption (FHE), a cryptographic technique that will revolutionize data privacy across various applications.

Intrigued by this potential, I dove into the world of FHE using a Python library called Concrete, developed by ZAMA, a company at the forefront of FHE technology. My mission was to complete a bounty from ZAMA’s bounty program by implementing secp256k1 signatures for Ethereum transactions within 1 week.

FHE: calculations on encrypted inputs producing encrypted outputs

Technical takeaways

FHE offers exciting possibilities, but it also comes with significant challenges. I experienced the following technical hurdles during my experiment:

  1. Performance overhead: FHE operations can be A LOT slower than their non-encrypted counterparts. I implemented addition for big integers and adding two 256bit numbers took 3 minutes on my machine.
  2. Accuracy trade-offs: You can improve performance by sacrificing accuracy, but this increases the likelihood of incorrect results.
  3. Control-flow limitations: You can’t perform comparisons or use conditions on encrypted numbers (e.g. if statements), which can lead to inefficient algorithms.
  4. Working with big numbers: Concrete struggles with numbers beyond 20-something bits, making the implementation of secp256k1 signatures challenging.

Despite these obstacles, FHE has enormous potential, especially if native big number calculations arrive and specialized hardware developed to optimize FHE circuits becomes available.

A Glimpse into the Future: Signing Ethereum Transactions with FHE

One potential application of FHE is securely signing Ethereum transactions. If secp256k1 signatures become possible, you could sign a transaction using an encrypted private key, as illustrated in this pseudocode:

def signTx(int clearTxHash, int encryptedPrivateKey) -> int encTxSignature:
...
return encTxSignature

This could enable products like a “ledger in the cloud,” allowing users to sign transactions without revealing their private keys. However, the power of signing transactions would now shift to the key that decrypts the encrypted and signed transaction, introducing new security considerations.

During my FHE experiment, I attempted to implement secp256k1 signatures for Ethereum transactions, which you can explore in my GitHub repository: https://github.com/jo-tud/FHE_scp251k1. A week was not enough. Although incomplete, my work demonstrates that there is a path for FHE into blockchain applications on Ethereum specifically.

Conclusion

The journey into FHE was an eye-opening experience that revealed the current limitations and the tremendous potential of this technology. As FHE continues to advance, we can expect to see a broader range of applications in various industries, including blockchain. For now, I’ve decided to pause my FHE exploration, but I eagerly anticipate the innovations this fascinating area of research will bring in the future.

--

--