Skip to main content

A Python library for verifying Ethereum signatures in compliance with EIP-6492, supporting both smart contracts and externally owned accounts (EOA).

Project description

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

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

erc6492_signature_verifier-0.1.0.tar.gz (9.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

erc6492_signature_verifier-0.1.0-py3-none-any.whl (10.0 kB view details)

Uploaded Python 3

File details

Details for the file erc6492_signature_verifier-0.1.0.tar.gz.

File metadata

  • Download URL: erc6492_signature_verifier-0.1.0.tar.gz
  • Upload date:
  • Size: 9.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.4 Darwin/23.5.0

File hashes

Hashes for erc6492_signature_verifier-0.1.0.tar.gz
Algorithm Hash digest
SHA256 aca60d8d13798ed60808b077eff1e1c3b70f81947835b77ad4a70bf616428d43
MD5 0799478562388427557f928993b2da47
BLAKE2b-256 953d0a0cc37839c387833b582035fd014bc8d7199094cfbb1f8939cf0f4e17da

See more details on using hashes here.

File details

Details for the file erc6492_signature_verifier-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for erc6492_signature_verifier-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 86518a83fa4acb60877071bbb95b6330fd4452b01881f0a16b505a1d8e9b0aec
MD5 42227eea0feb3561318f912a17fac2e2
BLAKE2b-256 3522744ebfd4e4c244703c2e98e12b435a26ff40b7900678e118bfd4d417543b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page