If I was not mistaken, with transactioninput.getConnectedOutput(), the output which is used for the input is obtained.

But what to do later? There seem to be two relevant methods: getAddressFromP2PKHScript(NetworkParameters networkParameters) and getAddressFromP2SH(NetworkParameters networkParameters). Am I correct that either one of them will give me the correct address?

Also how to obtain the addresses involved in multisignature transaction with bitcoinj?

1 Answer 1


Yes, but be aware that there is no concept of a "from address" in Bitcoin. So you should always be prepared for unknown script types. For example, the sender could also be using P2PK, the oldest standardized form of payment in Bitcoin.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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