Metadata-Version: 2.4
Name: seed-scan
Version: 2026.11.16
Summary: What a mnemonic of unknown scheme holds: its scheme, addresses, coins and forks
Keywords: account-discovery,bip39,cryptocurrency,electrum,mnemonic,seed-phrase,slip39
Author: The btclib developers
Author-email: The btclib developers <devs@btclib.org>
License-Expression: MIT
License-File: AUTHORS.md
License-File: LICENSE
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Classifier: Programming Language :: Python :: 3.15
Classifier: Programming Language :: Python :: Implementation :: CPython
Classifier: Development Status :: 4 - Beta
Classifier: Environment :: Console
Classifier: Intended Audience :: End Users/Desktop
Classifier: Intended Audience :: Developers
Classifier: Natural Language :: English
Classifier: Operating System :: OS Independent
Classifier: Topic :: Security :: Cryptography
Classifier: Typing :: Typed
Requires-Dist: bip39-slip39>=2026.11.13
Requires-Dist: bip32-descriptors>=2026.11.13
Requires-Dist: btclib-wallet>=2026.11.14
Requires-Dist: coin-addresses>=2026.11.14
Requires-Dist: btclib>=2026.11.12
Requires-Dist: bitcoin-core-rpc>=2026.11.15
Requires-Python: >=3.11
Project-URL: homepage, https://btclib.org/seed-scan/
Project-URL: documentation, https://seed-scan.readthedocs.io/
Project-URL: download, https://github.com/btclib-org/seed-scan/releases
Project-URL: changelog, https://github.com/btclib-org/seed-scan/blob/main/RELEASE_NOTES.md
Project-URL: repository, https://github.com/btclib-org/seed-scan
Project-URL: issues, https://github.com/btclib-org/seed-scan/issues
Project-URL: pull_requests, https://github.com/btclib-org/seed-scan/pulls
Description-Content-Type: text/markdown

# seed-scan

A command for somebody who holds a mnemonic and does not know what it
is: which scheme it follows, which addresses it gave, which coins those
addresses held, and whether a fork concerns them. It finds funds; the
user's own wallet moves them.

