Skip to content

Curve25519

Solace::Utils::Curve25519Dalek answers one question fast: is a 32-byte value a point on the Ed25519 curve? That's the test that distinguishes a normal address (on-curve, has a private key) from a Program Derived Address (off-curve, no key) — so it's the engine behind PDA derivation.

ruby
Solace::Utils::Curve25519Dalek.on_curve?(bytes) # => Boolean
ArgumentTypeDescription
bytesString or bytesThe 32-byte point to test. Raises ArgumentError if not exactly 32 bytes.

Native extension

The check is implemented in Rust (the curve25519-dalek crate) and called over FFI, which is why PDA bump searches are quick even though they may test many candidates.

Prebuilt shared libraries ship with the gem for every supported platform — Linux, macOS, and Windows, on both x86_64 and ARM64 — under lib/solace/utils/. There is nothing to compile when you install Solace; the FFI loader picks the right binary for your platform at require time.

Rebuilding the binaries

Maintainers regenerate these binaries with the build-libs GitHub Actions workflow (or rake compile locally with a Rust toolchain). End users never need to.

Why you rarely call it directly

on_curve? is a low-level building block. In practice you use the higher-level PDA helpers, which call it internally:

ruby
# find_program_address uses on_curve? to reject candidate addresses that
# land on the curve, returning the first valid (off-curve) bump.
address, bump = Solace::Utils::PDA.find_program_address(seeds, program_id)

A Ruby SDK for Solana