Bitcoin Forum
May 14, 2024, 02:56:42 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: How to do multisig transaction 2 of 3 via testnet  (Read 171 times)
btchelpmeplz (OP)
Newbie
*
Offline Offline

Activity: 2
Merit: 9


View Profile
May 28, 2020, 06:56:27 PM
Last edit: May 28, 2020, 07:27:19 PM by btchelpmeplz
Merited by LoyceV (6), hugeblack (2), o_e_l_e_o (1)
 #1

I'm looking for a simple guide on how to do multisig transaction using the testnet network.

I'm looking to create a payment solution with escrow capabilities. (buyer, vendor, marketplace).

However, when I create a funding address and send the funds and go to create a raw transaction it's already signed and I'm unable to do anything with it?

I'm willing to also maybe reward the user that can help, and there could be a very high reward depending the help.

# Market:
tpubD6NzVbkrYhZ4XoHF1Ww7V5Q4PTdTR6KWac6mjMCHfEsTKyc8eLSS5ts9DytQjssgeXqSYKzP5UM iC2Ecnhu9LUfAT3knc7oScpRBfLK3N7Y
02059948c2ee7136f5e986471f7be70858f94007cadaf2690ed4126ed24eeca284

# Vendor:
tpubD6NzVbkrYhZ4XuM7tF5GQteD3uPo982nPsnCprvRsWfMfPDJ5Zx5cY4fVHNCgNAAjKEumyXjBbA AVMUV1K4vkbPb4RzthzyviEn7DJqn5xT
0269329aabf3e782438040b719169cd186c81c4ee841712159ca2c0decc695d7a4


#Buyer
tpubD6NzVbkrYhZ4YanxUmHzabCCsTBNUVWcZnKbDgR54shAUKNQBh7TY9UUFUFhPN1r3KY4MkAzjqB e3yju5vDTALxSq3YMdW49vn59xaXZkYp
033f94135ea1ee3ca6467bc5ebb3357284bf038223bb5651fece1ee6207b2479c8

bitcoin-cli --testnet createmultisig 2 '["033f94135ea1ee3ca6467bc5ebb3357284bf038223bb5651fece1ee6207b2479c8","0269329aabf3e782438040b719169cd186c81c4ee841712159ca2c0decc695d7a4","0269329aabf3e782438040b719169cd186c81c4ee841712159ca2c0decc695d7a4"]'
Code:
{
  "address": "2N4DqqGFJn7bBNmE3yjBssUpCZEVxrTcJan",
  "redeemScript": "5221033f94135ea1ee3ca6467bc5ebb3357284bf038223bb5651fece1ee6207b2479c8210269329aabf3e782438040b719169cd186c81c4ee841712159ca2c0decc695d7a4210269329aabf3e782438040b719169cd186c81c4ee841712159ca2c0decc695d7a453ae"
}


