Questions tagged [offchain-storage]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
3 votes
1 answer
84 views

Offchain indexing storage overwrites during forks

We are using offchain indexing to store some value that will be read in offchain worker . The keys that we are using to store data via offchain indexing is as following: key = some_prefix + ...
Aramik M's user avatar
  • 139
2 votes
0 answers
30 views

How to fetch floating no in offchain worker?

I want to fetch the floating value in offchain worker. I'm using lite_json for http request. Api data: { "price": 0.5 } To fetch and store this price from api. I'm defining a struct: pub ...
Deepak Chaudhary's user avatar
1 vote
1 answer
58 views

Iterating on a storage from Offchain Worker Concerns

I have a StorageMap named PublicKeyToMsaId which has around 300K inserted items and I want to iterate on all of those keys-values in offchain-worker to create a reverse map in offchain storage. To ...
Aramik M's user avatar
  • 139
1 vote
0 answers
21 views

offchain worker choose key to sign and send

I have multiple keys in my node storage with offchain worker running, there are currently 2 ways to sign and send transactions, it is done either for all of the keys stored locally, or 1 unspecified ...
cocokick's user avatar
  • 165
1 vote
0 answers
37 views

Fetching offchain storage value returns different value than the value fetched using localStorageGet function

I need to get the rpc_url value set initially from the explorer. The localStorageGet rpc function returns the correct value of the rpc_url. This returns https://eth-mainnet.g.alchemy.com/v2/MY_API_KEY ...
strider's user avatar
  • 11
3 votes
0 answers
22 views

Offchain Storage lock vs compare-set/mutate function

While using offchain workers when do we want to use a StorageLock and when would we want to use a mutate function on StorageValueRef since both of them are kind of lock on db.
Rusty Pythonic Script's user avatar
2 votes
1 answer
83 views

Is it possible to write-access Local Storage from the Node?

My use case is this: an Offchain Worker sends Http requests to certain endpoints. These endpoints are hardcoded on chain under current implementation. I would like to be able to configure those ...
Yury Yukhananov's user avatar
2 votes
0 answers
83 views

Offchain cache/view of on-chain storage data

I am implementing a pallet, that stores in on-chain storage (aka StorageNMap's) some user provided data. Pallet is performing offchain computations by iterating on-chain storage from offchain-worker ...
Klapeyron's user avatar
  • 111
3 votes
1 answer
49 views

How to store offchain mutable values

Are there offchain storage options in substrate? Like a regular mongodb- or mysql database, I don't want to use something else and just stick with something supported with substrate stack. The only ...
dadzerlaze's user avatar
  • 1,083
1 vote
1 answer
55 views

Configure OCW to run every x blocks or on demand

I understand that off-chain workers are spawned during block import, quote: Offchain workers are spawned during each block import. However, they aren't executed during initial blockchain ...
Ronin's user avatar
  • 175
0 votes
0 answers
72 views

offchain indexing for large files

I'm new to the project and currently working on a pallet, which is supposed to deal with large files offchain. Pallet, offchain indexing and the offchain worker are all working fine, still I get "...
langi667's user avatar
1 vote
2 answers
139 views

Native Substrate runtime support for storing data Offchain to IPFS

There appear to be 2 two substrate forks addressing offchain data storage with a IPFS backend: https://github.com/iridium-labs/substrate/tree/iris https://github.com/WunderbarNetwork/substrate/tree/...
Begley Brothers Inc's user avatar
0 votes
0 answers
34 views

Is there a way to create a peer to peer network on top of substrate?

Most of substrate tutorials are based on on-chain logic so there's not much information on this topic. Is there a way to use Substrate's in-built p2p network for other purposes such as constant ...
Kofi's user avatar
  • 141
1 vote
1 answer
87 views

Off-chain local storage map?

I have an off-chain worker that needs to write a HashMap<u64,Vec<u64>> to local storage. I can see how to write a single value using StorageValueRef and how I could possibly store a ...
Robert La Ferla's user avatar
0 votes
1 answer
41 views

Example for sp_runtime::offchain::storage::mutate()

I could not find any example code that shows how to call mutate() for offchain storage. Looking for an example. I could only find onchain examples. https://docs.rs/sp-runtime/latest/sp_runtime/...
Robert La Ferla's user avatar
3 votes
0 answers
53 views

What is transaction indexing in externalities useful for?

For example, there's a FRAME pallet called Remark which does one thing: it allows storing data in externalities that can access the node's storage via a runtime interface. If integrated into a runtime,...
Sacha Lansky's user avatar
  • 2,620
2 votes
1 answer
62 views

How can I access a backend instance from a host function?

As given in the title, I would like to get access to an instance of the backend from a host function. When I say 'backend instance' here, I'm referring to this. I hope to call its offchain_storage(), ...
Justin Frevert's user avatar
5 votes
0 answers
109 views

How to extend a `custom RPC` service to query the `off-chain` storage? [closed]

There are many docs/tutorials explaining how to extend the node's RPC service with a Custom RPC to query the Runtime storage. What I could not figure it out yet, is how to do the same but to query the ...
Pablo Buitrago's user avatar
9 votes
1 answer
69 views

Is there any way to get all the key/value pairs together from sc_client_db::offchain::LocalStorage?

I can see we have the option to get the values by using their keys one by one using get(), but is there any way to get all the pairs together wrapped in an iterator so that we don't need to hit the ...
Pawan Bisht's user avatar
6 votes
1 answer
147 views

How to extract data from Offchain storage in client-side?

I'm trying to access data that I'm storing through the RPC off-chain endpoint. Is there any way to get the instance of off-chain storage in service.rs through which we can extract that has been ...
Pawan Bisht's user avatar
2 votes
1 answer
63 views

How do you test offchain_index::set?

I have code that writes to offchain_index: offchain_index::set(&my_key, &my_data.encode()); However, my unit tests are unable to retrieve the data via: let my_offchain_data = StorageValueRef::...
Jeremy Frank's user avatar