Questions tagged [storage]

all questions regarding data and storage on the ethereum blockchain

Filter by
Sorted by
Tagged with
0
votes
1answer
27 views

Searching for a value in a dynamic array

I understand that for loops on dynamic arrays are a big no no in Solidity, so I am trying to find an alternative to this problem. Goal: From a dynamic array of numbers, I am trying to extract the ...
0
votes
3answers
60 views

Alphanumeric ranking of adresses

How is it possible in an ethereum contract to sort the public adresses of senders of eth in the contract in the alphanumeric order ?
2
votes
2answers
363 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 ...
3
votes
3answers
569 views

How to handle dynamic size string array in solidity?

I have a shop owner and a shop owner can have multiple products. I want to keep the products id in an array. Also, A public method can return all the product id list of a shop owner. I tried the ...
1
vote
0answers
294 views

Downloading Mist Chaindata to a New Storage Device

The computer I am working on has an SSD and HDD. The Chaindata was originally set to download to the SSD, but the SSD has run out of storage. The computer is running Mist; how can I either (1) move ...
3
votes
2answers
95 views

Map or Array…?

I'm having a huge dilemma! I'm developping a smart contract that has, let's say Struct A and Struct B. Because I want to have a function retrieving all objects type A and B, I created a Struct All ...
1
vote
1answer
183 views

Looking for help with designing a private Ethereum blockchain to store information

I would like to be able to store a history of an object on a private chain and have it update-able via a website.It needs to hold public information and some hashed links to an external database. Just ...
0
votes
2answers
21 views

Costs of storing an empty dynamic array of length 2**256-1 vs length 4

If the array is completely empty, is it more expensive to store uint[] of length 2**256-1 vs of length 4?
1
vote
1answer
20 views

Whats the best way of translating this struct?

Let's say I must have this data structure: ├── Operations (struct) │ ├── date_begining (uint) │ └── date_end (uint) │ └── responsible (address) │ └── type **(?)** │ ├── Observation (...
33
votes
3answers
29k 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 ...
0
votes
0answers
19 views

Where's a contract storage stored exactly and how does it interact with the blockchain? [duplicate]

From what I've understood a contract is a special account that gets initialized with a 256 bit array and this array is stored as the root hash of a merkle tree, is that correct? But where is this ...
1
vote
1answer
328 views

Where do you save the application data of a Dapp?

Let's say that I want to implement a Dapp similar to Facebook. Each user has its own profile, pictures and information. Usually you would use a database to store all this data. This guarantees that ...
0
votes
1answer
31 views

Is it possible to set a struct property as undefined or null?

In JavaScript we're able to have: Object { a: number; b?: string; c: number; d?: string; } b and d being optional, these can be left out during variable initialisation. Is this possible in ...
0
votes
1answer
25 views

Read and write products using solidity

I am new to Solidity, trying to store a product in the purchaser wallet and retrieve the information from the owner wallet. I have some ideas but didn't know which one will be best. To store an ...
0
votes
1answer
22 views

Fire transaction from contract

I have a contract holding a mapping like this: mapping (address => User) users. How can I get the contract to automatically fire a transaction/event when a certain condition is met? For example, ...
0
votes
1answer
30 views

How to properly initialize nested storage array/struct?

contract Contract { struct A { int a; } struct B { A[] as; } mapping(address => B[]) bs; function addB(B memory b) { bs[msg.sender].push(...???...); } } I have nested hell of arrays and ...
0
votes
1answer
16 views

How data is stored in Ethereum blockchain?

If I become a full node in Ethereum and retrieve the current state, how all this data is going to be stored in my physical drive?
0
votes
0answers
28 views

Efficient way to save and retrieve hash in blockchain

I am learning Ethereum using Geth. I have a private blockchain and I am saving hashes through a REST API (python web service). I have readed I can save hash values using maps (mapping data type) and ...
0
votes
1answer
21 views

Storing name values off-chain in events and web3.js

Somewhere I read the advice to store name (title, geographical name, people name, etc.) value off-chain in events. But if a value is stored in an event, is there an efficient way to retrieve its ...
0
votes
1answer
19 views

can't get struct in return

