usigverifier

package
v0.0.28 Latest Latest
Warning

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

Go to latest
Published: Apr 1, 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"
	USigVerifierPrecompileAddressV2 = "0xEC00000000000000000000000000000000000001"
	// 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

func GetAddressV2 added in v0.0.23

func GetAddressV2() common.Address

GetAddressV2 returns the new (0xEC..01) address of the precompile

Types

type Precompile

type Precompile struct {
	cmn.Precompile
}

Precompile defines the precompile

func NewPrecompile

func NewPrecompile() (*Precompile, error)

func NewPrecompileV2 added in v0.0.23

func NewPrecompileV2() (*Precompile, error)

NewPrecompileV2 creates a new USigVerifier precompile at the new address (0xEC..01). It provides the same functionality as NewPrecompile but at the reserved address range.

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