usigverifier

package
v0.0.12 Latest Latest
Warning

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

Go to latest
Published: Jan 13, 2026 License: MIT Imports: 9 Imported by: 0

README

Universal Signature Verifier (USigVerifier) Precompile

This is the USigVerifier (Universal Signature Verifier) precompile, responsible for verifying cryptographic signatures from supported source chains.

✅ Currently supported signature: ed25519

Generate ABI encoding

cd precompiles/usigverifier
solcjs USigVerifier.sol --abi
mv *.abi abi.json
jq --argjson abi "$(cat abi.json)" '{"_format": "hh-sol-artifact-1", "contractName": "USigVerifier", "sourceName": "precompiles/USigVerifier.sol", "bytecode": "0x", "deployedBytecode": "0x", "linkReferences": {}, "deployedLinkReferences": {}, "abi": $abi}' <<< '{}' > abi.json
cd ../../
# jq ".abi" abi.json | abigen --abi - --pkg usigverifier --type USigVerifier --out USigVerifier.go

Verification

# if you just get 0x, make sure the address is in the app_state["evm"]["params"]["active_static_precompiles"]

# precompile directly
cast abi-decode "verifyEd25519(bytes,bytes32,bytes)(bool)" `cast call 0x00000000000000000000000000000000000000ca "verifyEd25519(bytes,bytes32,bytes)" \
  "5DgQvTf6BvVs5Y4vNFnB5iXvTQvZah7y2JbT1dFxN6T2" \
  0x68656c6c6f776f726...bytes32_message_here \
  0x6f7c...your_signature_here
`

Documentation

Index

Constants

View Source
const (
	USigVerifierPrecompileAddress = "0x00000000000000000000000000000000000000ca"
	// VerifyEd25519Gas is the gas cost for verifying an Ed25519 signature.
	VerifyEd25519Gas uint64 = 4000
)
View Source
const VerifyEd25519Method = "verifyEd25519"

Variables

This section is empty.

Functions

func GetAddress

func GetAddress() common.Address

return address of the precompile

Types

type Precompile

type Precompile struct {
	cmn.Precompile
}

Precompile defines the precompile

func NewPrecompile

func NewPrecompile() (*Precompile, error)

func (Precompile) IsTransaction

func (Precompile) IsTransaction(method *abi.Method) bool

IsTransaction checks if the given method name corresponds to a transaction or query.

func (Precompile) RequiredGas

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

func (Precompile) Run

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

func (Precompile) VerifyEd25519

func (p Precompile) VerifyEd25519(
	method *abi.Method,
	args []interface{},
) ([]byte, error)

Jump to

Keyboard shortcuts

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