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
0 votes
1 answer
15 views

Solidity - Function Selector Loading onto the stack: why DIV instead of SHR?

I'm currently learning about how the function selector is loaded from calldata. The algorithm is like so: PUSH4 ffffffff PUSH29 0100000000000000000000000000000000000000000000000000000000000000 PUSH1 ...
riordant's user avatar
0 votes
0 answers
13 views

Could I just replace the RPC URL of Infura with the RPC URL on MetaMask of a different chain?

I have a backend code that uses the endpoint of Infura for Goerli. But I'm now working on a very new EVM that is not supported by any Web3 provider. So, could I just replace the RPC URL in my code ...
ratib90486's user avatar
0 votes
2 answers
28 views

Is it possible to use CREATE2 without going through the Smart Contract's function?

EIP-1014 was the standard that added the CTEATE2 Opcode (0xf5). Is there any way to use 0xf5 other than calling the SmartContract's inline-assembly function?
imelon2's user avatar
  • 455
0 votes
1 answer
25 views

Rebasing tokenomics

I have the following variables where all values are multiplied by 1e18 to represent fixed-point numbers on the EVM: uint totalShares = 100; uint sharesAlice = 20; uint sharesBob = 30; uint ...
dNyrM's user avatar
  • 711
1 vote
3 answers
52 views

How was the Ethereum 0x0 address generated?

Ethereum addresses are generated using a process called the Elliptic Curve Digital Signature Algorithm (ECDSA). ECDSA is a cryptographic algorithm that uses a pair of keys, a public key and a private ...
Mila A's user avatar
  • 264
0 votes
1 answer
9 views

Reliably disassamble bytecode to opcodes across various evm versions

Is there a reliable way of disassembling bytecode into opcodes across different EVM versions, to make it agnostic to the EVM version used during compilation? As the second best option - is there a ...
Stas Buzuluk's user avatar
3 votes
1 answer
54 views

How do old smart contracts that contain certain opcodes behave when those opcodes get deprecated/removed in hard fork upgrades?

For example say a contract with a compiler version of 0.7.5 (pragma solidity 0.7.5) contained selfdestruct(payable(address)) what happens to the contract when the self destruct opcode gets deprecated ...
davidastro's user avatar
1 vote
1 answer
19 views

Do dynamic arrays in memory require a pointer to where the length and elements are stored in the memory?

At 29:07 of the video here: Devcon it is mentioned and written in the slide that dynamic arrays have pointer slot, length slot and elements after the length slot However, when I debug the following on ...
Xirexor's user avatar
  • 127
2 votes
1 answer
35 views

Is there a way to stop wallet homomorph attacks without ditching the create2 opcode?

Losses from create2 wallets that look similar to recently active wallets has surpassed $60m: https://gbhackers.com/create2-bypass-wallet-security-alerts/ Even today I made a transaction, and noticed ...
rook's user avatar
  • 141
1 vote
0 answers
15 views

Why the mentioned assembly block is skipped?

A very simple function: function test(uint256 i) public { uint256 j; uint256 k = 4; assembly { pop(4) } uint256 l = 5; } I checked debugging it in Remix but the assembly block ...
Xirexor's user avatar
  • 127
0 votes
1 answer
14 views

Verify signature result return 0x

