Bitcoin Forum
October 15, 2019, 07:42:22 AM *
News: Latest Bitcoin Core release: 0.18.1 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: How to sign an Unsigned RawTx from 2-of-3 Multi-Sig Address using Bitcoin Core?  (Read 150 times)
100bitcoin
Sr. Member
****
Offline Offline

Activity: 605
Merit: 271


View Profile
September 28, 2019, 07:22:18 PM
 #1

The actual problem is not for BTC, but for BCD. But, I believe, the solution will be same.

I have some BCD stuck at a 2-of-3 Multi-Sig Address for a long time. So far, I have tried out almost all the wallets that support BCD, except for QT or Core wallet. None of the BCD wallets support signing an unsigned rawtx from 2-of-3 multi-sig address using private keys only (Electrum thread - https://bitcointalk.org/index.php?topic=5169272.0). All of them require xPriv key, which I dont know. Hence, I am now trying to sign with Bitcoin Diamond QT or Core wallet downloaded from https://github.com/eveybcd/BitcoinDiamond/releases/download/v1.3.0/bitcoindiamond-1.3.0-win64-setup-unsigned.exe.

So, here is what I have...

1. 2-of-3 Multi-Sig Address

2. Redeem Script

3. 3 different private keys

4. Unsigned RawTx to a legacy BTC/BCD address

I need to sign using QT or Core without downloading the complete blockchain data. Because, my purpose is not to run a full node, but to sign and broadcast a transaction.

How do I do so?
1571125342
Hero Member
*
Offline Offline

Posts: 1571125342

View Profile Personal Message (Offline)

Ignore
1571125342
Reply with quote  #2

1571125342
Report to moderator
1571125342
Hero Member
*
Offline Offline

Posts: 1571125342

View Profile Personal Message (Offline)

Ignore
1571125342
Reply with quote  #2

1571125342
Report to moderator
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
1571125342
Hero Member
*
Offline Offline

Posts: 1571125342

View Profile Personal Message (Offline)

Ignore
1571125342
Reply with quote  #2

1571125342
Report to moderator
Dabs
Staff
Legendary
*
Offline Offline

Activity: 2478
Merit: 1287


The Concierge of Crypto


View Profile
September 29, 2019, 01:47:58 AM
 #2

Not sure if it will help, but you could try coinb.in ...

If that doesn't work or help, then your last resort would be to run the full node and grab the whole blockchain long enough to import the private keys, sign, and broadcast the transaction.

nc50lc
Hero Member
*****
Offline Offline

Activity: 742
Merit: 632


Self-proclaimed Genius ㊙️


View Profile WWW
September 29, 2019, 02:46:45 AM
 #3

Not sure if it will help, but you could try coinb.in ...
It will work for Bitcoin,
but unfortunately, there's no altcoin version of coinb.in.

@100bitcoin Electrum won't work since it's currently impossible to import the redeem script of an imported multisig address.
Importing the address won't do.

Hence, I am now trying to sign with Bitcoin Diamond QT or Core wallet downloaded from https://github.com/eveybcd/BitcoinDiamond/releases/download/v1.3.0/bitcoindiamond-1.3.0-win64-setup-unsigned.exe.
If it's based from Bitcoin Core client, addmultisigaddress and signrawtransaction commands might work but requires you to sync the client.
Refer to the link for the syntax.

signrawtransaction to that "unsigned raw tx" might work without a full synced client if it contains the redeem script.
You can also manually create a raw tx using the console but it requires manual addition of the info... <-haven't tried this though.

pooya87
Legendary
*
Offline Offline

Activity: 1792
Merit: 1968


Remember tonight for it's the beginning of forever


View Profile
September 29, 2019, 04:27:47 AM
Merited by dbshck (4), ETFbitcoin (1)
 #4

try combining the two methods: coinb.in with core client while using a BCD block explorer. that way you don't need to sync anything.

- open a BCD block explorer and search your address to get the list of transactions. now you have to figure out if each received tx is spent or not, explorers usually have some sort of indicator for that. if it weren't then copy its txid and the index of your address among the outputs of that transaction (eg. if the tx is paying you and your address is the first one your index is 0, if your address is the fifth one then your index is 4)*
- select inputs tab and set txid and N value. (leave script and amount empty)
- select output tab and insert your address and amount, you may need to convert your address here if BCD uses a different address encoding like a different version byte (if it does let me know to explain how to do that)
- click submit and get the raw transaction and transfer that to core client
- use the signrawtransaction command to sign it with your list of keys.

* a random example from last block:
https://www.blockchain.com/btc/tx/7f3298d222478f9ad2eae0e44dca57c32f6a5461c87555caf77e1954d05197f5
assuming 3CrHefYE5ZnMEeedXxKZbU8icQVkc93rPD is your address hypothetically, the txid is 7f3298d222478f9ad2eae0e44dca57c32f6a5461c87555caf77e1954d05197f5 and N (or index) is 7

100bitcoin
Sr. Member
****
Offline Offline

Activity: 605
Merit: 271


View Profile
September 29, 2019, 08:42:29 PM
 #5

- open a BCD block explorer and search your address to get the list of transactions. now you have to figure out if each received tx is spent or not, explorers usually have some sort of indicator for that. if it weren't then copy its txid and the index of your address among the outputs of that transaction (eg. if the tx is paying you and your address is the first one your index is 0, if your address is the fifth one then your index is 4)*
- select inputs tab and set txid and N value. (leave script and amount empty)
- select output tab and insert your address and amount, you may need to convert your address here if BCD uses a different address encoding like a different version byte (if it does let me know to explain how to do that)
- click submit and get the raw transaction and transfer that to core client
I have already done this through Electrum for BCD. As I mentioned in OP, I already have an Unsigned RawTx to a legacy BCD address, which is accessible through Electrum for BCD.

- use the signrawtransaction command to sign it with your list of keys.
How do I do this part using QT for BCD without syncing the whole blockchain? I really dont trust the BCD nodes.
pooya87
Legendary
*
Offline Offline

Activity: 1792
Merit: 1968


Remember tonight for it's the beginning of forever


View Profile
September 30, 2019, 04:37:16 AM
 #6

- use the signrawtransaction command to sign it with your list of keys.
How do I do this part using QT for BCD without syncing the whole blockchain? I really dont trust the BCD nodes.

i have not tested this command but try using this:
Code:
signrawtransactionwithkey "rawtxhex" ["privatekey1","privatekey2"] ( [{"txid":"id","vout":n,"scriptPubKey":"pubScrHex","redeemScript":"redeemhex"}] )

replace "rawtxhex" with your raw transaction hex,
"privatekey1" and 2 are the keys to sign the transaction (if it didn't work try using 1 key at a time and do the whole thing twice but the second time use the result from previous step)
"id" is the txid you are spending
n is the index i explained above
pubScrHex is your P2SH script (your address converted to its script form)
redeemhex is your redeem script

ref: https://bitcoincore.org/en/doc/0.18.0/rpc/rawtransactions/signrawtransactionwithkey/

sowns
Jr. Member
*
Offline Offline

Activity: 69
Merit: 3


View Profile
September 30, 2019, 06:32:15 PM
 #7

Multisig addresses start with three right? Then unless I somehow did it wrong then you're out of luck with using bitcoin core since they don't sign 3s apparently. I get the "entered address does not refer to a key" error when I tried.
HCP
Legendary
*
Offline Offline

Activity: 1120
Merit: 1837

<insert witty quote here>


View Profile
September 30, 2019, 11:45:53 PM
Merited by dbshck (4)
 #8

Fairly sure I've done exactly this for several people (but for Bitcoin Gold) who had fork coins "stuck" in multisig (or Electrum 2FA) wallets.

I vaguely recall that you needed to have a synced "core" node to be able to do this... or at least, a node that was synced up to the point where the UTXOs that you were attempting to spend were created. Then it is simply a matter of creating the raw unsigned transaction from those UTXOs... then signing the transaction with at least 2 of the 3 private keys... then broadcasting the transaction.

There should be some old posts floating around somewhere with a bit of a guide on how to do it... I'll have a dig around and see if I can find them.


EDIT: Here you go... have a read through this: https://bitcointalk.org/index.php?topic=2550529.0

It's for BTG, but the same should apply for BCD... again, as noted in the OP in that thread, you will need the "core" node fully synced.

100bitcoin
Sr. Member
****
Offline Offline

Activity: 605
Merit: 271


View Profile
October 02, 2019, 07:44:19 PM
 #9

- use the signrawtransaction command to sign it with your list of keys.
How do I do this part using QT for BCD without syncing the whole blockchain? I really dont trust the BCD nodes.

i have not tested this command but try using this:
Code:
signrawtransactionwithkey "rawtxhex" ["privatekey1","privatekey2"] ( [{"txid":"id","vout":n,"scriptPubKey":"pubScrHex","redeemScript":"redeemhex"}] )

replace "rawtxhex" with your raw transaction hex,
"privatekey1" and 2 are the keys to sign the transaction (if it didn't work try using 1 key at a time and do the whole thing twice but the second time use the result from previous step)
"id" is the txid you are spending
n is the index i explained above
pubScrHex is your P2SH script (your address converted to its script form)
redeemhex is your redeem script

ref: https://bitcoincore.org/en/doc/0.18.0/rpc/rawtransactions/signrawtransactionwithkey/
Thanks. What would be the "scriptPubKey" for my address? I mean, how do I get to know that?


Fairly sure I've done exactly this for several people (but for Bitcoin Gold) who had fork coins "stuck" in multisig (or Electrum 2FA) wallets.

I vaguely recall that you needed to have a synced "core" node to be able to do this... or at least, a node that was synced up to the point where the UTXOs that you were attempting to spend were created. Then it is simply a matter of creating the raw unsigned transaction from those UTXOs... then signing the transaction with at least 2 of the 3 private keys... then broadcasting the transaction.

There should be some old posts floating around somewhere with a bit of a guide on how to do it... I'll have a dig around and see if I can find them.


EDIT: Here you go... have a read through this: https://bitcointalk.org/index.php?topic=2550529.0

It's for BTG, but the same should apply for BCD... again, as noted in the OP in that thread, you will need the "core" node fully synced.
Thanks. But, this wont work for me. As I mentioned in OP, I dont know my xPriv keys. Though, for BTG, there is a Coinb.in fork, which works like charm only with private keys.
HCP
Legendary
*
Offline Offline

Activity: 1120
Merit: 1837

<insert witty quote here>


View Profile
October 02, 2019, 11:00:10 PM
 #10

Thanks. But, this wont work for me. As I mentioned in OP, I dont know my xPriv keys. Though, for BTG, there is a Coinb.in fork, which works like charm only with private keys.
It will work... as Bitcoin Gold Core doesn't work with xpriv keys anyway... you need the individual private keys. If you read the guide, you see that they just use the xprivs (with iancoleman's BIP39 tool) to convert to the necessary private keys.

So you can skip down the guide to the bit AFTER the xprivs are converted to private keys... somewhere around here:
...
Now we really have everything to start to sign the transaction.

Open Electrum, select “View”->”Show console”.

Run this command:
Code:
deserialize(gettransaction("TXID_HERE"))
Replace TXID_HERE with the transaction ID (leave the “ “)

You will get something like this: https://i.imgur.com/sKXBZNm.png
Go to the section in the bottom with where it says: "address": "our address",

Ok, now copy all that thing in the note at the bottom.
Now we have the prevout_n, the scriptPubKey, the type and the value of this transaction ID.
Now close Electrum.


We are almost finished, now open Bitcoin Gold Core wallet.
Create a wallet of course, click receive, generate an address in which we will receive our BTG, paste it in a new block note to not get confused.
....

From this point on, the guide shows how to create the raw transaction (sending to your desired BTG address), and then how to sign it using the redeem script and each of the private keys that you have... and then finally broadcasting it.

Granted, the tutorial isn't the best... but the general idea is correct.

Pages: [1]
  Print  
 
Jump to:  

Sponsored by , a Bitcoin-accepting VPN.
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!