Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [storage]

all questions regarding data and storage on the ethereum blockchain

1
vote
0answers
23 views

Why is an address changing when I add it to an array?

I'm encountering a memory / storage issue (I think) w/ an array of addresses where I want to swap out one address with another. Here's how I've initialized the array: address[] public maintainers; ...
2
votes
2answers
21 views

How do I read an array inside of a struct?

as part of learning solidity and smart-contract development, I am developing a simple part management/tracking system. I have a struct and a mapping for a list of parts as such: struct Part { uint ...
0
votes
3answers
16 views

Is There any way to check if the entered key is having a corresponding value in a mapping or not?

Suppose In a banking system many people are enrolled (managed through mapping ) mapping (address => bool) enrolled; And only those can deposit who are enrolled in the bank. Can I check if ...
0
votes
1answer
19 views

How the data management is done in Ethereum blockchain?

Anyone who have a good idea about ethereum blockchain storage can send me some docs to get a good idea for myself? i am in a full confused state.
1
vote
2answers
33 views

Where are local variables of Primitive (Elementary) data types stored in Solidity

Though in the latest solidity compiler versions, it has been made clear that for reference variables local to a function, one needs to now explicitly mention its location modifier (memory, storage), ...
3
votes
1answer
8 views

In Solidity, how does the slot assignation work for storage variables when there's inheritance?

In a simple solidity contract, without inheritance, storage variables get assigned sequentially starting from slot 0. But in case of inheritance, the inherited variables appear before or afterwards?
1
vote
1answer
22 views

IPFS Versioning for dynamic content

is it possible to keep versioning in IPFS? Like im saving one row of record like pid:1, mid:3, status: started --> v1 pid:1, mid:3 status;completed --> v1.1 is there any way to implement ...
0
votes
1answer
26 views

Finding the memory position of mapping(address => uint) using JavaScript

I am wanting to read data from internal mappings with the following structures: mapping (uint256 => uint256) internal nums; mapping (address => uint256) internal addrToInt; Finding the memory ...
1
vote
1answer
51 views

Are constant state variables cached in the EVM?

From the docs: constant for state variables: Disallows assignment (except initialisation), does not occupy storage slot. Does this mean that the EVM caches constants across all contracts using ...
1
vote
1answer
20 views

Gas cost difference between uint[] and mapping(uint => uint)

When mapping for example a large integer to some integer, uint[] index; index.length = 1000000; index[600001] = 4; is it cheaper to use mapping(uint => uint) index; index[600001] = 4; ? one ...
0
votes
1answer
16 views

Membership in a set of strings

I'm looking solidity help in storing a set of strings and checking for membership in that set. I have a concrete and an abstract question on that: Concrete What is the data structure in solidity ...
0
votes
3answers
65 views

What are my blockchain options when I have terabytes of data to access?

I have several terabytes of relatively simple data, not much more complicated than the ledger storing ids, timestamps, simple metadata. I understand ETH storage costs are rather expensive. What are ...
1
vote
0answers
25 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 ...
1
vote
2answers
46 views

How To store data in ethereum network using truffle framework ?How to achieve the database layer in dapps?

I am creating a dapp which has to be a login authentication system and some datas has to be store in database. So I really cant' store all the datas in Solidity's variable or class object, it has to ...
0
votes
1answer
26 views

Can storage be referenced without being copied?

With for example struct Foo { mapping(address => uint) b; } Foo[] foo; if a function only deals with foo[4], can it reference it from storage without copying it? is that what function c() { ...
0
votes
1answer
17 views

Read List of Posts using struct

I tried to read a list of posts using the code below struct posts { bytes32 postTag; string post; address[] acceptedBy; uint8[] voteCount; } mapping(address => posts) totaluserPosts; ...
2
votes
0answers
29 views

Can we use Ethereum Swarm to store normal data other than blockchain or dapp data.

I want some basic data to be stored like name and city phone no etc.So just want to ask can I use ethereum swarm just to store file and make several node to create decentralized storage.
0
votes
2answers
34 views

What is the proper pattern to use a temporary variable and ensure it gets stored?

A contract has a state variable, which is complex. For the example, lets say it is a mapping of structs. Inside a method, I want to access that and store the changes. Like so: contract FooManager { ...
0
votes
1answer
27 views

cypto-signing in a smart contract -> verify the identity of a smart contract

my Question in short is: -> is it possible to digitally sign some data by a smart contract (e.g. with a secret key of the contract) and thus confirm that it was exactly this smart contract, who ...
0
votes
2answers
64 views

How to check if element of struct array has been deleted?

So let's say that I have struct A and an array A[] of struct A's I then fill 3 first indexes of A[] with some A's. I then delete second index of A[] and and want to test if it has been deleted. In ...
0
votes
2answers
42 views

How can I store and read data from Etherum blockchain? [closed]

I'm doing a project and I want to store some basic information on Etherum, for example: Name, ID, Height, Weight. How can I store this on the blockchain and after that be availble to read it. I read ...
1
vote
0answers
19 views

Gas cost of adding an item to a class-level (storage) array

I would like to make sure that the gas cost of adding an item to a (storage) array is constant, i.e., not dependent on the length of the array. To my understanding, the relevant EVM operation is ...
1
vote
1answer
120 views

Does Ethereum Swarm work?

I need to upload 8Tb data to Swarm. I read docs but I can't understand: does public swarm work?
2
votes
1answer
30 views

Data Search Complexity in Ethereum

I am new to Ethereum and wish to know that how is data for a smart contract fetched in Ethereum Blockchain. When we store the value of a variable in a smart contract, say simple storage (https://...
0
votes
1answer
16 views

Delete function affects my array in my struct

I am using the function mentioned below to delete a user (i added delete entityList[rowToDelete] to the function )My main issue is that the function deletes the user but somehow I lose the data in ...
1
vote
1answer
32 views

How can we calculate swarm storage cost?

I am trying to integrate ethereum to another fin-tech app, the basic idea is to store the transaction details on swarm and then pass the hash on ethereum network. I haven't used swarm earlier and I am ...
0
votes
1answer
41 views

Creating an automatically ordered pledge list. Can I do better in terms of gas?

Inspired by What's the best way to return top X values in a mapping? and Are there well-solved and simple storage patterns for Solidity?, I've created a data structure that automatically orders ...
3
votes
1answer
90 views

Why time values should be used as uint256?

Is there a reason to use the time value as uint256? Is not uint128 enough? UnixTime...
0
votes
1answer
99 views

pass an array as parameter in solidity

As far as i know solidity doesn't support passing an array of strings into a function ? My issue is that i just added an array of strings (hashs from ipfs) into my struct and i am used to use the ...
3
votes
2answers
109 views

Delete function in solidity

There is something is wrong with my delete function or i do not know what i have missed. The id of the user is stored in both User (struct) and userIds (array) and i want to be able to delete the id ...
1
vote
1answer
74 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 ...
1
vote
1answer
27 views

Which node to use in Merkle Patricia Tree when there are single and shared nibbles at the same point?

If I understood well, extension and leaf nodes should be used when there are shared nibbles, and branch nodes when there are differences. Which type of node should be used when storing a different ...
1
vote
1answer
174 views

How the blocks and tries are stored

Newbie here! I still not sure if I understood how some structures of Ethereum are physically stored (assuming Geth implementation) State Trie: only one off-chain Merkle Patricia Tries stored using ...
1
vote
1answer
101 views

Blockchain storage in IoT applications

Studying about the Ethereum blockchain I realized that it is ideal for my project. I intend to develop a blockchain to exchange electric energy between consumers on a smart grid. The mining nodes of ...
1
vote
0answers
34 views

How can I create array of array contains characters with solidity

I recently approached the Smart contract two days ago. I'm still learning about it, and I have a lot of difficulties. Can you help me to create a variable like this photo? It has a arrays of numbers ...
1
vote
2answers
39 views

How accurate are Etherscan's internal tx's on Rinkeby for Oraclize calls?

I'm trying to optimize my smart contract and am breaking down where the gas is being spent. Each execution for one function costs me about $5 in gas. I looked at Etherscan and in the internal tx's it ...
1
vote
0answers
30 views

Can a blockchain such as Ethereum grow “physically” too big? [closed]

If a blockchain can be downloaded and verified by any node, wouldn't it get too big in storage size eventually? Ethereum only carries bytecode for smart contracts as additional information (please ...
1
vote
1answer
97 views

Storing Non-Transaction data on Private(or Public) Blockchain

I'm fairly new to blockchain technology and need some advice for my first application. I'm creating a dApp for Asset Tracking using a private ethereum blockchain network. I have already created the ...
0
votes
1answer
23 views

moving data from a smart contract to a local drive

is it possible to copy data from smart contract to a local drive?? ie, suppose I created a smart contract and i wish to copy the available data at the storage to my local drive... Is there any ...
1
vote
3answers
71 views

Should I use `storage` or `memory` when just reading the value and not changing state?

pragma solidity 0.4.24; contract Test { struct Book { uint id; } Book[] books; uint public status; constructor() public { books.push(Book(10)); } ...
0
votes
0answers
30 views

Problem creating struct inside a struct

Currently I am developing a game in solidity, I have 2 structs as follow: struct Team{ address owner; uint[] players; uint8[] moves; } struct Game{ Team challenger; Team ...
1
vote
0answers
31 views

How to check last block in which storage variable was modified?

I am looking for method to quick chceck in which block variable was modified last. Assuming I have geth database synced in archive mode, that means I have all previous world states tries and accounts ...
2
votes
0answers
62 views

Plasma: how were the UTXO bitmaps conceptualised and how will they be stored?

From the white paper, page 5: We construct an interactive game whereby the exiting party attests to a bitmap of participants’ ledger outputs arranged in an UTXO model which requests a ...
0
votes
0answers
19 views

Getting storage variable state by name

What do I need to make script, which given the variable name and db with storage tree, will read account storage to check the value of the variable. Can I do this only having code of contract, code ...
1
vote
0answers
24 views

Best way to restore historical storage state

What is the best way to get historical storage state, given db with current world state and blockchain data? Do I need to reverse assemby code or can I do this using receipt logs?
2
votes
0answers
59 views

What is a cheap way to store mnemonic generator list of 1024 words in smart contract?

What is the cheapest way to store a list of 1024 words for a mnemonic generator, and why? These ideas had a gas cost of 165720 GAS for a string array, and 42300 GAS for storing all the words in a ...
1
vote
1answer
35 views

Where the contract code located physically and how it can be accessed?

After deployed where the contract code physically is located at? Storage or ROM of each node? And how it can be accessed for execution? By contract address? Then, Does contract address act like a ...
1
vote
1answer
32 views

How can I get the content of storage and memory in my private chain?

I'm looking for some methods to know the content of storage and memory while the contract is running.Mayba some useful tools or abi ? By the way, the abi of geth, debug_writeMemProfile and ...
1
vote
0answers
16 views

Can Factory Contract Be Used As Parent/Child Function?

I am attempting to modify the contract below; the way it is set up at the moment is so that the contract can be deployed, and then anytime a user wants to create a campaign, they can do so without ...
2
votes
1answer
178 views

Declaring a memory array of storage pointers in Solidity

I would like to declare a variable as a memory array of pointers to storage arrays of uint256. For example: pragma solidity ^0.4.24; contract A { uint256[] public array0; uint256[] public ...