Determine input addresses of a transaction



Summary:

Jan, who is working on a green address endeavor, is attempting to extend the 'gettransaction' call by adding an extra field called "inputaddresses." The goal of this field is to return a list of the Bitcoin addresses linked with the inputs of a transaction. Although it is typically impossible due to various scripting language structures, Jan believes it can work for "regular" transactions. To do this, he will go through the inputs and see if the scriptSig field has only two opcodes. If it does, then Jan believes that it is possible to calculate the Bitcoin address from that structure. However, Jan is concerned about the safety of this approach. Can someone trick the system somehow? Is it possible to create a valid transaction that has an input with only two opcodes but with an arbitrary pubKey at the second position? Jan asks for feedback from anyone who has a better grasp on the scripting capabilities. Jan wonders if there is another way to determine the input addresses of a transaction. He requests suggestions on how to resolve this issue. Jan's patch for the project is available at https://github.com/javgh/bitcoin/compare/vps_wheezy...showinputaddresses.


Updated on: 2023-06-04T20:51:12.613422+00:00