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
21 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 ...
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 ...
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?
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 ...
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
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 ...
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 ...
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 ...
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
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
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, ...
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 := ...
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 ...
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.
0
votes
0answers
14 views

importing a big standard contract

I am following a tutorial to use oracle from Provable, so I have to import "https://github.com/provable-things/ethereum-api/blob/master/provableAPI_0.6.sol". I notice that the contract is very big but ...
0
votes
1answer
24 views

How to reverse byte order in uint256 or bytes32?

Need to convert BigEndian to LittleEndian or vice versa.
0
votes
0answers
25 views

How does EVM search in the storage?

I am reading this article to understand the storage in Solidity/EVM https://programtheblockchain.com/posts/2018/03/09/understanding-ethereum-smart-contract-storage/ It says that each smart contract ...
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 ...
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
12 views

Geth Node stalled at EVM layer when sending higher txs to it

Hello in my private clique network with 2 Nodes I have a genesis with block period 2. Block gas limit: 500000000 I also set my miner gas limit and gas target as 500000000 to ensure a linear block ...
2
votes
1answer
131 views

Calculate transaction costs for storing data

I'm trying to figure out how the transaction costs are calculated for a transaction that is storing data on the Ethereum Blockchain. It seems I'm always off. Here is my way of calculating (I'm using ...
0
votes
0answers
20 views

which client produced the gasUsed on Etherscan?

There are many EVM implementations, such as js-EVM, Py-EVM and geth. So I was wondering which EVM implementation generated the gasUsed on Etherscan (i.e., the gasUsed got by using web3) ?
0
votes
1answer
48 views

How do exchanges work internally?

Because EVM cannot watch events, we cannot send a token to an exchange and immediately get back some other token (EVM just does not "know" when it was send a token). As far as I understand, this is ...
2
votes
1answer
97 views

How to perform delegate call inside of view call (staticall)?

Inside view method it's not possible to do delegatecall due to compilation errors. Is there any way to delegate view calls?
2
votes
1answer
86 views

Why is there a SHA256 pre-compiled contract when SHA256 is also an opcode?

The question is in the title :). Trying to understand why there is both an opcode and pre-compiled contract for SHA256. To execute the computation, would people canonically "CALL" into the pre-...
0
votes
1answer
68 views

Gnosis multisig wallet, Error in call method

This is an external function which will be called when a transaction have enough number of confirmations. function external_call(address destination, uint value, uint dataLength, bytes data) ...
3
votes
0answers
25 views

What is the purpose of DUP1 at the beginning of contact creation bytecode?

I am trying to analyse the bytecode of creating a contract and I can't figure out why there is a need for the 006 DUP1 opcode in the snippet below. 000 PUSH1 80 002 PUSH1 40 004 MSTORE 005 CALLVALUE ...
1
vote
0answers
57 views

Gas cost for ether transfer < 9000

According to the Yellow Paper, creating a transaction costs 21000 gas (regardless if it contains value) and creating a message call with non-zero call value costs at at least 9000 gas. Yet when I call ...
4
votes
2answers
174 views

Function to execute raw bytecode in EVM

Suppose, I have the following bytecode (0x610101610102016000526001601ff3) that pushes two numbers to the stack, adds them and returns the value. Now I want to write a function in Solidity that will ...
1
vote
0answers
167 views

get event logs and debug trace from eth_call

I am looking for a way to execute a transaction locally (using local geth/parity node) for simulation only, before actually submitting it to blockchain. I know that I can use 'eth_call' RPC call and ...
1
vote
1answer
30 views

Validating equality between two address variables

I'm testing the challengeOpponent function in my Connect4 contract in remix. The function creates a new Escrow contract instance so that each player in the game has a place to hold their funds until ...
1
vote
1answer
77 views

Using assembly to create a fallback function with a return value?

Is it possible to use Solidity assembly to create a fallback function that makes a DELEGATECALL to another contract, and then uses assembly to correctly store the return value of the DELEGATECALL in ...
0
votes
2answers
79 views

Costs of storing an empty dynamic array of length 2**256-1 vs length 4

If the array is completely empty, is it more expensive to store uint[] of length 2**256-1 vs of length 4?
0
votes
0answers
19 views

Where's a contract storage stored exactly and how does it interact with the blockchain? [duplicate]

From what I've understood a contract is a special account that gets initialized with a 256 bit array and this array is stored as the root hash of a merkle tree, is that correct? But where is this ...
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
69 views

Why does not Ethereum allow removing all entries from a mapping, like clear() in Python

Is it common that dictionaries like mapping(uint => uint) foo; cannot be cleared with something like clear()? What is the reason deleting mappings aren't allowed in Ethereum?
0
votes
2answers
69 views

Use uint[] to map uint(address) to uint

Is there any reason not to use uint[2**160-1] addressIndex; instead of mapping(address => uint) addressIndex; ?
0
votes
1answer
51 views

ERC20 decimals and gas costs

This question is twofold: The standard number of decimals for an ERC20 token is 18. If we lower this number, can we expect decreased gas costs when creating/transferring the token, since this should ...
0
votes
1answer
57 views

How to distinguish uint and int types during evm execution (via opcode)

I am searching for a long time on net. But no use. Please help or try to give some ideas how to achieve this Orz. I'm doing some security-related attempts on Ethereum EVM (very immature, just an ...
3
votes
1answer
40 views

Solidity assembly: why is the length of _bytes added to _bytes before mload()?

For example in BytesLib: https://github.com/GNSPS/solidity-bytes-utils/blob/master/contracts/BytesLib.sol#L348 (Edit: Note that the same pattern is used for lengths: 1, 2, 4, 8, 16, and 32) ...
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=...
1
vote
1answer
28 views

Is it considered secure at all to use passwords and private keys in the code of smart contract?

Basically something like: function transfer(address to, string privkey) { if(privkey == "cd33434343...") { msg.sender.transfer(this.balance); } } The above is obviously flawed since the privkey is ...
2
votes
1answer
57 views

Map Bytecode of Function to Function Within Entire Bytecode

Is it possible to distinguish a functions bytecode out of an entire contracts bytecode? For example, when I pull the bytecode from a contract address, I get something like: ...
2
votes
2answers
70 views

Revert()/throw/invalid are so powerful they can even put back an already self-destructed contract, but is there a way to surpass such limitation?

I know this sounds confusing so let me explain: In this case below a transaction will succeed and a contract will be first destroyed and then re-initialized on the same address (yes, I didn't think ...
1
vote
1answer
36 views

Are simultanous transactions possible (basic but potentially very dangerous security concern…most likely impossible…)?

Long story short I am curious how a contract stores variables in memory, so is it possible to spam say 100 transactions at once and the values to be changed afterwards...I am sure I am giving bad ...
4
votes
0answers
68 views

UNGAS and why was GAS made available to programming smart contracts?

Hardforks, such as Istanbul, have illustrated the best practice that smart contracts should not make any assumptions about gas. Gas costs have, can, and will change, for example: Is transfer() still ...
0
votes
0answers
30 views

How Gas Cost is defined in EVM gas table?

i was checking into EVM gas table (https://docs.google.com/spreadsheets/d/1n6mRqkBz3iWcOlRem_mO09GtSKEKrAsfO7Frgx18pNU/edit#gid=0) (even though it is old sheet) Have few question: On what basis for ...

1
2 3 4 5
11