1

I am using the latest (3.2.3) command line version of Electrum. I want to find the inputs of a transaction by looking at the history. The previous version of Electrum (that I was using 8 months ago) had a field (array) called input_addresses in its history output.

The current version does not have it.

A sample output from history is something like this:

$ electrum --testnet history --show_addresses | tail -40
...
        {
            "balance": "xxx BTC",
            "confirmations": 1,
            "date": "2018-09-21 12:27",
            "height": 1413976,
            "inputs": [
                {
                    "prevout_hash": "c96274d67e095...74c1af",
                    "prevout_n": 1
                },
                {
                    "prevout_hash": "f7e443ade3f0e...fe1eb8",
                    "prevout_n": 0
                }
            ],
            "label": "",
            "outputs": [
                {
                    "address": "myAB...",
                    "value": "0.49794855 BTC"
                },
                {
                    "address": "2N25...",
                    "value": "5.000258 BTC"
                }
            ],
            "timestamp": 1537522037,
            "txid": "3404f9fb96...0d253c",
            "value": "-5.00233525 BTC"
        }
    ]
}

So I am left with something called inputs containing some hashes. I need to convert these hashes to input addresses from command line.

The GUI version of Electrum will show the input address on the right of the hashes, like this:

c96274d67e095...74c1af:1    mhAhgR...
f7e443ade3f0e...fe1eb8:0    mhAhgR...
0

The hashed refer to the previous tx the input is consuming, and its vout position in that tx.

You will need to use the electrum API to fetch that transaction's details, and look at the outputs[vin] value for the locking script, and then convert that to an address by encoding it for base58check/bech32.

  • Thanks. But, a bit complicated. I found the information I was looking for in api.blockcypher.com which can be accessed using wget or curl in my scripts. – FedonKadifeli Sep 21 '18 at 13:18
0

They removed input addresses aka from addresses because those were technically incorrect. There are no from addresses in bitcoin so this was misleading to users. I believe even in the GUI it only shows from addresses where the addresses belong to the same wallet. They should remove them entirely.

Whatever are you doing that requires tracking from addresses? I suggest handing out different receive addresses to different users to track who sent you how much and not relying on from addresses. This is the correct way to use bitcoin.

  • Thank you for the clarification! I had a similar feeling along your lines. My case is something like this: Somebody -- who I do not know -- will send some me some testnet3 bitcoins; an automatic script will do some calculation; and it will send back an amount of testnet bitcoins to the "wallet" that started the transaction. As "wallet" I was trying to use one of the input addresses of the original transaction. Since, the potential senders (i.e., the people or "wallets" who will start a transaction) are not limited, I cannot give a different receive address to each one. – FedonKadifeli Sep 22 '18 at 12:02
  • @FedonKadifeli You can generate unlimited addresses from an extended public key so just install that on your website and have the sender get an address from there. Mycelium gear offers an easy to use donation widget that can solicit information like an email or name and generate a unique address for every individual that requests it. Another option is this wordpress plugin but you'll have to modify it to ask for personally identifying info from the sender. You can get your wallet's xpub via wallet > information. – Abdussamad Sep 23 '18 at 7:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.