We’re rewarding the question askers & reputations are being recalculated! Read more.
15

I'll leave the precise interpretation of the OpCodes to someone else and just point out that they are different instructions so different implementations are to be expected. According to this: http://solidity.readthedocs.io/en/develop/control-structures.html#error-handling-assert-require-revert-and-exceptions Starting with Metropolis, revert; will return ...


13

The Solidity compiler appends the metadata file hash at the end of the bytecode http://solidity.readthedocs.io/en/develop/metadata.html Metadata file is a json file that contains hashes of source files so changing comments changes the metadata file hash.


11

Mainly due to optimizations carried out when the source code is compiled it's not feasible to get the source code from the bytecode/opcode itself. Refer this question. Compilation back to the original source code is impossible because all variable names, type names and even function names are removed. It might be technically possible to arrive at some ...


10

Runtime bytecode is what's actually stored at the contract address. It doesn't include the constructor function or initialization code (which the bytecode does). https://www.reddit.com/r/ethereum/comments/3pq08g/some_quick_things_about_verifying_contracts/cw8qn0d/


10

It's the job of the compiler to produce the correct EVM bytecode so that as you say the MethodID "piece of data will end up jumping to the appropriate address for that function in the bytecode of the contract". Since the MethodID is only 4 bytes, hash collisions (between 2 different functions) are possible. The Solidity compiler gives an error in that case ...


8

Go to Remix and paste your code there. In the "Compile" tab, select the contract you want and click on "Details" and you can copy ABI, Bytecode, etc... That being said, I find it way easier to deploy your contracts straight from Remix with Metamask. Make sure you are connected to the right network/account in Metamask, then go to the "Run" tab, make sure the ...


8

What you've got in bytecode here is the contract's constructor / construction bytecode. When you create a contract, the constructor runs, handles any initial arguments or statements you make, and also "creates" the code of the contract. The way this is done is through a return statement. The deployed contract code will be whatever the constructor returns. ...


7

You don't need the source code, but in your contract creation transaction, you need to specify the initialization code: bytecode that returns the bytecode that you want deployed. For example, if you wanted to deploy a contract with code 0x60606040, you can't just set the data field of your transaction to 0x60606040: your data field needs to be bytecode that ...


7

No, as there is no difference in the output of the bytecode from the simple contract Test {} plugged into Browser-solidity when using different recent versions of the Solidity compiler. There is some information on how http://etherchain.org checks the contract source code against the contract bytecode at How can I verify that a contract on the blockchain ...


5

The revert is often referred to as cheap throw as it refunds unused gas to the sender. If you are interested in the detailed design of this feature please look at the original EIP-140 discussion.


5

This was already answered in the comments to your own previous question To summarize: The transaction that created the contract is visible on Etherscan (example here) The input data to that transaction, which is mostly the compiled bytecode of the contract itself, also contains the constructor parameter values in the last bytes (32 bytes per parameter) ...


5

6 bytes (code: 6 bytes, payload: 0 bytes); 3 distinct opcodes. Same idea just 2 gas cheaper than previous 6-byter. Bytecode: Assembly: Works as follows: Sample transaction: on etherscan Gas used to deploy: 54622.


5

I wrote an article that goes over this information in depth. I will summarize it here. tl;dr - There are only two types of bytecode on Ethereum but five different names to describe them. Creation Bytecode This is the code that most people are referring to when they say bytecode. This is the code that generates the runtime bytecode—it includes constructor ...


4

Truffle and Ganache seem to be an excellent combo: Ganache is a standalone, in-memory node, designed for development. It can auto-mine, meaning it immediately creates and mine a block each time a transaction is submitted. This make smart contract deployment and invocation almost synchronous. Truffle comes with a command line tool and console with web3 built-...


4

Answering my own question: This is the free memory pointer. The first 0x40 bytes are reserved for internal calculations. Then 0x40 - 0x60 (one word) stores a pointer to free memory (available for allocations) - which is in this case obviously is 0x60. So this code: PUSH1 0x60 PUSH1 0x40 MSTORE Initializes memory pointer. Details: https://solidity....


4

