casper-node icon indicating copy to clipboard operation
casper-node copied to clipboard

Implement generic_hash() function to support hashing algorithms (ZKP)

Open devendran-m opened this issue 1 year ago • 0 comments
trafficstars

As a developer building Zero Knowledge (ZK) software on Casper Network, I need cryptographic utilities to be implemented as host functions to ensure that the execution cost of cryptographic operations is efficient and manageable.

Acceptance Criteria:

  • Implement a host function called generic_hash(input, type) that supports various hash algorithms.
  • Currently supported algorithms:
    • HashAlgoType::Blake2b - utilizes the existing Blake2b implementation.
    • HashAlgoType::Blake3b - introduces the Blake3 library.
  • Future support planned for additional algorithms such as sha256, keccak, and poseidon.
  • The host functions should significantly reduce the execution cost, which in the current state (without host functions) can be excessive (e.g., running Risc0 VM proof verification for a simple sum of squares costs more than 6000 CSPR).

Benefit:

This feature will enable more efficient execution of ZK cryptographic operations like proof verifications, enhancing the usability and scalability of Casper-based applications without incurring prohibitive transaction costs.

devendran-m avatar Sep 17 '24 17:09 devendran-m