Documentation
¶
Overview ¶
Package ed25519 provides instruction builders for the Solana ed25519 precompile program, which verifies Ed25519 signatures. It is a native precompile: it reads instruction data only and takes no account inputs.
Index ¶
- Variables
- func NewInstruction(data []byte) solana.Instruction
- func NewRawInstruction(data []byte) solana.Instruction
- func NewSignatureVerifyInstruction(signatures []Ed25519SignatureOffsets) (solana.Instruction, error)
- func NewVerifySignature(publicKey [32]byte, signature [64]byte, message []byte) (solana.Instruction, error)
- type Ed25519SignatureOffsets
Constants ¶
This section is empty.
Variables ¶
var ProgramID = solana.MustPublicKey("Ed25519SigVerify111111111111111111111111111")
ProgramID is the canonical address of the Solana ed25519 precompile: Ed25519SigVerify111111111111111111111111111.
Functions ¶
func NewInstruction ¶
func NewInstruction(data []byte) solana.Instruction
NewInstruction is an alias for NewRawInstruction.
func NewRawInstruction ¶
func NewRawInstruction(data []byte) solana.Instruction
NewRawInstruction wraps pre-encoded ed25519 precompile data as a solana.Instruction.
func NewSignatureVerifyInstruction ¶
func NewSignatureVerifyInstruction(signatures []Ed25519SignatureOffsets) (solana.Instruction, error)
NewSignatureVerifyInstruction builds an ed25519 precompile instruction from a slice of Ed25519SignatureOffsets descriptors. Layout: [1 byte count] [1 byte padding] [14 bytes per entry, LE encoded]. len(signatures) must not exceed 255 (the on-chain count field is u8).
func NewVerifySignature ¶
func NewVerifySignature(publicKey [32]byte, signature [64]byte, message []byte) (solana.Instruction, error)
NewVerifySignature builds a self-contained ed25519 verification instruction. All data (public key, signature, message) is packed inline in the instruction data field; no other instructions are needed.
publicKey — 32-byte ed25519 public key signature — 64-byte ed25519 signature message — bytes that were signed; must be ≤ 65535 bytes
The instruction has no accounts; the precompile reads everything from the instruction data.
Types ¶
type Ed25519SignatureOffsets ¶
type Ed25519SignatureOffsets struct {
SignatureOffset uint16 // byte offset to the 64-byte ed25519 signature
SignatureInstructionIndex uint16 // which transaction instruction holds the signature; 0xFFFF = this instruction
PublicKeyOffset uint16 // byte offset to the 32-byte ed25519 public key
PublicKeyInstructionIndex uint16 // which transaction instruction holds the public key
MessageDataOffset uint16 // byte offset to the signed message data
MessageDataSize uint16 // length of the message data in bytes
MessageInstructionIndex uint16 // which transaction instruction holds the message
}
Ed25519SignatureOffsets describes the byte offsets within an ed25519 precompile instruction where the signature components can be found. On-wire layout is 14 bytes, seven u16 fields in little-endian order. Unlike Secp256k1SignatureOffsets, every field — including the three instruction-index fields — is u16.