Stack Exchange Network

Stack Exchange network consists of 175 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

Questions tagged [evm]

EVM is the Ethereum Virtual Machine, the protected, distributed "sandbox area" (virtual machine) where contract execution occurs, replicated on every node in the network. EVM is also the name of the bytecode that runs on the virtual machine -- what Solidity, Serpent and LL get compiled down to before deployment.

16
votes
2answers
1k views

What does bytecode of blank contract do?

When I compile a blank contract: contract A {} with solc --optimize --optimize-runs 300000 --opcodes test.sol I get: PUSH1 0x60 PUSH1 0x40 MSTORE PUSH1 0x6 DUP1 PUSH1 0x10 PUSH1 0x0 CODECOPY ...
4
votes
2answers
265 views

Is code execution time limited by the block time?

I'm fairly new to Ethereum, and I'm still trying to grasp the potential uses. I keep seeing articles using encrypted instant messaging as a potential application. But, there is a problem with this: ...
7
votes
1answer
559 views

Is it convenient to use mappings as temporary KeyValue instances?

Consider the following contract that illustrates the problem. Here we have a dynamic array of mappings, add() is meant to add a fresh new mapping to the end of the array, return the value for mapping ...
11
votes
1answer
999 views

Is there a formal specification for the EVM?

The yellowpaper specifies the EVM, albeit in a fashion that favors formalism over readability: But there's no indication if this is up to date with the current state of the Ethereum ecosystem or not, ...
7
votes
2answers
2k views

Clarification of “256 bit word” semantics

EVM has "256bit words". Some cases treat strings shorter than 32 bytes (256 bits) as left-justified ascii (packed into the most significant bytes of the word). Does this mean that the word value of ...
22
votes
4answers
4k views

Why does a Solidity throw consume all gas?

When you throw an exception, all gas is consumed. What is the rationale for this design decision?
6
votes
2answers
231 views

Separated Ethereum VM

I'm trying to figure out if anyone has separated out the Ethereum VM for experimentation. It would be interesting to play with the interface to the EVM for smart contract testing without all of the ...
8
votes
1answer
852 views

Can a contract access the code of another contract?

Using web3.js, the EVM (bytecode) of a contract can be obtained by web3.eth.getCode(addressOfContract). Can this be performed by a contract using the address of another contract? If so, how? ...
8
votes
1answer
640 views

Are linkable ring signatures available in Ethereum?

Are transactions with ring signatures available in Ethereum? There should be as anonymity/fungibility is important. Also, I think Vitalk Buterin mentioned it may be possible to implement an EVM ...
3
votes
1answer
474 views

Will the processing power of the EVM ever be increased?

From what I understand almost all hash power on the network is used to secure the blockchain, but the processing power of the EVM remains constant even as the hash power of the network increases, and ...
17
votes
1answer
606 views

Out of Gas invoking precompiled contracts on private blockchains

Why do precompiled contracts lead to Out of Gas on private blockchains? Some tidbits are provided in the Solidity docs but can it be explained more? It might be that you run into Out-of-Gas for ...
6
votes
2answers
771 views

Why does an empty message still invoke the code of the contract?

An empty message still invokes the code of the contract and is the mechanism that allows Solidity to implement a feature of a fallback function per contract. But when msg.data is empty, why does ...
4
votes
1answer
745 views

How does a Solidity fallback function work with the raw CALL opcode of the EVM?

Since a fallback function is a Solidity feature, how does it work if the EVM opcode CALL is used? If msg.data is empty, how can Solidity run the fallback function? Shouldn't the EVM just transfer ...
3
votes
2answers
1k views

What is chaincode (Open Blockchain) and is it compatible with the EVM?

What is chaincode and is it compatible with the EVM? Chaincode FAQ says it supports smart contracts and can these contracts be deployed and function on the Ethereum blockchain?
13
votes
2answers
2k views

Can a contract access another contract's storage?

I have a contract with numerous complex structs. Is it possible for a second contract to iterate over this data directly? I can't really use public accessor/getter methods as it's not possible to use ...
29
votes
3answers
7k views

Difference between Memory and Storage?

What is the difference between Memory and Storage ? From both the EVM point of view and the contract design one. Thanks!
4
votes
1answer
2k views

Where exactly do DApps run? Who gets rewarded for running them? [duplicate]

