p256

package
v1.8.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 17, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// VerifyGas is the secp256r1 elliptic curve signature verifier gas price.
	VerifyGas uint64 = 3450
	// VerifyInputLength defines the required input length (160 bytes).
	VerifyInputLength = 160
)
View Source
const PrecompileAddress = "0x0000000000000000000000000000000000000100"

PrecompileAddress defines the hex address of the p256 precompiled contract.

Variables

This section is empty.

Functions

This section is empty.

Types

type Precompile

type Precompile struct{}

Precompile secp256r1 (P256) signature verification implemented as a native contract as per EIP-7212. See https://eips.ethereum.org/EIPS/eip-7212 for details

func (Precompile) Address

func (Precompile) Address() common.Address

Address defines the address of the p256 precompiled contract.

func (Precompile) RequiredGas

func (p Precompile) RequiredGas(_ []byte) uint64

RequiredGas returns the static gas required to execute the precompiled contract.

func (*Precompile) Run

func (p *Precompile) Run(_ *vm.EVM, contract *vm.Contract, _ bool) (bz []byte, err error)

Run executes the p256 signature verification using ECDSA.

Input data: 160 bytes of data including:

  • 32 bytes of the signed data hash
  • 32 bytes of the r component of the signature
  • 32 bytes of the s component of the signature
  • 32 bytes of the x coordinate of the public key
  • 32 bytes of the y coordinate of the public key

Output data: 32 bytes of result data and error

  • If the signature verification process succeeds, it returns 1 in 32 bytes format

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL