solidity-smart-contract-verifier
TypeScript icon, indicating that this package has built-in type declarations

1.0.1 • Public • Published

Smart Contract Verifier

Tests Documentation npm version

Smart contract verification library.

Makes it possible to verify some contract code against a deployed contract address.

Originally inspired by Shawn's article: Verify Ethereum Contracts Using Web3.js and Solc

Usage example

const { compileExtractCompare } = require("smart-contract-verifier");
const Web3 = require("web3");
const web3 = new Web3(
  new Web3.providers.HttpProvider(process.env.RPC_PROVIDER)
);
const solcVersion = "v0.4.16+commit.d7661dd9";
const contractName = "LinkToken";
const contractFilename = "LinkToken.sol";
const contractAddress = "0x514910771AF9Ca656af840dff83E8264EcF986CA";
// assuming the LinkToken.sol file is on the file system
const contractPath = "./" + contractFilename;
const sources = { [contractFilename]: fs.readFileSync(contractPath, "utf8") };
compileExtractCompare(
  web3,
  sources,
  solcVersion,
  contractName,
  contractFilename,
  contractAddress
).then((matching) => console.log(matching));

Package Sidebar

Install

npm i solidity-smart-contract-verifier

Weekly Downloads

0

Version

1.0.1

License

MIT

Unpacked Size

9.01 kB

Total Files

5

Last publish

Collaborators

  • nguyenquangthang