Skip to content

Commit

Permalink
Add example for Ethereum with Atomic wallet
Browse files Browse the repository at this point in the history
  • Loading branch information
ebellocchia committed May 4, 2024
1 parent e409866 commit de04cde
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions examples/eth_atomic.py
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()}")

0 comments on commit de04cde

Please sign in to comment.