Author

Topic: Proper workflow to CoinJoin combined PSBTs? (Read 111 times)

newbie
Activity: 21
Merit: 11
February 05, 2020, 07:41:15 PM
#2
I am very embarrassed, just circling back to share the solution for the community (I'm an idiot).

The above workflow works perfectly. My problem was that I had an incorrect "vout" value in one of my inputs. Basically I was trying to spend money I don't have (/facepalm). As soon as I corrected that, everything worked flawlessly.

Here's my multi-wallet.dat file Coinjoin Smiley https://live.blockcypher.com/btc-testnet/tx/537d4f9c49e06916c8f74ad53e52c3389f1654f4dec1014e2335c7ad49e268ab/
newbie
Activity: 21
Merit: 11
February 05, 2020, 01:14:20 PM
#1
I am trying to learn the workflow for manual Coinjoins using PSBTs. I was following Andrew Chow's suggestions in a thread on Bitcoin Stack Exchnage here https://bitcoin.stackexchange.com/questions/57253/how-do-i-spend-bitcoins-from-multiple-wallets-in-a-single-transaction/89169#89169 Where he outlines this flow;

    1. Createpsbt (he suggests using walletcreatefundedpsbt)
    2. Have individual users send their PSBTs to coordinator
    3. Coordinator uses joinpsbts to join the separate PSBTs into one
    4. Coordinator sends joined PSBT back to users to sign with walletprocesspsbt
    5. Once all users have signed/processed the joined PSBT, coordinator uses combinepsbt.
    6. Coordinator uses finalizepsbt and then transmits to the network using sendrawtransaction.

 - I am on having an issue between Numbers 5 and 6 above. I can combine the signed PSBTs, but cannot get them to finalize.
 - I am on testnet using Bitcoin Core version v0.19.0.1 (64-bit)
 - I'm using the console in QT
 - I am using multiple wallet.dat files to simulate different CoinJoin participants. 
 - I've created 2 PSBTs from two separate wallet.dat files, and am able to join them together using joinpsbts

Once I have my joined PSBTs, I was able to sign my PSBT in each wallet, and then combine them into one PSBT using combinepsbt.

When I try to finalizepsbt, I get a return of  "complete": false
I am able to decode the PSBT and view all the correct inputs/outputs, but I must be missing a step to finalize the transaction after combining.

**I believe I need to get finalizepsbt to return a value of true.**


As a sidenote, if I use a single wallet.dat file, I can create multiple PSBTs, join, process, finalize, and send exactly as Andy describes. However when I try to do this in a  more-real-world-situation than "just one user combining his own PSBTs" and then try to combine the PSBTs from different wallet.dat files, then I run into problems (to me, each wallet.dat file = one separate user/Coinjoin participant).

  [1]: https://bitcoin.stackexchange.com/questions/57253/how-do-i-spend-bitcoins-from-multiple-wallets-in-a-single-transaction/89169#89169
Jump to: