-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
EVM networks wallet generation logic added
- Loading branch information
Showing
3 changed files
with
23 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -43,6 +43,8 @@ | |
], | ||
install_requires=[ | ||
"aiohttp", | ||
"eth_keys", | ||
"eth_utils" | ||
], | ||
extras_require={ | ||
"test": extras_test, | ||
|