7

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 1

7

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.

0

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.