Git Product home page Git Product logo

omni-recovery-tool's Introduction

evias/omni-recovery-tool

Build Status License

The evias/blockchain-cli Package aims to be an easy to use command line interface and API utility Software built around Bitcoin, Colored Coins and NEM blockchain features.

Dependencies

  • php>=7.1 : for laravel-zero/laravel-zero Package
  • php7.1-gmp : for Bit-Wasp/bitcoin-php Package
  • php7.1-bcmath : for Bit-Wasp/bitcoin-php Package
  • php7.1-intl : for UTF-8 encoded passphrases
  • php7.1-xml : for PHPUnit
  • php7.1-mbstring : for PHPUnit
  • php7.1-curl

Usage Examples

# Get list of available commands
$ php application list

# Get Simple HD Address from BIP32 Extended Public Key
$ php application wallet:hd-from-xpub --xpub="xpub123456"

# Get Multisig HD Address from BIP32 Extended Public Keys of cosigners
$ php application wallet:hd-from-xpub --xpubs="xpub123456,xpub1234332,xpub493554" --mincount 2

# Get BIP39 Seed from Mnemonic as well as BIP32 Root Key :
$ php application wallet:derive --mnemonic="abandon abandon abandon"

# Get BIP44 Addresses, Public Keys and Private Keys
$ php application wallet:derive --mnemonic="abandon abandon abandon" --path="m/44'/0'/0'/0"

# Get BIP32 Addresses protected by password (Bitcoin Core) :
$ php application wallet:derive --mnemonic="abandon abandon abandon" --password="mySecurePassword" --path="m/0'/0'"

# Parse a OP_RETURN colored coin hexadecimal payload (Omnilayer or any other OP_RETURN content)
$ php application script:op-return --asm="OP_RETURN 6f6d6e69000000000000001f000000002faf0800 OP_EQUAL"

Example of USDT (Omnilayer) recovery on CoPay Multisig Wallet

I have proceeded to a recovery of 8 USDT from a CoPay Multisig Wallet to a Bittrex wallet which you can see in details on the following links :

The created transaction uses 2 Inputs because I needed an address from which I would pay the Bitcoin Fee for processing the transaction. Following are details about HD Key derivation paths needed to sign those 2 inputs. Because both inputs are different Bitcoin Addresses we will need different public/private key Pairs for each Input we need to sign.

In my case, the first input was located in the third address of the CoPay wallet. Which turns out to be at derivation path m/44'/0'/0'/0/2.

The second input was located in the first change address of the CoPay wallet. Which turns out to be at derivation path m/44'/0'/0'/1/0.

After gathering the right data about those inputs, I then ran the following command providing --input1 and --input2 are transaction IDs of the transaction in which your inputs are the outputs. (Inputs are always Outputs in a previous transaction)

The magic:

$  php application omni:copay-recovery --input1="9141346500a45fb588e2ee2908583d9d2b0484b1941dcb0e50fbf9bf1e4e5b51" \
                                       --vindex1="1" \
                                       --path-sign1="m/44'/0'/0'/0/2" \
                                       --input2="517a0ad4bf4cc423ce578f043a13e98d405902c08b1bfcac92b199ba3fd2cc39" \
                                       --vindex2="1" \
                                       --path-sign2="m/44'/0'/0'/1/0" \
                                       --cosig1="this is not the right mnemonic" \
                                       --cosig2="nor is this one because crazy" \
                                       --cosig3="this third mnemonic is optional" \
                                       --destination "1Ajqkh2foqMGLRAe9YkS7mwMgsAEiAx3aM" \
                                       --change "143f5QPkc5mJurEr2kGPPoecJqkhvaQ2u2" \
                                       --min 2 \
                                       --bitcoin 75000 \
                                       --fee 40000 \
                                       --colored-op="6f6d6e69000000000000001f000000002faf0800"

How to find the right derivation path

Using your cosigner wallet's mnemonics, it is possible to recover the Copay Multisig Wallet produced at derivation path X. For this, I added a command which will display the Wallet Address as well as the Redeem Script and Output Script in human readable format.

Running this command, you can test a lot of derivation paths as to find the exact derivation path of the address you need to recover.

Example derivation paths include:

  • CoPay Multisig First Address: m/44'/0'/0'/0/0
  • CoPay Multisig 19th Address: m/44'/0'/0'/0/18
  • CoPay Multisig First Change Address: m/44'/0'/0'/1/0
  • CoPay Cosigners Base Derivation Path: m/44'/0'/0'.
    • XPUBs of the cosigners are derived with the base derivation path.
  • Multibit HD First Address: m/0'/0/0.
  • BIP44 First Address: m/44'/0'/0'/0/0.
  • BIP49 First Address: m/49'/0'/0'/0/0.
  • BIP141 (Segregated Witness) First Address: m/0/0
  • Bitcoin Core BIP32 First Address: m/0'/0'/0'
    • Always Hardened!
  • Blockchain.info BIP32 First Address: m/44'/0'/0'/0

The command to create multisig wallets and display their informations such as Address, Redeem Script and Output Script, can be run with the following:

# Get Multisig Address at derivation m/44'/0'/0'/0/0 (first CoPay Wallet address) with 2 of 3 configuration
php application wallet:multisig --cosig1="this is not the right mnemonic" \
                                --cosig2="nor is this one because crazy" \
                                --cosig3="this third mnemonic is optional" \
                                --count 2 \
                                --path="m/44'/0'/0'/0/0"

# Get Multisig Address at derivation m/44'/0'/0'/0/0 (first CoPay Wallet address) with 1 of 2 configuration
php application wallet:multisig --cosig1="this is not the right mnemonic" \
                                --cosig2="nor is this one because crazy" \
                                --count 1 \
                                --path="m/44'/0'/0'/0/0"

# Get Multisig Address at derivation m/44'/0'/0'/0/1 (second CoPay Wallet address) with 2 of 3 configuration
php application wallet:multisig --cosig1="this is not the right mnemonic" \
                                --cosig2="nor is this one because crazy" \
                                --cosig3="this third mnemonic is optional" \
                                --count 2 \
                                --path="m/44'/0'/0'/0/1"

Pot de vin

If you like the initiative, and for the sake of good mood, I recommend you take a few minutes to Donate a beer or Three [because belgians like that] by sending some Coins (I'm open to any Network :P) to my Wallet:

  • NEM/XEM: NCK34K5LIXL4OMPDLVGPTWPZMGFTDRZQEBRS5Q2S
  • Bitcoin: 38dGUttcaiVg3fTFacMevaWWmC9deuaQc5
  • Ethereum: 0x4C5dda72140A73605dA3E535801a103Be42E99c0
  • Litecoin: LdoNqbeN9jtMhL1HBicvnoq5RH9eycWQo8
  • IOTA: PSXGQLYRSSYUPRYPW9VWCMXFUFDMTCUXGYIKJGONXUZEXTYGIJM9MIYCKPYPCEHWQRSX9BKCFQKLYYL9GPFCDFOFJX

Credits

License

The blockchain-cli Package is open-sourced software licensed under the MIT license

omni-recovery-tool's People

Contributors

clarkeash avatar evias avatar geoffroy-aubry avatar ilesinge avatar introwit avatar nunomaduro avatar scrutinizer-auto-fixer avatar stefanzweifel avatar vojtasvoboda avatar

Watchers

 avatar  avatar  avatar

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.