Skip to content

Instantly share code, notes, and snippets.

@buzztiaan
Last active March 5, 2019 19:41
Show Gist options
  • Save buzztiaan/07e5844508c9fb5334fe026518c4e030 to your computer and use it in GitHub Desktop.
Save buzztiaan/07e5844508c9fb5334fe026518c4e030 to your computer and use it in GitHub Desktop.
sent to segwit address by accident
say, you make a new bitcoin address and leave it in your copy paste buffer
then you remember you had to send 1M dogecoin, and paste the address by accident
OMG COINS LOST
or are they?
background of the method this uses ;
https://www.reddit.com/r/btc/comments/6z56x3/attention_benevolent_bch_miners_a_bch/
some more good background on ;
https://bitcoin.org/en/developer-examples#p2sh-multisig
---------
find wrongtx_txid
find wrongtx_vout
find wrongtx_outputscript
find wrongtx_amount
make rightcoin_newaddress
find originalsegwit_redeemscript ( probably from BTC? do validateaddress 3xxxx , it should be in there )
1 ) rightcoin-cli createrawtransaction "[{\"txid\":\"wrongtx_txid\",\"vout\":wrongtx_vout}]" "{\"rightcoin_newaddress\":wrongtx_amount}"
2 ) rightcoin-cli signrawtransaction rawtx-of-previous-command "[{\"txid\":\"wrongtx_txid\",\"vout\":wrongtx_vout,\"scriptPubKey\":\"wrongtx_outputscript\", \"redeemScript\":\"originalsegwit_redeemscript\"}]" "[]"
3 ) rightcoin-cli sendrawtransaction rawtx-of-previous-command
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment