Skip to main content

Questions tagged [storage]

all questions regarding data and storage on the ethereum blockchain

Filter by
Sorted by
Tagged with
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 ...
Patoshi パトシ's user avatar
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 ...
SCBuergel's user avatar
  • 8,784
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!
Hcharlanes's user avatar
  • 1,135
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 ...
slothbag's user avatar
  • 443
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?
eth's user avatar
  • 86.3k
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 ...
wxcvbn's user avatar
  • 837
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 ...
J-B's user avatar
  • 8,961
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 ...
Patoshi パトシ's user avatar
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. ...
uberlaufer's user avatar
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?
ronme's user avatar
  • 1,045
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 ...
ethinterest's user avatar
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?
bamos's user avatar
  • 1,944
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? ...
Shelvacu's user avatar
  • 1,405
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 ...
Fernando Tiberti's user avatar
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 <...
Henrique Barcelos's user avatar
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 ...
Aldekein's user avatar
  • 412
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?
q9f's user avatar
  • 33k
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 ...
Naveen V's user avatar
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 "...
0xgoku's user avatar
  • 471
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 ...
CryptoScroller's user avatar
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....
Alex Zhukovskiy's user avatar
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 ...
Jesbus's user avatar
  • 10.5k
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 ...
Joël's user avatar
  • 1,720
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 ...
Rob Hitchens's user avatar
  • 55.5k
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 ...
Roy Kuper's user avatar
  • 153
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, ...
MrChico's user avatar
  • 1,786
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 ...
Sam Lincoln's user avatar
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 ...
Jesbus's user avatar
  • 10.5k
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 ...
tinybike's user avatar
  • 535
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?
BlockA's user avatar
  • 857
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 { ...
bumi's user avatar
  • 348
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?
samurai jack's user avatar
  • 1,125
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 ...
jytoronto's user avatar
  • 195
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 ...
mohamed azaiez's user avatar
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 ...
user3400139's user avatar
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 ...
manidos's user avatar
  • 4,308
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. ...
Sky's user avatar
  • 2,370
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 ...
Teleporting Goat's user avatar
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 ...
Robert's user avatar
  • 141
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 { ...
Paul Razvan Berg's user avatar
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 ...
user2584960's user avatar
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: ...
goodvibration's user avatar
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 ...
Andrew's user avatar
  • 133
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 ...
Adrian33's user avatar
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 : ...
Shubham Naphade's user avatar
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?
Patoshi パトシ's user avatar
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 ...
cabeer's user avatar
  • 105
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]; ...
user339946's user avatar
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 ...
Muhammad Yasir's user avatar
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(...
Manan Mehta's user avatar