-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Pass arguments to off-chain worker #3912
Comments
it seems arguments to off-chain worker can benefit from the architecture of the chain spec. with availability to changes keys at specific block numbers and extend it. |
hmm did I actually understood correctly ? pass argument to off-chain worker from where ? from the runtime ? or from the cli ? if it is from the runtime this can be done indeed |
I don't understand how this make use of arguments ? this key is just in the trie ? |
This should be just inserted to the local offchain worker database under some known key. You can set it up during service or CLI initialisation. |
Yes like @tomusdrw said. Pass arguments from runtime is easy as offchain worker can just read storage. I would like to pass arguments from CLI or API. Preferably from API so it can be rotated without reboot the node. The API key can be used to make external service HTTP call. For example: https://github.com/SubstrateOrg/Oracle-Infinity/blob/2f7e05ae936c907600714299fc49de21c3919635/runtime/runtime/src/oracle.rs#L178 |
Fixed by #4694 |
How to pass arguments to off-chain worker? AFAIK it is possible to configure session key for offchain worker to consume. But can this session key be arbitrary string?
For example, I would like to pass API key to off-chain worker so it can fetch data from exchanges. The offchain code can check if it has API key configured to do actual work.
In the end, I would like to build an oracle module that allow people to stake to become an operator. Then they can configure a session key and one or more external services API keys to start submit data using offchain worker. This makes a permisionless decentralised oracle network possible.
The text was updated successfully, but these errors were encountered: