I came across an article that said we could use any crate that supports serialization and deserialization as long as the function does the work. But my question is why Borsh is popular, and is Borsh often used in Rust programs? Is Solana forcing the use of Borsh?
1 Answer
Do you perchance mean Borsh?
Solana is not opinionated about which serialisation/deserialisation library you use in your program. The protocol just expects a byte array for account and instruction data. How you read/write that buffer is entirely up to you.
Even in the Solana Program Library source code itself, you will see a mixture of things including Borsh, Serde, Buffer Layout, etc.
Btw Borsh actually comes from NEAR protocol. It just happens to be optimised for some use cases so it was chosen for those. You can see the benchmarks on their website above.