Skip to content

A Python library for easy verification of Ethereum signatures, supporting both smart contracts (EIP6492) and externally owned accounts (EIP1271)

License

Notifications You must be signed in to change notification settings

Sajad-Salehi/EIP6492-Signature-Verifier

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

27 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

EIP6492-Signature-Verifier

Overview

The erc6492_signature_verifier library is a Python package designed to verify Ethereum signatures in compliance with EIP-6492. It supports both smart contract and externally owned account (EOA) signatures, automatically selecting the appropriate verification method based on the length of the signature. This library simplifies the process of signature verification for Ethereum-based applications.

Features

  • Smart Contract Signature Verification: Validates signatures associated with Ethereum smart contracts.
  • Externally Owned Account (EOA) Signature Verification: Verifies signatures from externally owned accounts.
  • Automatic Method Selection: Determines the appropriate verification method based on the signature length.

Installation

You can install the erc6492_signature_verifier library from PyPI using pip:

pip install erc6492_signature_verifier

Usage

Here’s a quick guide on how to use the SignatureVerifier class:

Example

from erc6492_signature_verifier import SignatureVerifier

# Initialize the verifier with your Web3 provider URL
verifier = SignatureVerifier("YOUR_WEB3_PROVIDER_URL")

# Example data
signature = "0x..."  # Replace with the actual signature
message = "Hello, world!"
signer = "0x..."  # Replace with the actual signer's Ethereum address

# Verify the signature
is_valid = verifier.verify_signature(signature, message, signer)
print(f"Signature valid: {is_valid}")

Method Descriptions

  • SignatureVerifier(web3_provider: str): Initializes the verifier with the specified Web3 provider URL.
  • verify_signature(signature: str, message: str, signer: str) -> bool: Verifies the given signature. The method automatically selects whether to use smart contract or EOA verification based on the signature length.

Development

To contribute to the development of this library, follow these steps:

  1. Clone the Repository

    git clone https://github.com/sajad-salehi/EIP6492-Signature-Verifier.git
    cd EIP6492-Signature-Verifier
  2. Install Development Dependencies

    poetry install
  3. Run Tests

    Execute the following command to run the tests:

    poetry run pytest
  4. Build and Publish

    To build the library, use:

    poetry build

    To upload the package to PyPI, use:

    poetry publish --build --username __token__ --password YOUR_PYPI_TOKEN

License

This project is licensed under the MIT License - see the LICENSE file for details.

Contact

For issues or feature requests, please open an issue on the GitHub repository.

For direct contact, email: SajadSolidity@gmail.com

About

A Python library for easy verification of Ethereum signatures, supporting both smart contracts (EIP6492) and externally owned accounts (EIP1271)

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published