I see for the moment two way to write solana program the first one using the solana_program crate only following the structure dictate on the solana doc and the second using anchor, Im wondering what are the benefits writing solana program using only the solana_program crate ?
1 Answer
This is a question of opinion, but the main difference is that Anchor is a framework. A framework will do a lot of things for you, but not let you do everything as a result. Here are a few random pros for each:
Anchor:
- defines an IDL consumable by any client
- adds safety checks for free
- reduces boilerplate
Non-anchor:
- use any serialization format
- not restricted by any account checks
- reduce compute usage by doing anything you need, e.g. selectively serializing back into accounts