<p>You can't get a previous transaction via the p2p network based on the txid.</p>

<p>If you use BIP37, fees for received transactions are difficult to calculate in a decentralised way.</p>

<p>Have a look at BIP158 which will probably be available on the network soon.
It has a <a href="https://github.com/bitcoin/bips/blob/master/bip-0158.mediawiki#block-filters" rel="nofollow noreferrer">feature</a> to find the block of your previous txout as well as it doesn't have the privacy problem of BIP37.</p>

CC BY-SA 4.0
2018-08-29T19:18:05.557Z
2018-08-29T19:18:05.557Z
Jonas Schnelli
<p>We're working on bitcoin SPV wallet. After setting bloom filter, we only get merkle blocks, and transactions that match the hashes we set plus some false positives. </p>

<p>If a transaction is where we <strong>SEND</strong> coins, we can calculate a fee of that transaction, because we also <strong>HAVE</strong> previous transaction holding an output we spent. </p>

<p>But, if a transaction is where we <strong>RECEIVE</strong> coins, then we can't calculate the fee. Because, we <strong>DON'T HAVE</strong> previous transaction holding someone's output which he spent.</p>

<p>As far as I know, there's no way to request single transaction from peers. </p>

<p>How can we get previous transaction or at least it's output's value?</p>

<transaction-fees><synchronization><spv>
How to get output linked to input in SPV node?
Esenbek Kydyr uulu
# How to get output linked to input in SPV node?

(Asked by: username_0 on 2018-08-29)

We're working on bitcoin SPV wallet. After setting bloom filter, we only get merkle blocks, and transactions that match the hashes we set plus some false positives.

If a transaction is where we **SEND** coins, we can calculate a fee of that transaction, because we also **HAVE** previous transaction holding an output we spent.

But, if a transaction is where we **RECEIVE** coins, then we can't calculate the fee. Because, we **DON'T HAVE** previous transaction holding someone's output which he spent.

As far as I know, there's no way to request single transaction from peers.

How can we get previous transaction or at least it's output's value?

**Tags:** transaction-fees, synchronization, spv


---

## 1 answers

### Answer by username_1 on 2018-08-29. Score: 0 | Accepted answer

You can't get a previous transaction via the p2p network based on the txid.

If you use BIP37, fees for received transactions are difficult to calculate in a decentralised way.

Have a look at BIP158 which will probably be available on the network soon.
It has a [feature](https://github.com/bitcoin/bips/blob/master/bip-0158.mediawiki#block-filters) to find the block of your previous txout as well as it doesn't have the privacy problem of BIP37.


---

