GithubHelp home page GithubHelp logo

esneider / indy Goto Github PK

View Code? Open in Web Editor NEW
59.0 6.0 27.0 4.73 MB

๐Ÿ•ต๏ธโ€โ™‚๏ธ Find and sweep all the funds spendable by your bitcoin private key.

License: MIT License

Python 100.00%
bitcoin hd-wallet segwit mnemonics mnemonic-phrase electrum electrum-server

indy's Introduction

Indy: the ultimate recovery tool

About

Recovering funds from a wallet using just the mnemonic phrase has historically been a difficult problem. The main reason being that different wallets use different derivation paths and script types. Sadly, the mnemonic format doesn't document this and other important metadata needed during the recovery process.

Indy intends to cover the gap left by the standard by making the recovery of funds from a mnemonic trivial. Just input your mnemonic and let the tool guess the derivation path used by the wallet.

You can use Indy to sweep all the funds to a destination address of your choice.

Features

  • Supports sweeping funds from mnemonics, xprivs, and xpubs (for xpubs it will just find the UTXOs)
  • Supports mnemonics in English, Chinese, Spanish, French, Italian, Japanese and Korean
  • Supports all the derivation paths and address types from the wallets listed in walletsrecovery.org
  • Supports customizing the address gap limit and the account gap limit
  • Supports using a custom electrum server

Demo

How it works

Indy uses electrum servers to try every possible combination of known derivation paths and script types. Once the relevant path and script type combinations are detected, the tool will proceed to find all the UTXOs for those combinations. After all funds are found, if you desire so, Indy can create a transaction that will sweep them to an address of your choosing.

Some wallets use a custom address gap limit (or none at all), or really high account numbers, so you can choose to override these parameters.

Finally, notice that this tool is only useful for single key wallets. If you are using a multisig or lightning wallet, then you cannot recover the funds with just the mnemonic.

Installation

git clone https://github.com/esneider/indy && cd indy
pip3 install -r requirements.txt
python3 indy.py --help

Usage

usage: indy.py [-h] [--address <address>] [--broadcast] [--fee-rate <rate>]
               [--address-gap <num>] [--account-gap <num>] [--host <host>]
               [--port <port>] [--protocol {t,s}] [--no-batching]
               key

Find and sweep all the funds from a mnemonic or bitcoin key, regardless of the
derivation path or address format used.

positional arguments:
  key                  master key to sweep, formats: mnemonic, xpriv or xpub

optional arguments:
  -h, --help           show this help message and exit

sweep transaction:
  --address <address>  craft a transaction sending all funds to this address
  --broadcast          if present broadcast the transaction to the network
  --fee-rate <rate>    fee rate to use in sat/vbyte (default: next block fee)

scanning parameters:
  --address-gap <num>  max empty addresses gap to explore (default: 20)
  --account-gap <num>  max empty account levels gap to explore (default: 0)

electrum server:
  --host <host>        hostname of the electrum server to use
  --port <port>        port number of the electrum server to use
  --protocol {t,s}     electrum connection protocol: t=TCP, s=SSL (default: s)
  --no-batching        disable request batching

Credits

This tool was created after reading this twitter thread by @aantonop. Many thanks for the idea and the relentless contributions to the Bitcoin community!

Also, Indy stands on the tremendous effort done by @NVK and @J9Roem documenting the derivation paths for many wallets at walletsrecovery.org. It belongs in a museum!

indy's People

Contributors

esneider avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

indy's Issues

set spend limit

I have 4 my own seeds, one of which is for hodling (0.01 btc)
the others is 0.05 - 0.1

How i can set spent limit , when i check seed with --broadcast parameter ?
For example, if my key contains <0.05 btc script isn`t send it automatically or skip

AttributeError: 'StratumClient' object has no attribute 'batch_rpc'

I receive the following error output upon running indy:
๐Ÿ”‘ Read mnemonic successfully
โณ Connecting to electrum server, this might take a while
๐ŸŒ Connected to electrum server successfully
๐Ÿƒโ€โ™€๏ธ Searching possible addresses: 0%| | 0/609 [00:00<?, ?it/s]
Traceback (most recent call last):
File "/home/trenaz/indy/indy.py", line 188, in <module>
main()
File "/home/trenaz/indy/indy.py", line 67, in main loop.run_until_complete(find_utxos( File "/usr/lib/python3.9/asyncio/base_events.py", line 642, in run_until_complete return future.result() File "/home/trenaz/indy/indy.py", line 130, in find_utxos utxos = await scanner.scan_master_key(client, master_key, address_gap, account_gap, should_batch) File "/home/trenaz/indy/scanner.py", line 66, in scan_master_key responses = await _electrum_rpc(client, batch_request) File "/home/trenaz/indy/scanner.py", line 131, in _electrum_rpc response = await client.batch_rpc(requests) AttributeError: 'StratumClient' object has no attribute 'batch_rpc'`

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.