Skip to content
SummaryPrecompiles (Ed25519, Secp256k1, Secp256r1) verify signatures as native code, bypassing the sBPF VM. They handle cryptographic operations where sBPF execution would be too slow. Precompiles are not callable via CPI.

​Precompiled programs

Precompiled programs bypass the sBPF virtual machine and run as native code within the validator. They handle cryptographic operations where sBPF execution would be too slow.

​Verify ed25519 signature

The ed25519 program verifies one or more ed25519 signatures within a single instruction.
ProgramProgram IDDescriptionInstructionsSource
Ed25519 ProgramEd25519SigVerify111111111111111111111111111Verifies ed25519 signatures. If any signature fails, an error is returned.InstructionsSource
The instruction’s first u8 contains a count of the number of signatures to check, followed by a single byte of padding. After that, the following struct is serialized once per signature:
Ed25519SignatureOffsets
Signature verification pseudocode

​Verify secp256k1 recovery

The secp256k1 program verifies secp256k1 public key recovery operations (ecrecover).
ProgramProgram IDDescriptionInstructionsSource
Secp256k1 ProgramKeccakSecp256k11111111111111111111111111111Verifies secp256k1 public key recovery operations (ecrecover).InstructionsSource
The instruction’s first byte contains a count of the number of public keys to check. After that, the following struct is serialized once per public key:
SecpSignatureOffsets
Recovery verification pseudocode
Signature and message data can reference any instruction data in the transaction. By specifying the special instructions sysvar, programs can also read data from the transaction itself. Transaction cost equals the number of signatures to verify multiplied by the per-signature verification cost.

​Verify secp256r1 signature

The secp256r1 program verifies up to 8 secp256r1 signatures per instruction.
ProgramProgram IDDescriptionInstructionsSource
Secp256r1 ProgramSecp256r1SigVerify1111111111111111111111111Verifies up to 8 secp256r1 signatures. Takes a signature, public key, and message. Returns error if any fail.InstructionsSource
The instruction’s first u8 is a count of signatures to check, followed by a single byte of padding. After that, the following struct is serialized once per signature:
Secp256r1SignatureOffsets
Low S values are enforced for all signatures to avoid accidental signature malleability.
Signature verification pseudocode