HORIZON HASKELLDocslts/ghc-9.14.xd82dee82026-10-12Search names, modules, packages, or :: a typeCtrl K

GHC 9.14.1 · lts/ghc-9.14.x · d82dee8 · 2026-10-12

Modulesolana-haskell-sdk-1.3.0.0GHC2021

Network.Solana.NativePrograms.Secp256k1

Client for the Secp256k1 native precompile program. The precompile verifies secp256k1 (ECDSA/ecrecover) signatures included directly in an instruction's data against a message and Ethereum address, also included in that data; it does not compute a signature itself. Signing (producing the signature and recovery id from a private key) is out of scope for this SDK — callers must supply an already-computed signature.

  • 2 types
  • 2 values
datadata SecpSignatureOffsets
#

Offsets (within the transaction's instructions) of the signature, Ethereum address, and message data used to verify a single secp256k1 signature. The u8 instruction indexes are absolute indexes into the transaction's instruction list; index 0 means the transaction's FIRST instruction. Serialized as an 11-byte little-endian packed struct, matching the Rust SDK layout.

Constructors

Instances3Eq, Show, Binary
newtypenewtype Secp256k1InstructionData
#

Secp256k1 instruction data: a pre-built byte string. The Binary instance mirrors MemoData: put emits the bytes verbatim (no discriminant, no length prefix) and get consumes all remaining input, so that mkInstruction reproduces exactly the bytes built by newSecp256k1Instruction.

Instances3Eq, Show, Binary

Creates a Secp256k1 signature-verification instruction that checks a single, precomputed ECDSA signature: this SDK's counterpart of the Rust SDK's new_secp256k1_instruction_with_signature. Receives the 20-byte Ethereum address the signature is expected to recover to, the 64-byte compact ECDSA signature, the recovery id, and the RAW message bytes: the precompile applies Keccak-256 to the message itself during verification, so the supplied signature must have been produced over keccak256(message). The signature, address, and message are all embedded in this single instruction's data (instruction index 0), so the precompile takes no accounts.

The recovery id selects which public key the signature recovers to; only values 0-3 verify on-chain, but that range is not validated here, matching the Rust builder.

Throws via error if ethAddress is not exactly 20 bytes or signature is not exactly 64 bytes, mirroring the assertions in the Rust builder.

The built instruction hardcodes all instruction indexes to 0, so it must be placed as the FIRST instruction of the transaction for verification to read its own embedded data (matching the Rust SDK's new_secp256k1_instruction).