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
1answer
13 views

Transferring a value into a fallback function of a contract

I'm trying to figure out what happens when you send a value to a contract. If the destination address (to) is a contract, then the EVM will execute the contract and will attempt to call the function ...
0
votes
1answer
19 views

Need help with checking responses from balanceOf functions

So I have two contracts Contract A & Contract B Contract A is an ERC721 that allows for the balanceOf function to be called after passing it an address. It will return response of how many NFTs ...
1
vote
0answers
24 views

How to change/set values of a mapping through a function in solidity?

I have the following structure, with the mentioned mapping struct A { uint a; bool[100] b; } mapping(uint => A) public arr; I am using this function to set/...
0
votes
1answer
16 views

How to convert default two's complement representation to sign magnitude form?

According to this answer the EVM by default uses two's complement notation for handling signed integers. However for my application I would like to work with the sign-magnitude representation where ...
0
votes
1answer
21 views

Getting a pointer to `uint` in Solidity

I have a uint pos; I want to get a pointer to pos. In C, I would do something like: uint posptr = &pos; How to do something similar in Solidity? It's fine if it's in assembly.
0
votes
1answer
13 views

Why does changing a storage slot's value from zero to non-zero cost more than non-zero to non-zero in the sstore opcode?

Why does changing a storage slot's value from zero to non-zero cost more than changing from non-zero to non-zero, zero to zero, or non-zero to zero?
1
vote
1answer
85 views

Can an ERC-20 have more than 18 decimals?

I've seen most tokens use 18 decimals and USDC use 6 decimals. Is it possible for a token to have over 18?
0
votes
0answers
13 views

Use OpenZeppelin with clean Python

as i failed to use Brownie framework with Flask (i have another question about this matter on the forum Working with Brownie scripts using Flask), I am currently trying with plain Web3 and python to ...
0
votes
0answers
16 views

How to parse event logs (ERC-20 Transfer) from trace_call

I'm trying to get the event logs of a transaction (simulating transaction without actually adding it to blockchain). From trace_call, I am able to get vmTrace and a sample entry looks like this { &...
0
votes
0answers
19 views

Transaction interacting with contract used gas higher than estimated

