Questions tagged [offchain-worker]

Oracle-like capabilities for Substrate chains.

Filter by
Sorted by
Tagged with
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 ...
Maksim Ramanenkau's user avatar
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 ...
Yury Yukhananov's user avatar
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 ...
Klapeyron's user avatar
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.
Matt Duncan's user avatar
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?
Maksim Ramanenkau's user avatar
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 ...
Amiya Behera's user avatar
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 ...
Ronin's user avatar
  • 145
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 ...
Rust Dev's user avatar
  • 313
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?
Rust Dev's user avatar
  • 313
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 ...
Mateo Baldassarre's user avatar
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 "...
langi667's user avatar
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 ...
Hoang Viet Nguyen's user avatar
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!&...
digital illusion's user avatar
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 ...
Alexandre Ribeiro's user avatar
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 ...
Brendan's user avatar
  • 45
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 ...
Kianoush Dortaj's user avatar
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 ...
rh00's user avatar
  • 13
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 ...
Adam Wierzbicki's user avatar
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?
P.E's user avatar
  • 121
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 ...
Kofi's user avatar
  • 121
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 ...
digital illusion's user avatar
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 ...
PoCk3T's user avatar
  • 13
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 (...
random-bacon's user avatar
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/...
Stefan Muto's user avatar
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 ...
kugool's user avatar
  • 101
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 ...
Immanuel John's user avatar
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 ...
kugool's user avatar
  • 101
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 ...
kugool's user avatar
  • 101
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 ...
Bernardo Rodrigues's user avatar
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 ...
Bart Yang's user avatar
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 ...
Leu Barycheuski's user avatar
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 ...
Mrisho Lukamba's user avatar
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 ...
Stefan Muto's user avatar
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 ...
Pawan Bisht's user avatar
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 ...
jpataylor's user avatar
  • 311
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 ...
jpataylor's user avatar
  • 311
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....
brendan's user avatar
  • 31
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 ...
llvm_ninja's user avatar
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 ...
Pablo Buitrago's user avatar
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 ...
Pablo Buitrago's user avatar
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 ...
Alejandro Martínez's user avatar
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 ...
Immanuel John's user avatar
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?
Joshua Aruokhai's user avatar
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 ...
naiem's user avatar
  • 123
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
Sam Elamin's user avatar