Introduction

As Bonfida devs, we have been writing Solana programs for some time now. As a result, we have come to cultivate a particular code style. This systematic approach to writing Solana programs has enabled us to write programs faster, with no sacrifice to their security. If anything, being systematic about our programs has made them safer and easier to audit.

Our approach is based on several key principles:

  • We don't use frameworks, and this is not quite a framework: critical program logic should never be hidden away behind macros.
  • Security checks should always be obvious.
  • Redundant security and safety checks are better than implicit ones.

This book is intended as a guide to what we have come to define internally as the Bonfida style. As we learn new and better ways to write programs, it will necessarily evolve.

Feedback

If you notice a mistake in this book, or if you would like something to get clarified, please do not hesitate to open an issue on the guide's repo.