This project demonstrates how to use the @ethereum-sourcify/lib-sourcify library directly within a web browser. It leverages web-solc to dynamically fetch and execute the Solidity compiler (solc) in the browser.
It demonstrates two primary verification flows:
- Verification via JSON Input: Manually constructs the
SolidityJsonInputobject required by the compiler. - Verification via Metadata: Fetches a Solidity metadata file (
metadata.json) and uses it to drive the verification process.
In both cases:
- An implementation of
ISolidityCompilerfromlib-sourcifyis created usingfetchSolcfromweb-solc. Verificationobject fromlib-sourcifyis instantiated.- The
verification.verify()method is running the Sourcify verification flow in the browser.
- Install dependencies:
npm install
- Start the development server:
npm run dev