The contract prologue instructions changed to provide an additional slot at 0x60, which should always hold the value 0. The documentation states that: The zero slot is used as initial value for dynamic memory arrays and should never be written to (the free memory pointer points to 0x80 initially). FYI I checked several contracts with JEB Decompiler, ...


3

Since Noel got close, time to release my 6-byter: Bytecode: Works as follows:


3

You could try emailing the authors of the publication and authors of the code. The publication contains the contact details for the author of the code and paper. Email: brokendragon@uestc.edu.cn, {csxqli,csxluo}@comp.polyu.edu.hk, johnsonzxs@uestc.edu.cn Most likely they have not published it anywhere publicly yet. When you get a response from them, do ...


3

There's a difference between the "Contract Creation Code" (which includes the constructor at the front) and the deployed bytecode. The "Bytecodes view" is showing you the full contract creation code with the constructor at the front; the "Opcodes view" is showing you only the actual deployed contract code. The constructor is only run once at contract ...


3

The ABI gives you a list of all members functions and events in the contract (parameter types, parameter names, return types, etc.). You can revert these members, but this is useless, as you already have all their details in the ABI. You won't be able to revert the implementation of these members, however.


3

It looks like they actually follow a concept of "Universes", and each universe is an instance of the following: contract Delegator is DelegationTarget { function Delegator(IController _controller, bytes32 _controllerLookupName) public { controller = _controller; controllerLookupName = _controllerLookupName; } function() external ...


3

The source code is indeed missing as etherscan cannot link it easily. If you switch to OPCODE View, you're going to find the following: PUSH20 0x273930d21e01ee25e4c219b63259d214872220a2 PUSH2 0x235a GAS SUB CALLCODE Judging by the time the contract was deployed and the code it's using ( CALLCODE ) we can determine that it's actually delegating it's ...


3

Sure. To deploy smart contract one needs to publish a transaction with empty to address and with data containing contract initialization code concatenated with values of constructor parameters. Initialization code usually consists of constructor byte code and contract's byte code to be deployed. So, deployed byte code does not contain constructor and ...


3

That's because they are not the same thing. When you execute the getCode(...) function, you get the deployed bytecode of a specific address, as the docs says. The bytecode on the blockchain is the result of the execution of the compiled bytecode of your contract, which includes initialization code. About the contract you provide, which is verified: await ...


2

No, this does not hold for the EVM. A simple counterexample is a recursive function: function f(int a) { f(a); } That would get compiled to: tag 5 JUMPDEST ; method entry PUSH [tag] 7 ; push return address DUP2 ; push argument `a` PUSH [tag] 5 ; push method address JUMP [in] ; call method tag 7 ...


2

EVM is quite similar to JVM in terms of execution model. Both are stack machines executing bytecodes. EVM adds a concept of storage and its bytecode instructions are more suited for contract development. The most comprehensive description of EVM is Ethereum yellow paper: https://ethereum.github.io/yellowpaper/paper.pdf - see point H.2 for instruction set. ...


2

While the EVM does have some flaws (for example, not being able to poll sites outside the blockchain), it is a fine piece of engineering in that it can accurately tabulate memory usage in form of decreasing gas, is extremely efficient in how it uses memory (although it still cant really do much), and most importantly, it is entirely deterministic (meaning ...


2

I have found two methods for doing this: The data in a contract can be iterated through using eth_getstorageat at 0x0, 0x1 etc. You can use the abi to find which variables are stored at each index. Public variables are automatically assigned a getter function. This can be called with eth_call to return the value stored in that variable.


2

Use debug.traceTransaction(...). Example from Mainnet: > debug.traceTransaction("0xe7cdf3ddebd6b1f3c21b26346da52901b6035b39bdfb58de49491b47a92808a7") { gas: 30981, returnValue: "", structLogs: [{ depth: 1, error: null, gas: 13725, gasCost: 3, memory: null, op: "PUSH1", pc: 0, stack: [], ...


2

For whom it may interests, I used the build-in EVM of the Go-Ethereum implementation (Geth). For that I wrote my application in go and mainly used "github.com/ethereum/go-ethereum/core/vm/runtime" and github.com/ethereum/go-ethereum/core/vm" as imports. To generate a EVM-instance I used *runtime.Config and *vm.EVM. Then I used a modified version of the ...


Only top voted, non community-wiki answers of a minimum length are eligible