#TX ID: fad9591024f7c8d182295d516c913c1171eb4c6ddd38578d18fe32735f8a368f
Code:
bitcoin-cli getrawtransaction fad9591024f7c8d182295d516c913c1171eb4c6ddd38578d18fe32735f8a368f 1
{
  "txid": "fad9591024f7c8d182295d516c913c1171eb4c6ddd38578d18fe32735f8a368f",
  "hash": "fad9591024f7c8d182295d516c913c1171eb4c6ddd38578d18fe32735f8a368f",
  "version": 2,
  "size": 224,
  "vsize": 224,
  "weight": 896,
  "locktime": 1746762,
  "vin": [
    {
      "txid": "d36a8e3333bec23a26cbb374c9f9d9d43ac19110e92378a847fc1408485e39c6",
      "vout": 0,
      "scriptSig": {
        "asm": "304502210091c441482225222b0e0b929b7aecde0460d746cc51e808b100dd4209a74ca87302207767b8c47cc79182ca13f9f5defb041dab8456a3fa2c2d96701087580bdf91cf[ALL] 02c76d29461a3a6a2614258d8636e7031a2f71140e6a87757a49d4a82c04cc6596",
        "hex": "48304502210091c441482225222b0e0b929b7aecde0460d746cc51e808b100dd4209a74ca87302207767b8c47cc79182ca13f9f5defb041dab8456a3fa2c2d96701087580bdf91cf012102c76d29461a3a6a2614258d8636e7031a2f71140e6a87757a49d4a82c04cc6596"
      },
      "sequence": 4294967293
    }
  ],
  "vout": [
    {
      "value": 0.00100000,
      "n": 0,
      "scriptPubKey": {
        "asm": "OP_HASH160 786679211df292d49a4565e412d4087ee2db644c OP_EQUAL",
        "hex": "a914786679211df292d49a4565e412d4087ee2db644c87",
        "reqSigs": 1,
        "type": "scripthash",
        "addresses": [
          "2N4DqqGFJn7bBNmE3yjBssUpCZEVxrTcJan"
        ]
      }
    },
    {
      "value": 0.01006896,
      "n": 1,
      "scriptPubKey": {
        "asm": "OP_DUP OP_HASH160 22bde504f3b57d4f17fab1b2d5b281623a83923a OP_EQUALVERIFY OP_CHECKSIG",
        "hex": "76a91422bde504f3b57d4f17fab1b2d5b281623a83923a88ac",
        "reqSigs": 1,
        "type": "pubkeyhash",
        "addresses": [
          "migekgg56pYFkMjPRTWKEzXdNXHu6Gfi66"
        ]
      }
    }
  ],
  "hex": "0200000001c6395e480814fc47a87823e91091c13ad4d9f9c974b3cb263ac2be33338e6ad3000000006b48304502210091c441482225222b0e0b929b7aecde0460d746cc51e808b100dd4209a74ca87302207767b8c47cc79182ca13f9f5defb041dab8456a3fa2c2d96701087580bdf91cf012102c76d29461a3a6a2614258d8636e7031a2f71140e6a87757a49d4a82c04cc6596fdffffff02a08601000000000017a914786679211df292d49a4565e412d4087ee2db644c87305d0f00000000001976a91422bde504f3b57d4f17fab1b2d5b281623a83923a88ac4aa71a00"
}


#
Code:
bitcoin-cli --testnet createrawtransaction '[{"txid" : "d36a8e3333bec23a26cbb374c9f9d9d43ac19110e92378a847fc1408485e39c6","vout":0}]' '{"n3QXqyFHcBuWoe5TmCvp4k38sc6APpMUmn":0.00090000}'

[bitcoind@centos dev]$ bitcoin-cli --testnet createrawtransaction '[{"txid" : "fad9591024f7c8d182295d516c913c1171eb4c6ddd38578d18fe32735f8a368f","vout":0}]' '{"n3QXqyFHcBuWoe5TmCvp4k38sc6APpMUmn":0.00090000}'
02000000018f368a5f7332fe188d5738dd6d4ceb71113c916c515d2982d1c8f7241059d9fa00000 00000ffffffff01905f0100000000001976a914f01bdca4126338417da56340825fb458007bd17b 88ac00000000


Output: https://prnt.sc/spmeyo
1715655402
Hero Member
*
Offline Offline

Posts: 1715655402

View Profile Personal Message (Offline)

Ignore
1715655402
Reply with quote  #2

1715655402
Report to moderator
1715655402
Hero Member
*
Offline Offline

Posts: 1715655402

View Profile Personal Message (Offline)

Ignore
1715655402
Reply with quote  #2

1715655402
Report to moderator
1715655402
Hero Member
*
Offline Offline

Posts: 1715655402

View Profile Personal Message (Offline)

Ignore
1715655402
Reply with quote  #2

1715655402
Report to moderator
Activity + Trust + Earned Merit == The Most Recognized Users on Bitcointalk
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
BitMaxz
Legendary
*
Offline Offline

Activity: 3248
Merit: 2972


Block halving is coming.


View Profile WWW
May 28, 2020, 10:25:37 PM
 #2

If it is related to payment processor why not start on using with BTCpayserver it is a self-hosted payment processor and you can use multisig wallet.


Anyway, what wallet you currently using when testing?
Do you want to make an unsigned transaction?

I don't know exactly what wallet you currently using but on using the Electrum wallet you can use the preview when creating a transaction where you can sign the transaction or not.

