Giter Club home page Giter Club 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

Stargazers

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

Watchers

 avatar  avatar

omni-recovery-tool's Issues

Suggestions!

Hi @evias ,

I like your solution so much in case when we go integrate the usdt node js other libs. So here as I have seen your code there is method getColoredScript so inside that method you have this below line
$rawOperation = $this->arguments["colored-op"] ?: "6f6d6e69000000000000001f000000002faf0800";
So could you please suggest $this->arguments["colored-op"] => what is the value of it and where from you are getting, not sure what exactly is this. Also what is the 6f6d6e69000000000000001f000000002faf0800 ?

I am also trying to add op_return to the bitcoin multisig trasaction for usdt. So your help will help me a lot. Thanks

Getting error Call to undefined method BitWasp\Bitcoin\Script\Script::getOutputScript()

First of all thanks for the implementation.

I have a problem when i try to recover a USDT fund. I am using "copay-recovery" command but i am getting Call to undefined method BitWasp\Bitcoin\Script\Script::getOutputScript() error.

The command i execute is:
php application omni:copay-recovery --input1="33itMqP2QngTbiR4ydS2hhNn1gRWGV3ULr" --vindex1="1" --cosig1="treat float add crouch trash decide mirror alert debris race evil coach obvious used torch" --cosig2="badge toe bid hurdle forum motion half talk file mirror mind night arrange spray unveil" --destination "1PXP46i4MxPQjzMr9uxtTY9dRWYj8rFqWN" --change "33itMqP2QngTbiR4ydS2hhNn1gRWGV3ULr" --min 2 --path-sign1="m/44'/0'/0'/0/2" --path-sign2="m/44'/0'/0'/0/2" --colored-op="6f6d6e69000000000000001f00000003e82a7b00"

The error i get at line:
395: $m1_outputScript = $m1_P2SHScript->getOutputScript();

The mnemonics are totally random they dont matter but the error i get simply says that the generated redeemscript is not instaceof type P2shScript. Why is that? How can i get this this code to work?

Does not build/run with non-relative paths giving errors

I would like to run this project but cannot get it to work, I got the composer part figured out but always get this error, and the files it is looking for in /vendor/ are not present after using composer to install the dependencies. Is there something I am missing installing?

PHP Fatal error: require(): Failed opening required '/home/myuser/omni-recovery-tool/bootstrap/../../../autoload.php' (include_path='.:/usr/share/php') in /home/myuser/omni-recovery-tool/bootstrap/autoload.php on line 22

Is there a build command for this?

Hello,

I am trying to run this again, and am wondering if I need to build these files locally before running the app? The way it is set up now, running the script just calls a require() on itself and exits.

Is there a command to build with Composer or Laravel? Or how do you run when you use it?

Can I use this tool?

I apologise in advance for not submitting a bug report but rather asking for support. I have a client that sent Omni USDT to my bitcoin.com multisig wallet. that wallet has no support for this token so whilst I can see the transaction and that the token was delivered, I cannot access it.

can I use this tool to retrieve it, possibly sending it back to the sender? or elsewhere but where?

TIA - ekkis

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.