Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange
Join us in building a kind, collaborative learning community via our updated Code of Conduct.

operation codes specify the instructions to be performed in machine languages

1
vote
0answers
20 views

How to separate functions in evm-opcode?

I want to make control-flow-graph of opcodes and I should separate functions. Is there a way to separate functions in evm-opcodes?
1
vote
1answer
17 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: [...
0
votes
2answers
68 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
36 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
33 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
0answers
40 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. ...
2
votes
1answer
45 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
48 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
117 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?...
1
vote
1answer
116 views

EVM opcodes-prices

1) Why are opcodes in Ethereum priced the way they are priced and why is die 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
1answer
36 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
1answer
33 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 ...
1
vote
1answer
116 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
404 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
103 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 ...
2
votes
1answer
621 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 { ...
2
votes
1answer
114 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
159 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 ...
1
vote
0answers
85 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
182 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 ...
2
votes
1answer
228 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
108 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 { ...
3
votes
1answer
536 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? ...
2
votes
1answer
278 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 ...
1
vote
1answer
72 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
125 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 ...
0
votes
0answers
234 views

log output of modified function to geth console

To analyze the execution time of different opcodes I've created the following modifications to the go-ethereum file instructions.go: func opAdd(pc *uint64, evm *EVM, contract *Contract, memory *...
5
votes
1answer
136 views

Are new Opcodes approved in EIP's implemented in Solidity before they are introduced in a hardfork?

REVERT, STATICCALL, RETURNDATASIZE and RETURNDATACOPY are all approved and pending the next Ethereum hardfork as specified here However, the Solidity changelogs shows all 4 of these opcodes entering ...
3
votes
1answer
196 views

evaluation of execution speeds for various opcodes in EVM

Using traceTransaction we can get the following data: debug.traceTransaction("0x0cec118d22fbd572bf25c7e4143919e608989bec7da08512f2a6f3171df3b3b8") { gas: 104030, returnValue: "...
2
votes
1answer
129 views

geth console flag/option to output all opcodes executed in call to contract or function invocation

What I'd like to do is analyze all the opcodes that are executed when I call a contract, or call a function from a contract. According to my understanding, this computation would happen on my own ...
2
votes
0answers
177 views

analysis of the opcodes used in smart contract execution on ropsten, geth

I've deployed the following verified smart-contract to ropsten: contract Incrementer { uint iteration; function Incrementer() { iteration = 0; } function increment(uint ...
3
votes
1answer
387 views

Why doesn't bytecode match the opcodes on Etherscan?

I'm just going through the first few opcodes on this contract: https://etherscan.io/address/0xab7c74abc0c4d48d1bdad5dcb26153fc8780f83e#code. Which are (according to the opcodes view): PUSH1 0x60 ...
4
votes
1answer
114 views

Why does the init code of a contract change for Solidity > 0.4.5?

I have a simple empty contract: contract test { } That I compile on Remix using different versions. I notice that the compiled output is getting more and more complex with later compiler versions: ...
1
vote
1answer
1k views

Where are the opcode 0xfe and 0xfd documented?

The Solidity documentation has the following: Internally, Solidity performs a revert operation (instruction 0xfd) for a require-style exception and executes an invalid operation (instruction ...
5
votes
3answers
263 views

Can a transaction have a negative fee?

I know there are some opcodes that have negative gas costs (see this). So if I send a transaction that calls one (or multiple) instance(s) of these opcodes, will the gas used be negative? i.e. will my ...
2
votes
1answer
401 views

Internal message call CALL opcode

I am trying to make sense of a contacts internal messaging. The contract is sending 6.6 ether to the address that invoked the contract. From what I understand, the CALL opcode carries out a ...
4
votes
2answers
316 views

Can the CALL opcode be used to create a contract?

The Yellow Paper Appendix H defines the CREATE and CALL opcodes. For CALL: the operand order is: gas, to, value, in offset, in size, out offset, out size. By setting the second operand (the "to"...
16
votes
1answer
6k views

Is there a table of EVM instructions and their gas costs?

The EVM instructions are in the yellow paper, or they are summed up in this answer. But their gas costs are not there. Where can I find a list of all instructions with their associated gas costs?
5
votes
1answer
335 views

Can a contract fetch the global block gas limit?

The OPCODE GASLIMIT gets the block's gas limit. Could in-line assembly, uint gasLimit; assembly { gasLimit := gaslimit } fetch the gas limit ? contract B { function ...
11
votes
3answers
2k views

what is block.timestamp

In a function, does block.timestamp record the time the transaction was processed, or the time the block.timestamp computational step was processed? Is block.timestamp the time the transaction is ...
8
votes
1answer
204 views

Why a contract with only one variable produces lots of EVM code?

Why does a 'void' contract we have a long bytecode with many duplicated opcodes? For instance, the following contract: pragma solidity ^0.4.0; contract A { string s="s"; } will be translated ...
3
votes
1answer
264 views

Is there any available sandbox for Ethereum's OPCODES?

In case of Bitcoin, there are few tools, which allow you to play with Script OPCODES - one, two. So, is there any handy way to simulate / debug Ethereum's OPCODES execution?
2
votes
2answers
1k views

Recursive call ends with `VM Exception: invalid opcode`

I am running f: contract Test { function f() { f(); } } which produces VM Exception: invalid opcode in browser-solidity. Is that a bug or expected behavior?
3
votes
1answer
403 views

Ethereum Ddos attack

I have a background in security, so i try to understand what is hapeneing to Ethereum project. Recently, i heard that Ethereum will make a fork to stop the Ddos attack. here i want to know how the ...
5
votes
1answer
295 views

What are the two arguments to a RETURN opcode?

The RETURN opcode in the EVM takes 2 arguments(ie, consumes two elements from the stack), but what do they represent? I tried to understand the yellow paper describing them, but I don't understand the ...
3
votes
1answer
346 views

Ethereum's Storage: is SSTORE updates only at the post-transaction state?

I'm trying to figure out from Ethereum's yellow paper (Homestead edition) how does its storage model works (NOT memory model). It seems that the storage is updated only once, after a transaction is ...
1
vote
2answers
254 views

Create a contract at a defined address?

Is it possible to define a smart contract at a predictable address? 0xf0 CREATE in the Yellow Paper suggests that the address is deterministically determined by x = A(Ia, σ[Ia]n) page 29 of http://...
2
votes
0answers
119 views

Possible to create new contract via a proposal in the ethereum.org/dao framework?

Is it possible to deploy contracts from within contracts, using something like p.recipient.call.value(p.amount * 1 ether)(bytecode); This article says so, https://blog.ethereum.org/2015/12/04/...
4
votes
1answer
423 views

Why are there missing opcodes when using the disassembler on bytecode from the blockchain?

I'm using the disassembler from go-ethereum repo which fails on about 20% of the bytecode from the blockchain with missing/unknown opcodes. The disassembler on Etherscan fails as well. Is there an ...
6
votes
1answer
188 views

When does a SUICIDE opcode becomes effective?

The documentation (https://github.com/ethereum/wiki/wiki/Subtleties) states that SUICIDE becomes effective at the end of the transaction, but in block 116525, the same contract was able to SUICIDE ...