What exactly do you want to achieve? Are you going to make a website with a payment processor?

█▀▀▀











█▄▄▄
▀▀▀▀▀▀▀▀▀▀▀
e
▄▄▄▄▄▄▄▄▄▄▄
█████████████
████████████▄███
██▐███████▄█████▀
█████████▄████▀
███▐████▄███▀
████▐██████▀
█████▀█████
███████████▄
████████████▄
██▄█████▀█████▄
▄█████████▀█████▀
███████████▀██▀
████▀█████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
c.h.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀█











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
nc50lc
Legendary
*
Online Online

Activity: 2408
Merit: 5601


Self-proclaimed Genius


View Profile
May 29, 2020, 03:29:21 AM
Merited by pooya87 (1)
 #3

However, when I create a funding address and send the funds and go to create a raw transaction it's already signed and I'm unable to do anything with it?
-snip-
Output: https://prnt.sc/spmeyo

(Image re-hosted to be displayed)
Are you trying to use Electrum to co-sign the RAW transaction? If yes, you won't be able to do it for two reasons:

1. Electrum seems to have an issue with imported transactions created from other wallets due to incompatibility.
I have experienced that "can't sign - broadcast already available" bug when I tried to load a raw transaction that I created using coinb.in.

2. Electrum 3.3.8 as of now doesn't support importing individual multisig addresses through private keys/public keys/redeem script,
if you import the address itself, and try to sign it in the console, you still wont be able to because you can't input the redeem script.
Notice that it says "Transaction unrelated to your wallet", and I presume you have imported one of the private key.

I haven't used Bitcoin core to do Multisig but I think these commands are the ones you need:

Co-sign the transaction using signrawtransactionwithkey and provide one or two of the keys.
Or use: signrawtransactionwithwallet given that the client have one of the private keys.

█▀▀▀











█▄▄▄
▀▀▀▀▀▀▀▀▀▀▀
e
▄▄▄▄▄▄▄▄▄▄▄
█████████████
████████████▄███
██▐███████▄█████▀
█████████▄████▀
███▐████▄███▀
████▐██████▀
█████▀█████
███████████▄
████████████▄
██▄█████▀█████▄
▄█████████▀█████▀
███████████▀██▀
████▀█████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
c.h.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀█











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
pooya87
Legendary
*
Offline Offline

Activity: 3444
Merit: 10560



View Profile
May 29, 2020, 03:55:06 AM
 #4

02000000018f368a5f7332fe188d5738dd6d4ceb71113c916c515d2982d1c8f7241059d9fa00000 00000ffffffff01905f0100000000001976a914f01bdca4126338417da56340825fb458007bd17b 88ac00000000

this transaction is NOT signed.
what you see in your preview window of Electrum is a couple of bugs where it greys out the "sign" button since it can't sign it but doesn't do the same with broadcast, and also is showing it as "signed" on top of the window!
however, if you click it you can see how you'll get an error telling you your transaction is not valid.

there could be a couple of reasons why Electrum doesn't recognize your tx/address here. for starters importing the same extended pubkeys doesn't result in the same address which is probably due to wrong derivation paths. so you should first figure out what derivation path you used to get the 3 public keys used in creation of 2N4DqqGFJn7bBNmE3yjBssUpCZEVxrTcJan.
the first address i get is 2NBsiKyRMkSUy2mYAphMpXz6BWS4dzv4ANS and your address does not exist among any addresses at all.
(keep in mind that Electrum "sorts" public keys lexicographically that can result in an entirely different address, checking the individual pubkeys of my first address shows different individual pubkeys also)

second it could be because Electrum expects a certain set of "commands" in signature of the unsigned transaction to tell it what to do. although i haven't tested this particular issue but empty script has been a reason for Electrum not knowing what to do and how to sign the transaction.

.
.BLACKJACK ♠ FUN.
█████████
██████████████
████████████
█████████████████
████████████████▄▄
░█████████████▀░▀▀
██████████████████
░██████████████
████████████████
░██████████████
████████████
███████████████░██
██████████
CRYPTO CASINO &
SPORTS BETTING
▄▄███████▄▄
▄███████████████▄
███████████████████
█████████████████████
███████████████████████
█████████████████████████
█████████████████████████
█████████████████████████
███████████████████████
█████████████████████
███████████████████
▀███████████████▀
█████████
.
btchelpmeplz (OP)
Newbie
*
Offline Offline

