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 ...
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 ...
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') ? ...
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.
...
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]
...
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 ...
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 ...
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[...
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://...
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 ...
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.
...
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 ...
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 ...
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 (...
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);
}
}
...
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 ...
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 ...
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....
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 ...
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...})
...
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 ...
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 ...
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. ...
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.
...
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....
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.
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: ...
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 ...
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 ...
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
...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
eth-call × 59solidity × 10
contract-invocation × 10
web3js × 8
go-ethereum × 7
json-rpc × 6
ethers.js × 5
transactions × 4
evm × 4
python × 4
abi × 4
ether × 3
uniswap × 3
infura × 3
send × 3
web3.py × 2
ganache × 2
nodes × 2
out-of-gas × 2
bytecode × 2
fallback-function × 2
opcode × 2
transfer × 2
static-call × 2
contract-development × 1