I'm working on a Bitcoin transaction involving two parties. The aim is to lock some funds and create a custom struct in the transaction output. Here's what I plan to do:
The first party will provide the funds and kick off a Partially Signed Bitcoin Transaction (PSBT) based on BIP-174. The second party will then add a custom struct (like metadata or specific output details) to the PSBT without contributing any funds. I'm curious if this setup is workable:
Can the second party insert a custom struct (output or metadata) into the PSBT while the first party is the sole provider of funds? Who covers the transaction fees? Will the first party have to shoulder all the fees since they’re supplying the input funds, or is there a way to split this between both parties? Are there any specific limitations or best practices for doing this according to Bitcoin's protocol and the PSBT standard? I'd really appreciate any insights on whether this is doable and how to manage fees and adding structs in a PSBT.
The second parity can be structured with a custom struct (output or metadata). As long as the first party is only the one providing funds, that will pay all the fees. Bitcoin blockchain don't support splitting fees. But splitting fees are the most important in your case, we can adjust it manually by controlling inputs and outputs of the transaction. I think you can practice with bitcoinjs-lib which is the library for Bitcoin PSBT, addresses, etc.
I'm not expert on PSBT, but
1. BIP 370 (PSBT v2) improve BIP 174 (PSBT v0) which add more feature, mainly adding more input and output.
2. TX fee actually determined by subtract total coin on the input and total coin on the output. That means determining who's responsibility to pay TX fee entirely depends on all inputs and outputs.
BIP 68 isn't about output tagging. It's about timelock which determine when an UTXO can be spend, not about managing TX fee. Here's simple explanation about BIP 68 to other reader.
Thanks for explanation. By the way in what platform I can see your illustrations on Bitcoin topics ? I have found only X but it doesn't seems the best platform to investigate something
As i said previously, i never create any Bitcoin illustrations. But if you want to see more illustration created by @cygan, you can check https://twitter.com/BTCillustrated.