<blockquote>
<p><strong>Will the first party bear all the fees since they are providing the input funds,</strong></p>
</blockquote>
<p>Yes, since they are the only one providing input funds.</p>
<blockquote>
<p><strong>or is there a way to distribute this between the parties?</strong></p>
</blockquote>
<p>There is no way for someone who is not providing funds to pay transaction fees in the transaction.</p>
<p>Note also that the Bitcoin network does not have any concept of which inputs contribute fees.</p>
<hr />
<blockquote>
<p><strong>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).</strong></p>
</blockquote>
<p>There is no fixed relationship between party that transmits (&quot;does&quot;) 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) &gt; sum(outputs), that is all.</p>
<p>From <a href="https://learn.saylor.org/mod/book/view.php?id=36341&amp;chapterid=18919" rel="nofollow noreferrer">learn.saylor.org</a>:</p>
<p><a href="https://i.sstatic.net/tCjDZq2y.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/tCjDZq2y.png" alt="Types of sighash flag" /></a></p>
<p>As I understand it†, sighash_single (for example)  means your &quot;user&quot; can provide for your &quot;non-user&quot; to add an extra output without your &quot;non-user&quot; 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 <a href="https://bitcoin.stackexchange.com/q/104937/13866">Transaction outputs with value 0</a></p>
<p><sub>† I don't use this, so caveat emptor</sub>.</p>

CC BY-SA 4.0
2024-10-21T12:24:07.857Z
so isnt there a way that fees can be paid by funds of second entity as he is broadcasting the tx ?
Nerses Asaturyan
CC BY-SA 4.0
2024-10-21T12:38:39.750Z
Since transaction fees are `sum(inputs) - sum(outputs)`, a second party with no inputs has no way to contribute to fees.
RedGrittyBrick
CC BY-SA 4.0
2024-10-21T12:42:20.383Z
Maybe you are thinking about [Sighash_anyonecanpay](https://learn.saylor.org/mod/book/view.php?id=36341&chapterid=18919)?
RedGrittyBrick
CC BY-SA 4.0
2024-10-21T12:56:03.250Z
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). now I am a lil bit confused which BIP I should use
Nerses Asaturyan
CC BY-SA 4.0
2024-10-21T14:29:26.947Z
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
CC BY-SA 4.0
2024-10-21T15:18:52.597Z
*" 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.
RedGrittyBrick
CC BY-SA 4.0
2024-10-21T10:19:11.323Z
2024-10-21T15:33:45.590Z
2024-10-21T15:33:45.590Z
RedGrittyBrick
<p>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:</p>
<p>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:</p>
<p>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.</p>

<bitcoin-core><blockchain><transaction-fees><bip174-psbt><funds>
How to add a custom struct to PSBT and handle transaction fees with two parties using BIP-174?
Nerses Asaturyan
# How to add a custom struct to PSBT and handle transaction fees with two parties using BIP-174?

(Asked by: username_0 on 2024-10-21)

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.

**Tags:** bitcoin-core, blockchain, transaction-fees, bip174-psbt, funds


---

## 1 answers

### Answer by username_1 on 2024-10-21. Score: 0 | Accepted answer

> **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](https://learn.saylor.org/mod/book/view.php?id=36341&chapterid=18919):

[![Types of sighash flag](https://i.sstatic.net/tCjDZq2y.png)](https://i.sstatic.net/tCjDZq2y.png)

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](https://bitcoin.stackexchange.com/q/104937/13866)

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

> **Comments:**
> **username_0**: so isnt there a way that fees can be paid by funds of second entity as he is broadcasting the tx ?  
> **username_1**: Since transaction fees are `sum(inputs) - sum(outputs)`, a second party with no inputs has no way to contribute to fees.  
> **username_1**: Maybe you are thinking about [Sighash_anyonecanpay](https://learn.saylor.org/mod/book/view.php?id=36341&chapterid=18919)?  
> **username_0**: 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). now I am a lil bit confused which BIP I should use  
> **username_2**: 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  
> **username_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.  

---

