Questions tagged [offchain-worker]
Oracle-like capabilities for Substrate chains.
80
questions
5
votes
2
answers
168
views
Is there any oracle solution available for substrate based solo chain?
We have a Substrate based solo chain where we need to fetch external data like ETH/USD price using off-chain workers right now. But these OCW doesn't work for reaching consensus on data being fetched ...
1
vote
2
answers
136
views
How to comprehend the hooks of Substrate? Such as `on_initialize`, `on_finialize` and `offchain_worker`
I want to use hooks for some business logic, but I'm not very familiar with the usage of on_initialize, on_finialize and offchain_worker. Can all of them modify the on chain storage? If yes, what is ...
0
votes
1
answer
70
views
How to use "A secure, local entropy source for random number generation" in offchain worker?
The official website tells us there is " A secure, local entropy source for random number generation" . I think it means that I can make use of this feature to generate random number or even ...
2
votes
1
answer
117
views
How to write unit tests for offchain workers?
Pallets can have unit tests with a mock runtime where extrinsics are tested against multiple cases.
However it's not obvious how to do the same for offchain workers.
How can I write unit tests for ...
0
votes
1
answer
124
views
app_crypto!(sr25519, KEY_TYPE): cannot find trait `TryFrom` in this scope
I am building an ocw demo, the code is from https://github.com/paritytech/substrate/blob/master/frame/examples/offchain-worker/src/lib.rs, when using polkadot-v0.9.25 version, it appears got this ...
2
votes
1
answer
124
views
Only one node should make http call from OCW
I'm trying to figure out with OCW. And have a question is it possible to configure OCW so that if one node starts an HTTP call in OCW other nodes will skip it. I checked all examples I could find ...
3
votes
1
answer
82
views
Can we enable off-chain workers http client to support web-sockets request?
As for now it supports rest request, and some duration limitation due to valid reasons. So my question is can we enable or work with web sockets for monitoring data changes , as for now we are only ...
0
votes
1
answer
80
views
How to get on-chain data on pallet?
I want to get some 'trustful' on-chain data on the pallet, for example, get transaction data by transaction hash. I found Offchain Workers might do that job but is it really trustful because the API ...
3
votes
1
answer
75
views
Calling CLI subcommand through different terminal after running the node
I'm trying to set some off-chain storage through a different terminal using a custom subcommand after starting up the node.
Question here is:
Is there any way to call the custom CLI subcommand in the ...
2
votes
2
answers
173
views
How to ensure call was made by Offchain Worker
Feels like a very newbie question but, whilst I've found hints of how to implement this, I can't find the recommended solution.
I have an offchain worker that does some validation of remote data and ...
1
vote
1
answer
103
views
How to get the Peer count in an Off Chain Worker?
I have an Off Chain Worker that validates some data in IPFS and then calls a function on chain to set the status to valid or invalid. That's all working fine.
However, I do not need all nodes to ...
4
votes
0
answers
107
views
Accessing On-Chain Data In an Off-Chain Worker
I am looking to aggregate On-Chain data in an Off-Chain Worker, e.g. summing transaction fees included in blocks from the last 24 hrs. This is listed as one of the main use cases for Off-Chain Workers....
8
votes
2
answers
808
views
When does an off-chain worker get executed?
I have a scenario where I want to execute a scheduled call via the scheduler pallet at block number n. This call will change certain storage items of pallet.
So before this storage changes, I want to ...
3
votes
2
answers
102
views
How can a OCW determine if a node is fully synced?
Is there a status-call/api that a OCW could invoke in order to establish if the actual running node instance is fully synced? Maybe listening to a frame_system event? Or knowing the total blocks ...
7
votes
1
answer
191
views
Is it possible to query an OCW's Off-chain storage via RPC from an external service?
I'm off-chain indexing some pallet events into my off-chain local storage using an OCW. Now, I want to be able to retrieve this data via RPC from an external service.
Is this possible? Does it require ...