Fix PublicKey generation from Tx

The original tx struct was being overwritten by the append action, copy the data first to prevent this
Merge pull request #2 from maran/publicKeyFix

Fix PublicKey generation from Tx