There is not much info about using an asynchronous task in substrate docs i.e. task_manager in service.rs

I want to know when one should be using offchain-worker and when one should use background asynchronous tasks.

1 Answer 1


To my understanding, tasks are some client-only properties.

OCW has the ability to access the runtime directly. It's much easier to query the storage and submit some off-chain extrinsics.


If you want to watch your disk usage periodically, use the service task.

If you want to submit the I'm online messages periodically, use the OCW.

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.