HIP-867: Add Smart Contract Services Support for KZG Point Evaluation Precompiled Function
Author | Danno Ferrin |
---|---|
Working Group | Nana Essilfie-Conduah |
Requested By | EVM Developers |
Discussions-To | https://github.com/hashgraph/hedera-improvement-proposal/discussions/872 |
Status | Final ⓘ |
Needs Council Approval | Yes ⓘ |
Review period ends ⓘ | Wed, 06 Mar 2024 07:00:00 +0000 |
Type | Standards Track ⓘ |
Category | Core ⓘ |
Created | 2024-01-24 |
Updated | 2024-06-24 |
Release | 0.50.1 |
Table of Contents
Abstract
Add the Ethereum KZG Point Evaluation Precompile from EIP-4844: Shard Blob Transactions.
Motivation
One part of EIP-4844 is the KZG Point Evaluation function, a cryptographic precompile that can be used with zero knowledge proofs as well as proving that certain subsections of a blob are present without introducing the entire blob. This precompile adds value to the other parts of EIP-4844, but it does not require them. Hedera will expose support for this precompile without introducing other parts of the EIP.
Rationale
While Hedera will not be supporting most EIP-4844 features the KZG Point Evaluation Precompile is cleanly severable from the other integrated features. This precompile, when accompanied by the associated trusted setup, can be viewed as a cryptographic primitive similar to ECDSA. The ability to prove subsets of hashed data provides unique functionality not found in other cryptographic precompiles. Ethereum apps may use the KZG features without any interation with blob varying transactions, and it makes sense to allow Hedera Smart Contract apps the same latitude.
This precompile will be brought in with the same semantics and calling conventions as Ethereum Mainnet. It also requires a customizable data file known as the trusted setup. For maximum compatibility the same trusted setup from Ethereum Mainnet will be used.
User stories
- As a smart contract developer I want to use the EIP-4844 Point Evaluation Precompile in my smart contract applications.
Specification
There are no changes needed to Hedera Services and the JSON-RPC relay.
EVM Implementation
The KZG Point Evaluation precompile will be implemented as it is in EIP-4844.
The address for the precompile will be the same as Ethereum
Mainnet (0x000000000000000000000000000000000000000A
).
The point evaluation will use the same trusted setup as Ethereum Mainnet.
This is the same out-of-the-box setup provided by the Besu EVM library, there should be little to zero Hedera code needed to enable this.
Backwards Compatibility
The core EVM library shipping with Hedera as of version 0.46 already contains the needed EVM support. The activation will add a new Hedera EVM version that will activate all the Cancun support in one release. The precompile should automatically be part of the Besu EVM Library implementation.
Security Implications
It is expected the gas cost of the precompile will fall in line with compute usage during the execution. Performance tests will need to be executed to process that heavy use of the precompile matches this expectation.
How to Teach This
User documentation that discusses available precompiled contracts will need to be updated to reflect the presence of this precompile. Because this is a feature using cutting edge cryptography there should be no need for tutorials. References to Ethereum specifications may be useful, but it is expected users using this feature will already be familiar with the function.
Reference Implementation
The Besu EVM Library uses the Java bindings for c-kzg-4844.
Rejected Ideas
The only two ideas granted serious consideration were either full inclusion of the feature or full exclusion of the feature. The idea of doing our own trusted setup would (a) provide incompatibilities with developer tools, (b) be time-consuming or (c) lack credible neutrality.
The decision to include the precompile over exclusion is predicated on the anticipation that some zero knowledge systems will be able to use the precompile.
Open Issues
// none
References
- c-kgz-4844 reference implementation
- EIP-4844: Shard Blob Transactions
A collections of URLs used as references through the HIP.
Copyright/license
This document is licensed under the Apache License, Version 2.0 – see LICENSE or (https://www.apache.org/licenses/LICENSE-2.0)
Citation
Please cite this document as: