Secp256k1 native precompile program address.
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
- Packagesolana-haskell-sdk-1.3.0.0
- Exports4
- LanguageGHC2021
- LicenceApache-2.0
- SourceSecp256k1.hs
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
SecpSignatureOffsetsssoSignatureOffset :: Word16Offset to the [signature, recovery_id] bytes (64 + 1 bytes).
ssoSignatureInstructionIndex :: Word8Instruction index to find the signature.
ssoEthAddressOffset :: Word16Offset to the Ethereum address (20 bytes).
ssoEthAddressInstructionIndex :: Word8Instruction index to find the Ethereum address.
ssoMessageDataOffset :: Word16Offset to the start of the message data.
ssoMessageDataSize :: Word16Size of the message data, in bytes.
ssoMessageInstructionIndex :: Word8Instruction index to find the message data.
Instances3Eq, Show, Binary
Eq SecpSignatureOffsetsDefined in solana-haskell-sdk-1.3.0.0 · Network.Solana.NativePrograms.Secp256k1Show SecpSignatureOffsetsDefined in solana-haskell-sdk-1.3.0.0 · Network.Solana.NativePrograms.Secp256k1Binary SecpSignatureOffsetsDefined in solana-haskell-sdk-1.3.0.0 · Network.Solana.NativePrograms.Secp256k1
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.
Constructors
Instances3Eq, Show, Binary
Eq Secp256k1InstructionDataDefined in solana-haskell-sdk-1.3.0.0 · Network.Solana.NativePrograms.Secp256k1Show Secp256k1InstructionDataDefined in solana-haskell-sdk-1.3.0.0 · Network.Solana.NativePrograms.Secp256k1Binary Secp256k1InstructionDataDefined in solana-haskell-sdk-1.3.0.0 · Network.Solana.NativePrograms.Secp256k1
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).