All Projects → evias → omni-recovery-tool

evias / omni-recovery-tool

Licence: MIT License
CLI for the recovery of OMNI funds (any OP_RETURN inputs) out of a Bitcoin Multisig Wallet

Programming Languages

PHP
23972 projects - #3 most used programming language

Projects that are alternatives of or similar to omni-recovery-tool

MercadoLivreProductsCrawler
PHP Console Crawler to Download Products from a Store on MercadoLivre.com.br
Stars: ✭ 18 (+20%)
Mutual labels:  laravel-zero
installer
This repository contains the installer of Laravel Zero
Stars: ✭ 18 (+20%)
Mutual labels:  laravel-zero
foundation
This is a mirror from https://github.com/laravel/framework/tree/9.x/src/Illuminate/Foundation
Stars: ✭ 26 (+73.33%)
Mutual labels:  laravel-zero
tinker-zero
Bridge laravel/tinker for your laravel-zero applications
Stars: ✭ 39 (+160%)
Mutual labels:  laravel-zero
secure-webstore
A secure IndexedDB store with built-in encryption
Stars: ✭ 35 (+133.33%)
Mutual labels:  key-derivation
gtk
🎨 Omni for GTK and Gnome Shell
Stars: ✭ 35 (+133.33%)
Mutual labels:  omni
cli
🐸 The command-line interface for set up a standard frontend project (react-spa, vue-spa, react-ssr, react-component, vue-component, toolkit)
Stars: ✭ 32 (+113.33%)
Mutual labels:  omni
spicetify
🎨 Omni for Spicetify
Stars: ✭ 111 (+640%)
Mutual labels:  omni
tokencore
The core components of the blockchain wallet backend, support a variety of blockchain address generation and offline signatures
Stars: ✭ 412 (+2646.67%)
Mutual labels:  omni
omni
DSL for low-level audio programming.
Stars: ✭ 165 (+1000%)
Mutual labels:  omni
Wallet
Bitpay Wallet (formerly Copay) is a secure Bitcoin and other crypto currencies wallet platform for both desktop and mobile devices.
Stars: ✭ 3,382 (+22446.67%)
Mutual labels:  copay
Laravel Zero
A PHP framework for console artisans
Stars: ✭ 2,821 (+18706.67%)
Mutual labels:  laravel-zero

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

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].