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

0
votes
0answers
6 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
25 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
1answer
22 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
21 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
14 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
33 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
32 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
28 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
26 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
48 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
13 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 ...
0
votes
0answers
18 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
25 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
27 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
51 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
67 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
34 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
340 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
42 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
35 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
74 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
14 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
129 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. ...
1
vote
2answers
62 views

Smart contract interaction (with another contract) example for solidity version 0.4.24 that works on Remix

I was going through this code and I decided to test it on RemixIDE... Creating a function that calls another contract I kept getting "VM Exception while processing transaction: revert" when I ran a ...
1
vote
1answer
30 views

Why are timestamps stored in a uint (256 bit) when they would fit in a uint64?

A (signed) 64 bit timestamp can store a date much larger than the age of the universe. On many platforms this would be a micro-optimization, but in the context of Ethereum, we want to squeeze every ...
0
votes
1answer
42 views

callvalue opcode, for what?

someone know what the opcode CALLVALUE is for? I would like to understand it well. Have you an example on which I can easily understand it?
1
vote
0answers
29 views

how are conditional JUMPI opcodes valid?

I've been reading this example from https://github.com/comaeio/porosity/wiki/Ethereum-Internals And I am wondering how some of these JUMPI operations are valid: loc_00000000: 0x00000000 60 60 ...
2
votes
1answer
32 views

how are negative numbers stored within the EVM stack?

for example, I have these opcodes: PUSH60 PUSH40 SUB for sub operations, I believe that the second stack item is subtracted from the first stack item (60 - 40) which would equal to -20 being the new ...
1
vote
0answers
24 views

Code scope in evm

Short question, how is code scope defined/determined by the compiler when looking at EVM opcodes (or rather bitcode)? Is it simply by looking out for jump calls or return statements? Or does it define ...
2
votes
2answers
39 views

EVM Contract Testing with JS issue - ReferenceError: artifact is not defined

There is a problem i have with a new DAPP tutorial i'm looking at from this YouTube video: I have an issue from for testing of my contract. when i run the "truffle test": it returns the following ...
1
vote
1answer
147 views

VM error: The constructor should be payable if you send value

I have used the Token Contract from https://www.ethereum.org/token#the-code . I have set the buy/sell price as 1000000000000000000 wei, but when i try to buy token from another account by sending 1 ...
1
vote
1answer
40 views

How to get notify if transaction got failed, dropped, or successes [closed]

I am new in dapps world and I want to deduct balance/points when a user buys an item currently I am unable to update balance because sometimes transaction got failed, dropped, or successes after 30 ...
0
votes
0answers
32 views

Strange behaviour of require() for view-type methods?

I know the require(bool expression) method will stop the contract execution and revert all state changes made by it when the expression evaluates to false. And recently it adds a feature to return an ...
0
votes
1answer
27 views

Progamming contracts in Ethereum, is it safe?

I am completely new to Ethereum. I read a lot of articles and have a question. As far as I understood, one can develop smart contracts in Ethereum that are like executable programs. In these ...
0
votes
0answers
26 views

How are arithmetic operations performed on strings within EVM bytecode?

for eample, I have this following bytecode: 60A060020a which translate into: PUSH1 0xA0 PUSH1 0x2 EXP How would an exponentiation operation be performed on the 2 items pushed into the stack, when ...
0
votes
1answer
28 views

Who is paying for a transaction within a contract?

Let's assume I do a transaction to a contract function with my external account, then I have to pay gas for this transaction. If the function within the contracts makes now a transaction on his own ...
1
vote
1answer
35 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
37 views

Geth evm not executing contracts on main net but runs fine on ropsten

I built geth from a fairly new release 1.8.12, when running on testnet (ropsten) it is executing contracts, however when running on the real net it is not, any idea why this is happening? I am using ...
3
votes
3answers
96 views

EVM - How is it connected to the Blockchain? [duplicate]

I have a few problems understanding the software architecture of the Blockchain. For me Blockchain is the database where all transactions, receipts, balances, etc are stored. But how is the connection ...
0
votes
0answers
33 views

What's the difference of contract.call and call by interface

ERC20 TOKEN's ApproveAndCall has two type of implementations. what's the difference? method 1: contract ApproveAndCallFallBack { function receiveApproval(address from, uint256 _amount, address ...
0
votes
1answer
32 views

Unable to use go-ethereum evm utility

I am unable to use evm tool, e.g. leads to a crash: $./evm --code 60ff60ff --debug run panic: runtime error: invalid memory address or nil pointer dereference Is this tool still supported ?
0
votes
1answer
14 views

invalid state after miner rejects transaction

I refer to the transaction flow in the following link: https://web3j.readthedocs.io/en/latest/_images/web3j_transaction.png What happens if the transaction is propagated to other ethereum client (...
3
votes
2answers
127 views

How to separate functions in evm bytecode?

I want to build the control-flow-graph (CFG) from the bytecode of a smart-contract (assuming it is obtained by compiling a Solidity source file). This CFG should also distinguish the different methods ...
1
vote
1answer
85 views

Solidity airdrop exiting with REVERT opcode

I work on solidity airdrop contract. I tested the contract in ropsten testnet https://ropsten.etherscan.io/address/0xc91cc586a0f4b08df677b0b0ef3e1e96cea9a1b2#tokentxns Our goal is working multisend ...
0
votes
0answers
18 views

Chain txvm vs EVM: Specified Differences

Chain txvm vs EVM: What are the specified differences between both platforms?
2
votes
1answer
25 views

could you tell me how to use the Executables evm?

i use a contract as follows : pragma solidity ^0.4.0; contract TestContract { function multiply(uint a, uint b) returns (uint) { return a * b; } } and solc --bin-runtime TestContract....
0
votes
1answer
17 views

How does the network / EVM handle same contract call within same block with same gas?

As an example take the following test contract: pragma solidity ^0.4.24; contract DoubleCall { address public superHero; uint256 public price = 1 ether; function becomeSuperHero() ...
1
vote
1answer
37 views

Multi node replication

In a multi node network, if one node is down (and a majority of nodes are up and running) for a period of time - say its down at block 100 block and rejoins when the network is at block 200. Q1: ...
1
vote
1answer
33 views

“Difficulty” opcode pushes always 0x0 to stack

Currently, I do some experiments with Geth-EVM and opcode execution. During the experiments, I observed that the DIFFICULTY opcode always pushs 0x0 to the EVM stack regardless of how I set the ...
1
vote
1answer
21 views

Two legal questions on Ethereum and Smart Contracts

1- Who answers before the judicial instances by any problem in the platform of Ethereum? 2- How does the decentralized platform of Ethereum to annul and render ineffective any smart contracts on ...