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.

Filter by
Sorted by
Tagged with
7
votes
2answers
1k views

Is it possible to call another contract from a contract maintaining the msg.sender of the original caller?

Imagine that Alice calls a contract method C1 and that method calls another method in contract C2. Regularly msg.sender equals the Alice Account in the C1 method. And msg.sender equals the C1 ...
6
votes
2answers
2k views

How to know, inside the contract function, the amount of gas that will be refunded in the end

Consider the following situation: my function can be divided into 2 parts Always consumes constant gas; Always results in a refund of 0 < R < 1500000 gas. After the second part had happened, ...
4
votes
0answers
57 views

Why is there a CALL instruction in this contract? [duplicate]

This is a code snippet from a real contract. I wonder why the compiled code (can be obtained online from https://chriseth.github.io/browser-solidity) has several CALL instructions, although the ...
18
votes
2answers
4k views

Contract reading a string returned by another contract

I have 2 contracts, Parents and Child which has a public string variable - name. contract Child { string public name; function child (string _name){ name = _name; } } Parents ...
60
votes
2answers
19k views

Difference between CALL, CALLCODE and DELEGATECALL

CALL and CALLCODE take the same number of operands (in the execution stack). For the exception flag being pushed on top of the stack: 0 means exception, 1 means successful execution. CALL is easy to ...
14
votes
1answer
1k views

Is functional programming possible on the EVM?

Is there a technical limitation preventing functional programming on the EVM? For instance the cost of computation? I have heard that FP is "too costly". Is that correct? If it is, why? Because "...
8
votes
1answer
612 views

Is the cost of updating storage different than the cost of adding to storage?

Do these have a separate cost? sstore(1, 10) # first time adding a value to storage with this key sstore(1, 20) # changing the value in storage. I looked for a list of gas costs / opcodes, and the ...
2
votes
0answers
79 views

Is there a decompiler for the binary data in the blockchain [duplicate]

I want to know if there is a decompiler for the binary data in the blockchain, I want to know about the details of my contract after it was uploaded to the blockchain?
4
votes
1answer
102 views

Is it possible to establish a conditional gas limit in a transaction?

Imagine a contract that rewards the first user that publish a specific big piece of data into the blockchain. The transaction may cost an appreciable cost if the information size is big. The problem ...
12
votes
1answer
326 views

How growing contract storage increases the gas spending?

I have some further questions about this and this threads. For simplicity, let's imagine that I want to create a cryptocurrency on top of ethereum. The contract that "handles" this cryptocurrency ...
5
votes
2answers
464 views

What’s the role of the EVM in a plain ether transfer between Externally Owned Accounts?

In a plain ether transfer from one Externally Owned Account to another, for which the base fee of 21000 gas has been provided, how is the EVM involved if at all? I realize that the signature needs to ...
13
votes
2answers
796 views

Why does a simple function returning a 'string', call another contract?

This trivial contract: contract Test { function test() returns (string) { return "foobar"; } } Results in assembly code output (in the solidity web compiler) for the function 'test' ...
17
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
269 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: ...
8
votes
1answer
565 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
1k 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 ...
24
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
235 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
868 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
647 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
482 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 ...
18
votes
1answer
637 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
787 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
759 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?
14
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 ...
30
votes
3answers
8k 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
369 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.
23
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 ...
12
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 ...
17
votes
3answers
3k 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" ...
21
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 ...
35
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 ...
25
votes
1answer
4k 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). ...
10
votes
1answer
702 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
325 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 ...
25
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
394 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?
90
votes
7answers
38k 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
282 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?
53
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?
30
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
167 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 ...
57
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?
41
votes
3answers
10k 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 ...