Benchmarking Solana programs compute units


Or, why you shouldn’t log a public key One of the limitations of smart contract development is that you typically have some steep constraints on the resources your contract can use during execution. One of those constraints in nearly every runtime is a limitation on the number of CPU cycles you can use. In the Solana world, these are represented as ‘compute units’. Not only is there a hard limit (200k), but there’s also a cost associated with them, similar to how gas fees work in the Ethereum world.…
Read more ⟶

Bump distribution of findProgramAddress


There’s some frequent misunderstanding when it comes to PDA’s on Solana, starting with the ‘bump’ value. First, let’s look at what makes up a PDA. A PDA, or Program Derived Address, is an address on Solana that satifies two requirements. “Program address must not lie on the ed25519 curve to ensure there is no associated private key” - This means that there’s no corresponding private key for the public address; no one will ever be able to sign a transaction with this key.…
Read more ⟶

Anchor/Solana safety check you get for free


When you’re writing any Solana contract, it’s easy to make a costly mistake. In fact, coming as a developer from a typical backend or frontend engineering role, it feels a bit like going back to writing C. Mistakes are easy to make, easy to miss, and easy to misjudge. Rust is a language that sells safety as a feature, but when it comes to smart contracts, it’s not the null pointer that’s going to kill you, it’s forgetting to check an input, something that Rust can’t solve with memory safety.…
Read more ⟶

Building Sequoia PGP on Windows


This is more for my own notes, but if you’re new to Windows development, it’s easy to get lost in the mix of MSVC and ‘mingw’. For the purposes of this post, the goal will be to build Sequoia PGP, a rust PGP implementation, in Windows using the ‘mingw’ environment (which uses the Nettles cryptography library vs Windows Cryptography). Summary of the steps Install Rustup using the official package Install the windows-gnu toolchain and set it to default Install MSYS2 Install the required packages from MSYS2 (clang, nettles, pkg-config) Update PATH Build using cargo Installation steps Install rustup Use the official package at rustup.…
Read more ⟶

Playing with Solana Serialization


While exploring Solana, I wanted to get a better handle on how Solana serializes its own data. In order to do this I built a tool to quickly look at data on an account. Normally, consumers would have the RPC server parse the account data into its relevant fields. In my case, I’m looking at the raw data and ignoring any parsing in order to better understand the serialization handling.…
Read more ⟶