15

How can I retrieve the solidity code of an already published contract in the mist wallet?

19

There is no general solution for this because the solidity code is not published on the blockchain. On the blockchain only the resulting byte code is published. There are different block explorers like ether.camp that offer the option to upload the solidity code. They can use the solidity code to verify that it indeed matches with the byte code on the address.

There is one project that aims to do this automatically by scraping github repositories for source code that fits to published byte code.

  • 1
    It seems to me that "contract" is really a misnomer if the Solidity code is not known to the person calling its functions. If a party creates a real contract, which defines the terms of an agreement, and then asks another party to sign it without showing what the terms are, I think they would be shown the door, laughing all the way. So how can a piece of code be called a "contract" if only one of the signatories knows its contents? – Ajoy Bhatia Feb 13 '18 at 18:52
  • I think your example though tells you exactly why it can be called a contract. You wouldn't sign a contract without reading it, as you mentioned. In this case, you can see the byte code on the blockchain, but not the source code. However, you can easily ask the other party for the source code, and verify that the byte code matches the source code you were given before you make any commitments to it. – Michael Martin Apr 28 at 16:45
1

See source at https://github.com/comaeio/porosity It does exactly what you need.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.