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):
- Generate new addresses independently
- Extract the public keys from the addresses.
- Exchange public keys.
- Generate a multisignature address from the exchanged keys.
- 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).
- Adding the address as “watchonly” to their nodes, so they record transactions to that address.
To demonstrate spending from the address we introduce a third node operator, Charlie. The flow looks like this:
- Charlie sends funds to the address so it has an unspent transaction output (UTXO).
- Alice creates a PSBT spending the UTXO.
- Alice “processes” the PSBT, which triggers signing it.
- Alice sends the processed PSBT to Bob.
- Bob “dumps” the PSBT, to check its contents are as expected (spending the expected inputs, and sending to the correct address).
- Bob “processes” the PSBT, which triggers signing it.
- Bob “finalizes” the PSBT, converting it to a transaction that can be relayed.
- Bob relays the transaction to the Dogecoin network, effectively executing it.
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.