I am trying to execute unit tests for a solidity smart contract: I have: mapping (bytes16=>Device) public Device_Table struct Device { bytes16 UUID; bytes16 hardware_UUID; string ...
0
votes
2answers
619 views

Default getter and setter for mapping in solidity

In my smart contract I've public mapping as mapping (uint=>User) public users where User is a Struct, so is there any way to get the values of this mapping using default getter. For Example : If ...
0
votes
1answer
26 views

Data storage and replication in a private blockchain

What type of data is Ethereum storing (file? data row in DB)? Where does it put it (theoreticaly it is stored in peers, does this mean every node must have a local db)? How the peers of the p2p ...
0
votes
2answers
703 views

List of items per address

I'm working on a dApp and I am trying to figure the following issue. I want to map an address to a dynamic list of items in one of my contracts. In this way when a user logs, he/she has their own list ...
1
vote
1answer
41 views

Storing multiple values in one key mapping (Solidity)

Can I store multiple values in one key mapping in solidity? like I can retrieve all of the values if I use that one mapping key? Is this possible?
0
votes
0answers
33 views

Safe usage of delegatecall

Hey guys I have a few questions about delegatecall. The setup: I have 2 contracts A and B. A has 2 uint state variables B has 4 uint state variables To ensure storage layout compatibility, B ...
0
votes
1answer
13 views

A smart contract's storage problem , further ERC ?

Er .. I have a question about smart contract , a single smart contract's storage capacity Follow the answer is this question: Is there a (theoretical) limit for amount of data that a contract can ...
0
votes
1answer
60 views

Associate event struct to user addresses

I have two contracts. One called User and other called Event pragma solidity ^0.4.24; contract User { mapping(uint=>address) addresses; uint addressRegistryCount; } pragma solidity ^...
1
vote
1answer
454 views

Storing structured data in private blockchain

The task. Develop distributed registry on blockchain network that can store public data of the certain objects. For example: { "id": 123456789012345, "title": "Big black box (not more than 100 ...
2
votes
2answers
289 views

Reset all values in a mapping

I am trying to figure out how to have the balance of all players reset to (amount) when a certain condition happens. This is the function that will update a specific player balance. How do I make it ...
5
votes
4answers
122 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 ...
0
votes
4answers
51 views

Mutating slot 0 of a storage array in Solidity assembly

Have been working on a function allow users to edit specific types of state using Solidity assembly, and ran into some unexpected behavior. According to the documentation, for a storage array arr ...
0
votes
1answer
13 views

arrays and structs for function arguments

A lot of contracts and libraries with functions that use arrays and structs for arguments. Structs can themselves include arrays, structs and mappings. For example: function doSomething(MyStruct ...
4
votes
1answer
316 views

How can I maintain a sorted list in my smart contract?

Is it crazy to feel the need to sort solidity arrays? Imagine implementing a market (double action) you need to sort the orders. I could imagine other usecases where sort is useful. But as we all ...
0
votes
1answer
8 views

Can you have an array of mappings? The mappings have an address key and a struct value

Can you have an array of mappings? I want to have mappings with addresses as keys and structs as the value. I want to store these addresses in an array and iterate through them. so far it looks like ...
93
votes
5answers
44k 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?
1
vote
1answer
37 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.
4
votes
2answers
267 views

How to pop from (decrease the length of) a memory array in Solidity

I have a function that gets an address array from another contract, conditionally deletes the msg.sender from the array, then saves the new array back to that contract. Because the array backerList ...
3
votes
1answer
696 views

Regarding external file storage

Let's say you have a private blockchain, a DApp with an workflow to store and retrieve data from that blockchain. Now there is a need to store binary files and access it in a permissible way. One way ...
0
votes
1answer
39 views

Calling a function to zero out struct data in a mapping costing more gas than other calls, causing out of gas error

I am working with the following function and state vars: struct TimeRestriction { uint256 fromTime; uint256 toTime; } mapping (address => TimeRestriction) public whitelist; function ...
0
votes
1answer
35 views

pass storage through interface to library

Here is what am i doing: There is a library, accept storage argument as parameter, then do some math and return the result. And there is a contract to call the function in the library, and an extra ...
1
vote
1answer
29 views

How do programs on the 'Ethereum World Computer' compare to traditional programs or websites?

So this question has been bugging for me for a while and I can't seem to find the answer to it. Context I have been a web developer for many years. When I access a website, any frontend code is run ...
0
votes
3answers
137 views

New temporary struct causing state variables to be overwritten

I'm running an experiment where I'm trying to create the following behavior: Service owner deploys Experiment1 to the blockchain and is recorded as the owner. Owner then adds a user address, a user-...
0
votes
1answer
41 views

How to store and encrypt Keys?

I am developing chrome extension like metamask for the private Chain. I have generated the keys and using localStorage to store the Keys. But I am not sure whether I am going correct or not for ...
0
votes
1answer
30 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 ...
0
votes
1answer
30 views

Ethereum Petabyte Storage Problem

As the need of blockchain systems grows so will be the storage issues and the cost of handling such large amounts of data. Is ethereum capable of handling petabyte storage or is it upto an ...
2
votes
2answers
34 views

loop though all the members of a map

I need to loop though all of the members of a map and change their property (which is a struct). the way i'm doing this is when adding a member to the map object also save it's address inside an ...
0
votes
1answer
38 views

map multikey how-to?

I'm trying to create a map whose key is composed of two bytes32 keys. I've tried with tuples-keys and struct-keys but both are rejected by the compiler. I'm also thinking about "hashing" both keys ...
0
votes
2answers
110 views

State variable being overwritten

When I run the code in remix, The state variable requesting is overwritten after a call to addSimpleStruct(), which makes it impossible to add another struct because of the require statement. Why ...
1
vote
1answer
76 views

Decentralized Data Storage for IoT using Sia

For my Master research I want to make a proof-of-concept of decentralized data storage for an IoT scenario. My idea is to receive measurement values from a raspberry pi and to store them using sia. I ...
0
votes
1answer
96 views

Why do external accounts have storage space?

The Solidity documentation on accounts states that there are two types: External accounts, which are owned by humans Contract accounts, which are controlled by code The following line in the ...

1 2 3 4 5 8