https://book.anchor-lang.com/ has no article on these yet, but I see many programs using them.
What is the problem that they are solving? What are the common code patterns and best practices for implementing and consuming events?
Solana Stack Exchange is a question and answer site for Solana software users and developers. It only takes a minute to sign up.
Sign up to join this communityhttps://book.anchor-lang.com/ has no article on these yet, but I see many programs using them.
What is the problem that they are solving? What are the common code patterns and best practices for implementing and consuming events?
What: log messages (anything you would do with msg!()
). But they are not human readable as they are base64 encoded.
Why: msg!()
with string formatting is relatively expensive for compute units
How: example
program.rpc.initialize();
that is wrapped in the Promise?
Jan 6 at 9:07
They allow encoding of data into the transaction through the logs. They are more efficient that formatting a string (very expensive) and allow easy decoding through the anchor SDK
They can be used for:
Program.addEventListener
to subscribe to them on the client: coral-xyz.github.io/anchor/ts/classes/…