Activity: 2
Merit: 9


View Profile
May 29, 2020, 08:38:07 AM
 #5

I've moved away from Electrum for evening attempting to sign the signature its fucking useless.

I've moved to coinb.in had this working fine, now looking to create a raw transaction via bitcoin-cli, however, when, I create a raw transaction I get input errors, but when I create a raw transaction via Coinb.in, I don't?

Is there an updated method for creating a raw transaction using multisig to payout to multiple addresses using client based commands
nc50lc
Legendary
*
Online Online

Activity: 2408
Merit: 5601


Self-proclaimed Genius


View Profile
May 30, 2020, 03:40:40 AM
 #6

I used Regtest for this test and it was successful.
Here are the commands that I've used (skipping createmultisig);

2-2 Multisig address info:
"address": "2N9dcyDUNXxAGbBhmeSnwLQsYdEXk7jkewp",
"redeemScript": "5221024e25a55cf263164b718f2df8e246b3772f995dd783b40e6f4e5de62c93ec49232103cb1b2 55f0ea86b612eedb9c8e6446a9261d666359b5273301a45d6e3d2a3abe152ae"

Prv key1: cRBmMvn2riZHyTw13Dr9y23ynfADUiwH1YvvAg6Pp92n8TT93k8t
Prv key2: cPNZRp3FYP9JZfYRStpZhSCmQZAfWKnB4hgGffBvpcMMekKFZ5pZ

Funding transaction (TXID): 60aebde463de893dce4b72003d57c2f4ef63f88b4c0818fdaba3c9fef0a59efe

Create a new transaction, send to two outputs:
Code:
createrawtransaction "[{\"txid\":\"60aebde463de893dce4b72003d57c2f4ef63f88b4c0818fdaba3c9fef0a59efe\",\"vout\":1}]" "[{\"2N1S5utkMt53XrXuy18wURf9qqZfb7i29DB\":1.795},{\"2N4LrRMimkACSMn2LnfKrGFi4Hic6UdhxNq\":8.2}]"
Result (unsigned RAW transaction):
Code:
0200000001fe9ea5f0fec9a3abfd18084c8bf863eff4c2573d00724bce3d89de63e4bdae600100000000ffffffff02e0f3b20a0000000017a91459ced730eb49677bbf4d9d977fd66f3562c2e40a870035e0300000000017a91479b9e026e043718332aeffc5d9f15aec3d2c8b658700000000

Sign the transaction using the first key:
Code:
signrawtransactionwithkey "0200000001fe9ea5f0fec9a3abfd18084c8bf863eff4c2573d00724bce3d89de63e4bdae600100000000ffffffff02e0f3b20a0000000017a91459ced730eb49677bbf4d9d977fd66f3562c2e40a870035e0300000000017a91479b9e026e043718332aeffc5d9f15aec3d2c8b658700000000" "[\"cRBmMvn2riZHyTw13Dr9y23ynfADUiwH1YvvAg6Pp92n8TT93k8t\"]" "[{\"txid\":\"60aebde463de893dce4b72003d57c2f4ef63f88b4c0818fdaba3c9fef0a59efe\",\"vout\":0,\"scriptPubKey\":\"a914b3be5906d3390d5a9f9e28343a49b8467a822c5187\",\"redeemScript\":\"5221024e25a55cf263164b718f2df8e246b3772f995dd783b40e6f4e5de62c93ec49232103cb1b255f0ea86b612eedb9c8e6446a9261d666359b5273301a45d6e3d2a3abe152ae\"}]"
Result (partially signed transaction - HEX):
Code:
0200000001fe9ea5f0fec9a3abfd18084c8bf863eff4c2573d00724bce3d89de63e4bdae6001000000920047304402204f64de0fe2d433f4e0f98326cc3314183198dbf0e3c47f5de4a90a578a8b972a02201bc31ea3112edbc526b9aa8396de6d0ce664b770d9334d9963a83c3b4bd66efc0100475221024e25a55cf263164b718f2df8e246b3772f995dd783b40e6f4e5de62c93ec49232103cb1b255f0ea86b612eedb9c8e6446a9261d666359b5273301a45d6e3d2a3abe152aeffffffff02e0f3b20a0000000017a91459ced730eb49677bbf4d9d977fd66f3562c2e40a870035e0300000000017a91479b9e026e043718332aeffc5d9f15aec3d2c8b658700000000
I've got a "missing input" error when I tried to sign it without adding "prevtxs" that includes "redeem script" and others (2nd JSON array), so I guess it's required for P2SH-Multisig since it's P2SH.

