How to get output linked to input in SPV node?

1

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?

Esenbek Kydyr uulu

Posted 2018-08-29T06:22:13.607

Reputation: 113

Answers

0

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 to find the block of your previous txout as well as it doesn't have the privacy problem of BIP37.

Jonas Schnelli

Posted 2018-08-29T06:22:13.607

Reputation: 5 718