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.2.1.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.2.1-py3-none-any.whl (10.1 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: erc6492_signature_verifier-0.2.1.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.2.1.tar.gz
Algorithm Hash digest
SHA256 57e4ecf85f50454318b76792358e53c56b880957933510aee4eea5ec74d61b5e
MD5 cc37b26276fda931eee3e5a2b57cc026
BLAKE2b-256 75e5a99bf7ec98df3c2e97c1ac6a07b6d28ea1e68b676b7c03111453035524cc

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for erc6492_signature_verifier-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ff9dd93b683729c17099c385b0947b0ef8f4e80ab7dae9a5b870851b26b1e62a
MD5 e17e240b0b415d080bc44fbb6bcc026d
BLAKE2b-256 fedcd55fdf0d5b6589b88276791cae96230d33f615a7610856af070b836055b7

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