ethereum / fe

Emerging smart contract language for the Ethereum blockchain.
https://fe-lang.org
Other
1.6k stars 179 forks source link

Add verify command to allow verifying deployed contracts against local source code #948

Closed cburgdorf closed 10 months ago

cburgdorf commented 10 months ago

What was wrong?

People need to be able to verify that a deployed contract matches the source code that the author claims was used to deploy it. Previously, there was no simple way to achieve this.

How was it fixed?

These are the steps to verify a contract with the verify command:

  1. Obtain the project's source code locally.
  2. Ensure it is the same source code that was used to deploy the contract. (e.g. check out a specific tag)
  3. From the project directory run fe verify <contract-address> <json-rpc-url>

Example:

$ fe verify 0xf0adbb9ed4135d1509ad039505bada942d18755f https://example-eth-mainnet-rpc.com
It's a match!✨

Onchain contract:
Address: 0xf0adbb9ed4135d1509ad039505bada942d18755f
Bytecode: 0x60008..76b90

Local contract:
Contract name: SimpleDAO
Source file: /home/work/ef/simple_dao/fe_contracts/simpledao/src/main.fe
Bytecode: 0x60008..76b90

Hint: Run with --verbose to see the contract's source code.

This builds on #947