First draft of the sign tx code (fails on previous hash)