Multisig and PSBT Stream 13th June 2021

Yesterday’s stream we ran through rebasing the AuxPoW work on top of Michael’s work to break down the AuxPoW match, as part of making that work more feasible to review. By the time I deployed the latest version of the code on a long running system, it was late and I didn’t want to start the PSBT work without time to complete it, so I handled initial branding instead. That’s going well and the client is now looking rather more like Dogecoin.

This next stream then I’ll be back experimenting with PSBT, or Partially Signed Bitcoin Transactions. The plan is to build a new 2-of-2 multisignature address (as in there are two signing keys, and signatures from both are required to spend from the address), and then demonstrate sending money to the address and then sending it on to another address.

There are two stages to this, building the address and spending from it. Building the address requires the two node operators (Alice and Bob, in the diagram below):

  1. Generate new addresses independently
  2. Extract the public keys from the addresses.
  3. Exchange public keys.
  4. Generate a multisignature address from the exchanged keys.
  5. Verify they have both generated the same multisignature address. If they have not, something has gone wrong (probably the key order when generating the address was wrong).
  6. Adding the address as “watchonly” to their nodes, so they record transactions to that address.

Generating multisignature address

To demonstrate spending from the address we introduce a third node operator, Charlie. The flow looks like this:

  1. Charlie sends funds to the address so it has an unspent transaction output (UTXO).
  2. Alice creates a PSBT spending the UTXO.
  3. Alice “processes” the PSBT, which triggers signing it.
  4. Alice sends the processed PSBT to Bob.
  5. Bob “dumps” the PSBT, to check its contents are as expected (spending the expected inputs, and sending to the correct address).
  6. Bob “processes” the PSBT, which triggers signing it.
  7. Bob “finalizes” the PSBT, converting it to a transaction that can be relayed.
  8. Bob relays the transaction to the Dogecoin network, effectively executing it.

Spending from a multisignature address

Aware that’s a lot to take in, but hopefully with a worked example it will make more sense!

I’ll be live on https://www.twitch.tv/rnicoll at 5pm UK time, and as always there will be a video on demand available after.

Ross