Questions tagged [opcode]

operation codes specify the instructions to be performed in machine languages

Filter by
Sorted by
Tagged with
1
vote
1answer
9 views

How do I send funds from a contract to an account using bytecode?

The instruction CREATE will send funds to a new account. Is there another instruction for sending funds to an account that already exists? Or I just have to use CREATE as if the account doesn't exist?
1
vote
1answer
43 views

Missing create2 opcode in ethereum yellow paper

In eip 1014 Vitalik added Create2 at opcode 0xf5 Adds a new opcode at 0xf5 But in ethereum yellow paper opcode i don't see opcode 0xf5 or any create2 opcode, it doesn't appear in https://www....
0
votes
0answers
16 views

Finding methods executing a transfer

How can we find all the function which executes a .transfer to transfer ether even by parsing the contract or going through opcodes? One can also put their views related to it. Thanks!
0
votes
0answers
18 views

What is the OP_CODE for getting another account (storage and/or code)?

I'm debugging solidity opcode by opcode. How do I tell when the compiler is referencing another smart contract through OpCode? I know that you can do this in Browser Solidity. However I would just ...
0
votes
1answer
165 views

CREATE / CREATE2 Verification

Where do I verify whether a contract has been created with CREATE or CREATE2, would I have to disassemble the contract and look for a CREATE2 opcode in the contract creation code?
0
votes
2answers
27 views

Are current ethereum opcodes prices in pyethereum updated?

