1

I would like to ask you how to subscribe events from Polkadot blockchain? I am writing a rust application and I need this functionality there.

Is the using Substrate the right direction to achieve that?

Thanks in advance!

1 Answer 1

1

subxt has your back. Here's an example:

https://github.com/paritytech/subxt/blob/master/examples/examples/subscribe_all_events.rs

(Events are just the system.events state at a certain block, so if you know the block hash you're after you can retrieve them by via a storage query)

(if you want to subscribe to blocks there's an example in the PRs)

2
  • Broken link at this point. I couldn't find a current example in the repo that seems to demonstrate how to subscribe to events. Jul 11 at 13:02
  • I take that comment back, sorry. The example as of time of writing is here: github.com/paritytech/subxt/blob/… within the block subscription example. Jul 11 at 14:06

Your Answer

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

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