Questions tagged [get-storage-at]
Questions about web3.eth.getStorageAt which allows reading a contract's storage
28 questions
1
vote
0
answers
27
views
how to prevent array from occupying slots in solidity
I have this simple contract
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.8;
contract Ejemplo {
//[123,456,789] input
function test(uint256[] calldata nums ) external {
}
}
...
3
votes
3
answers
964
views
How to view the amount of storage a contract uses?
Is it possible to view the amount of storage a smart contract uses from an existing tool? Or if not is it possible to determine it by making json rpc calls?
There are a few similar questions such as ...
0
votes
1
answer
153
views
Getting all storage keys indexed by a smart contract - getStorageKeys or parity_listStorageKeys
I've seen that the functions getStorageKeys or parity_listStorageKeys have been discontinued from the most popular clients. Thus, the developer only has access to getStorageAt (I'm using etheres.js. ...
1
vote
0
answers
521
views
Retrieve Storage Variable Name given Storage Location and Contract Source
Is there any easy way to get the storage variable names provided you have the source code and the storage locations of the variables for a contract? For example, for the following contract I can use
...
1
vote
0
answers
225
views
particia merkle trie and level db architecture efficiency
I'm trying to gain as granular understanding of the use of MPTs and the underlying database as possible. The following is an excerpt from the particia merkle trie article on ethereum.org
That is, ...
1
vote
2
answers
2k
views
Accessing storage of a map of a map
I would like to access the storage of a specific contract using ethers.js and getStorageAt, but I can't get my head around how to do this for the mapping(address => mapping(address => address)) ...
1
vote
1
answer
286
views
How to use window.ethereum to read from EVM storage slots since window.web3 got deprecated in latest metamask update?
I was playing Capture the Ether challenge and in one of the challenge we had to read data from storage slot in the EVM.
I referred this medium article: https://medium.com/@saurfang/lets-play-capture-...
0
votes
1
answer
246
views
Read private large string
If you try to read from:
Polygon Mumbai: https://mumbai.polygonscan.com/address/0xB9545dFae31d62571f121C63D04Cf063c2EF8803#readContract
Field metadata at slot 0.
let hex = await web3.eth.getStorageAt(&...
1
vote
0
answers
91
views
web3 getStorageAt does not return expected mapping value
Beginner here, I dont manage to get the value of a mapping key.
Network is Fantom.
Contract Adress is 0xce761D788DF608BD21bdd59d6f4B54b2e27F25Bb.
mapping variable is adventures_log
Key is 1125349.
I ...
0
votes
1
answer
660
views
Read private variable from different contract in Solidity [duplicate]
I know that if I use the web3 family of libraries, I can use
web3.eth.getStorageAt
to read any variable I like directly from the storage of a smart contract. Is there a way to do this from a smart ...
3
votes
2
answers
944
views
Modify storage in Ganache or Hardhat Network?
I have an orchestrated contract with a function that can only be called by another contract.
While struggling to find an elegant solution for writing a unit test, I realised that I could circumvent ...
4
votes
1
answer
1k
views
How to download the blockchain of a single ethereum contract’s address?
The blockchain required to run ethereum is several Terabytes large. This means more than 9 years would be required to download it with my connection speed.
In my case, I just want to know if the ...
4
votes
1
answer
274
views
Most efficient way to get all non-zero storage locations for a smart contract?
I'm looking at a mainnet smart contract and want to figure out all storage positions/slots where the storage has a non-zero value.
Is there a way to do this other than replaying and tracing all ...
2
votes
0
answers
58
views
Finding the memory position of a mapping [duplicate]
I want to read data from an internal mapping variable using getStorageAt(), but this requires knowledge of the index where that variable is stored in memory.
The documentation says:
Due to their ...
0
votes
1
answer
443
views
Web3 behaves different on the client and server with different providers
I'm trying to read a mapping storage variable from blockchain. Below, are my attempts, from client and server. Testing on Rinkeby network.
From client:
Metamask is installed and I'm trying from the ...
0
votes
0
answers
661
views
How is getStorageAt() used?
I have tested with eth.getStorageAt() and it shows what I think is 32 bytes of storage. But what is the point of this function? Are we meant to see unused space with it?
This is what I have:
> ...
1
vote
0
answers
68
views
Where in the compile process do storage indexes get assigned to variable names and where can I sniff that data?
I have found the articles explaining how storage works and I understand that if I have a mapping that I need to know the key. What I'm trying to do is figure out how given, solidity code, abi, and ...
1
vote
0
answers
60
views
All variables in the Storage
I am a newbie at Ethereum, could you clarify one question.
Is it possible to see all variables within Storage of the Contract? If I don't know how many variables it has and want to see the list of ...
2
votes
1
answer
742
views
How can I query data from contract storage?
If I have a contract like below:
contract wallet{
mapping (address => uint) balances
function send(){...}
......
}
and I deploy this contract on the ethereum.
When I want to query the ...
22
votes
2
answers
5k
views
How to read a private variable from a contract?
Given a contract, how can I find out the current value of one of its variables (as a dev, not from the context of another contract), if it's not public?
7
votes
2
answers
2k
views
Accessing to a dynamically sized array value in a contract
I'm trying I have this contract:
pragma solidity ^0.4.2;
contract ArrayContract {
address _owner;
uint256[] array;
function ArrayContract (){
_owner = msg.sender;
array....
2
votes
1
answer
807
views
What should be the input for getStorageAt function in web3 js?
I am trying to trace history of transactions in ethereum. I am using a function called getStorageAt(). Now what should be the input to this function, a contract address or account address(account no)?
1
vote
1
answer
212
views
how to access multiple values using getStorageAt?
I have a small smart contract that has 2 functions, one to set 3 numbers and another function returning these 3 numbers.
return(a,b,c)
samplecont.setnumbers(100,250,250)
samplecont.getnumbers()
...
4
votes
1
answer
1k
views
Need help understanding — web3.eth.getStorageAt
Let's say I have three state variables in my contract
contract A {
uint private x = 255;
uint[] y;
uint z;
}
As I understand it, x will have index 0, y index 1 and z index 2? Is it ...
4
votes
1
answer
787
views
getStorageAt: What if two transactions in the same block?
I use web3.getStorageAt to access historical information. I can specify a block to see the content of a variable in a given block. But one block can contain several transactions, each modifying this ...
19
votes
1
answer
4k
views
How do I get the storage indices/keys?
I would like to explore the storage data of a contract. I have geth fully synched and I interact with it over RPC. There is the function "eth.getStorageAt(addr, index, block)" provided, but you need ...
16
votes
3
answers
17k
views
What does web3.eth.getStorageAt() return?
I want to know how this works: web3.eth.getStorageAt(addressHexString, position [, defaultBlock] [, callback])
What data we can store at any address and how? And what will this eth API return?
10
votes
5
answers
7k
views
web3.eth.getStorageAt for mapping
How can I get contract mapping storage?
Considering this simple contract
contract Currency{
mapping(address=>uint) public balances;
function deposit(){
balances[tx.origin]++;
}
}
...