So I am currently running a full node, as well as a GPU miner. I am curious first of all where do DApps get run? They wouldn't make sense to run on a GPU as they aren't very parallizable, so I am ...
5
votes
3answers
359 views

Are smart contracts unique to Ethereum?

Is that why ethereum is considered to have a lot of potential? In other words, what does ethereum offer that other blockchain technologies can't replicate.
21
votes
1answer
2k views

How does the solidity optimizer work?

The compiler for solidity supports the flag --optimize which performs some set of optimizations to the compiled solidity code, typically resulting in a reduction of gas costs. How does the optimizer ...
11
votes
2answers
5k views

What does a “bad JUMPDEST” error mean?

When I send a transaction to call my contract, it's causing a bad JUMPDEST error. The Ethereum wiki says this error is caused when a JUMP instruction jumps to a location that wasn't marked as a jump ...
15
votes
3answers
2k views

What are the limits to gas refunds?

Gas refunds are provided when clearing storage or calling SELFDESTRUCT on contracts. The Yellow Paper mentions that refunds are "being capped up to a maximum of half...". What exactly is this "half" ...
20
votes
2answers
1k views

What type of operations have negative gas costs?

I understand that some operations cost negative gas because they free up space on the blockchain, such as selfdestructs. What are all the operations that can have negative gas? Does this only occur ...
32
votes
2answers
3k views

What's a precompiled contract and how are they different from native opcodes?

The Yellow Paper states: These are four so-called ‘precompiled’ contracts, meant as a preliminary piece of architecture that may later become native extensions. The four contracts in addresses ...
22
votes
1answer
3k views

When can BLOCKHASH be safely used for a random number? When would it be unsafe?

I've seen more complicated ways for a contract to generate a random number. But the Ethereum Yellow Paper itself suggests a "trivial solution" using the BLOCKHASH opcode (see below, bold is mine). ...
9
votes
1answer
659 views

Why are contracts limited to only the previous 256 block hashes?

Why are contracts limited to only the previous 256 block hashes using the BLOCKHASH opcode (and corresponding functions in Solidity and Serpent)? Why does another contract, such as this, need to be ...
5
votes
1answer
318 views

Is there available source code for the Ethereum parser (JS/Solidity or Python/Serpent?

I've tried looking at the source code, but I'm unfamiliar with the structure. I can't seem to find a parser module or source code. I'm attempting to understand the parser and perhaps write one from ...
23
votes
4answers
6k views

Does every node execute the contract code for each transaction?

This question was asked on Reddit a while ago: When a node sends a transaction to the network and has the receiver as a contract, does every node execute the contract bytecode with the inputs to ...
7
votes
3answers
387 views

Why are there no bit shifting opcodes in Ethereum?

Why are there no bit shifting opcodes in Ethereum? What's the fastest and cheapest way (in terms of gas) to implement them?
87
votes
7answers
36k views

What is an ABI and why is it needed to interact with contracts?

ABI is referenced in many places including the official Ethereum website. What is an ABI and why is it necessary to use?
7
votes
1answer
276 views

Any similar quasi Turing complete systems?

In the literature, are there any remotely similar quasi Turing complete systems like Ethereum (EVM), that "charge" for each step of computation? Anything that the EVM could learn from?
49
votes
5answers
13k views

How can you decompile a smart contract?

On the blockchain I can inspect the code of a contract, and see the EVM opcodes. Is there a way to decompile this and convert it back to (Solidity) source code?
28
votes
3answers
3k views

What was the reason to invent the EVM?

What was the reason to invent the Ethereum Virtual Machine (EVM)? Why not use an existing virtual machine like the Java-VM. The big advantage would be that the existing toolsets for Java development ...
7
votes
1answer
166 views

How to propose future gas prices of OPCODES? [closed]

I'm concerned as to how are we going to reach consensus if new opcodes are to be included on the EVM or if we would like to update the cost of some opcodes. The gas price has been chosen arbitrarily ...
56
votes
2answers
20k views

What OPCODES are available for the Ethereum EVM?

The Ethereum virtual machine has a large number of operation codes and base level instruction sets. Is a complete listing available?
39
votes
3answers
9k views

How were gas costs chosen for the Ethereum Virtual Machine instructions?

Different instructions of the EVM have different associated gas costs -- you can look at the list of the gas-prices in the appendix G of the yellow paper. While the rough magnitudes of those numbers ...