possible to get the hash of contract's hex?

cslarsoncslarson Member Posts: 11
i have a "registry" contract that holds a list of contract addresses. i would like to find a way to validate the contracts that register themselves with my registry contract. my thought was that a hash of the calling contracts code might suffice for it's "type signature" and could be used to verify that it is a contract of a certain type. i see that solidity has a sha3 function. how would i access the calling contracts hex representation?

Comments

  • chrisethchriseth Member Posts: 170 ✭✭✭
    Are you interested in the actual code stored at that address? That is not yet possible, but could be easily implemented as a member of the address type.
  • cslarsoncslarson Member Posts: 11
    yes, that's right. i'm wondering if it would be useful (the hash of the code) to use when it calls another contract (like my registry contract) to prove to that contract that it is the right kind. the crowdfunding app i am working on creates a new contract for each campaign and then that contract registers itself with the registry contract. the dapp (client) finds campaigns by looping through the registry. this likely means that creating a campaign is more expensive in terms of gas, so i'm not entirely sure the tradeoff is worth it, but it's my current approach.
Sign In or Register to comment.