I am not an expert in opcodes for Ethereum, but I am wondering if their prices here [https://github.com/ethereum/pyethereum/blob/develop/ethereum/opcodes.py] are updated as the latest version used by ...
0
votes
1answer
44 views

What is after RETURN opcode?

I compiled a simple smart contract with --bin option (vs --bin-runtime), and looked at the assembly code. I can see that at first, the "setup" code copy all the run-time code with CODECOPY to memory, ...
2
votes
1answer
407 views

CREATE opcode: what does it really do?

I am looking at the docs, but cannot really understand what CREATE opcode does. I can tell that CREATE does create a new smart contract from a memory chunk, pass the gas value to this new contract, ...
0
votes
1answer
42 views

Which `EVM` bytecode is actually used to “deposit” the transferred Ether?

A quick question. Which EVM opcode is actually used to "deposit" the transferred Ether into the contract? From the EVM opcode list, there are only two opcodes related to the fund transfer: balance and ...
1
vote
1answer
44 views

why use up all the gasLimit when use assembly and revert together?

try to call erc20 token's transferFrom() using assembly(to save some gas), code like this: pragma solidity ^0.4.24; contract TestAssemblyAndRevert { function test(address from, address to, ...
1
vote
0answers
25 views

Why JUMP opcode costs more than the rest

Looking here, most of the basic opcodes are 3 while JUMP is 8. Wondering why this is, why the 3x multiplier on this instruction.
0
votes
1answer
39 views

Gas displayed on “Remix”

Is Gas displayed on "Remix" at function execution the same as when executed on the main net? I'm using the Javascript VM as the environment.
2
votes
1answer
150 views

Where can I learn to read a flow of opcodes and learn how to debug transactions?

There are many tools and visualizers to use to read through a transaction, but where can I go to learn how to understand this? Fore example, that first link has a series of opcodes (and their ...
3
votes
2answers
184 views

EVM SIGNEXTEND Opcode explanation

I am trying to develop my own small EVM. That is a good way for me to learn more about the bytelevel. I hadn't had any problems with most of the instructions, but there are a few, which I just don't ...
1
vote
1answer
231 views

How to deploy contract with bytecode from etherscan?

For example, I want to deploy a contract to my local testnet. But I only have its opcode from etherscan. How to deploy the contract with just those runtime bytecode?
1
vote
1answer
66 views

Are OPCODEs for ETH and ETC different?

I deployed an exactly same contract to both ETH and ETC. And I could see the contract doesn't work correctly only on ETC. contract ContractA { ContractB public BB; // Common constructor (...
0
votes
1answer
137 views

Opcodes PUSH, DUP and SWAP?

I studied EVM implementations and the bytecode sequences used by them. I wondered that there are three opcodes which are recognized by the EVM but actually are invalid opcodes. B0 PUSH B1 DUP B2 ...
1
vote
1answer
288 views

callvalue opcode, for what?

someone know what the opcode CALLVALUE is for? I would like to understand it well. Have you an example on which I can easily understand it?
2
votes
1answer
365 views

how are conditional JUMPI opcodes valid?

I've been reading this example from https://github.com/comaeio/porosity/wiki/Ethereum-Internals And I am wondering how some of these JUMPI operations are valid: loc_00000000: 0x00000000 60 60 ...
2
votes
0answers
32 views

What do last few opcodes of a smart contract do? [duplicate]

I built a sample smart contract, then I looked at the opcodes, and always found similar opcodes at the end - for all samples I tried - like below. a1 log1 65 62 7a 7a 72 30 58 push6 627a7a723058 20 ...
2
votes
1answer
59 views

how are negative numbers stored within the EVM stack?

for example, I have these opcodes: PUSH60 PUSH40 SUB for sub operations, I believe that the second stack item is subtracted from the first stack item (60 - 40) which would equal to -20 being the new ...
1
vote
0answers
33 views

Code scope in evm

Short question, how is code scope defined/determined by the compiler when looking at EVM opcodes (or rather bitcode)? Is it simply by looking out for jump calls or return statements? Or does it define ...
2
votes
2answers
171 views

CALL instruction push GAS to stack?

According to https://ethervm.io, when CALL instruction is executed, the stack layout like this: [address, value, argOffset, argLen, retOffset, retLen] So CALL would pop 6 words from stack bottom to ...
3
votes
2answers
156 views

Ethereum opcode: meaning of first few instructions?

Looking at the opcode level, the first few instructions of any smart contracts start with this: push1 80 push1 40 mstore I understand that this saves 0x80 to address 0x40, but what is this all for? ...
3
votes
2answers
429 views

How to separate functions in evm bytecode?

I want to build the control-flow-graph (CFG) from the bytecode of a smart-contract (assuming it is obtained by compiling a Solidity source file). This CFG should also distinguish the different methods ...
1
vote
1answer
51 views

Pushing bytes to EVM stack

I am sorry if this question seems to be somewhat bad, but I am trying to work out the stack representation of the following opcodes: PUSH1 60 PUSH2 40 would the stack representation of this be: [...
2
votes
2answers
307 views

How can we implement a new opcode in the Ethereum Virtual Machine.

How can we implement a new opcode in the Ethereum Virtual Machine. For eg : I want to implement an opcode logic such that the opcode number of this operation is 0x21. The EVM-implementation I am using ...
0
votes
1answer
107 views

What’s the purpose of the delegatecall second target parameter?

Simple question, but I couldn’t figure the answer. Are there plans/EIP to use the second parameter of DELEGATECALL ? Or am I wrong (in which case the parameter isn’t ignored) ? In c++ Ethereum evm ...
1
vote
1answer
204 views

What’s the opcode chain for sending ethereum from a smart contract?

Simple question, but I couldn’t find the answer anywhere. I know CALL is used and sometimes CALLER, but I don’t have any idea on how msg.sender.call.value(100) would be performed.
1
vote
1answer
118 views

What happens in CALL when gas is set to 0?

Reading the documentation on the CALL opcode : "call contract at address a with input mem[in..(in+insize)) providing g gas and v wei and output area mem[out..(out+outsize)) returning 0 on error (eg. ...
4
votes
1answer
156 views

How are storage pointers implemented in the EVM layer?

I'm trying to understand how storage pointers work. From looking at the ethereumjs-vm implementation it seems that the actual value is returned from SLOAD. Does the compiler handle the 'pointer' ...
0
votes
1answer
267 views

How does message call send gas?

contract Sample{ event Data(uint test) ; function test2() { Data(msg.gas) ; } } contract Sample2{ function try(address addr){ Sample(addr).test2() ; addr.call(...
2
votes
3answers
552 views

Updated list of EVM Opcodes

Is there an updated Opcode Specifications available for the EVM to date? Specifically, is there a continuously updated list of Opcode Specifications similar to that found in the ethereum yellow paper?...
2
votes
1answer
465 views

EVM opcodes-prices

1) Why are opcodes in Ethereum priced the way they are priced and why is the EVM so expensive? 2) Right upfront, I do not say that it is too expensive to perform a tx on Ethereum, I just say that ...
2
votes
2answers
108 views

Why return to String need so many operations when develop a smart contract?

I found a smart contract. The address is '0x2fabe69843e9a74a35b89145cb52e5568986c7a1'. I am really confused about is that why it need over 3000 lines Opcode to when Created this smart contract? Like ...
0
votes
2answers
83 views

How to code ADDRESS using opcodes in a solidity function?

Reference - http://solidity.readthedocs.io/en/develop/assembly.html Objective - example of a function returning the contract address. Code - pragma solidity ^0.4.18; contract d4{ function ...
3
votes
2answers
335 views

convert bytes to uint8[8] using mstore()

I know how to convert bytes to uint8[8] using mload but mstore seemed like it could be more gas efficient. Is something like this possible? function bytesToUintArray(bytes input) returns (uint8[8])) ...
0
votes
1answer
606 views

Transaction Error. Exception thrown in contract code. REVERT opcode when sending ETH to crowdsale

I wanted to follow the tutorial - https://blog.zeppelin.solutions/how-to-create-token-and-initial-coin-offering-contracts-using-truffle-openzeppelin-1b7a5dae99b6 - but there was a new release - https:/...
0
votes
1answer
147 views

Why is a state-modifying function working from Truffle console, but not when calling from web3?

I have a contract which offers two functions: 1) A state modifying function which takes two parameters 2) A constant function I have a web frontend in React calling these functions. When I call the ...
3
votes
2answers
975 views

Understanding solidity inline assembly code

Here is a code from solidity documentation: function sumAsm(uint[] _data) public returns (uint o_sum) { for (uint i = 0; i < _data.length; ++i) { assembly { ...
4
votes
1answer
315 views

What are the reasons behind jumpdest?

I know, the practical reasons behind it is just to add additional security layer. But why does EVM even need it? Asm doesn't have it and works great.
0
votes
2answers
254 views

Why is using `<address>.callcode()` discouraged in Solidity?

The Solidity document says Note The use of callcode is discouraged and will be removed in the future. But in what reason is using <address>.callcode() discouraged? Is using CALLCODE ...
2
votes
0answers
124 views

Is it possible to get compiler version from the bytecode and smart contract code?

The problem is that I have deployed some contract on the etherscan.io some time ago. Now I want to verify it, so I need to specify: Smart contract code Compiler version ABI encoded constructor ...
0
votes
2answers
259 views

Why does an Oraclize contract deployed with Remix JavaScript VM gives an “invalid opcode error” and not on main/testnet?

Why does an Oraclize contract deployed with Remix JavaScript VM gives an "invalid opcode error" and not on main/testnet? I have thought why the Remix JavaScript VM reports the error: Exception ...
3
votes
1answer
387 views

Why does PUSH1 0x60 PUSH1 x40 MSTORE store 0x60 at memory location 0x50 (and not 0x40)?

According to browser solidity, after executing 000 PUSH1 60 002 PUSH1 40 004 MSTORE Memory is: 0x00: 00000000000000000000000000000000 ???????????????? 0x10: 00000000000000000000000000000000 ?????...
2
votes
1answer
130 views

Are makeLog instruction functions opcodes or not?

The following code snippet is a constituent piece of the instructions.go file, where our lieblings opCodes all live. // make log instruction function func makeLog(size int) executionFunc { ...
5
votes
1answer
898 views

why is the EVM stack limited to 1024?

Here you can see that if the EVM stack gets larger than 1024, it results in an error: Why is there this hard limit on the stack size? What is the justification for this not being parametrizable? ...
3
votes
1answer
542 views

does the command `evm --debug --code OPCODES` still work?

I've been trying to run this command evm --debug --code 600580600b6000396000f36005600401, and some associated permutations of it, such as: evm --debug --code ...
2
votes
1answer
164 views

Why does the EVM program counter not increase by one but by two in PUSH1 opcode?

In the tutorial here, the program counter increases by 2 for a PUSH1 opcode. Then it increases by 1 for other opcodes. Why is this? Does it have to do with the opcodes size in memory? Aren't they all ...
1
vote
2answers
139 views

filter to restrict output of opcode data only to contracts/functions called by local node

Having modified the instructions.go file in geth I'm able to see the execution time of individual opcodes, it looks like this: My interpretation of that output is that it represents the execution of ...