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 Substrate Node Template)

I already:

  1. Went through https://docs.substrate.io/reference/how-to-guides/offchain-workers/
  2. Tried to integrate the Paritytech official offchain exemple pallet (reference from 1.)
  3. Tried to run this end-to-end demo (also a reference from 1.)
  4. Tried to integrate this exemple (also a reference from 1.)

But there's always a problem:

  • Either the code is few years old (point 4)
  • Or at least one year old and based on Substrate node template v3 instead of v4 (point 3, and it doesn't even start anyway..)
  • The reference pallet from Parity (point 2) is just the pallet, without the code for the runtime, so a lot of dependencies are broken...

enter image description here

Would anyone here able to share a working end-to-end exemple (runtime + pallet) based on node-template v4, or be able to guide me on how to successfully update the runtime for the pallet in point 3 to start working?

Any help is appreciated :)


  • "an offchain worker capable of API calls on top of an existing" What do you mean exactly by API calls? pallet-election-provider-multi-phase is a pallet that uses offchain workers and is compatible with substrate master, and it does submit transactions back to the chain.
    – kianenigma
    Oct 2, 2022 at 15:16
  • Thanks a lot @MrishoLukamba, I will take a look, I hope the runtime has all necessary dependencies to make that pallet works, or that the tutorial gives some clues on how to add these dependencies, thanks again
    – PoCk3T
    Oct 3, 2022 at 18:42
  • @kianenigma , I meant "calling an external service, outside of Substrate, through a HTTP GET or HTTP PUT call, from the off-chain worker"; it looks like the pallet you suggested is very thoroughly documented according to what I've found at crates.parity.io/src/pallet_election_provider_multi_phase/…, I will definitely sit down and go deeper in it as well, thank you!
    – PoCk3T
    Oct 3, 2022 at 18:47
  • Follow the How-to guides from the Substrate page: docs.substrate.io/reference/how-to-guides/offchain-workers/…
    – Alex Bean
    Oct 5, 2022 at 14:18

1 Answer 1


Here I integrated the official example offchain-worker pallet into a v0.9.28 Substrate node template. Check last commit to see the integration through runtime/src/lib.rs, node/src/service.rs and Cargo files.

  • Thanks a lot, just tried and it compiles! Makes it an easy base to start from.
    – PoCk3T
    Nov 6, 2022 at 2:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.