Skip links

Ethereum: Find all used addresses using xpub key

Discover All Ethereum Addresses Using Your Master XPub Key

As a Ledger user, you are no doubt familiar with managing your Ethereum balance and transactions. However, finding all the addresses associated with your account can be a tedious task, especially if you have access to your master xpub key. In this article, we will show you how to use your master xpub key to discover all the Ethereum addresses associated with your wallet.

What is an XPub key?

Before we dive into the solution, let’s quickly review what an xpub key is. An xpub key is a public encryption key that Ledger devices use to sign transactions and messages. This key is essential for creating and managing private keys on your Ledger hardware.

Why use a master xpub key?

Your master xpub key is securely stored on your Ledger device, making it accessible only to you. By using the xpub master key with other tools and software like this article, you can:

  • Unlock encrypted data or transactions in the Ledger app
  • Generate new private keys for secure storage
  • Create custom scripts to automate tasks

Finding All Ethereum Addresses Using the XPub Master Key

Now that we’ve covered the basics of xpub keys and what they mean, let’s take a look at how you can use the xpub master key to discover all the Ethereum addresses associated with your wallet.

Step 1. Open the Ledger app

First, make sure your Ledger app is up to date and running. If it’s not, open the app and head to the “Settings” menu (represented by three horizontal lines in the top-left corner).

Step 2. Access the Max menu

In the Settings menu, select the Max option.

Step 3: Generate a new Xpub key

To find all Ethereum addresses associated with your wallet, you will need to generate a new xpub key. You can do this by:

  • Clicking on “Generate New XPub”
  • Selecting the address type (e.g. Ledger Wallet Address)
  • Follow the instructions to create and save the new xpub key

Step 4: Use your master Xpub key with a script

To find all Ethereum addresses, you will need to use your master xpub key with a script. Here is an example of how to do this.


Import the required libraries

import eth_abi as ab

from subprocess import Popen


Define the contract address and ABI

contract_address = "0x...your contract address..."

abi = ab.abi_from_paths(["path/to/abi.json"])


Use your master xpub key to generate a new private key

private_key = Popen([' Ledger app', '-getaddress', '--from', 'master', 'xpub'], stdout=Popen(' -o', 'script.txt')).stdout.read().decode()


Write the script to a file

with open('script.txt', 'w') as f:

f.write(private_key)

This script uses your master xpub key to generate a new private key and writes it to a file named “script.txt”. You can then use this file to sign transactions in the Ledger app or on another device.

Step 5. Use your new private key with the Ledger app

To find all Ethereum addresses using your new private key, follow these steps:

  • Open the Ledger app
  • Select the “Wallet” option.
  • Click “Use Key”
  • Enter the file name (script.txt) and select the correct address type (e.g. Ledger Wallet Address)

Conclusion

Using your master xpub key is a convenient way to find all Ethereum addresses associated with your wallet. By following these steps, you can unlock encrypted data or transactions in the Ledger app and generate new private keys for safekeeping.

Remember to always keep your master xpub key safe, as anyone who has access to it could compromise the security of your entire wallet.

ROLE ROLE ARTIFICIAL INTELLIGENCE

Leave a comment

Explore
Drag