Skip to main content
Share Your Experience: Take the 2024 Developer Survey
8 votes

Can precompiles have state?

The existing precompiled contracts in Ethereum primarily handle specific computational tasks optimized for performance, and they have been stateless/pure mainly for design reasons, not because of ...
MShakeG's user avatar
  • 1,693
5 votes
Accepted

How to read private immutable field?

Summary You can examine the bytecode of the contract to find the value, the same applies for constants. This way, you could find any value. You would have to examine the contract bytecode to figure ...
Patrick Collins's user avatar
5 votes

Why does mload(0x40) result in 0x20?

Your reasoning is correct, but only for values of type bytes32 or uint256. The next code will return 0x80 function mloadTest1() public pure returns(bytes32) { bytes32 a; assembly { a :=...
Alexey Smirnov's user avatar
4 votes

Any materials to study EVM?

Learning the same thing at the moment, I'll be glad to share some amazing resources i found: A awesome list of great EVM learning resources An other list of curated EVM learning resources The go ...
Torof's user avatar
  • 782
4 votes
Accepted

Any materials to study EVM?

It's a good question. There are few EVM learning resources because it is an advanced, modern, topic in a niche industry. Most people who work with EVM already have an understanding of Virtual Machine ...
Mikko Ohtamaa's user avatar
4 votes
Accepted

Why does mload(0x40) result in 0x20?

Unlike value types like bytesN or uintN reference types (denoted by their memory, calldata or storage annotation) are merely pointers to their underlying data. When you use inline-assembly to set a ...
Philogy's user avatar
  • 627
3 votes

invalid opcode: opcode 0x5f not defined

Instead of going back to an older version of Solidity compiler, in hardhat to prevent use of PUSH0 you can try setting evmVersion to a previous version (e.g. paris, which is the one before shanghai) ...
SKYBITDEV3's user avatar
3 votes

Facing issues while running Chainlink node on XRPL EVM Sidechain network

The error messages you're seeing indicate that your Chainlink node is having difficulty communicating with the XRPL EVM Sidechain network. The warning message suggests that the node is not receiving ...
Kirill Balakhonoff's user avatar
3 votes
Accepted

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

As of 2023-10-01 all opcodes take a fixed number of stack inputs. https://ethereum.org/en/developers/docs/evm/opcodes/ Some opcodes, like call, accept an arbitrary amount of data, but they receive the ...
Ismael's user avatar
  • 30.5k
3 votes

Why aren't more common algorithms done as precompiles?

Usually the cryptographic algorithms are considered most important for the blockchain functions, so they are implemented as precompiles first. From what I understand, quite a bit of work and reasoning ...
Bruce's user avatar
  • 967
3 votes
Accepted

Do all EVM chains use the same minimum transaction gas of 21000?

No, not all EVM chains use 21,000 as a minimum transaction gas, and unfortunately, there's no universal explanation for why this is so. Each chain has implemented a unique gas metering system suited ...
Paul Razvan Berg's user avatar
2 votes

Why is my foundry test contract not deploying to the 0xb4c79daB8f259C7Aee6E5b2Aa729821864227e84 address?

@xana Sorry address 0x7FA9385bE102ac3EAc297483Dd6233D62b3e1496 is consistent as for myself as well the same deployment address pops up
Capt Python's user avatar
2 votes

OPCODES WHY DOES free memory pointer(0X40) use 0x80 as starting value?

First of all what exactly is a free memory pointer ? Free memory pointer points to a place where we can store whatever we want in memory right now meaning; we can store something right there in that ...
pv0's user avatar
  • 21
2 votes

transfering msg.value from user to contract give error

That is not the correct way to send ether from the user to the contract, you must do it in the call to buyCourse(), not inside. The contract cannot get ether from the user wallet, but receive it. In ...
ceseshi's user avatar
  • 740
2 votes

How to avoid vaue field in remix ide and send send msg.value directly from function

This is not possible. Contract function can't simply take ether from your wallet. The only way to send ether to a contract is by defining the value field, which you are trying to avoid. This however ...
Nal Luksic's user avatar
  • 1,157
2 votes
Accepted

How does the EVM stack behave between calls to remote contracts

Stack and memory are part of the call. Every call has its own stack and memory, which start from empty. So, using your words, stack and memory belong to the EVM, not to the contract. If you have a ...
0xSanson's user avatar
  • 3,249
2 votes
Accepted

Is the ether rewarded specified by the Ethereum client?

the amount of Ether or Wei that a validator or miner is rewarded is determined by the Ethereum protocol and is not specified by the Ethereum client itself. The Ethereum protocol includes rules for ...
Canard Coca's user avatar
2 votes

Can I say that gas cost is generated due to the EVM Read/Write of opcodes?

Gas is used not only to pay miners, now stakers, in exchange for executing smart contracts and transactions, but mostly it acts as a safety mechanism used to deter malicious actors from submitting ...
Rohan Nero's user avatar
  • 1,607
2 votes
Accepted

Am I able to see the EVM code?

If you look for it there are tons of documentation and actual implementations and tutorials of how to do; I'll link you couple, you do the rest. Building: https://noxx3xxon.notion.site/Building-an-...
Torof's user avatar
  • 782
2 votes

Is it possible to combine signing two cross-chain transactions into one single signing?

This is why we have chainId. Basically whenever you sign a transaction on an ethereum based blockchain, the chainId is included in that signature. BSC chainId is 56, and eth mainnet is 1. So if you ...
Bruce's user avatar
  • 967
2 votes

Why is Transaction Value showing 0 ETH on Etherscan?

Since you are using Coinbase, the initial transaction you made didn't really contain the ETH, but instead, it made a contract call that triggered the actual transaction to send the ETH from Coinbase's ...
Rohan Nero's user avatar
  • 1,607
2 votes

Why is Transaction Value showing 0 ETH on Etherscan?

This is not a transfer transaction. Rather, the transaction is the execution of a function of the smart contract. After executing this function of the smart contract, a number of internal transfer ...
Benyamin Karimi's user avatar
2 votes
Accepted

Determine compiler used to create a given bytecode

You can use the bytecode metadata1 to determine the smart contract language and the compiler version used to compile the bytecode. Both compilers include bytecode metadata by default2. Get the ...
ardislu's user avatar
  • 537
2 votes

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

No, that's a core functionality of Ethereum. it can't be altered from outside. Also this type of functionality can introduce more attack vectors.
Zartaj Afser's user avatar
  • 4,221
2 votes
Accepted

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

A contract that uses an opcode that is subsequently removed would no longer be working (its behavior would be unspecifiable). However, to my knowledge, no opcode has ever been removed from Ethereum. ...
Paul Razvan Berg's user avatar
2 votes

How was the Ethereum 0x0 address generated?

It was not generated. Addresses can exist without having a matching private key. No one can access tokens at this address.
Mikko Ohtamaa's user avatar
2 votes
Accepted

Rebasing tokenomics

The reason I asked for the value of n is because it is the only part affecting your code. I tried implementing the same logic and guess what, I found out that when I gave undervalue a value of 1 ether ...
Zartaj Afser's user avatar
  • 4,221
2 votes
Accepted

How does opcode JUMP work in the EVM?

Yes, The JUMP instruction uses a value from the stack and alters the program counter, thus breaking the linear path of the execution to another point in the deployed code. The value of the counter in ...
Alexey Smirnov's user avatar
2 votes

How to implement the below solidity code in golang? especially the `abi.encode` function?

You can make the similar encoding go-ethereum package. Load the abi file as abi.ABI object: abiObject, err := abi.JSON(strings.NewReader("pathToAbiFile")) if err != nil { ...
Bapi Reddy's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible