#ed25519 #helper #solana #signatures #verifying #precompile #cpi

solana_ed25519_verify

A helper library for verifying signatures in a Solana program without CPIs or the Ed25519 precompile program

2 releases

0.1.1 Apr 28, 2024
0.1.0 Apr 28, 2024

#6 in #precompile

Download history 18/week @ 2024-09-20 22/week @ 2024-09-27 13/week @ 2024-10-04 2/week @ 2024-10-11 4/week @ 2024-10-18 8/week @ 2024-11-15 9/week @ 2024-11-22 3/week @ 2024-11-29 33/week @ 2024-12-06 30/week @ 2024-12-13

79 downloads per month

MIT/Apache

53KB
66 lines

Solana ED25519 Signature Verification Helper Function

Pretty self-explanatory. Quite a bit more expensive than the precompile program, but also quite a bit easier to use with no instruction sysvar shenanigans necessary and no required instruction data overhead.


Compute Costs

See compute-usage.csv or look at the chart below for the compute costs per message length.

There's a static cost of ~11,000 CUs for curve stuff, and an additional cost of ~8000 CUs per SHA512 128 byte block. There's an 80 byte overhead from the signature R scalar, pubkey scalar, and 16 byte message length, which is why the second block starts at only 48 message bytes.

Formula is approximately: CU_COST = ceil((80 + MESSAGE_BYTE_LEN) / 128) * 8000 + 11000

compute-usage.png

Dependencies

~21–30MB
~485K SLoC