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
1
vote
1answer
22 views

How does the EVM identify a dynamic type in the function calldata?

So as per the ABI encoding specifications mentioned in Solidity Docs, for a dynamic array, the data location (in bytes from start, for the data part) is specified at first, followed by the length of ...
66
votes
4answers
23k 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 ...
0
votes
0answers
14 views

Clarification on how Calldata persists on the blockchain and how Optimistic Rollups use it

So I see that a lot of optimistic rollup solutions say that they store the chain's transaction data on Ethereum via "calldata" which is way cheaper in gas costs than contract storage (I ...
2
votes
1answer
158 views

How does the EVM connect to all the blockchain nodes?

Someone recently told me that Ethereum does not use IP addresses to work out the node connections. I know networkid is used in the connection but how does networkid translate into the EVM finding the ...
0
votes
1answer
36 views

Running a local development evm virtual machine

Is there a way to compile, run and debug a solidity class on my developpment computer. I do not want to connect to an ethereum network. I just want to debug my class Thanks
0
votes
0answers
14 views

How does ecrecover get compiled?

How does ecrecover() in solidity work? Looking at ethervm.io there doesn't seem to be an opcode for ecrecover? To what bytes is a ecrecover() call compiled?
2
votes
1answer
31 views

What are the changes to EVM from Constantinople fork and later forks? [duplicate]

What are the changes to EVM from Constantinople fork and later forks? Could you tell me which commit in git? Or Could you provide a list? Thank you!
0
votes
0answers
13 views

Does the EVM have an opcode to check private key signatures?

I have plain and simple desire. I want my dapp users to be able to generate some data payload, sign it with their private key, and send it using any external channel (eg JSON between apps) to a ...
1
vote
2answers
564 views

Linked list in contract storage?

I'd like to implement a linked list in contract storage Something link this: contract A { struct LinkedList { uint value; LinkedList storage next; // What goes here? Can I reference ...
4
votes
1answer
20 views

Copy and deploy a smart contract from opcodes without source code

I extracted opcodes from an already existing and deployed smart contract and I would like to know if it is possible to deploy an exact copy of this contract from its opcodes? My extracted opcodes ...
0
votes
1answer
288 views

Threat Model Question - Code Injection / ROP possible in Ethereum Smart Contracts?

I am trying to understand a basic threat model for Ethereum Smart Contracts, to perform some research on how existing attacks techniques may be applied here as well. Is there a risk of a contract with ...
0
votes
1answer
81 views

gasCost of opcode “STATICCALL” in Geth VM Trace

{ "pc": 4765, "op": "STATICCALL", "gas": 222711, "gasCost": 219243, "depth": 1, ... } As above, Geth VM Trace (https://etherscan.io/vmtrace?txhash=...
2
votes
1answer
510 views

Why can't the return value of a transaction be included in the transaction receipt?

Shouldn't this be possible as the return value will be known when the receipt is created?
2
votes
1answer
286 views

Formal definition of the EVM as a Turing Machine

I am trying to understand the EVM in the context of a classic Turing Machine. I have read through the yellow paper and taken what I can from the internet, but I still feel like I could use some help ...
3
votes
2answers
257 views

Does the EVM process transactions or is it used solely to execute contract code?

Does the EVM process transactions or is it used solely to execute contract code? I wonder whether the EVM is used to process transactions? I know it is used to execute (or interpret) the bytecode of ...
0
votes
1answer
14 views

Why is my view function running out of gas when reading from mapping/HashMap?

I have the following vyper code: address_to_addresses: public(HashMap[address, address[2]) Vyper auto generates a view function called address_to_addresses(arg0: address, arg1: uint256) -> address ...
0
votes
1answer
29 views

Why uint foo = 5, foo/=6 work, but not foo = 5/6?

I'm writing a contract that evaluates (foo/x)*x to give equivalent of math.floor(foo/x)*x. It works, but if I hard code numbers instead (I don't need to do that, just interested), (5/6)*5, it is not ...
27
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). ...
0
votes
0answers
13 views

How to find value of non-public state variable

I understand that public state variables automatically creates a getter function when deployed, its value can be accessed via the getter function. However, if a state variable is not public, how can ...
2
votes
2answers
429 views

How do I use filter EVM log events by an indexed field in web3j?

I've looked through the documentation, but there doesn't seem to be this scenario listed. What I want to do is filter the Ethereum event log of a specific contract by an indexed field with Web3j. ...
0
votes
1answer
252 views

Opcode for out of gas inside a message call

