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

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 ...

1
vote
0answers
8 views

How does Transactions work in Ethereum Virtual Machine?

While reading the transactions sections of EVM documentation many questions raised in my head: If the target account is not set (the transaction does not have a recipient or the recipient is set ...
0
votes
1answer
22 views

Difference between Binary of the Contracts in Hex and contract bytecode?

I use the command "solcjs --bin mycontract.sol" to get the "Binary of the contracts in hex" and it looks like: It can be used as a parameter of evm in geth after the command "evm --code". When I use ...
1
vote
0answers
28 views

Ethereum state database persistence

Is there a way to reinstantiate a stateDB after saving the output of state.Dump()? My problem is the following : I create a new StateDB object using : db := ethdb.NewMemDatabase() state, _ := state....
3
votes
1answer
100 views

Gas costs of the following contract

I'm calculating the gas costs of the following contract: 0x6001600190016007026005016002900460049060016021900560150160030260059007600303600960110a60005260086000f3. Disassembled versions: contract ...
1
vote
0answers
36 views

eWASM vs PWASM: Are they complete independent? If so, in what ways are they different?

Understanding that eWASM is more like EVM 2.0 by replacing EVM with a subset of WASM instructions set.. What is the motivation of the PWASM project from Parity? Notes: https://medium.com/paritytech/...
1
vote
1answer
82 views

Understand an EVM call instruction with gas as 0x00

I am trying to understand the following EVM call instruction generated from here: https://ethervm.io/decompile memory[temp3:temp3 + 0x00] = address(msg.sender).call.gas(0x00).value(var1)(memory[...
0
votes
0answers
15 views

What's the difference b/w WASM and EVM? [duplicate]

I have been reading a lot about teams using WASM instead of EVM for their blockchain. What is WASM? What is EVM? And what makes WASM better than EVM? I am coming from a non-software background, so ...
1
vote
0answers
32 views

How can I run smart contract locally on my computer?

We all know that Ethereum nodes can run smart contract. But I'm wondering whether can I setup contract run-time environment from Ethereum source code locally so I can run smart contract without ...
3
votes
2answers
60 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
2answers
33 views

Solidity: Info on How it works on the low level

I'm looking for information on how Solidity works on the low level and how exactly it gets executed or run on the EVM? Do you have any documentation or Papers that describe that? Thank you!
0
votes
0answers
33 views

Gas estimation errored with the following message: VM Exception while processing transaction: invalid opcode

I am new to Solidity and am not sure why the following error is occurring: Gas estimation errored with the following message (see below). The transaction >execution will likely fail. Do you want ...
1
vote
1answer
52 views

Are constant state variables cached in the EVM?

From the docs: constant for state variables: Disallows assignment (except initialisation), does not occupy storage slot. Does this mean that the EVM caches constants across all contracts using ...
0
votes
1answer
21 views

is it possible to add whitelist of contract in self mainnet node?

I am working in a company write games on eth mainnet and maintenance a eth node(geth) not using infura.io. My boss require me our eth node just can deal with our contract, so is it possible to do it? ...
0
votes
1answer
19 views

Is it possible to jump to an arbitrary location in a contract's bytecode?

The assembly for a smart contract looks like there is a single entry point and a series of if/thens or a switch to jump to the entry point of each function. Is it possible to skip the lookup and jump ...
1
vote
1answer
39 views

Is Ganache GUI real EVM?

I was wondering whether Ganache GUI is real EVM or just a replica of it. Because its throughput and latency are way better than Geth client. Any comments on it?
1
vote
1answer
50 views

Smart Contracts without ETH Transactions

Maybe I'm wrong, but I understand that Smart Contract Transactions must always contain a "VALUE" field, that's to say, the amount of Ether Alice will transfer to Bob in case certain condition ...
1
vote
1answer
63 views

What happens to a transaction after you clicked 'send' in Ethereum network?[Transaction life cycle at the EVM and P2P networking level]?

Ref: What happens when you type in an URL in the browser So in a web browser, it's kinda easy to reason the life cycle of an HTTP request, how it moves down the network stack, reach the server, get ...
1
vote
0answers
25 views

Finding the memory position of a mapping [duplicate]

I want to read data from an internal mapping variable using getStorageAt(), but this requires knowledge of the index where that variable is stored in memory. The documentation says: Due to their ...
0
votes
1answer
26 views

Can storage be referenced without being copied?

With for example struct Foo { mapping(address => uint) b; } Foo[] foo; if a function only deals with foo[4], can it reference it from storage without copying it? is that what function c() { ...
0
votes
1answer
18 views

Use same argument name in modifier and function

If I have a function function b(address _foo) verifySomeClause { } and a modifier that can take different addresses as an argument, so that msg.sender can be one of those, modifier c(address _foo) {...
1
vote
1answer
29 views

Stack too deep, difference between memory variables local variables

Got a "stack too deep" error, and saw on stack exchange that I could try and use memory variables instead of local variables, and moved 8 uint into a uint[8], no error anymore. Why does that work ...
0
votes
2answers
29 views

updating variable inside and outside struct, different results, why?

With this, bool p does not update, contract b { bool p; mapping(uint => bool) public t; function setValue() { bool b = t[1]; b = true; } function ...
1
vote
1answer
21 views

How can I increase EVM time in web3.py?

When working with web3.js, Truffle and Ganache, I can do this: web3.currentProvider.send({method: "evm_increaseTime", params: [numOfSeconds]}); How can I do the equivalent in web3.py? When I do: ...
1
vote
1answer
22 views

Extra incentives for miners in smart contracts

I am thinking to create a smart contract where miners are not only incetivized by gas price but where basically the miner can get other assets like erc20 tokens if he/she mine my transaction in the ...
0
votes
2answers
36 views

How to let evm execute one function from a smart contract and receive outputs in a handy way?

I am a newbie to this field so I apologize in advance if this seems trivial. Say I have written some code in Solidity, for instance something like the quick sort code (https://gist.github.com/subhodi/...
0
votes
1answer
34 views

Run solidity bytecode with ethereumj

I am a newbie to Ethereum and I would like to run some simple smart contract code written in Solidity locally with my ethereumj virtual machine. I am aware of how to use EVM and aleth-vm to run some ...
2
votes
1answer
88 views

Instrumenting GETH

I'm working on instrumenting VM of GETH in order to index interesting data from the blockchain. I did manage to intercept the call and see internal transactions, but I want to go a little deeper, and ...
0
votes
1answer
29 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 ...
2
votes
1answer
46 views

Isolating the EVM and calling contracts functions

For a project of mine I would like to run a standalone new EVM with precise specifications. After having instantiated and set up the vm, I have a deployed a test contract using the vm « Create » ...
1
vote
2answers
58 views

What is the size of byte code stored in the EVM?

Generally, what is the size of the bytecode stored in the EVM. I mean the approx average value of it or bytecode of a simple hello world program (setting and getting a string). On what factors this ...
0
votes
1answer
34 views

Solidity SafeMath support for uint64

So commonly used snippet for safeMath in solidity is the following: https://github.com/OpenZeppelin/openzeppelin-solidity/blob/64c324e37c17c5e0501bb746975040d1ae020806/contracts/math/SafeMath.sol ...
0
votes
1answer
20 views

Instrumenting GETH: breakpoints on evm never hits

I'm trying to instrument the GETH virtual machine, and in order to do so I'm studying the geth code running it on debug. I expected that, during syncing, EVM is used to compute state of each single ...
1
vote
1answer
43 views

why are return values only True or False

Return values from functions which create transactions, can only be true or false, at least when you check them post transaction (e.g., with web3 through receipt). However, when functions call each ...
3
votes
1answer
44 views

What is the purpose of extcodecopy?

I am wondering, what is the purpose of the EXTCODECOPY bytecode instruction? I don't see any advantage in copying the code of another contract in memory. I am a little bit confused, because of the ...
1
vote
0answers
55 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 ...
5
votes
1answer
38 views

Historical state in mainnet EVM

I would like to get a snapshot of EVM state on a certain block and then execute smart contract call actions against this state. Do Go Ethereum, Parity or any of other Ethereum clients provide ...
2
votes
1answer
55 views

What is this evm code produced by solc in this public array checking, and why?

When solc creates code for arrays when they are declared public. In particular, it contains a check on the length of the array. For example, this: contract OutOfBoundsException { uint256[8] ...
1
vote
0answers
19 views

Gas cost of adding an item to a class-level (storage) array

I would like to make sure that the gas cost of adding an item to a (storage) array is constant, i.e., not dependent on the length of the array. To my understanding, the relevant EVM operation is ...
1
vote
1answer
33 views

invalidJumpLabel no longer available?

I am trying to compile the create op code example in here Create new contract via .call(). But it fails: execute.sol:17:19: Error: Identifier not found. jumpi(invalidJumpLabel,iszero(...
0
votes
1answer
34 views

Contracts are “instantiated” by the account creating transaction?

I read the following in a research paper: Short Paper: Formal Verification of Smart Contracts that: contracts are “instantiated” by the account creating transaction; this will allocate the ...
0
votes
1answer
76 views

How calldata is stored in memory?

when I execute this: bytes8 h = 0x000008dfe2f440000733c; t.call.gas(0x7e0b0)(bytes4(keccak256("enter(bytes8)")),0x8dfe2f440000733c0000000,h); the calldata is : 0: ...
1
vote
1answer
61 views

what are the diffrences between <address>.call and <address>.<function name>?

contract GatekeeperOne { address public entrant; modifier gateOne() { require(msg.sender != tx.origin); _; } modifier gateTwo() { require(msg.gas % 8191 == 0); _; } ...
1
vote
1answer
302 views

What is the maximum value an int and uint can store

I am new to solidity. I need to understand the couple of things maximum value an int and unit can store ? does maximum values stored in int and uint are same ?
2
votes
1answer
65 views

How does a contract's constructor work and load input values?

I set up the following contract: pragma solidity ^0.4.25; contract Simplest { uint x; constructor(bool _lucky) public { if (_lucky == true) { x = 7; } else { ...
2
votes
1answer
382 views

Understanding how a simple contract breaks into bytecode

I'm trying to understand how contracts look in terms of bytecode and struggling to do that just based on the yellow paper. In particular, consider the following empty contract: pragma solidity ^0.4....
2
votes
1answer
51 views

Out of gas error when reading from blockchain?

function getPosts(address[] subscriptions, uint[] subscriptionIndexes, uint count) public view returns (address[], bytes32[], bytes32[], uint[]) { address[] storage ...
0
votes
1answer
76 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 ...
3
votes
1answer
145 views

How do we enable smart contracts on UTXO based chains?

Smart contracts fundamentally enable change of state programmatically. (Is that a fair fundamental description?). How would one go about enabling smart contracts on UTXO based blockchain as against ...
2
votes
1answer
21 views

Assertion Rely on Balance Amounts

Is it possible in Ethereum blockchain to have two or more events simultaneously occurred? Regarding the following solidity code: function _transfer(address _from, address _to, uint _value) ...
4
votes
1answer
143 views

What Sequence Occurs 'Under the Hood' When an Ethereum Contract Function is Called?

It seems when a single function is called, the Ethereum Virtual Machine: Does 'pre-call checks' for exceptions/errors. Computes the amount of gas needed, checks that the accounts involved exist. ...