1

In P2PKH transactions, the content after signing the transaction contains: <signature(with hash_flag)><public_key>. However, since the signature can't sign itself, during the signature process the ScripSig field is temporarily set to a certain value.

According to the accepted answer from How to redeem a basic Tx?, the field is temporarily set with the ScriptPubKey field from the UTXO we want to redeem (in this case a P2PKH ScriptPubKey with the RIPEMD160 of the previous address). However, according to VButerin's pybitcointools, the field is set with a P2PKH ScriptPubKey with the RIPEMD160 of your own address (the one you are using as a source, and which private key will be used to sign the transaction).

I used pybitcointools signing function several times, and the generated transactions are valid, but the answer from the aforementioned question has been well received, so at this point I'm quite confused about what the field should contain.

2

According to the accepted answer from How to redeem a basic Tx?, the field is temporarily set with the ScriptPubKey field from the UTXO we want to redeem (in this case a P2PKH ScriptPubKey with the RIPEMD160 of the previous address). However, according to VButerin's pybitcointools, the field is set with a P2PKH ScriptPubKey with the RIPEMD160 of your own address (the one you are using as a source, and which private key will be used to sign the transaction).

You're saying the same thing twice here.

A transaction T1 existed with an output T1:0 which has a scriptPubKey P2PKH(K1). This is the transaction that credited you. It resulted in the creation of a UTXO with script P2PKH(K1), and your own key is K1.

You're trying to create a transaction T2 with as input T1:0 and an output T2:0 with scriptPubKey P2PKH(K2). This is the spending transaction, which you're signing for with K1. It sends money to K2, but consumes the UTXO T1:0 which has script P2PKH(K1).

  • Yes, right, long hours working on the same I guess. Thanks Pieter. – sr-gi May 5 '17 at 18:04

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.