Refactor to make better use of streams

 - Use flatMap where appropriate
 - Introduce index and txId to TransactionOutput
 - Factor out an intermediate TransactionOutput.Data class to ensure it
   remains convenient to create and add outputs on the fly from tests
   (and in the future, when parsing from the wire, etc)

Resolves #12