Bitcoin Forum
May 02, 2024, 10:25:35 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Signing order for m-of-n transactions  (Read 1318 times)
No_2 (OP)
Hero Member
*****
Offline Offline

Activity: 901
Merit: 1031


BTC: the beginning of stake-based public resources


View Profile
January 27, 2015, 07:18:07 PM
 #1

For a transaction containing an m-of-n output, say 7-of-10 that 7 signatories are required to release funds, as an input for the next transaction. I understand that the signing order must be the same as the original signing order used to create the 7-of-10 contract within the transaction.

If I've understood this correctly can someone point me to where this is enforced in the code.
1714645535
Hero Member
*
Offline Offline

Posts: 1714645535

View Profile Personal Message (Offline)

Ignore
1714645535
Reply with quote  #2

1714645535
Report to moderator
In order to achieve higher forum ranks, you need both activity points and merit points.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1714645535
Hero Member
*
Offline Offline

Posts: 1714645535

View Profile Personal Message (Offline)

Ignore
1714645535
Reply with quote  #2

1714645535
Report to moderator
1714645535
Hero Member
*
Offline Offline

Posts: 1714645535

View Profile Personal Message (Offline)

Ignore
1714645535
Reply with quote  #2

1714645535
Report to moderator
1714645535
Hero Member
*
Offline Offline

Posts: 1714645535

View Profile Personal Message (Offline)

Ignore
1714645535
Reply with quote  #2

1714645535
Report to moderator
yakuza699
Hero Member
*****
Offline Offline

Activity: 935
Merit: 1002


View Profile
January 27, 2015, 07:34:02 PM
 #2

If I've understood this correctly can someone point me to where this is enforced in the code.
Yes you understood it correctly but unfortunately I can not link you to the place where it is in the code.

▄▄▄▄▄▄▄▄
▄▄▄▄▄▄
▄▄▄▄
BTC BitDice.me 
.
hhanh00
Sr. Member
****
Offline Offline

Activity: 467
Merit: 266


View Profile
January 27, 2015, 08:21:05 PM
 #3

https://github.com/bitcoin/bitcoin/blob/b01a435c34f0669affece2b3d90f92c347588d69/src/script/interpreter.cpp
Code:
                        bool fOk = checker.CheckSig(vchSig, vchPubKey, scriptCode);

                        if (fOk) {
                            isig++;
                            nSigsCount--;
                        }
                        ikey++;
                        nKeysCount--;

No_2 (OP)
Hero Member
*****
Offline Offline

Activity: 901
Merit: 1031


BTC: the beginning of stake-based public resources


View Profile
January 28, 2015, 02:39:11 PM
 #4

Thanks.

Can anyone explain why the signing order is important? i.e. Why can the nodes not just sign to release in any order?
dabura667
Sr. Member
****
Offline Offline

Activity: 475
Merit: 252


View Profile
January 28, 2015, 03:21:58 PM
 #5

Thanks.

Can anyone explain why the signing order is important? i.e. Why can the nodes not just sign to release in any order?

Signature can happen in any order... it's just that once you have the necessary number of signatures, you must switch around their order to meet the proper ordering requirements.

My Tip Address:
1DXcHTJS2DJ3xDoxw22wCt11FeAsgfzdBU
johoe
Full Member
***
Offline Offline

Activity: 217
Merit: 238


View Profile
January 28, 2015, 06:07:41 PM
 #6

Can anyone explain why the signing order is important? i.e. Why can the nodes not just sign to release in any order?

To keep the code that checks the signatures simple and fast (remember that it must be checked by every full node in the bitcoin network).  Suppose you have a 14 of 15 signature.  If these were not ordered you have to check every signature with every key, in the worst case more than 100 checks.  Since the protocol requires that the signatures are in the right order, you only have to check each key once.  If it doesn't match the signature at the expected position you immediately know that the signature for that key is not present.

Also, its easy for a signer to put his signature at the right place, so you don't have to really sign the transaction in the right order, you just have to order the signatures right.

Donations to 1CF62UFWXiKqFUmgQMUby9DpEW5LXjypU3
No_2 (OP)
Hero Member
*****
Offline Offline

Activity: 901
Merit: 1031


BTC: the beginning of stake-based public resources


View Profile
January 28, 2015, 11:11:29 PM
 #7

Thank you johoe that rational makes sense.

Can anyone explain why the signing order is important? i.e. Why can the nodes not just sign to release in any order?

To keep the code that checks the signatures simple and fast (remember that it must be checked by every full node in the bitcoin network).  Suppose you have a 14 of 15 signature.  If these were not ordered you have to check every signature with every key, in the worst case more than 100 checks.  Since the protocol requires that the signatures are in the right order, you only have to check each key once.  If it doesn't match the signature at the expected position you immediately know that the signature for that key is not present.

Also, its easy for a signer to put his signature at the right place, so you don't have to really sign the transaction in the right order, you just have to order the signatures right.
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!