Skip to main content
9 votes

Trying to understand the difference between trace_call and debug_traceCall methods

API methods trace_* namespace was originally used in the openethereum client (which is currently unmaintained), some other clients such as erigon also provide this namespace. While debug_* namespace ...
hack3r-0m's user avatar
  • 1,929
7 votes

How to get reason revert using web3.eth.call

Web3 supports revert strings now: https://web3js.readthedocs.io/en/v1.2.8/web3-eth.html#handlerevert. You can activate it easily by setting web3.eth.handleRevert = true. Now when you use call or send ...
Markus - soliditydeveloper.com's user avatar
7 votes
Accepted

How to get reason revert using web3.eth.call

Try this, async function getRevertReason(txHash){ const tx = await web3.eth.getTransaction(txHash) var result = await web3.eth.call(tx, tx.blockNumber) result = result.startsWith('0x') ? ...
Meet Siraja's user avatar
6 votes
Accepted

How can I tell if a node I am using is a full archive node?

A full archive node has access to the historical state of the blockchain. For example, if the node returns balance of an account (which has some eth) at block 1 then that node will be an archive node. ...
Ankit Chiplunkar's user avatar
6 votes
Accepted

Call another contract with huff?

This is close! When you're storing the four byte function selector, you're actually storing 32 bytes where the selector is to the right. 0xaabbccdd // [selector] 0x00 // [offset, selector] ...
jtriley.eth's user avatar
5 votes

Trying to understand the difference between trace_call and debug_traceCall methods

trace_call is an API method that allows you to execute the given call and returns the number of possible traces for it. These traces include transactions that have been mined or hypothetical ones not ...
Yongjian P.'s user avatar
  • 4,308
5 votes
Accepted

What happens when you use multiple "call" arguments?

The low-level .call function allows you to call a function by its function signature calculated as bytes4(sha3("functionName()")). Also take a look at https://ethereum.stackexchange.com/a/9722/16 and ...
SCBuergel's user avatar
  • 8,784
5 votes

web3py - Function Call when Sender Must Be Certain Address

Web3.py's ContractFunction.call method accepts a dictionary of transaction parameters in the same way as ContractFunction.transact. For example, if you wish to call the method from web3.eth.accounts[...
iamdefinitelyahuman's user avatar
4 votes
Accepted

What are the best online tools to easily make json rpc calls?

I've found the following 3 tools to be very useful for different use cases. https://ethereum.github.io/execution-apis/api-documentation/ https://abi.ninja/ https://justsmartcontracts.dev/#/ https://...
MShakeG's user avatar
  • 1,855
4 votes
Accepted

How to decode the output of an eth_call that returns a Tuple[]

After re-reading https://docs.soliditylang.org/en/latest/abi-spec.html#use-of-dynamic-types with a fresher brain, I understood that the way the bytes are divided is as follows: first 32 bytes: offset ...
pestopasta's user avatar
4 votes
Accepted

Recommended way to remove ETH balance from a contract?

You are right. But the thing is, even the gas cost of opcodes can be increased in the upgraded version and it is evident in EIP1884 during Istanbul hard fork, where gas cost for sload increased. ...
Zartaj Afser's user avatar
  • 5,320
3 votes

The block number argument in ETH JSON-RPC function calls

The result is based on the state at the end of the previous block. This means the start of the block. Edited: Sorry I need to be more specific here. For historical transactions, you need to specify ...
Wuzhong - DevEx's user avatar
3 votes
Accepted

The block number argument in ETH JSON-RPC function calls

For the JSON-RPC API functions you mentioned (eth_getBalance, eth_getCode, eth_getTransactionCount, eth_getStorageAt, and eth_call), the result of the function call with a historical block number ...
JakuAme's user avatar
  • 96
2 votes

Can I get the return value of a .call from a contract from the Blockchain?

Low-level calls are just a tiny bit above inline assembly, so you can use inline assembly to emulate this feature. Something like this: function get(address _addr, string _func) public view returns (...
Aquila's user avatar
  • 1,822
2 votes
Accepted

Why does this throw a stack underflow error?

Try adding the constant modifier as follows: pragma solidity ^0.4.10; contract Test { function getSha256(uint32 nonce) constant returns (bytes32 hash) { return sha256(nonce); } } ...
BokkyPooBah's user avatar
  • 40.4k
2 votes
Accepted

How to understand from web3py if I need a transaction or a call

Emitting an event is also modifying operation, because events are recorded in blocks. Though, if you don't need event to be visible to others, you may do the following: Invoke function locally via ...
Mikhail Vladimirov's user avatar
2 votes
Accepted

Why field `data` in `eth_call` optional?

Documentation can be is a bit misleading here, I think because it aims to simplicity. The following statement from the current RPC official documentation: data: DATA - (optional) Hash of the method ...
Giuseppe Bertone's user avatar
2 votes

Why field `data` in `eth_call` optional?

When data is empty (and there is no receive ether function) the fallback function will be called. See: https://solidity.readthedocs.io/en/v0.6.8/contracts.html#fallback-function Prior to Solidity 0....
Dirk Jäckel's user avatar
2 votes
Accepted

got response data to nonsencical eth_call request. What is that response?

You are sending to 0x0000000000000000000000000000000000000002 which is the precompiled contract for SHA256. It is returning the SHA256 of data field, which is an empty string, result is ...
Ismael's user avatar
  • 30.3k
2 votes
Accepted

Race conditions in brownie, how to guarantee this will execute in order?

To 100% guarantee that this will execute in order, you can wait for a transaction to be mined. initial = contract.getTest() set_transaction = contract.setTest(1, {"from": 0x123123123...}) ...
Patrick Collins's user avatar
2 votes

The low-level functions call, delegatecall and staticcall return true as their first return value if the account called is non-existent

You could use Address.isContract() from the OpenZeppelin contracts. There's no way to determine if the callback was executed or no. It shouldn't be too important since many important contracts use a ...
Ismael's user avatar
  • 30.3k
2 votes
Accepted

Out of gas ethernaut lvl 10 - reentrance

The problem is that your amount is 0.0001 ether, and the Reentrancy contract balance is 0.001 ether, and after you send it 0.0001 it will be 0.0011. So, your attack needs to make 11 recursive calls to ...
Jeremy Then's user avatar
  • 4,649
2 votes

How to decode the output of an eth_call that returns a Tuple[]

If you look at the source code of the contract, the return type of the function getAllReserveTokens is TokenData[] memory which is an array of a custom struct defined in the storage of the contract. ...
0xOsiris's user avatar
  • 149
2 votes
Accepted

Hardhat localhost issue "Calling an account which is not a contract" with read functions only?

The address you are using is a contract on Ethreum mainnet. But not on Goerli. So when you call for balanceOf, there is no code at this address. Instead of forking Goerli you should fork the mainnet. ...
MadeInDreams's user avatar
  • 1,615
1 vote

Extract transaction details from uniswap eth_call event

Using as an example this tx, you get the inputData for a muticall function. Using web3py, with abi being the JSON copied from Etherscan for the Uniswap v3 router at address 0x68b... r = web3.eth....
Nicolas Bernard's user avatar
1 vote
Accepted

calling transfer of ERC20 token using call function is not working

You always need to approve this contract address to be bale to manage your funds externally. You will need to do is using the token's approve function.
AvocadoChocolate's user avatar
1 vote

eth_call to call a function in my solidity contract fails with "execution reverted"

How parameters in a call are encoded is defined in the Contract ABI Specification. All fixed size types are first padded to 32 bytes. In you case you have: address: ...
Ismael's user avatar
  • 30.3k
1 vote

Why does the `DoCall` function use the first account by default?

This is only the Call API expose to everyone then from is not deal. The state is only temporarily for execute the call and cannot update any real state so it do no harm at all. You can see on the ...
Tony Dang's user avatar
  • 2,161
1 vote

Transfer ether between two addressrd using call

A contract only has access to its own funds. (bool success, ) = owner.call.value(100)(""); This code send 100 wei from the contract's balance to owner address. If no units is given solidity ...
Ismael's user avatar
  • 30.3k
1 vote
Accepted

Custom bytecode logs data but doesn't return it on eth_call, why not?

I tried this in remix and it worked as expected web3.eth.sendTransaction({ data: “0x684160005260206000f360005260096017f3", from: "0x...."}) The input data works as follow ...
Ismael's user avatar
  • 30.3k

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