AlacrisIO / meta

Internal management of Legicash/Legilogic/Alacris
0 stars 0 forks source link

JS stdlib: Add a `verify` function that checks a contract address and ensures it is this contract #82

Open jeapostrophe opened 5 years ago

jeapostrophe commented 5 years ago

Cooperate with Swarm system

fare commented 5 years ago

What Swarm system?

Verifying an individual contract without a factory requires the compiler to provide not a single contract (unless the entire compiler is included in the JS frontend), but a contract template, so the frontend can fill in the template with the given parameters and compare to the the code used in the transaction. (Also, never forget to check that the receipt indeed says the transaction was successful.)

Following events emitted by a factory is what Ethereum makes easy. (With Bitcoin, nothing is easy.)

fare commented 5 years ago

As mentioned in #81:

Ah, apparently no need to decompile, as the solidity documentation at https://solidity.readthedocs.io/en/v0.5.3/contracts.html claims that there's a standard trivial encoding:

Internally, constructor arguments are passed ABI encoded after the code of the contract itself, but you do not have to care about this if you use web3.js.

Therefore the template is big code constant followed by an concatenation of the arguments each as a 32-byte chunk.

The element to communicate offline would be the txHash for the contract creation.