2

I want to make a contract, from a factory contract, that can't be replicated by contracts deployed by other addresses. The factory contract will be called by different addresses so signing a piece of data is not an option. Are there any other methods for making a contract unreproducible?

I am aware that it is possible to find the deployer of the contract but I would prefer if the contract itself could be made unique

Joe
  • 1,173
  • 1
  • 11
  • 31

2 Answers2

3

This is basically impossible.

A contract's code is the result of the execution of its init code (which is what you actually get from solc and then send.) Anyone can make an init code whose output is perfectly identical to any contract on the chain, and, lo, on execution that init code produces a clone. There's no way to stop this.

There may be other ways to do what you're looking for, but this particular method just can't be done.

Matthew Schmidt
  • 7,290
  • 1
  • 24
  • 35
  • If the contract was being deployed by a user account you could store the signed contract address in the contract. Would that not be unreproducible? – Joe Mar 09 '17 at 14:17
  • That would be unreproducible, although someone could make their own, signed by themselves. – Matthew Schmidt Mar 09 '17 at 17:56
0

It occurred to me that you could store the transaction number (nonce) of the contract factory in the generated contract. This nonce could then be used to generate an address using the method described here: https://ethereum.stackexchange.com/a/761, which can be compared with the address of the generated contract. If they are the same then the contract must have been generated by that factory contract.

Joe
  • 1,173
  • 1
  • 11
  • 31