Sign the partially signed transaction using the second key:
Code:
signrawtransactionwithkey "0200000001fe9ea5f0fec9a3abfd18084c8bf863eff4c2573d00724bce3d89de63e4bdae6001000000920047304402204f64de0fe2d433f4e0f98326cc3314183198dbf0e3c47f5de4a90a578a8b972a02201bc31ea3112edbc526b9aa8396de6d0ce664b770d9334d9963a83c3b4bd66efc0100475221024e25a55cf263164b718f2df8e246b3772f995dd783b40e6f4e5de62c93ec49232103cb1b255f0ea86b612eedb9c8e6446a9261d666359b5273301a45d6e3d2a3abe152aeffffffff02e0f3b20a0000000017a91459ced730eb49677bbf4d9d977fd66f3562c2e40a870035e0300000000017a91479b9e026e043718332aeffc5d9f15aec3d2c8b658700000000" "[\"cPNZRp3FYP9JZfYRStpZhSCmQZAfWKnB4hgGffBvpcMMekKFZ5pZ\"]" "[{\"txid\":\"60aebde463de893dce4b72003d57c2f4ef63f88b4c0818fdaba3c9fef0a59efe\",\"vout\":0,\"scriptPubKey\":\"a914b3be5906d3390d5a9f9e28343a49b8467a822c5187\",\"redeemScript\":\"5221024e25a55cf263164b718f2df8e246b3772f995dd783b40e6f4e5de62c93ec49232103cb1b255f0ea86b612eedb9c8e6446a9261d666359b5273301a45d6e3d2a3abe152ae\"}]"
Result:
Code:
0200000001fe9ea5f0fec9a3abfd18084c8bf863eff4c2573d00724bce3d89de63e4bdae6001000000d90047304402204f64de0fe2d433f4e0f98326cc3314183198dbf0e3c47f5de4a90a578a8b972a02201bc31ea3112edbc526b9aa8396de6d0ce664b770d9334d9963a83c3b4bd66efc0147304402204ac450beea00c89cbc51ce58845de2cf3ddba07df6676532e5c092e661a32117022071be0746ad33b5dc20830782334bc15f50b264fefd9f8f6867d005bba925e86301475221024e25a55cf263164b718f2df8e246b3772f995dd783b40e6f4e5de62c93ec49232103cb1b255f0ea86b612eedb9c8e6446a9261d666359b5273301a45d6e3d2a3abe152aeffffffff02e0f3b20a0000000017a91459ced730eb49677bbf4d9d977fd66f3562c2e40a870035e0300000000017a91479b9e026e043718332aeffc5d9f15aec3d2c8b658700000000
Then it was successfully broadcast using sendrawtransaction without errors.

If you still received "missing inputs" error, check the funding transaction's "vout" (output index) if it's the same as you indicated in createrawtransaction.

█▀▀▀











█▄▄▄
▀▀▀▀▀▀▀▀▀▀▀
e
▄▄▄▄▄▄▄▄▄▄▄
█████████████
████████████▄███
██▐███████▄█████▀
█████████▄████▀
███▐████▄███▀
████▐██████▀
█████▀█████
███████████▄
████████████▄
██▄█████▀█████▄
▄█████████▀█████▀
███████████▀██▀
████▀█████████
▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
c.h.
▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄▄
▀▀▀█











▄▄▄█
▄██████▄▄▄
█████████████▄▄
███████████████
███████████████
███████████████
███████████████
███░░█████████
███▌▐█████████
█████████████
███████████▀
██████████▀
████████▀
▀██▀▀
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!