How to recover xcp funds sent by error to a personal Trezor hardware wallet

Anyone can advise how to process in this situation
Can i use the seeds in anyway ?
Can i use other wallets and get the private key?

In the final wallet only arrived the dust of transaction and the blockchain did not recognize part of thentransaction

How to process and do the sweep

  • using other wallet?
  • Use the seeds in anyway ?

Urgent

Is Multibit
Electrum
Usefull or other wallets and the way to do it

Unfortunately the current software available to manage the trezor makes it a bit user-unfriendly to sign arbitrary transactions – the MyTrezor webwallet doesn’t even give the user the option and Electrum can be finicky with which transactions it will actually allow the user to pull in (it likes its loadable transactions to be created in Electrum as well, transactions created elsewhere aren’t really officially supported).

I know you sent your funds by error, but I actually store some counterparty assets on my trezor deliberately in order to take advantage of its security :slight_smile: . Counterparty is not officially supported by the trezor team, but as you probably know any bitcoin address can also be a counterparty address

I just pushed a script that I use to send counterparty funds from my trezor wallet up at https://gist.github.com/sorce/396fe44739392756abac8c2e213bb11e. Only OP_RETURN encoded transactions are supported by the script at the moment.

I made it (a little) user friendly, so you should just configure lines 40-53 to your specific environment / need. You need access to a bitcoin and counterparty node. You’ll also need to know the node path for the address that is controlling the counterparty asset you want to send out (e.g. 44'/0'/0'/0/1) which you can find displayed in the MyTrezor wallet.

Script should be python2/3 compatible and you’ll need the trezor and requests libraries installed. It is relaltively simple, so I recommend decoding the transactions that are output to ensure they look correct before broadcasting.

1 Like

Hi Ebx,

i also accidentally sent quite a bit xcp and pepecash to my trezor and i would like to retreive theme.
could we maybe get into contact with each other ?

Gr

You can reach me on freenode IRC or I also check the Counterparty slack somewhat frequently. I’d also be happy to respond here if you have any specific questions.

What should I enter configure lines 46-53 ?

You should be able to import your trezor address (non-segwit) into Freewallet.io and then just sign the transaction with your Trezor when your ready to send funds :slight_smile:

2 Likes

BITCOIN_USER – username to access RPC for bitcoin node, rpcuser in your bitcoin.conf

BITCOIN_PW – password to access RPC for bitcoin node, rpcpassword in your bitcoin.conf

The BITCOIN_URL and BITCOIN_PORT is the location that your bitcoin node is listening RPC on.

COUNTERPARTY_USER – username to access RPC for counterparty node, rpc-user in your counterparty config

COUNTERPARTY_PW – password to access RPC for counterparty node, rpc-password in your counterparty config

COUNTERPARTY_URL is the location that your counterparty node is listening for RPC on.

I’ve been meaning to make the script take arguments via the CLI and have a descriptive help so I will probably do that soon, and then it won’t be so confusing to use. I can also make it so that you don’t need a local (countrparty) node to do things, so it can be improved a lot.

Beware that the aforementioned freewallet is closed source – if you decide to use that I’d advise creating the transaction using an offline machine and then decoding the output transaction to ensure that it looks correct before passing it on to the trezor to sign and broadcast.

1 Like

Thank you for your reply.

freewallet.io is cool.
But, my trezor address is segwit address.

is there something good way?

Is it P2WPKH or P2WSH? If it is the latter then you should be able to recover it. (edit: actually I guess it would most likely be P2WSH that your asset(s) ended up in)

I finally got around to rewriting my script today (gist is already updated). I made it a lot nicer to use, removed the reliance on your own bitcoin/counterparty node, added more features and made it segwit compatible (at least P2WSH, counterparty is not yet able to parse bech32). You should be able to utilize it to recover the assets that you have stored on your trezor – I tested it on my model one and my model t and both work fine.

From the new help:

usage: send_counterparty_from_trezor.py [-h] [-v] [-n {mainnet,testnet}]
                  [-t {address,segwit,p2shsegwit}] [-r] -a ADDRESS_PATH -x
                  ASSET -q QUANTITY -d DIVISIBLE -o DESTINATION -c CHANGE_PATH
                  -f FEE

Create, sign and broadcast a counterparty transaction from a trezor device

optional arguments:
  -h, --help            show this help message and exit
  -v, --verbose         verbose output
  -n {mainnet,testnet}, --network {mainnet,testnet}
                        network to use
  -t {address,segwit,p2shsegwit}, --type {address,segwit,p2shsegwit}
                        script type used to derive addresses
  -r, --replaceable     opt transaction in to replace-by-fee
  -a ADDRESS_PATH, --address-path ADDRESS_PATH
                        node path of address containing asset to send out
                        (e.g. 44'/0'/0'/0/4)
  -x ASSET, --asset ASSET
                        asset you wish to send
  -q QUANTITY, --quantity QUANTITY
                        amount of asset you wish to send
  -d DIVISIBLE, --divisible DIVISIBLE
                        whether the asset is divisible or not, used for
                        calculating the proper amount of asset to send as
                        divisible asset quantities must be defined in satoshis
  -o DESTINATION, --destination DESTINATION
                        destination adddress where you want to send asset
  -c CHANGE_PATH, --change-path CHANGE_PATH
                        node path of address that you wish to use for change
                        (e.g. 44'/0'/0'/0/5)
  -f FEE, --fee FEE     static fee (in satoshis) to use for the transaction

Here’s a mainnet transaction that I just did utilizing the new script, I also made a few testnet ones:

https://xchain.io/tx/1257708 ,
https://www.smartbit.com.au/tx/307ba5e9d3187d6c5965c2912f3d5673486d13d07370000c2cde8c4052433cb8

And the command that I used for that transaction so you can get an idea:
./send_counterparty_from_trezor.py -t p2shsegwit --replaceable -a "49'/0'/0'/0/0" -x DEADMAN -q 1 -d false -c "49'/0'/0'/0/2" -o 1QEx9kdYQqmNzC8HW8FPQS3Mb7vVXYa7bK -f 2000

And just a few notes that I want to point out about the new script

  • it encodes counterparty data directly – good because you don’t need your own node (or to even query a third party node) – but it puts the responsibility of correctness on you. You need to make sure that you’re passing in the correct address where you want the asset to be sent, ensure the asset name is correct, and ensure that you’re passing the correct value for --divisible. The script is not checking that these are accurate or correct (it functions fine on testnet if you want to try that first).
  • it queries a third party API to get unspent transaction outputs and to broadcast transactions (it will ask before broadcasting) and thus has some privacy concerns. Currently the same API is used for both purposes: smartbit.com.au
1 Like

Hi

The code above doesn’t work now, does it?

Yes, it still works.

I can’t import TrezorClientVerbose.