2

I believe TransactionOutput represents one of the outputs of a transaction.

I have a list of such output objects, and a String that represents my own address. I would like to check that this output reached my address.

How do I get the destination address from the TransactionOutput object?

2

TransactionOutput.getScriptPubKey.getToAddress.toString

Unfortunately, this gives an exception when dealing with an oldstyle pay-to-IP script, so you might have to deal with these yourself if you need them (which in your use case you probably won't). An example can be found in the Scala code from the link below (from line 120 on):

https://github.com/stefanwouldgo/Bitcoin-Graph-Explorer/blob/master/src/main/scala/Graph.scala

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.