Questions tagged [offchain-worker]
Oracle-like capabilities for Substrate chains.
45
questions
1
vote
1
answer
19
views
AccountId in offchain worker
I'm working on Substrate based project. In the project, each blockchain validator has an offchain worker. author_insertKey() is used to set up a key so the offchain worker can sign transactions. Each ...
2
votes
1
answer
39
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 ...
2
votes
0
answers
32
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 ...
3
votes
2
answers
87
views
Read a value from offchain storage of a node
I want to read a single value from OffchainStorage of a live substrate node. Is it possible? Assume I can not use localStorageGet rpc request because it is an unsafe rpc.
2
votes
1
answer
20
views
Configure offchain worker with command line argument
Is configuring an off-chain worker with a command line argument possible?
e.g.
./target/release/cere --dev --alice --my-custom-url "http://my-..."
If not what are the other options?
1
vote
0
answers
12
views
How to connect with phala contract for creation of anonymous accounts using phala network?
I want to create anonymous account using phala network.
Here is my logic.
You need to sign with your kyc account using the password as message and verify that the account is yours inside phala ...
1
vote
1
answer
29
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 ...
0
votes
1
answer
36
views
Off-chain worker. Error submitting a transaction to the pool: InvalidTransaction::ExhaustsResources [duplicate]
Error submitting a transaction to the pool: Transaction pool error: Invalid transaction validity: InvalidTransaction::ExhaustsResources
It works fine in standalone but in parachain it fails.
Off chain ...
0
votes
1
answer
39
views
How to enable off-chain workers for parachain via command line?
There is no any logs and off-chain workers does not work by default.
How to specify to enable workers for parachain via command?
0
votes
0
answers
28
views
Iterate storage maps inside an offchain worker
I need to iterate over the following double map inside an offchain worker:
How can I access this map outside the pallet assets? Can I use an RPC method to get all the values for that double map ...
0
votes
0
answers
55
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 "...
0
votes
1
answer
70
views
Is there any way to interact between ink smart contract and off-chain worker?
I know that we can interact between smart contract and runtime (and vice versa) but I can not find a way that I can fetch data from API (in off-chain worker pallet) and pass those data to the smart ...
4
votes
1
answer
61
views
How to verify that a signed payload of an unsigned extrinsic is signed by a local account?
I've been following the how-to guide to implementing unsigned extrinsic call with a signed payload.
My pallet defines the following KeyTypeId:
pub const KEY_TYPE: KeyTypeId = KeyTypeId(*b"ver!&...
0
votes
1
answer
64
views
Implementing an Identity Management pallet, would be more efficient in a Relay or Parachain?
I'm implementing an Identity Management pallet for an administrative ecosystem.
Suppose that using the same architecture as Polkadot.
Questions
It would be more secure, efficient and scalable to have ...
1
vote
1
answer
101
views
Offchain Worker Not Initializing - Cumulus Parachain Template
I am observing unexpected behavior with the Cumulus Parachain Template. Our pallet uses off-chain workers (OCW), and the functionality successfully runs when we attach it to the Substrate Node ...
1
vote
1
answer
37
views
how does work offchain in substrate ( pokadot ) [closed]
I Wanna know about off-chain in the substrate ( Polkadot ) how does work?
How is it mine from the onchain ( main chain in Polkadot )?
maybe somebody wants to hack the off-chain and they do it a ...
1
vote
0
answers
37
views
Enabling Offchain workers in a parachain
I know the way to enable ocw in a solo chain is to edit the service.rs as per the documentation and it works perfectly. I have tried making equivalent changes to the service.rs in my parachain but ...
1
vote
1
answer
50
views
Can an off-chain worker read/write the state of an EVM contract?
Let's assume we have a frontier-based node with smart contract X. From an off-chain worker, we want to call X.some_method() which will return data, and then the worker would use this data to make some ...
0
votes
1
answer
97
views
How to get data to off-chain worker from runtime?
Is any option to get data to off-chain workers from runtime?
For example, I have used runtime to store something.
How can I access this data from off-chain woker without using HTTP calls?
0
votes
0
answers
25
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 ...
1
vote
0
answers
67
views
using any account for offchain worker signed transaction
I'm trying to implement the following sequence:
Alice calls extrinsicA
extrinsicA calls off-chain worker
off-chain worker invokes an external service
off-chain worker uses Alice for a signed ...
1
vote
1
answer
97
views
Working up-to-date complete source code for offchain workers?
Hello Substrate community
I've been trying to integrate an offchain worker capable of API calls on top of an existing Substrate cluster of 3 nodes I already have up and running successfully (based on ...
0
votes
3
answers
134
views
Enabling off-chain workers for substrate-node-template
I'm trying to test offchain workers in my local substrate node.
It seems that by default the ocw is not enabled? I've only been able to see logs from ocw's when running the node with the --dev option (...
1
vote
1
answer
31
views
What is Offchain Call in TransactionSource?
What is an Off-Chain Call in this scenario?
for instance an Off-Chain Worker, or an Off-Chain Call
source: https://github.com/paritytech/substrate/blob/master/primitives/runtime/src/...
0
votes
1
answer
42
views
How to write a dispatch function which can only access from offchain worker with signed extrinsic/transaction?
I want to modify some on-chain storage from offchain worker by sending a signed transaction, so I write a dispatch function which handles the transaction. But the dispatch function also can be ...
3
votes
2
answers
101
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
75
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 am 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 ...
0
votes
1
answer
42
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 ...
1
vote
1
answer
69
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
92
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
104
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
53
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
65
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
71
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
127
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
80
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 ...
3
votes
0
answers
92
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
752
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
79
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 ...
5
votes
1
answer
131
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 ...
3
votes
2
answers
86
views
Persistent Offchain Worker Storage
Offchain workers storage comes in two flavors: Persistent and Local.
pub enum StorageKind {
/// Persistent storage is non-revertible and not fork-aware. It means that any value
/// set by the ...
3
votes
2
answers
91
views
How to avoid multiple OCWs duplicating work?
We are running 2 OCWs each in separate instances and we have an extrinsic which mutates a storage in runtime which is done twice from the 2 OCWs but we want only one OCW to sign. How to do that?
For ...
3
votes
2
answers
147
views
How to create a transaction that calls an offchain worker?
Is it possible to create a transaction that calls an offchain worker to write data to the offchain worker?
2
votes
1
answer
163
views
Process ethereum transactions in an offchain worker
I need to process Ethereum transactions in a substrate offchain worker. I already include EVM and Ethereum pallets, but I also need to do some communications with runtime code running as solidity ...
2
votes
2
answers
116
views
Can I call external APIs inside my pallet?
How can I call external APIs from the chain then use that data to implement further logic