bitcoin-dev

A Fool's Errand or should I try?

A Fool's Errand or should I try?

Original Postby Fractal Encrypt

Posted on: May 4, 2024 15:00 UTC

The sender expresses a keen interest in enhancing the functionality of decoderawtransaction within Bitcoin development, aiming to include transaction fee information and possibly the satoshis per virtual byte (sats/vB) metric.

This interest stems from personal experiences with creating transactions using createrawtransaction and encountering difficulties in accurately calculating fees manually. The current limitation of decoderawtransaction not displaying fee information is noted, attributed to its inability to determine the value of inputs in a transaction.

To circumvent this issue for more accurate fee verification, the individual resorts to using createpsbt (Create Partially Signed Bitcoin Transaction) instead, which provides detailed information upon finalization, including fees. However, this method is considered more labor-intensive for straightforward transactions, especially when all UTXOs used as inputs are contained within the sender's wallet.

The proposed solution involves modifying decoderawtransaction to automatically fetch UTXO details for each input, calculate the total input value, and then subtract the total output value to ascertain the transaction fee. Additional considerations include determining whether inputs are from the user's wallet, suggesting a possible command argument to conditionally display fee information based on this factor. Furthermore, compatibility with nodes operating with txindex enabled, which have access to the entire chainstate for transaction ID lookup, is also highlighted as a necessary consideration.

The sender acknowledges their limited technical skills but counters this with high interest and persistence, seeking guidance, mentorship, or even criticism for their project idea. They express hope that if successful, they could contribute the enhancement back to the community through a pull request, despite initially intending the project for personal use and learning within their own node environment.