question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Feature req: Output contract metadata in build artifacts

See original GitHub issue

Overview

Recently I got my hands on a project that compiles contracts with brownie and wants to verify their contracts with Sourcify. Sourcify does full/perfect verification which leverages Solidity’s contract metadata and the hash of it appended at the end of the bytecode.

To be able to perfectly verify contracts, the contract metadata is needed and brownie doesn’t seem to output this information in the contract’s compilation artifacts.

Specification

To be able to verify, users need to provide the contract metadata alongside the source files. In brownie, I noticed the metadata is not output in the build/contracts/*.json files by default. In contrast, metadata is output by default in Truffle, and since v2.6.8 in Hardhat.

I also couldn’t find an option to modify the Standard JSON Input-Output of the compiler where it would be possible to output the metadata as such:

version: ...,
  optimizer: {...},
  outputSelection: {
    "*": {
      "*": [
        "abi",
        "evm.bytecode",
        "evm.deployedBytecode",
        "metadata", // <-- add this
        ...
      ]
    },
  },

Including a Truffle output file as a reference. Notice the metadata field: Resolver.json.txt

Also if the metadata file becomes available, it would be possible to develop a Sourcify verification plugin to easily verify contracts following the deployment of the contract.

cc: @fredo

Issue Analytics

  • State:open
  • Created a year ago
  • Reactions:1
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
Jeevan-Jcommented, Aug 25, 2022

@istankovic No. I am starting as a open source contributor and started working on porting Lens Protocol from Hardhat-TypeScript to Brownie-Python and was facing some issue with verification for few contracts.

Try using your compile contract’s get_verification_info to get standard json input.

For example:

Token.get_verification_info()
0reactions
marcocastignolicommented, Oct 26, 2022
Read more comments on GitHub >

github_iconTop Results From Across the Web

Generate Artifact — Remix - Ethereum IDE 1 documentation
It is used for linking a library address to the file. artifacts/<contractName_metadata>.json : contains the metadata from the output of Solidity compilation.
Read more >
Spring Cloud Contract Features
You can add metadata to your contract. Via the metadata you can pass in configuration to extensions. Below you can find an example...
Read more >
wighawag/hardhat-deploy - GitHub
The deploy scripts have only access to the artifact specified in the artifacts field. This allow project to share their deployment procedure. A...
Read more >
Pipeline artifacts - GitLab Docs
Pipeline artifacts are files created by GitLab after a pipeline finishes. Pipeline artifacts are different to job artifacts because they are not explicitly ......
Read more >
Fixing metadata with component metadata rules
The component metadata rules API is oriented at the features supported by Gradle Module Metadata and the dependencies API in build scripts.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found