Bitcoin Forum

Bitcoin => Development & Technical Discussion => Topic started by: nofiat on December 27, 2017, 03:14:27 PM



Title: A few questions on creating a transaction
Post by: nofiat on December 27, 2017, 03:14:27 PM
Hi,

So I'm learning bit by bit on how to create a transaction (without using any external library).

When creating the scriptSig, we sign the transaction hash using the spender's private key. Does that mean that the scriptSig is the same for all inputs?  Or is the tx hash calculated separately for each input?

Also, is there a developers chat or group?


Title: Re: A few questions on creating a transaction
Post by: achow101 on December 28, 2017, 04:30:34 AM
When creating the scriptSig, we sign the transaction hash using the spender's private key. Does that mean that the scriptSig is the same for all inputs?  Or is the tx hash calculated separately for each input?
The hash is different for each input.

Also, is there a developers chat or group?
#bitcoin-dev on freenode.


Title: Re: A few questions on creating a transaction
Post by: nofiat on December 28, 2017, 07:11:01 AM
When creating the scriptSig, we sign the transaction hash using the spender's private key. Does that mean that the scriptSig is the same for all inputs?  Or is the tx hash calculated separately for each input?
The hash is different for each input.

Also, is there a developers chat or group?
#bitcoin-dev on freenode.

In that case, what do we put in the final "hash" parameter of the transaction? Is it the double-hashed raw transaction before it's broadcasted?


Title: Re: A few questions on creating a transaction
Post by: pebwindkraft on December 28, 2017, 07:26:53 AM
yes and no ...  ;D :D

yes: while creating your tx, you replace the sigscript with the pubkey script.
no: when signing the whole structure, you are doing a hash. As the unsigned, raw transaction has previous tx hash and previous outpoint, when you hash it, this creates always a different value, which makes the sig again being different for each input.

there is just a similiar question here:
https://bitcoin.stackexchange.com/questions/66714/is-scriptsig-different-for-each-input/66722?noredirect=1#comment77506_66722