Created
October 17, 2021 19:05
-
-
Save mikoim/c833b4b7c33021ee12e01eb9b327d58d to your computer and use it in GitHub Desktop.
Retrieve Ethereum address from private key with web3.py
This file contains hidden or 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
from web3.auto import w3 | |
from eth_account.messages import encode_defunct | |
message = encode_defunct(text='') | |
signed_message = w3.eth.account.sign_message(message, private_key='0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80') # Hardhat | |
address = w3.eth.account.recover_message(message, signature=signed_message.signature) | |
print(address) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment