https://github.com/mewmix/erc5564py
A python implementation of ERC5564 for Stealth Addresses on Ethereuem as described https://eips.ethereum.org/EIPS/eip-5564
https://github.com/mewmix/erc5564py
cryptocurrency cryptography ecdsa-cryptography erc5564 ethereum python stealth-addresses
Last synced: about 1 month ago
JSON representation
A python implementation of ERC5564 for Stealth Addresses on Ethereuem as described https://eips.ethereum.org/EIPS/eip-5564
- Host: GitHub
- URL: https://github.com/mewmix/erc5564py
- Owner: mewmix
- License: mit
- Created: 2023-12-31T19:45:51.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2024-01-01T00:05:55.000Z (over 2 years ago)
- Last Synced: 2025-09-02T14:50:48.195Z (10 months ago)
- Topics: cryptocurrency, cryptography, ecdsa-cryptography, erc5564, ethereum, python, stealth-addresses
- Language: Python
- Homepage: https://github.com/mewmix/erc5564py
- Size: 28.3 KB
- Stars: 2
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ERC-5564 Python Implementation
## Unaudited, heavy WIP, use in production at own risk.
## Quick start
```python
# Imports
from erc5564py.stealth_meta_address import generate_stealth_meta_address, generate_stealth_address
from erc5564py.stealth_address import computeStealthAddress, computeStealthKey
from erc5564py.utils import point_from_hex
# Generate Stealth Meta-Address
stealth_meta_address, spending_private_key, viewing_private_key = generate_stealth_meta_address()
# Generate Stealth Address
stealth_address_data = generate_stealth_address(stealth_meta_address)
ephemeral_pub_key_hex = stealth_address_data['ephemeral_pubkey']
# Convert ephemeral public key hex to Point
ephemeral_pub_key = point_from_hex(ephemeral_pub_key_hex)
# Check if the stealth address belongs to the recipient
computeStealthAddress(ephemeral_pub_key, viewing_private_key, spending_private_key.get_verifying_key(), stealth_address_data['view_tag'])
# Compute Stealth Private Key
stealth_private_key = computeStealthKey(ephemeral_pub_key, viewing_private_key, spending_private_key)
print(f"Stealth PK: {stealth_private_key.hex()}, Stealth Meta Addres {stealth_meta_address}, Stealth Address Data: {stealth_address_data}")
```