<!-- Section 2 of the organization's standard says which badges sit here. -->
[![PyPI version](https://img.shields.io/pypi/v/seed-scan.svg?logo=pypi)](https://pypi.org/project/seed-scan/)
[![GitHub release](https://img.shields.io/github/v/release/btclib-org/seed-scan.svg)](https://github.com/btclib-org/seed-scan/releases)
[![development status](https://img.shields.io/pypi/status/seed-scan.svg)](https://pypi.org/project/seed-scan/)
[![license](https://img.shields.io/github/license/btclib-org/seed-scan.svg)](https://github.com/btclib-org/seed-scan/blob/main/LICENSE)
[![downloads](https://static.pepy.tech/badge/seed-scan)](https://pepy.tech/projects/seed-scan)
[![supported Python versions](https://img.shields.io/pypi/pyversions/seed-scan.svg?logo=python)](https://pypi.org/project/seed-scan/)
[![implementation](https://img.shields.io/pypi/implementation/seed-scan.svg)](https://pypi.org/project/seed-scan/)
[![wheel](https://img.shields.io/pypi/wheel/seed-scan.svg)](https://pypi.org/project/seed-scan/)

[![OpenSSF Best Practices](https://www.bestpractices.dev/projects/16633/badge)](https://www.bestpractices.dev/projects/16633)
[![OpenSSF Baseline](https://www.bestpractices.dev/projects/16633/baseline)](https://www.bestpractices.dev/projects/16633)

## What is here

`seed-scan identify`, `seed-scan scan`, `seed-scan forks` and
`seed-scan report` are the first commands.
[btclib-org/.github#2203](https://github.com/btclib-org/.github/issues/2203)
records the design. The command is to stay thin: what is general goes
down to the packages it is to build on,
[bip39-slip39](https://github.com/btclib-org/bip39-slip39),
[bip32-descriptors](https://github.com/btclib-org/bip32-descriptors),
[btclib-wallet](https://github.com/btclib-org/btclib-wallet) and
[coin-addresses](https://github.com/btclib-org/coin-addresses). A
scheme or a coin they do not cover is to be reported as not checked,
never passed over: the costly failure is a wrong "nothing found".

## Identifying a mnemonic

```shell
seed-scan identify > bundle.json
```

It asks for the mnemonic, then for passphrases until an empty one, at
hidden prompts, and for further shares where the words are one
SLIP-0039 share. It writes the bundle to standard output and what it
found to standard error. Where you know an address the mnemonic gave,
`--address` followed by it has the command search for the address's
path. `seed_scan.bundle` documents the bundle, and
`seed-scan identify --help` the bounds of what it writes and searches.

## Scanning a bundle

```shell
seed-scan scan bundle.json --server electrum.example.org:50002 \
    --node http://127.0.0.1:8545 > scan.json
```

It asks the Electrum server named, as `host:port`, which Bitcoin
accounts of the bundle were used, and the EVM node named, by its URL,
which of its accounts were on the chain the node serves, and writes the
scan result to standard output and what it found to standard error.
Name either or both. Each learns every address it is asked about, so
name your own: there is no default.

The Electrum connection is TLS, and the server's certificate is
verified against the system's CA certificates, or against those of the
file `--cafile` names, which is how a server with a self-signed
certificate is reached.

The connection is kept from one request to the next, and replaced by a
new one, with a new handshake, where btclib-wallet's
`PersistentTlsLineTransport` says it is: after a failed request, or a
connection the server closed, among others. The command closes the one
open when it ends.

`--tcp` asks a server on your own machine over plain TCP instead. Its
host must resolve to loopback addresses alone, `127.0.0.0/8` or `::1`,
and any other is refused. The connection is not encrypted or
authenticated: SECURITY.md's *Limitations, not vulnerabilities* says
what that exposes.

Before any address is asked, the server's genesis block and its block
at a height Bitcoin Core pins are compared with Bitcoin's, and each
history it answers is then proved on that block. SECURITY.md's
*Limitations, not vulnerabilities* says which servers that refuses, what
the proof holds, and what the server is still trusted for.

The node is an execution client's JSON-RPC, at an `https` URL, or an
`http` one on a loopback address such as `http://127.0.0.1:8545`.
`--cafile` is the Electrum server's alone: `seed_scan.evm` says what the
node's certificate is verified against. An address is used where it
holds the chain's native asset, has a nonce or holds one of the ERC-20
tokens `seed_scan.evm` lists for the chain, a few stablecoins and
wrapped assets. Any other token is not asked: an address with no
native balance, zero nonce and no listed token balance reads as unused,
whatever other tokens it holds. The result and the report list the
tokens checked.

`--evm-chain` names the chain the node serves, Ethereum where it is not
given; `seed-scan scan --help` lists the chains. A key gives the same
address on each, so Ethereum's accounts are read on every chain: those
at `m/44h/60h/<n>h`, the legacy addresses Ledger Live and MyEtherWallet
derive at `m/44h/60h/0h/<n>`, and those MyEtherWallet derives from a
mnemonic at `m/44h/60h/<n>`, as far as the keys the bundle holds of
them: the search is cut short where they end before the gap limit. On
Ethereum Classic its own are read too: those at `m/44h/61h/<n>h`, where
its wallets derive, and the legacy ones at `m/44h/60h/160720h/0h/<n>`.
On BNB Smart Chain, BNB's are read too: those at `m/44h/714h/<n>h`,
where Trust Wallet's "Smart Chain Legacy" derives, and the one address
of its "Stable Account", at `m/44h/60h/9172h/3604/9999`. Before any
address is asked, the node's chain id is compared with the chain's.
SECURITY.md's *Limitations, not vulnerabilities* says which nodes that
refuses, and what it does not prove.

A coin with no server or node named, every coin but Bitcoin and those
an EVM chain reads, and the accounts of a coin one chain alone reads on
any other chain, are listed as not checked. `seed_scan.scan` documents
the result, `seed_scan.evm` the node's requests, and
`seed-scan scan --help` the bounds of the search.

## Reading a fork of Bitcoin

```shell
seed-scan forks bundle.json --chain bitcoin-cash \
    --server bch.example.org:50002 > forks.json
```

Coins a key held on Bitcoin when a chain forked from it are on that
chain too, at the same script, and the chain's own wallets may have used
the key since. `forks` asks the Electrum server named, which serves the
chain named, which of the bundle's accounts were used there, and writes
the forks result to standard output and what it found to standard
error. `seed-scan forks --help` lists the chains it reads. How it reads
an output that also holds tokens, on each chain, is in `seed_scan.forks`.

The server is the user's own, reached as *Scanning a bundle* says, over
TLS or, with `--tcp`, over loopback. Before any address is asked, its
blocks at the chain's checkpoints are compared with the chain's, so that
a server of a chain whose blocks differ there, as one of Bitcoin's, is
refused. Each history it answers is then proved on the chain's last
checkpoint, under the chain's own difficulty rule, as for `scan`.
SECURITY.md's *Limitations, not vulnerabilities* says what the proof
holds, and what the server is still trusted for.

`seed_scan.forks` documents the result and which accounts are read, and
`seed-scan forks --help` the bounds of the search.

## Reporting what was found

```shell
seed-scan report bundle.json --scan scan.json --forks forks.json > report.txt
```

It reads the bundle and the scan result made from it, offline, and
writes what they say to standard output: for each reading, coin and
purpose, the used accounts and each of their used addresses, with its
balance and path, and what was not checked and why. Without `--scan`,
as after a server or a node failed, scan's lines list every account as
not checked. Each `--forks` names a forks result made from the bundle,
one per chain, with or without `--scan`, and the report lists what it
read the same way, each used account with its balance at the fork too.
A result made from another bundle is refused. The last line is the
SHA-256 of the lines above it. `seed_scan.report` documents the layout.

## What touches the secret

The commands are to keep to this split, so that the mnemonic stays on
one machine and everything after it reads public data:

- **`identify` touches the secret and no network.** It reads the
  mnemonic from a prompt, never from an argument. It tries each scheme,
  language and candidate passphrase, and, given an address the user
  knows, finds the reading and the path that give it. It writes a
  *public bundle*: the fingerprint and the account public keys, and,
  for MyEtherWallet's layout, the public keys of its first addresses.
- **`scan` and `forks` touch the network and no secret.** They read the
  bundle and what the commands before them wrote, and the CA
  certificates they verify their server against, and `scan` its node:
  the system's or, for a server, those of the file the user names;
  nothing else. *Scanning a bundle* and *Reading a fork of Bitcoin* say
  which server and which node each asks. `forks` reads the bundle's
  accounts on a chain forked from Bitcoin, and takes what each held at
  the fork from the history the chain's server answers.
- **`report` touches neither.** It assembles what `scan` and `forks`
  found: what was searched, what was found, the limits of the search,
  and the digest of the report.

The bundle holds no secret, but it is not harmless: an account public
key gives every address of that account, so whoever holds the bundle can
follow its history and balance, though not spend from it. The same
holds of the report: it holds no secret, but it lets anyone follow the
wallet's history.

Nor is the bundle harmless beside one leaked key: by BIP32, an extended
public key and the private key of one of its unhardened children give
the extended private key, so the bundle and the key of a single address
give its account's keys. It holds no key above a hardened account, which
with one leaked key would give every account below it. MyEtherWallet's
addresses of a mnemonic are the children `m/44h/60h/<n>` of the key
above Ethereum's accounts: the bundle holds the public key of each, for
`n` below `identify --keys`, and not that key, so the key of one of them
gives that address alone.

The package is fully annotated and ships `py.typed`. Its refusals are
`seed_scan.exceptions`'s classes: a `ValueError` or a `TypeError`,
under one base, `SeedScanException`.

```python
from seed_scan.exceptions import (
    SeedScanException,
    SeedScanTypeError,
    SeedScanValueError,
)

assert issubclass(SeedScanValueError, (SeedScanException, ValueError))
assert issubclass(SeedScanTypeError, (SeedScanException, TypeError))
```

`tests/readme_test.py` runs every Python block of this file, so the
example above is the one the suite checks.

## Security

[SECURITY.md](https://github.com/btclib-org/seed-scan/blob/main/SECURITY.md)
says what the package does to guard the mnemonic and what it cannot,
how to report a vulnerability, which versions are supported, and how a
published file is traced back to the run that built it.

## Contributing

Software development in btclib-org is mainly LLM-driven, but human
beings are welcome too. A contribution must have been read and
understood by the person who submits it.
[`CONTRIBUTING.md`](https://github.com/btclib-org/seed-scan/blob/main/CONTRIBUTING.md#working-with-an-llm)
has the rules.

[CONTRIBUTING.md](https://github.com/btclib-org/seed-scan/blob/main/CONTRIBUTING.md)
has the commands each CI job runs, verbatim. `uv sync` creates the
environment; uv is the only tool that has to be installed.
[REVIEWING.md](https://github.com/btclib-org/seed-scan/blob/main/REVIEWING.md)
is what a pull request is answered against.

How the organization decides, and who holds which role, is its
[GOVERNANCE.md](https://github.com/btclib-org/.github/blob/main/GOVERNANCE.md);
what it intends to do, and what it deliberately does not, is its
[ROADMAP.md](https://github.com/btclib-org/.github/blob/main/ROADMAP.md).

## Links

- Source: <https://github.com/btclib-org/seed-scan>
- Releases: <https://github.com/btclib-org/seed-scan/releases>
- [CHANGELOG.md](https://github.com/btclib-org/seed-scan/blob/main/CHANGELOG.md),
  and [RELEASE_NOTES.md](https://github.com/btclib-org/seed-scan/blob/main/RELEASE_NOTES.md)
  for what a release asks a user to act on

## Status

<!-- Section 2 of the organization's standard says which badges sit here. -->
[![pre-commit.ci status](https://results.pre-commit.ci/badge/github/btclib-org/seed-scan/main.svg)](https://results.pre-commit.ci/latest/github/btclib-org/seed-scan/main)
[![lint workflow status](https://github.com/btclib-org/seed-scan/actions/workflows/lint.yml/badge.svg?branch=main)](https://github.com/btclib-org/seed-scan/actions/workflows/lint.yml?query=branch%3Amain)
[![test workflow status](https://github.com/btclib-org/seed-scan/actions/workflows/test.yml/badge.svg?branch=main)](https://github.com/btclib-org/seed-scan/actions/workflows/test.yml?query=branch%3Amain)
[![docs workflow status](https://github.com/btclib-org/seed-scan/actions/workflows/docs.yml/badge.svg?branch=main)](https://github.com/btclib-org/seed-scan/actions/workflows/docs.yml?query=branch%3Amain)
[![deps-latest workflow status](https://github.com/btclib-org/seed-scan/actions/workflows/deps-latest.yml/badge.svg?branch=main)](https://github.com/btclib-org/seed-scan/actions/workflows/deps-latest.yml?query=branch%3Amain)
[![pypi-install workflow status](https://github.com/btclib-org/seed-scan/actions/workflows/pypi-install.yml/badge.svg?branch=main)](https://github.com/btclib-org/seed-scan/actions/workflows/pypi-install.yml?query=branch%3Amain)
[![deps-oldest workflow status](https://github.com/btclib-org/seed-scan/actions/workflows/deps-oldest.yml/badge.svg?branch=main)](https://github.com/btclib-org/seed-scan/actions/workflows/deps-oldest.yml?query=branch%3Amain)
[![os-macos workflow status](https://github.com/btclib-org/seed-scan/actions/workflows/os-macos.yml/badge.svg?branch=main)](https://github.com/btclib-org/seed-scan/actions/workflows/os-macos.yml?query=branch%3Amain)
[![os-ubuntu workflow status](https://github.com/btclib-org/seed-scan/actions/workflows/os-ubuntu.yml/badge.svg?branch=main)](https://github.com/btclib-org/seed-scan/actions/workflows/os-ubuntu.yml?query=branch%3Amain)
[![os-windows workflow status](https://github.com/btclib-org/seed-scan/actions/workflows/os-windows.yml/badge.svg?branch=main)](https://github.com/btclib-org/seed-scan/actions/workflows/os-windows.yml?query=branch%3Amain)
[![links workflow status](https://github.com/btclib-org/seed-scan/actions/workflows/links.yml/badge.svg?branch=main)](https://github.com/btclib-org/seed-scan/actions/workflows/links.yml?query=branch%3Amain)
[![sdist-rebuild workflow status](https://github.com/btclib-org/seed-scan/actions/workflows/sdist-rebuild.yml/badge.svg?branch=main)](https://github.com/btclib-org/seed-scan/actions/workflows/sdist-rebuild.yml?query=branch%3Amain)
[![codeql workflow status](https://github.com/btclib-org/seed-scan/actions/workflows/codeql.yml/badge.svg?branch=main)](https://github.com/btclib-org/seed-scan/actions/workflows/codeql.yml?query=branch%3Amain)
[![OpenSSF Scorecard](https://api.scorecard.dev/projects/github.com/btclib-org/seed-scan/badge)](https://scorecard.dev/viewer/?uri=github.com/btclib-org/seed-scan)

---

The btclib organization and its projects are actively supported by
[DGI](https://dgi.io) and [CheckSig](https://checksig.com).
