1

I am a newbie here, and I have a question (that might be trivial) concerning the definition of smart contracts. As far as I understand, people write these contracts in the form of EVM bytecode which is then posted to the blockchain and later executed by miners.

My doubt is: if my counterparty posts some bytecode for a contract that we previously agreed about, how am I supposed to verify that his code will actually perform the "right" actions, and he's not trying to cheat somehow? Should I learn to read bytecode in order to fully trust a contract?

I see that there are scripting languages (like Solidity) that allow you to write contracts in a readable way, but if I understood correctly those are all external to Ethereum, and are only there to help you write the final bytecode. So in the end it seems to me that people have no guarantee whatsoever that a given contract on the blockchain actually refers to a specific readable script/description. So how can they fully trust it?

Would it be feasible/reasonable to build a scripting language that is integrated to Ethereum, so that people can actually post a contract script instead of machine code? It wouldn't need to be a general purpose language, but just include few keywords allowing the definition of basic conditional payments that make up for most financial transactions.

I suspect this has already been discussed somewhere but I couldn't find it, so again sorry if I'm asking trivial stuff.

1

You're on the right track but it's little easier.

People write smart contracts usually in a higher-level language such as Solidity and then compile it into bytecode that the EVM understands.

If I want to earn your trust, I should present the source code in a form you can easily understand. I should also tell you the version of the compiler I used. You would then be able to compile it yourself and confirm that the bytecode matches, so you know the readable contract I gave you is actually the true contract.

Etherscan.io actually takes this idea further and makes a human-friendly way to 1) read the source code and 2) confirm that it represents the code actually running on the blockchain.

Disclosure. If you have to fight too hard to discover what's going on ...

Hope it helps.

  • 1
    Thanks for the answer. I get your point, but somehow it still seems a bit unnatural, from a user's perspective, that you have no idea what a contract does until you can come up with a "candidate" description to test your bytecode against. Though I understand that must have been the optimal design with compactness and efficiency as main criteria. – splinter123 Aug 13 '17 at 22:04

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.