The return signature result from signMessage method obtained is 0x. How do we handle 0x signer result from frontend? const signer = new ethers.providers.Web3Provider(provider).getSigner(); try { ...
Edwin Chen's user avatar
0 votes
1 answer
54 views

Unable to deploy on Eth mainnet

i done all the steps and when im connecting to "Injected provider" its still asking to be on EVM version: shanghai. i want to deploy the CA on the mainnet.
TryingToDeploy's user avatar
0 votes
1 answer
9 views

provider.broadcastTransaction is not a function

I'm trying to call a contract function on the avalanche network. However I'm running into this error. Interestingly, the transaction goes through on hardhat network however fails on a evm testnest (...
Ibra's user avatar
  • 137
0 votes
1 answer
30 views

Gas griefing in "typed" external calls

I was wondering whether the "insufficient gas griefing attack" is possible in cases when the external call is a typed call rather than an inline call with lower level utility functions (i.e. ...
Mila A's user avatar
  • 264
1 vote
1 answer
31 views

Weak RNG vulnerability proving

Hi guys I am auditing a smart contract and I found a WeakRNG in order to prove it I have written 2 smart contracts which simulate the work of this function( a bit ) here is the 1 a have changed block....
NeoRusI's user avatar
  • 11
1 vote
0 answers
18 views

How can I approve spending limit manually without having to use metamask?

When interact with smart contract on EVM chain, new token need to use "approve" function on metamask. I know this, but I have a good reason to approve the spending limit manually without ...
cht's user avatar
  • 11
0 votes
0 answers
13 views

Need help with debugging Error: Definition of base has to precede definition of derived contract

I'm working on a social account recovery feature for smart accounts (ERC-4337) on top of Thirdweb's smart account contract. Link to the codebase I'm getting the error Base has to precede definition of ...
alfheimrShiven's user avatar
0 votes
0 answers
11 views

How to have solidity output as minimal assembler-close bytecode as possible?

While as indicated in this answer it is probably impossible to have Solidity optimize away the free memory pointer and it's initialization causing the bytecode to start with 0x6080, I was wondering if ...
Zommuter's user avatar
  • 113
0 votes
1 answer
31 views

Is it possible to include extra bytes at the end of the data payload when executing a contract method?

I wanna add extra bytes at the end of the data payload. For example, in this contract : //SPDX-License-Identifier: UNLICENSED pragma solidity ^0.8.21; contract Test { constructor() {} ...
이태림's user avatar
0 votes
0 answers
29 views

Deploying On Remix Returned Error 32000 Gas Issue?

So i am trying to publish a smart contract using a guide. https://github.com/tanishbaansal/legendary_token/blob/main/Legendary.sol When i am trying to deploy to livenet it gives me the following error,...
Jim Mike's user avatar
3 votes
1 answer
90 views

Why aren't more common algorithms done as precompiles?

I've been interested in precompiles recently and it seems asinine that things such as ecrecover, hash algorithms, etc. are all written as precompiles under the hood of the EV, however simple binary ...
Origami's user avatar
  • 136
0 votes
0 answers
17 views

Consensus with nondeterministic chain code

Ethereum Virtual Machine is necessary part of Ethereum network because it ensures deterministic code execution. For this reason, it is impossible to have chain code written in general programming ...
0x11111's user avatar
  • 101
0 votes
1 answer
12 views

Is it possible to make my CREATE2 factory so that the calculated address is totally independent of the address my factory is deployed on?

Is it possible to make my CREATE2 factory so that the calculated address is totally independent of the address my factory is deployed on. For example, this is the formula listed on solidity-by-example ...
Priyank Gupta's user avatar
0 votes
0 answers
45 views

Smart contrat working in remix ide but actions not working with web3.js html interface, only displays work and i can't figure out where and why it is

first of all thank you for your time reading this. I'm trying to learn and play with solidity on polygon mumbai blockchain. I worked with internet forums, videos and chatgpt4. Here is some details ...
Jawhar Aredsgfs's user avatar
1 vote
1 answer
32 views

Is there a way that we can mint native coin more in ethereum?

I mean if i have my own private evm chain. the intial supply for it is, assumingly, 10000 coins. after starting the blockchain can I create more coins for that. Like minting and burning works for ...
Hammad Ali's user avatar
0 votes
1 answer
39 views

Why is EVM ( Ethereum Virtual Machine ) so popular?

Why? Many other crypto projects (Filecoin, NEAR,...) make efforts to be EVM compatible. "Ethereum developer community is one of it's biggest assets", to quote someone. Is there something ...
0x11111's user avatar
  • 101
2 votes
1 answer
67 views

Determine compiler used to create a given bytecode

Context The method that the solc compiler uses to set storage slots for a mapping is slightly different from how the Vyper compiler does so. In Vyper, it's keccak256(slotMapping, key), while in ...
Another0xDev's user avatar
1 vote
2 answers
41 views

Are there any EVM opcodes that assume a variable number of stack inputs?

In other words, do any opcodes pop a variable number of elements from the stack? The Ethereum Virtual Machine allows up to 1024 elements on the stack, so it should be possible to allow a variable ...
Paul Razvan Berg's user avatar
2 votes
0 answers
153 views

How to work with foundry anvil custom rpc methods?

I'm running an anvil fork node on localhost:8545, and I create a provider by ethers: const provider = new ethers.JsonRpcProvider('http://localhost:8545') I tried some common rpc methods like: ...
CT95's user avatar
  • 183
0 votes
1 answer
18 views

Why were EVM opcodes not made to be compatible with assembly?

It seems like both machine language and the ethereum machine read through instructions like ADD or MOV or etc.. Why did Vitalik, when he made ethereum not just follow that standard, it seems quite ...
IBeFrogs's user avatar
0 votes
0 answers
66 views

Facing issues while running Chainlink node on XRPL EVM Sidechain network

Basically, I’m trying to run a Chainlink node on XRPL EVM Sidechain network. Here's the content of the config.toml file that I'm using: [Log] Level = 'warn' [WebServer] AllowOrigins = '\*' ...
SYED ASAD KAZMI's user avatar
0 votes
0 answers
37 views

Is there any way to change hardhat running environment (hre) provider when running script?

I'm running multiple hardhat nodes in different ports like: 0.0.0.0:8545, ...:8546, ... My scripts is something like this and I use it in a nestjs project import * as hre from 'hardhat'; async ...
CT95's user avatar
  • 183
0 votes
2 answers
23 views

Why there are few transaction before the Contract Creation txn?

Does anyone know in this smart contract (see screenshot below) why there are few transaction before the smart contract creation txn? It seem like this smart contract was previously a normal EVM wallet ...
jojo12's user avatar
  • 1
0 votes
1 answer
15 views

How to import external files?

I'm trying to create a fund function that allows users to fund their wallet after signing. I had my contract address & ABI stored in an external file and tried to export and import, but that didn'...
SABER's user avatar
  • 1
0 votes
1 answer
26 views

How do you use the Diamond Pattern for escrow upgrades?

I am creating a contract with the diamond pattern so I can evolve and add new features to my contract. Contract facets: Contract A: an ERC721 that takes care of minting its own NFTs Contract B: ...
Piyush Chittara's user avatar
0 votes
0 answers
13 views

How to Implement User Account Switching in a Mobile DApp without Hardcod Wallet Private Keys?

I'm currently developing a mobile decentralized application (DApp) and I've had to hardcode the private key of the wallet to sign transactions. However, I'm facing a challenge when it comes to ...
kaustubh sharma's user avatar
1 vote
1 answer
41 views

how come loading the funcSig from data isn't enough, you have to shift it also to use it in the rest of the code/function

basically we have this function function FlaggedMethods( bytes memory data ) public returns (address) { bytes4 funcSig; assembly { // Shift right by 224 bits ...
owl's user avatar
  • 13
1 vote
0 answers
16 views

Is there any way to read block attestation from inside a solidity smart contract?

Are there any precompiles, or any other native ways to get block attestation data from ETH2 POS inside a solidity contract?
Bruce's user avatar
  • 927
1 vote
2 answers
177 views

Why is Transaction Value showing 0 ETH on Etherscan?

I'm not sure why the transaction value on Etherscan is showing as 0 ETH when the transaction was confirmed. According to the recipient, they haven't received anything in their wallet either and I'm ...
Dan's user avatar
  • 11
0 votes
0 answers
13 views

Avalanche Consensus and how better it is than Ethereum?

Which consensus mechanism do Avalanche currently uses and is it better than ethereum and other EVM compatible blockchain and apart from consensus what others benefits does avalanche provides us?
Code Blocker's user avatar
0 votes
1 answer
4 views

Ethereumjs putContractStorage throws an error

I'm experimenting with Ethereumjs and having issues with the putContractStorage from vm.stateManager. The following code snippet: const { VM } = require('@ethereumjs/vm') const vm1 = new VM() const ...
Andreas Tzionis's user avatar
5 votes
1 answer
82 views

Can precompiled contracts have state?

Ethereum currently has 9 precompiled contracts available at addresses 0x01-0x09, none of which are state-changing. But is that a VM requirement? Is it possible to implement a new precompile that does ...
Paul Razvan Berg's user avatar
0 votes
1 answer
31 views

What are Pros and cons of deploying a new minimal proxy contract for every minted token vs minting all in a single contract?

[I am thinking about NFTs but it might be a broader idea] It is intuitive to think that deploying a new minimal proxy contract exclusive for every new minted token (like an ERC721 with totalSupply of ...
Rafael Werlang's user avatar
0 votes
0 answers
52 views

Uniswap V2 router contract call fails with TransferHelper: TRANSFER_FROM_FAILED

The scan link is here: https://wemixscan.com/tx/0x717a6385a15f896a08dc9e6ca3980cdd7443ca8a88a0ab5944522c61200c06a8 I'm trying to swap between WWEMIX(Wrapped Wemix token) for WEMIX$ (Wemix dollar) by ...
pheonixkid's user avatar
1 vote
0 answers
15 views

What does a name represent for a primitive variable such as uint256 ? How does EVM know a variable with a name is linked to a value on stack?

A primitive variable such as: uint256 var; or uint256 var = 0xffff; stores a value. And this value is on the stack of EVM. What exactly is the name 'var' ? How EVM knows 'var' points to 0xffff ? ...
Xirexor's user avatar
  • 127
1 vote
1 answer
17 views

When declaring a variable inside a function, why EVM always pushes 0 before any primitive value onto stack?

A simple declaration inside a function such as: uint256 var = 0xffff; has it's line executed in assembly (from Remix) like the following: push0 push1 0xffff swap1 pop Why was the 0 pushed to be ...
Xirexor's user avatar
  • 127
1 vote
1 answer
24 views

Why EVM does CALLDATALOAD and MSTORE an array parameter and its elements individually instead of CALLDATACOPY all of it?

I debugged a simple function execution on Remix: function megaTest(uint256[] memory p) external pure returns(uint256[] memory r) {} What I noticed is that CALLDATALOAD and MSTORE were used to copy ...
Xirexor's user avatar
  • 127
3 votes
1 answer
39 views

If returning string via assembly requires pointer, length and data in memory, why there is no pointer in memory when returning using return keyword?

1- Solidity: function name() external view returns(string memory) { return _name; // No pointer slot } 2- Assembly: function name() external view returns(string memory) { ...
Xirexor's user avatar
  • 127
1 vote
1 answer
42 views

How to calculate make precision calculations with very small ETH amounts?

In the given scenario that I have the following code, in which a user sets a token amount and an ETH amount, I want to determine a price of token using the following code: pricePerToken = (ethAmount * ...
Samuel Sandoval's user avatar
1 vote
1 answer
16 views

VM Exception while processing transaction: revert while buy token

I built a token based on ERC20, when I try to buy tokens I get this error In the truffle console Quinn.deployed().then(function(ins){token=ins}) QuinnSale.deployed().then(function(ins){tokenSale = ins}...
Mizanur Rahman Sohan's user avatar

1
2 3 4 5
21