According to the Solidity documentation: A require-style exception is generated in the following situations: ... If you call a function via a message call but it does not finish properly (i.e. ...
0
votes
2answers
37 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 ...
2
votes
1answer
59 views

Modifying simple function with inline assembly

I'm trying to write a super simple contract that's gas efficient utilizing inline assembly in solidity. All this function needs to do is create a child smart contract with one function, self destruct....
19
votes
3answers
3k views

How do gas refunds work?

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 ...
1
vote
0answers
16 views

Trying to understand the ethereum stack

I've been trying to understand the limits of the stack and how it works. It seems like the "Stack too deep" error only happens if there is an assembly block in the function. Without an ...
6
votes
2answers
92 views

Ethereum client implementation

I think to better my understanding of the EVM and underlying file system, I want to read through one or more ethereum client implementations and potentially build a client myself. So far I've been ...
2
votes
1answer
131 views

Using 'call' from a constant function

I am trying to determine the behavior of call when executed from a constant function. Of course, the compiler issues a warning on that: Warning: Function declared as view, but this expression (...
0
votes
1answer
22 views

Interacting with Bytecode

Is it possible to interact with a smart contract with bytecode only (without ABI)? If yes, how can I do this?
0
votes
1answer
18 views

How to determine the return address when we use CALL opcode?

I'm try to understand each opcode defined in Ethereum Virtual Machine. As for the opcode 'CALL' I find that it needs 7 arguments from the stack: gas, addr, value, argument addr, argument offset, ...
2
votes
1answer
54 views

Numerical Value of Bools in Solidity

What is the numerical value of true and false? Presumably one is 0x0000000000000000 and one is 0x0000000000000001
1
vote
1answer
220 views

Debugging a VM error in solidity

I'm getting the following error while running a test in truffle: Error: Returned error: VM Exception while processing transaction: revert Now, the code is simply to big and complicated to run ...
1
vote
1answer
52 views

does EVM support pop() that returns the last element?

pop() that returns the last element is a method I have found would be good to have in smart contract development. Since v0.5.0 released a year ago, Solidity supports pop() for removing the last ...
1
vote
1answer
72 views

Why is eth.coinbase node based and not blockchain based?

I have tested with geth using --datadir and found that if I have more than one node created using personal.newAccount then the account data is not shared. This seems confusing to me. I believed ...
1
vote
1answer
166 views

How to understand output of debug.trace

I have created a Private Ethereum network and I have deployed a contract in it.. Now I am trying to post a transaction in that contract but I m getting error that transaction has been reverted by EVM ...
0
votes
1answer
27 views

Loading modified contracts keeping the same super class

I am trying to implement upgrade of contracts. One pattern by [1] is to have a layer to resolve the actual address of a contract. I implemented that adding the Pausable manipulation. My idea was to ...
0
votes
2answers
290 views

Smart Contract with web3j - Stored SHA hash returned is not the same as input

I have a contract that stores sha-256 hashes of documents (stored as bytes32). I also have a method to retrieve a hash that is mapped to a unique id for the document. However, when I retrieve and ...
1
vote
1answer
160 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. ...
1
vote
1answer
134 views

It is possible to get bytecode from the evm in golang?

Imagine this scenario, I have a contract that has a function where I call with runtime.Call(). But this function returns an address of a newly created contract, but not the bytecode as runtime.Create ...
0
votes
1answer
29 views

Parameters on evm opcode create

Why the usual way to create a contract with evm opcodes use add and mload, for example: bytes memory bytecode = hex"600580600c6000396000b800602a600052b8"; ... assembly { _address := ...
3
votes
1answer
280 views

How to use evm compile?

I have been testing with evm and I am not getting any output. Code - pragma solidity ^0.4.18; contract d8 { function myBalance() pure public returns (uint) { return 880; } } My ...
0
votes
1answer
153 views

Unhandled promise rejection (rejection id: 1): Error: Transaction has been reverted by the EVM:

I don't know where i'm doing mistake. I have deployed my contract through remix and truffle and it was deployed without any mistake but now i'm deploying it from web3 solc@0.4.24 version and EVM is ...
3
votes
2answers
75 views

In Casper, what is the incentive to store the entire chain?

Do the validators need information from the blockchain to produce blocks, or is it enough just to store a few recent blocks? What is the incentive to use large amounts of storage to store the complete ...
0
votes
0answers
21 views

Error: CompileError: InternalCompilerError: Stack too deep, try removing local variables

Hello everyone please kindly help me out. I have researched on the error above associated with this block of code. But please is there a way to revise this code so that i can get all the data of a ...
1
vote
1answer
114 views

Verify multiple state channel signatures in one transaction

What are some ways to verify multiple state channel signatures (using ECverify) in a single transaction?
1
vote
1answer
200 views

Concatenating byte strings in assembly for call input data

I have the following piece of code in my contract. It's supposed to take in a byte string composed of a uint flag that is followed by a variable list of uint numbers and contruct a call using those ...
0
votes
1answer
117 views

How to tell the contract deployed size? (Error: The contract code couldn't be stored, please check your gas amount.)

I get Error: The contract code couldn't be stored, please check your gas amount. whenever I deploy to any test network (rinkeby, ropsten) or the live network. Deploy to a local Ganache works perfect. ...
0
votes
0answers
47 views

require Statement returns Transaction Revert Error instead of provided custom error message

For example, i have this piece of code here require(keys[_address].purpose != _purpose, "Key Already Exists"); in a Smart Contract. Upon executing a function and failing a requirement, ...
1
vote
1answer
62 views

derivation path for ethereum?

how are you doing! I would like to know what happens if from a ethereum seed I derive a wallet using BIP49, BIP84 derivation path and then send ethereum from another wallet which is BIP32 or BIP44, ...
0
votes
1answer
27 views

How to call sha256 in assembly

I wanna compute sha256 in Solidity Assembly for hash of getting bytes slice.
2
votes
1answer
29 views

Why can I call contract methods containing a selfdestruct multiple times?

The following code is part of a Smart Contract I'm working with: [...] function noComplain() allowed(receiver, stage.keyRevealed) public { selfdestruct(sender); } // function ...

1
2 3 4 5
11