-
Notifications
You must be signed in to change notification settings - Fork 89
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add example for Ethereum with Atomic wallet
- Loading branch information
1 parent
e409866
commit de04cde
Showing
1 changed file
with
19 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
""" | ||
Example of how to get Ethereum address like Atomic wallet. | ||
Atomic Wallet doesn't actually derive a BIP44 path for Ethereum, but it directly uses the master key for getting the address. | ||
""" | ||
|
||
from bip_utils import Bip39SeedGenerator, Bip44, Bip44Coins | ||
|
||
|
||
# Mnemonic | ||
mnemonic = "abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon abandon about" | ||
# Generate seed from mnemonic | ||
seed_bytes = Bip39SeedGenerator(mnemonic).Generate() | ||
|
||
# Construct from seed | ||
bip44_mst_ctx = Bip44.FromSeed(seed_bytes, Bip44Coins.ETHEREUM) | ||
# Print master key | ||
print(f"Private key: {bip44_mst_ctx.PrivateKey().Raw().ToHex()}") | ||
print(f"Address: {bip44_mst_ctx.PublicKey().ToAddress()}") |