I have a transaction interacting with a contract, I have used eth_estimateGas to calculate the gas limit because I do not have much ETH. Here are the eth_estimateGas params: { "jsonrpc": ...
1
vote
2answers
25 views

Is EVM deterministic?

Unlike something like JVM or CIL, EVM is said to be deterministic and understandably so when multiple nodes in a decentralized network have to simultaneously work together. But, EVM is also said to be ...
0
votes
1answer
31 views

Simulating a transaction's state change without writing to the blockchain

I'm trying to simulate a transaction to observe the state change and events that will be emitted, before sending the transaction to the blockchain. I'm interested in all the internal calls and state ...
0
votes
1answer
16 views

How does the EVM track the operations it performs when tallying up gas cost?

How does the EVM track the operations it performs when tallying up the gas cost of a tx? For example when a word is pushed to the stack - there is nothing in the solidity code explicitly saying to ...
1
vote
1answer
23 views

Why do Etherscan's opcode view and opcode disassembler show different opcodes for the USDT contract?

We have USDT smart contract, which is located at 0xdac17f958d2ee523a2206206994597c13d831ec7. I am trying to decompile the smart contract (at least view it as at opcodes). What I see is that it begins ...
0
votes
1answer
13 views

Why are failed transactions kept in node storage when querying eth_getTransaction...?

I'm querying an Alchemy node to get all the transactions from a single block. However, I see that it returns failed transactions. Why are these kept in the node's storage, and do they reflect only the ...
1
vote
1answer
27 views

How do contracts with timing functions get executed?

Let's say, there's a contract with timelock or vesting. In it there's a condition that check whether or not the right time has come, in order to release some tokens to some people. But said condition ...
0
votes
0answers
9 views

function call got a different result on remix and with web3js

i call the exact same function from the exact same contract on remix and got a different result that i had calling it with web3js. Actually remix give me the "good" result. All the others ...
0
votes
1answer
12 views

Gas costs of multiple Writes / Reads to same slot in transaction

I know that the EVM wants to charge for reading from slots, and even more for writing to those slots. That all makes sense. My question is, whether the EVM is smart enough to store in memory the ...
0
votes
1answer
11 views

If a contract call fails at require is the ethereum value returned to msg sender?

According to this and this answer any remaining gas after a require statements assert condition fails is returned/refunded back to msg.sender but what about any ETHER sent in that transaction call i.e....
0
votes
1answer
51 views

SendSignedTransaction TIMEOUT

I'm trying to sign data offline and then send signed transaction via web3.js Here's my code snippet: const {sign} = require('@warren-bank/ethereumjs-tx-sign'); const {Loader} = require("loader-in-...
1
vote
1answer
47 views

How to deploy a contract in Rinkeby, Ehereum, Polygon and Fantom with the same address?

I have noticed by doing some tests that when I publish the same contract on different networks, the address is the same. Then, the "Etherscan" of each network show a link to blockscan.com ...
0
votes
0answers
13 views

how to access contracts on a dapp-tools testnet with their address?

I have a json file like this : { "DEPLOYER": "0x3889c142090745AAa4803745739eE0a548204357", "CHANGELOG": "0xE3BAdfF0e84a551b8B53d5fac5aF9fB20f906898", ...
1
vote
1answer
34 views

Solidity function execution reverted. What is the wrong with my code?

I'm trying to get pairs reserves from QuickSwap but EVM reverts my calls. What's wrong with my code? interface IUniswapV2Factory { function getPair(address tokenA, address tokenB) external view ...
1
vote
1answer
85 views

What are the Pros and Cons of Managing Private Keys Directly vs Wallet Extension?

I would like to develop an app on an EVM compatible L1, however MetaMask currently does not have it on its list of supported networks. Hence the only alternative I can think off would be to manage ...
1
vote
0answers
50 views

EIP 1559 signed transaction stuck, now can't do anything on metamask either

contract_txn = weth_contract.functions.redeem(address, True).buildTransaction({ 'type': '0x2', 'chainId': 43114, ...
0
votes
0answers
106 views

EIP 1559 transaction for and swapExactTokensForTokens (Web3.py)

path = [TETHER, wAVAX, TIME] contract_txn = contract_TJ_ROUTER.functions.swapExactTokensForTokens( Web3.toWei(380.27, 'ether'), Web3.toWei(0, 'ether'), path , address_wallet, block['timestamp']+30 )....
0
votes
1answer
46 views

How to deploy ERC-20 token on Aurora and bridge it to Ethereum Mainnet?

Can I deploy ERC-20 token on Aurora and bridge it to ETH Mainnet ERC-20 contract? We plan to launch our token as Aurora native ERC-20, but we’ll need to bridge it to Ethereum and NEAR Protocol. Would ...
0
votes
1answer
21 views

Is it possible to upgrade the NFTs to Ethereum Mainnet using Aurora’s Rainbow Bridge? [closed]

For instance, we want to build our Marketplace on the NEAR chain. In Ethereum we can achieve this by an arbitrary Message Bridge (AMB) to relay data between two EVM-based chains. With a classic NFT ...
0
votes
1answer
13 views

Is it possible to map custom smart contracts to Ethereum?

We need snapshots (Snapshots allow to lock user's balances to prevent multiple votes with same tokens https://docs.openzeppelin.com/contracts/3.x/api/token/erc20#ERC20Snapshot) in the token smart ...
1
vote
0answers
18 views

"could not deploy due to insufficient funds", but still I have 0.000052197965366494 Ether. How could I solve this error?

Error: *** Deployment Failed *** "" could not deploy due to insufficient funds * Account: 0xDBC7A8105d32E4d6a80De11A94b0583047A7dbA5 * Balance: 52197965366494 wei * Message: ...
1
vote
0answers
24 views

transaction got reverted after call deposit function of weth, very strange behavior

address private immutable owner; IWETH private constant WETH = IWETH(0x358AA13c52544ECCEF6B0ADD0f801012ADAD5eE3); receive() external payable { if (msg.value > 0) { WETH....
1
vote
1answer
19 views

World state in Ethereum - Always 1 turn lagging?

About the data in Ethereum block header, there is the State root from the World state trie. However this World state trie contain the whole Accounts states (EOA + CA). In a block, we have transactions ...
2
votes
1answer
27 views

Is there an EVM compiler that supports coroutines? (e.g. generator functions)

With coroutine I mean a subroutine that can be paused and resumed from another subroutine; preserving its internal state across pauses and resumes. For example, a feature similar to: Javascript's ...
1
vote
0answers
27 views

The storage in EVM

I have 2 questions about the storage in the diagram bellow. 1- What is exactly content ? 2- Is it the same Storage which is store in the Account State under Hash form ("storage root hash")? ...
1
vote
0answers
12 views

Way to determine gas without deploying to blockchain?

Are there any nifty ways to determine what a smart contract call would need gas without actually deploying the contract to test net? Can I write solidity code -> compile it -> send runtime ...
0
votes
1answer
42 views

Decoding return bytes from Solidity `address.call`

If I call method x, which returns an address, in the Ethereum contract with address addr: (bool success, bytes memory returnVal) = addr.call(abi.encodeWithSignature("x()")); require(success, ...
1
vote
1answer
16 views

Are parameter names part of an Ethereum contract API?

If I change the names of method parameters in a public API of an Ethereum contract, will this break any caller's ability to call that API? The reason I ask is that I frequently see hashes of method ...
1
vote
1answer
19 views

Does Ethereum have a builtin package manager to prevent code duplication?

Does Ethereum have a package manager that is hosted on chain to mitigate code duplication? I've been learning Solidity development in brownie and as per my understanding in the brownie-config.yaml you ...
1
vote
0answers
56 views

Understanding performance optimizations of View Functions

First I understand that view functions cost no gas and they are run locally on the node that gets the call. I am curious about practical optimizations of view functions. To make things simple maybe a ...
0
votes
0answers
11 views

Using ERC721 or ERC1155

I was thinking of a case where each uri is set upon mint. The mint function takes in an amount to mint and a corresponding number of uri in an array. Then as the tokenID is increased, the current ...
0
votes
0answers
22 views

Ethereum Virtual Machine

Hi I have a question for with respect to Ethereum Virtual Machine . I understand every full node in ethereum network will have its own "Ethereum Virtual Machine" embedded in it .(One Full ...
3
votes
3answers
392 views

How does a smart contract "run on a blockchain" under-the-hood?

I'm quite new to the blockchain technology and I would like to understand a few concepts for which I couldn't find an in-depth explanation online. All the resources I examined so far explain the ...
0
votes
1answer
253 views

What is the upper limit of number of NFTs to be minted in one transaction with ERC1155 mintBatch function

This is the mint function I write in my contract. Each non-fungible token here represents a mobile device with a unique device ID and the device belongs to a certain owner. So apart from the token id, ...
0
votes
0answers
52 views

What is the upper limit of number of NFTs I can mint in one transaction with ERC1155 mintBatch function

This is a mintBatch function I adopt in my contract Basically I want to mint multiple non-fungible tokens (without metadata) to one address using this mintBatch function. I wonder if there is any ...
0
votes
0answers
11 views

interacting with an enum as an interface in other contract

having this issue of using enum as interface in other contract: will appreciate your help... // SPDX-License-Identifier: GPL-3.0 pragma solidity 0.8.9; interface interEnum { enum SIDE { ...
1
vote
1answer
19 views

How is function data encoded/decoded if a string exceeds the 32 byte length?

So function data input has a limit of 32 bytes. How exactly do the internals of the EVM work when you pass in a string arg that exceeds this limit? Does it pass a pointer to some value in memory ...
1
vote
1answer
137 views

Unable to transfer funds to contract address using Brownie

I have deployed a contract, testContract, onto bsc testnet I have a test wallet with sufficient funds and can seemingly make transfers to other wallet addresses without any issues. I am just trying to ...
0
votes
0answers
21 views

Would you help me understand what this decompiled contract code does?

I'm trying to understand what this contract does, I think it performs some kind of check to determine if a token is a honeypot or not, I hereby post the link to the decompiled code and the contract ...
0
votes
1answer
17 views

Is storage replicated through instances of deployment?

Say a contract has money stored in it and has already been uploaded to the blockchain. If I somehow get the source code to that contract and want to deploy that myself will the money that is stored in ...
0
votes
0answers
14 views

In Solidity, what structure is best to use when querying a small # of ordered elements whose size isn't fixed but max capacity is? Arrays or mappings?

Imagine a contract that required querying attributes of ordered elements whose number was not fixed but maximum capacity was, and that this maximum supply was relatively small (e.g. around ~100). ...

1
2 3 4 5
14