Micha Roon
Micha Roon

Reputation: 4009

how to get or verify the source code of a contract?

It is trivial to find a contract on Ethereum. and once found, it is easy to use. But how do I find out what the contract really does? How can I verify what code will be executed?

Upvotes: 3

Views: 1928

Answers (1)

fivedogit
fivedogit

Reputation: 8534

In order to verify that a piece of source code matches what you see on the blockchain, you need to know the version of the compiler used to create the contract.

  1. Get the source code.
  2. Compile it using the correct compiler (publisher should specify).
  3. Compare result to data on blockchain.

Note: Get blockchain data like so:

web3.eth.getCode('0xabcd1234....');

Upvotes: 5

Related Questions