16

TL;DR bin-runtime is the code that is actually placed on the blockchain. The regular bin output is the code placed on the blockchain plus the code needed to get this code placed on the blockchain, the code of the constructor. Longer answer The basics of the Ethereum Virtual Machine is defined in Section 9.1 of the Ethereum Yellow Paper. To answer this ...


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

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 ...


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

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 ...


11

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

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 ...


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.


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, ...


4

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 ...


4

Unfortunately, you cannot store the deploying contract's bytecode as a variable in the contract directly, as that creates a circular reference. From the docs: This property can not be accessed in the contract itself or any derived contract. It causes the bytecode to be included in the bytecode of the call site and thus circular references like that are ...


4

Surely, you may do this. Here are high-level steps: To the end of your bytecode append a few additional opcodes that copy stack and storage content into memory and return them together with memory content. Prepend you bytecode with a simple constructor that will just deploy your bytecode as a contract. Deploy modified bytecode and obtain deployed smart ...


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

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


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

According to the docs, you can use this method: web3.eth.getCode(addressHexString [, defaultBlock] [, callback]) Where addressHexString is the address your contract was deployed at.


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

Compiler does not have to put function body into contract bytecode as a consequent range. Actually, optimizing compiler could decide to inline small functions used only in few places, i.e. copy their bytecode into every place the function is actually used. However, I believe, current versions of Solidity does not do this. The body of the unction usually ...


3

In remix you have selected ApproveAndCallFallBack as your selected contract. You need to select NicePointsToken as your contract. See my image attachment to know where to find the contractdropdown.


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