Why does Ethereum store bytecode on the blockchain and not the sourcecode, what's the tradeoff?
As far as I know sourcecode does not need as much storage.
Ethereum Stack Exchange is a question and answer site for users of Ethereum, the decentralized application platform and smart contract enabled blockchain. It only takes a minute to sign up.
Sign up to join this communityWhy does Ethereum store bytecode on the blockchain and not the sourcecode, what's the tradeoff?
As far as I know sourcecode does not need as much storage.
Source code is for humans to read and write. Bytecode is for machines.
From Wikipedia:
In computing, source code is any collection of computer instructions, possibly with comments, written using a human-readable programming language, usually as plain text. ... The source code is often transformed by an assembler or compiler into binary machine code understood by the computer. The machine code might then be stored for execution at a later time.
That's exactly what's going on here.
Also consider that different versions of the Solidity compiler output different bytecode. It's easy to specify exactly what each piece of bytecode should do, but would be very hard to incorporate a human readable language into the EVM.