Skip to content

Commit

Permalink
EVM networks wallet generation logic added
Browse files Browse the repository at this point in the history
  • Loading branch information
Grommash9 committed Apr 30, 2024
1 parent 5f86630 commit bb49714
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 2 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).

## [0.0.10]
- EVM networks wallet generation logic added

## [0.0.5]
- empty (auto pypi testing)
Expand Down
21 changes: 19 additions & 2 deletions aiotx/clients/_evm_base_client.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,27 @@
class AioTxEVMClient:
import secrets
from eth_utils import keccak, encode_hex, to_checksum_address
from eth_keys import keys

class AioTxEVMClient:
def __init__(self, node_url):
self.node_url = node_url

def generate_address(self):
pass
private_key_bytes = secrets.token_bytes(32)
private_key = keys.PrivateKey(private_key_bytes)
public_key_bytes = private_key.public_key.to_bytes()
keccak_digest = keccak(public_key_bytes)[12:]
address = encode_hex(keccak_digest[-20:])
private_key_hex = private_key.to_hex()
return private_key_hex, to_checksum_address(address)


def get_address_from_private_key(self, private_key_hex: str):
private_key = keys.PrivateKey(bytes.fromhex(private_key_hex[2:]))
public_key_bytes = private_key.public_key.to_bytes()
keccak_digest = keccak(public_key_bytes)[12:]
address = encode_hex(keccak_digest[-20:])
return to_checksum_address(address)

def get_balance(self, address):
pass
2 changes: 2 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@
],
install_requires=[
"aiohttp",
"eth_keys",
"eth_utils"
],
extras_require={
"test": extras_test,
Expand Down

0 comments on commit bb49714

Please sign in to comment.