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

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for erc6492_signature_verifier-0.2.0.tar.gz
Algorithm Hash digest
SHA256 28faf53b1976c360a2f213988b6f32cfc538de38d20f1f312b68bf6fbc3c0952
MD5 bcea1220dfd481ca5fa0a81b82995738
BLAKE2b-256 084840766e969ec2afd6e7a5784a76544eacf95ba2a6675f26aab2a984d29f7d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for erc6492_signature_verifier-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 aee0c0afefd893f5c5d5a1e479fa4244cb69bf1be5802432a35aefa15107248c
MD5 5444472974df68f782a893f860ed4e67
BLAKE2b-256 31b419d6de5f89cc35b885bc747fb49fb541120369b28f4fd870a6528d44a83c

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