0

I am working on a Bitcoin transaction where two parties are involved. The goal is to lock funds and create a custom struct in the transaction output. Here's how I intend to set it up:

First party provides the funds and initiates a Partially Signed Bitcoin Transaction (PSBT) using BIP-174. Second party will add a custom struct (possibly metadata or a specific output detail) to the PSBT without providing any funds. I'm wondering if the following is possible:

Can the second party add a custom struct (output or metadata) to the PSBT, while the first party is the only one providing funds? Who will be responsible for paying the transaction fees? Will the first party bear all the fees since they are providing the input funds, or is there a way to distribute this between the parties? Are there any known constraints or best practices for achieving this within Bitcoin's protocol and the PSBT standard? I would appreciate any guidance on whether this setup is feasible and how to handle fees and struct addition in a PSBT.

0

1 Answer 1

0

Will the first party bear all the fees since they are providing the input funds,

Yes, since they are the only one providing input funds.

or is there a way to distribute this between the parties?

There is no way for someone who is not providing funds to pay transaction fees in the transaction.

Note also that the Bitcoin network does not have any concept of which inputs contribute fees.


I just want to user pay funds and other party (non user) add needed struct and also I want user not to do tx (dont pay fees).

There is no fixed relationship between party that transmits ("does") the completed transaction and the party or parties that provide the inputs to the transaction. Whoever submits the completed transactions to the network need not be a provider of inputs or even a signatory. People are not charged a fee for transmitting a new unconfirmed transaction, the participants providing funds arrange that sum(inputs) > sum(outputs), that is all.

From learn.saylor.org:

Types of sighash flag

As I understand it†, sighash_single (for example) means your "user" can provide for your "non-user" to add an extra output without your "non-user" having to provide any inputs. The second output could contain a small amount of embedded data. The monetary amount of the second output would come from sum(blue inputs) - sum(blue outputs) and leave some as the tx fee. Note also Transaction outputs with value 0

† I don't use this, so caveat emptor.

6
  • so isnt there a way that fees can be paid by funds of second entity as he is broadcasting the tx ? Commented Oct 21 at 12:24
  • Since transaction fees are sum(inputs) - sum(outputs), a second party with no inputs has no way to contribute to fees. Commented Oct 21 at 12:38
  • Maybe you are thinking about Sighash_anyonecanpay? Commented Oct 21 at 12:42
  • 1
    If one of the outputs belongs to the other party, that output’s amount could be reduced by the fees and they could pay the fees without providing an input. However, if the second party does not get paid in the transaction, indeed only someone that provided an input can pay fees since fees are the difference between the sums of input amounts and output amounts
    – Murch
    Commented Oct 21 at 14:29
  • 1
    " I want user not to do tx (dont pay fees)." There is no fixed relationship between party that transmits ("does") the completed transaction and the party or parties that provide the inputs to the transaction. Whoever submits the completed transactions to the network need not be a provider of inputs or even a signatory. People are not charged a fee for transmitting a new unconfirmed transaction, the participants providing funds arrange that sum(inputs) > sum(outputs), that is all. Commented Oct 21 at 15:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.