Bitcoin Forum
May 08, 2024, 05:36:09 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: A few questions on creating a transaction  (Read 142 times)
nofiat (OP)
Newbie
*
Offline Offline

Activity: 19
Merit: 2


View Profile
December 27, 2017, 03:14:27 PM
 #1

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?
1715146569
Hero Member
*
Offline Offline

Posts: 1715146569

View Profile Personal Message (Offline)

Ignore
1715146569
Reply with quote  #2

1715146569
Report to moderator
1715146569
Hero Member
*
Offline Offline

Posts: 1715146569

View Profile Personal Message (Offline)

Ignore
1715146569
Reply with quote  #2

1715146569
Report to moderator
1715146569
Hero Member
*
Offline Offline

Posts: 1715146569

View Profile Personal Message (Offline)

Ignore
1715146569
Reply with quote  #2

1715146569
Report to moderator
"The nature of Bitcoin is such that once version 0.1 was released, the core design was set in stone for the rest of its lifetime." -- Satoshi
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1715146569
Hero Member
*
Offline Offline

Posts: 1715146569

View Profile Personal Message (Offline)

Ignore
1715146569
Reply with quote  #2

1715146569
Report to moderator
achow101
Moderator
Legendary
*
expert
Offline Offline

Activity: 3388
Merit: 6631


Just writing some code


View Profile WWW
December 28, 2017, 04:30:34 AM
 #2

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.

nofiat (OP)
Newbie
*
Offline Offline

Activity: 19
Merit: 2


View Profile
December 28, 2017, 07:11:01 AM
 #3

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?
pebwindkraft
Sr. Member
****
Offline Offline

Activity: 257
Merit: 343


View Profile
December 28, 2017, 07:26:53 AM
 #4

yes and no ...  Grin Cheesy

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

Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!