[Deployment] Generating metadata hash from compiler metadata #784
-
Team or ProjectNo response EnvironmentMainnet L2 block numberNo response zkSolc Version1.3.19 zksync-ethers Versionna Minimal Reproducible Code or Repo LinkCommand to extract metadata:
Metadata schema:
Does this work on other EVMs? (If yes, please list at least 1 of them)NA Description of What Your Contract DoesNo response Additional DetailsBy default, it appears that zkSolc will append a How can this hash be generated using metadata in |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 3 replies
-
To generate the metadata hash from the compiler metadata in a Here’s how you can generate the hash:
The metadata you've extracted seems appropriate for generating the hash. Make sure that the JSON string used for hashing is correctly formatted and includes all relevant contract metadata as expected by the For more detailed guidance and troubleshooting, you might want to visit the ZKsync developers discussions on Github. Your feedback helps us serve you better. If this fully addresses your question, please give it a thumbs up. If it doesn't, please give it a thumbs down. This will inform the community and team so we can improve our support. |
Beta Was this translation helpful? Give feedback.
-
Hi @akroeger-circle 👋 ! You are correct that the I'm not entirely sure the exact shell code needed to replicate the generation of this Note that |
Beta Was this translation helpful? Give feedback.
Hi @akroeger-circle 👋 ! You are correct that the
metadata
field you've found contains the information needed for this hash. You can find thestruct Metadata
here in theera-compiler-solidity
Rust code to confirm: https://github.com/matter-labs/era-compiler-solidity/blob/a6bb196b2a0ac60aece76442924707137d37b858/era-compiler-solidity/src/project/contract/metadata.rs#L11I'm not entirely sure the exact shell code needed to replicate the generation of this
keccack256
has from the JSON/string form of the metadata, but here's the Rust version of converting the Metadata JSON into bytes and then into the hash: https://github.com/matter-labs/era-compiler-solidity/blob/a6bb196b2a0ac60aece7644292470…