Questions tagged [storage]
all questions regarding data and storage on the ethereum blockchain
81
questions
68
votes
5
answers
59k
views
What is the cost to store 1KB, 10KB, 100KB worth of data into the ethereum blockchain?
Whatever is stored in the blockchain is immutable which means I can fetch this data back in the future. As of today (2016-feb),
How does one store a 1kb, 10kb, or 100kb or arbitary data/text in the ...
51
votes
2
answers
19k
views
Is there a (theoretical) limit for amount of data that a contract can store?
Is there a theoretical limit to the amount of data that one contract can store while running in a private net in which gas is not a concern?
Context: In a financial Dapp which is to replace global ...
40
votes
3
answers
15k
views
Difference between Memory and Storage?
What is the difference between Memory and Storage ?
From both the EVM point of view and the contract design one.
Thanks!
20
votes
2
answers
5k
views
Can a contract access another contract's storage?
I have a contract with numerous complex structs. Is it possible for a second contract to iterate over this data directly?
I can't really use public accessor/getter methods as it's not possible to use ...
142
votes
1
answer
54k
views
What is Swarm and what is it used for?
What is Swarm and what is it used for? And what is Swarm's relationship with Whisper?
40
votes
5
answers
41k
views
How can I store data in ethereum blockchain
I want to store pdf hash in blockchain
I already read this post What are some proposed ways of storing data in Ethereum?
But I'm beginner in this domain and I don't understand...
Is it possible to ...
33
votes
3
answers
22k
views
Where is the state data stored?
This question was asked on Reddit a while ago:
Where is the state data actually stored though? On the hard drive of each node? Separate from or within the blockchain?
— Reddit: Basic ...
11
votes
1
answer
8k
views
What are some proposed ways of storing data in Ethereum?
I keep reading that swarm or ipfs would be used for storage, but how would that work exactly? Would an ethereum contract store its data in these data blockchains? I thought ethereum smart contracts ...
56
votes
2
answers
26k
views
What does the keyword "memory" do exactly?
I've been looking through the code of Etherdice and noticed that some variables are declared like
ParserResult memory result;
and I haven't found the keyword "memory" in any documentation.
...
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?
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 ...
112
votes
6
answers
55k
views
What is the difference between Swarm and IPFS?
IPFS seems a little slow on existing dapps. will Swarm load content more quickly? Also- is there a roadmap for swarm?
51
votes
4
answers
12k
views
Is there anything stopping me from using the ethereum blockchain as data storage?
As I understand it, smart contracts are currently immortal by default. Does this mean that I could create a contract that happened to contain an encoded form of baby photos and have it stored forever? ...
19
votes
2
answers
2k
views
Can a contract's internal storage keep increasing forever?
In other words, is there a limit on the amount of storage a contract can hold?
Suppose a field is an Array for instance, and the contract has a method for adding items. Can I keep calling the ...
8
votes
1
answer
1k
views
How is contract storage arranged?
Thinking about smart contract storage, how is the data arranged?
I know that every variable within a contract has an unique ID, therefore, it's possible to create a node with a structure like <...
18
votes
2
answers
7k
views
Ethereum event log maximum size
I'm thinking of storing some data in logs by emitting events but I cannot easily find the answers to the following questions:
What is the total size limit of one event?
Can I store lots of string32 ...
12
votes
1
answer
6k
views
How can I store big files on the blockchain?
I can hardly create transactions larger than 100kiB. I am wondering, is it possible to store huge files (several MiB or GiB) on the blockchain?
If so, how?
5
votes
1
answer
598
views
Why does zero to non-zero in storage take higher gas?
According to EIP-1087 https://eips.ethereum.org/EIPS/eip-1087 , it take 20,000 gas to set a slot from 0 to non-zero with SSTORE while it takes only 5000 gas for any other change. Why does 0 to non-0 ...
4
votes
1
answer
14k
views
How do you store image in the Ethereum Blockchain efficiently? [duplicate]
I don't think it makes sense to store the "entire image" on the blockchain. I thought it would be better to store a reference to that image, but that means the actual image file will still be in a "...
34
votes
3
answers
41k
views
TypeError: Data location must be "storage" or "memory" for parameter in function, but none was given
/// @dev Adds a new transaction to the transaction mapping, if transaction does not exist yet.
/// @param destination Transaction target address.
/// @param value Transaction ether value.
/// @param ...
26
votes
4
answers
27k
views
How to fill dynamic in-memory array
For some reason solidity doesn't allow to push values into memory array
Member "push" is not available in bytes32[] memory outside of
storage.
Here is sample contract code:
pragma solidity ^0.4....
15
votes
3
answers
49k
views
Where does metamask store the wallet seed? (file path)
I have a Windows installation that cannot be booted anymore.
I'd like to copy the file containing the Metamask wallet seed to another machine and have that Metamask installation use it.
The same ...
14
votes
3
answers
2k
views
Is there a functional equivalent to Factom in Ethereum?
Factom is a distributed data and records management and audit system. How easily can what Factom does be done in Ethereum? Are there any working DAPPS doing this? Could a simple smart contract take ...
12
votes
2
answers
3k
views
Why does delete increase overall gas cost?
My understanding is there is a gas refund for delete and the idea is to encourage developers to remove garbage from contract states.
Consider this contract with a delete-enabled index of keys to ...
11
votes
2
answers
18k
views
How does data storage on the blockchain work?
If I store file chunks in the blocks, I'm causing duplicated blocks all over the networks (I mean, my file's chunks will be in each computer on the blockchain network, So eventually I have many many ...
8
votes
1
answer
1k
views
What is the composition of the blockchain database?
From axic's explanation of the structure of the ethereum database, we learned that data is stored in Merkle Patricia tries, usually inside a LevelDB store. It consists of structures such as blocks, ...
8
votes
1
answer
2k
views
How does Ethereum fit a mapping into storage?
Probably a silly question, but how does Ethereum fit a mapping into storage? I am used to simple types like arrays, so I don't understand how "Solidity's mapping uses the entire 256-bit ...
7
votes
3
answers
1k
views
Efficient Solidity storage pattern for a directional weighted graph
I would like my graph's nodes to each have a struct of data and 0 or more pointers to other nodes.
It needs to be efficient for insertions of new nodes in between two existing nodes.
Should I use ...
28
votes
1
answer
3k
views
Is searching data stored in event logs prohibitively slow?
Augur uses event logs to store data that never needs to be accessed on-contract, since it is about 10x cheaper than on-contract storage. However, I've noticed that retrieving event logs (e.g., using ...
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?
16
votes
1
answer
15k
views
Nested structs in solidity?
Is it possible to have a struct inside a struct?
I am not sure about the data type internals, but I was basically trying to do something like (pseudo-code):
library IpfsUtils {
struct IpfsHash {
...
9
votes
1
answer
799
views
Truffle framework with storage
How can I integrate truffle with swarm or ipfs for permanent document storage?
Are there any libraries?
8
votes
2
answers
4k
views
DApp storage for data other than tranactions?
For the purpose of illustration, say I would like to create a decentralized version of Yelp.
A centralized approach would be to have a restaurants table and a reviews table in an Mysql database. In ...
7
votes
3
answers
1k
views
Why can't smart contracts access events
Looking through posts here most refer to the doc saying that smart contracts can't access event data.
The Log and its event data is not accessible from within contracts (not even from the contract ...
7
votes
1
answer
364
views
How do I Zero Storage
I am trying to delete all the players that played a turn in a game.
The contract is not meant to permanently store a list of players, it
simply keeps track of players that have played in the current ...
7
votes
1
answer
2k
views
What's cheaper — contract storage | log data | transaction input?
I want to collect user data and store it on the blockchain. Let's say I need to store usernames. Is the cost of storing 1 byte on the blockchain different for contract storage/log data/transaction ...
6
votes
3
answers
2k
views
Where are the smart contract constants stored?
I want to double-check something.
I had been writing upgradable smart contact that uses a lot of constants.
As far as I can see, smart contracts aren't storing constant variables in their storage.
...
6
votes
2
answers
6k
views
How can I estimate price of data storage? [duplicate]
I'd like to make estimations of the cost of an application, and one of the things I need is the price to store n kB of data on a contract. In ether and in USD.
Where could I find rates or prices of ...
4
votes
1
answer
515
views
What prevents the blockchain from being poisoned by copyrighted or illegal data?
It's possible to store data in smart contracts, and with the recent explosion of NFTs this is happening a lot. A couple of hundred kB is more than enough to encode copyrighted material - e.g. the text ...
4
votes
1
answer
2k
views
How to read high-level storage variable from inline assembly?
This code does not compile:
pragma solidity >=0.8.0;
contract MyContract {
uint256 public foo = 314;
function myFunction() external view returns (uint256 result) {
assembly {
...
3
votes
1
answer
951
views
Ethereum storage implementation at the database level - how is it stored
I have read the yellow paper many times as well as various articles, I suppose if I cannot find the answer here - I will look into the code.
My understanding is that each contract account contains a ...
3
votes
1
answer
1k
views
Gas cost of setting a state-variable to the same value
According to this spec, setting a state-variable to the same value consumes 200 gas.
However, I conducted a test over ganache-core v2.10.2, and the result was closer to 800 gas:
Solidity Contract:
...
3
votes
2
answers
3k
views
Why is storing via sstore more expensive than via events mechanism?
I just do not understand why emit Event(...) is cheaper than a = b. The only difference I noted between events and storage variables is that event logs is not accessible from Solidity. But both of ...
2
votes
2
answers
1k
views
Storing a document with multiple large video files
What's the best way to store a document with multiple large video and CAD files on Ethereum. I am just a beginner to Ethereum. The document is a science experiment with multiple documents linked.
I'd ...
1
vote
2
answers
10k
views
Default getter and setter for mapping in solidity
In my smart contract, I have a public mapping as mapping (uint=>User) public users where User is a Struct. Is there any way to get the values of this mapping using a default getter?
For Example : ...
1
vote
0
answers
2k
views
As of Feb 2016, how big is the ethereum blockchain size and its monthly growth rate? [duplicate]
As of Feb 2016, how big is the ethereum blockchain size and its monthly growth rate? Does the blockchain implement anything with pruning to reduce its size in the near future?
1
vote
1
answer
491
views
Unexpected behavior with storage keyword?
Could someone explain to me what exactly happens when I declare a storage pointer?
This example highlights the issue that I have encountered:
contract minimum {
uint256[] a = [1,2,3,4];
function ...
1
vote
1
answer
12k
views
Type error: memory is not implicitly convertible to expected type
I have a function that returns a list of BetProposition smart contracts:
function getBetsForMatchup(uint matchupIdentifier) public returns (BetProposition[]) {
return bets[matchupIdentifier];
...
1
vote
2
answers
8k
views
Is it possible to insert some custom data in the DATA field of an Ethereum Transaction?
i am working on trying to get some data encoded/inserted into an ethereum transaction.
Let me describe my environment first, i am using Web3py, Ganache and Remix IDE. I am able to successfully ...
18
votes
3
answers
20k
views
How to initialize an empty array inside a struct?
Is there a mistake in the way I initialize Bar b in the function foobar?
contract Foo {
struct Bar {
address owner;
uint[] x;
}
Bar[] public bars;
function foobar(...