Given a master public key (xpub, Ltub, etc.), get the balances of its derived legacy, native SegWit, and SegWit addresses, or check whether an address has been derived from it.
- Privacy Friendly: master public keys are never sent over the Internet: only their derived addresses are
- Derives specific addresses (by account+index) or all active ones
- Searches if a given address has been derived from a given master public key (perfect and partial match)
- Supports legacy, SegWit, and Native Segwit
- Automatically checks some categories of CSV files containing operations history
- Node.js and TypeScript,
- Docker
$ npm i -g typescript # if needed
$ npm i
$ tsc -p .
By default, Bitcoin xpubs and Litecoin ltubs are automatically detected.
To scan Bitcoin Cash xpubs, use the --currency bch
argument:
$ node build/scan.js --currency bch <xpub> …
In the following instructions, the generic xpub
term is used to designate a master public key. It can be substituted with another type of supported public key, such as Ltub
(Litecoin).
$ node build/scan.js <xpub> -a <account> -i <index>
Example:
$ node build/scan.js xpub6C...44dXs7p -a 0 -i 10
[addresses at account 0
, index 10
]
$ node build/scan.js <xpub>
Example:
$ node build/scan.js xpub6C...44dXs7p
$ node build/scan.js <xpub> --import <file path>
Example:
$ node build/scan.js xpub6C...44dXs7p --import /Users/Test/Downloads/export.csv
$ node build/scan.js <xpub> [args...] --save <directory>
The files are saved as <xpub>.json
and <xpub>.html
.
Note: --save stdout
can be used to display the JSON instead of saving the files. Furthermore, the --quiet
option does not display the analysis progress.
Check if an address has been derived from a master public key.
$ node build/scan.js <xpub> --address <address>
Add ?
where there is uncertainty about a character in the address. For instance: 1MYaYeZhDp?m3YtvqBMXQQN??YCz?7NqgF
Build: $ docker build -t xpubscan .
Run: $ docker run xpubscan <xpub> [optional: <args>]
When an analysis is performed, 3 elements are displayed in the following order:
- The analysis of each derived active address (type, path, address, current balance, total in
←
, total out→
) - The transactions ordered by date (date, block number, address, in
←
| out→
| sent to self⮂
| sent to sibling↺
| received as change from non-siblingc
) - A summary: total number of transactions and total balance by address type
The derived addresses are displayed during the analysis. Perfect matches are displayed in green (with the corresponding derivation path). Partial matches are displayed in blue (also with the derivation path). No matches are rendered in red.
- Modify
./src/settings.ts
- rebuild the tool:
$ tsc -p .
- Re-run it:
$ node build/scan.js <xpub> …
- At the root of the project, rename
.env.template
to.env
- In
.env
, set theAPI_URL
as well as yourAPI_KEY
(following the structure provided by the.env.template
) - rebuild the tool:
$ tsc -p .
- Re-run it:
$ node build/scan.js <xpub> …
- Ensure that, when running the tool, it shows that the custom provider is being used