Bitcoin Forum
October 19, 2017, 04:16:31 AM *
News: Latest stable version of Bitcoin Core: 0.15.0.1  [Torrent]. (New!)
 
   Home   Help Search Donate Login Register  
Pages: [1]
  Print  
Author Topic: What is the upper limit of 'm' and 'n' for m-of-n transactions?  (Read 2201 times)
No_2
Hero Member
*****
Offline Offline

Activity: 804


BTC: the beginning of stake-based public resources


View Profile WWW
May 24, 2013, 03:44:56 PM
 #1

My incomplete understanding of how m-of-n transactions work is that the public keys are split up and spread between the parties involved.

Satoshi, in his infinite wisdom, has abstracted this mechanism so that 'm' part-keys are required from a set of 'n' participants to be able to form the complete private key to be able to access the funds in a given address.

My question is: what are the upper limits on 'm' or 'n'?

If a limit does exist is this in any way connected to the fact that the private keys can only be divided so much?

MetaLair: a blockchain and cryptocurrency consultancy
Twitter: @MetaLair | Facebook | Google+
1508386591
Hero Member
*
Offline Offline

Posts: 1508386591

View Profile Personal Message (Offline)

Ignore
1508386591
Reply with quote  #2

1508386591
Report to moderator
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
1508386591
Hero Member
*
Offline Offline

Posts: 1508386591

View Profile Personal Message (Offline)

Ignore
1508386591
Reply with quote  #2

1508386591
Report to moderator
TalkingAntColony
Member
**
Offline Offline

Activity: 62


View Profile
May 24, 2013, 03:56:13 PM
 #2

M-of-N signatures are checked in scripts by OP_CHECKMULTISIG

It is limited to 20 public keys, so the limit of M and N is 20.
Source: https://github.com/bitcoin/bitcoin/blob/master/src/script.cpp#L871

The limit exists out of concern for limting the size and computational complexity of transactions. Private keys are not divided in M-of-N transactions. Rather, there are N private keys, of which M need to sign the transaction for it to be valid.

malevolent
can into space
Staff
Legendary
*
Offline Offline

Activity: 1820



View Profile
May 24, 2013, 04:03:15 PM
 #3

I think currently the limits are the relay nodes which might not relay non-standard transactions and miners which might not include them in blocks.

TalkingAntColony
Member
**
Offline Offline

Activity: 62


View Profile
May 24, 2013, 04:12:38 PM
 #4

M-of-N are now a standard Tx, and thus relayed/mined.

See here:

https://en.bitcoin.it/wiki/BIP_0011
https://en.bitcoin.it/wiki/BIP_0016
malevolent
can into space
Staff
Legendary
*
Offline Offline

Activity: 1820



View Profile
May 24, 2013, 04:41:30 PM
 #5

Yes, but the limits are like the one you posted few posts above and exceeding them would render a transaction non-standard.

And also:

Quote
One argument against using OP_CHECKMULTISIG is that old clients and miners count it as "20 sigops" for purposes of computing how many signature operations are in a block, and there is a hard limit of 20,000 sigops per block-- meaning a maximum of 1,000 multisig transactions per block. Creating multisig transactions using multiple OP_CHECKSIG operations allows more of them per block.
scintill
Sr. Member
****
Offline Offline

Activity: 448


View Profile WWW
May 24, 2013, 10:08:46 PM
 #6

M-of-N are now a standard Tx, and thus relayed/mined.

See here:

https://en.bitcoin.it/wiki/BIP_0011
https://en.bitcoin.it/wiki/BIP_0016

Only up to x-of-3 are standard.  As mentioned earlier 20 is the hard limit, but only up to 3 is by default relayed and mined.

1SCiN5kqkAbxxwesKMsH9GvyWnWP5YK2W | donations
No_2
Hero Member
*****
Offline Offline

Activity: 804


BTC: the beginning of stake-based public resources


View Profile WWW
May 24, 2013, 11:47:18 PM
 #7

TalkingAntColony, malevolent and scintill; thank you very much - for a person who can only read source code to a rudimentary level these answers are very concise. Much appreciated.

A further question: if a 2-of-20 transaction was split up amongst 18 escrow (I assume 18 as two parties are transacting) and one of the two parties gained access to all 18 escrow's private-part-keys, without knowing the order the 2-of-20 transaction was signed in by the escrows: would the party with the part-private-keys be able to infer the order those keys needed to be reassembled in or would they have to try all the possible combinations?

MetaLair: a blockchain and cryptocurrency consultancy
Twitter: @MetaLair | Facebook | Google+
DeathAndTaxes
Donator
Legendary
*
Offline Offline

Activity: 1218


Gerald Davis


View Profile
May 24, 2013, 11:51:58 PM
 #8

TalkingAntColony, malevolent and scintill; thank you very much - for a person who can only read source code to a rudimentary level these answers are very concise. Much appreciated.

A further question: if a 2-of-20 transaction was split up amongst 18 escrow (I assume 18 as two parties are transacting) and one of the two parties gained access to all 18 escrow's private-part-keys, without knowing the order the 2-of-20 transaction was signed in by the escrows: would the party with the part-private-keys be able to infer the order those keys needed to be reassembled in or would they have to try all the possible combinations?

Your wording seems to indicate you don't understand the concept of n of m.

1) There are no "part-private-keys.  A 2 of 20 setup means there are 20 valid private keys.
2) In a 2 of 20 setup there is no concept of order.  One just needs to sign a transaction with ANY 2 of the 20 VALID private keys to produce a valid transaction.

There is reassembled of private keys.

For example a "standard" transaction is a 1 of 1 transaction.  There is one private key.  The transaction must be signed by the one private key to be valid.
In a 1 of 2 transaciton there are 2 valid (unique and independent) private keys.  The transaction is valid if it is signed by ANY ONE of the TWO valid keys.
In a 10 of 10 transaction there are 10 valid (unique and independent) private keys.  The transaction is valid if it is signed by ALL TENS of the TEN valid keys.


No_2
Hero Member
*****
Offline Offline

Activity: 804


BTC: the beginning of stake-based public resources


View Profile WWW
May 25, 2013, 12:16:28 AM
 #9

In a 10 of 10 transaction there are 10 valid (unique and independent) private keys.  The transaction is valid if it is signed by ALL TENS of the TEN valid keys.

So for a 20-of-20 transaction does the order of signing to access funds at the destination address matter?

If so this would be a large number of combinations if the order were not known.

Are the private keys formed by the escrows in series or parallel?

MetaLair: a blockchain and cryptocurrency consultancy
Twitter: @MetaLair | Facebook | Google+
DeathAndTaxes
Donator
Legendary
*
Offline Offline

Activity: 1218


Gerald Davis


View Profile
May 25, 2013, 12:30:00 AM
 #10

Quote
So for a 20-of-20 transaction does the order of signing to access funds at the destination address matter?
The order never matters.  20 of 20 simply means all 20 keys must sign.  1 of 20 means any 1 of 20 can sign. 10 of 20 means ANY 10 of 20 can sign.

Quote
Are the private keys formed by the escrows in series or parallel?
Private keys aren't formed by anything.  They are private keys (random 256 bit numbers).    Multi-sig simply requires/allows more than one private key to be used.
No_2
Hero Member
*****
Offline Offline

Activity: 804


BTC: the beginning of stake-based public resources


View Profile WWW
May 25, 2013, 12:35:43 AM
 #11

Quote
Are the private keys formed by the escrows in series or parallel?
Private keys aren't formed by anything.  They are private keys (random 256 bit numbers).    Multi-sig simply requires/allows more than one private key to be used.

Thanks, so when the 20-of-20 transaction is set up do the escrows involved in it need to sign the 20-of-20 transaction request in series or can this be done in parallel?

MetaLair: a blockchain and cryptocurrency consultancy
Twitter: @MetaLair | Facebook | Google+
jl2012
Legendary
*
Offline Offline

Activity: 1694


View Profile
May 25, 2013, 03:41:57 AM
 #12

Quote
Are the private keys formed by the escrows in series or parallel?
Private keys aren't formed by anything.  They are private keys (random 256 bit numbers).    Multi-sig simply requires/allows more than one private key to be used.

Thanks, so when the 20-of-20 transaction is set up do the escrows involved in it need to sign the 20-of-20 transaction request in series or can this be done in parallel?

In series but the order doesn't matter. Can't be parallel.

Donation address: 374iXxS4BuqFHsEwwxUuH3nvJ69Y7Hqur3
PGP: D3CC 1772 8600 5BB8 FF67 3294 C524 2A1A B393 6517
No_2
Hero Member
*****
Offline Offline

Activity: 804


BTC: the beginning of stake-based public resources


View Profile WWW
May 25, 2013, 11:37:00 AM
 #13

Scenario:

A 20-of-20 transaction is set up.

This 20-of-20 transaction exists in a pool of 100 escrow agents. The other 80 escrow agents each hold a key for other separate m-of-n transactions.

A malicious entity somehow infiltrates this pool and is able to access all 100 escrow keys for the m-of-n transactions, where a sub set of 20 of the keys are for the 20-of-20 transaction in question.

Would the malicious entity be able to identify which of those 100 escrow keys were associated with the same 20-of-20 transaction? Or are the keys impossible to correlate if the entity does not know which transactions they relate to?

MetaLair: a blockchain and cryptocurrency consultancy
Twitter: @MetaLair | Facebook | Google+
TalkingAntColony
Member
**
Offline Offline

Activity: 62


View Profile
May 25, 2013, 03:32:51 PM
 #14

It depends. If funds had been sent in an M-of-N transaction with the output script exposing the public keys, the attacker can select the 20 private keys which belong to those public keys and create a new transaction spending the funds to himself. If the funds had been sent to a P2SH (pay-to-script-hash) address, and no funds have ever been spent FROM that address, then the attacker only knows the hash of the 20 public keys. In that case, he would have to brute-force it, trying every subset of 20 public keys from the 100. It turns out there are about 5.4 * 10^20 possible subsets, so it might not be possible to brute force in a reasonable time.
DeathAndTaxes
Donator
Legendary
*
Offline Offline

Activity: 1218


Gerald Davis


View Profile
May 25, 2013, 08:00:45 PM
 #15

Scenario:

A 20-of-20 transaction is set up.

This 20-of-20 transaction exists in a pool of 100 escrow agents. The other 80 escrow agents each hold a key for other separate m-of-n transactions.

A malicious entity somehow infiltrates this pool and is able to access all 100 escrow keys for the m-of-n transactions, where a sub set of 20 of the keys are for the 20-of-20 transaction in question.

Would the malicious entity be able to identify which of those 100 escrow keys were associated with the same 20-of-20 transaction? Or are the keys impossible to correlate if the entity does not know which transactions they relate to?


Yes it is trivially easy.  The 20 public keys are known.  If they weren't how would the Bitcoin network validate the transaction.  If the attacker has 100 keys he computes the 100 public keys and within miliseconds locates the ones which are used in the transaction.

On edit:  TAC brought up a good point.  If the P2SH script is unknown then the attacker may be unable to brute force the proper keys however I can't really imagine a scenario where the private keys would be compromised but the p2SH script isn't.  I mean if that is the case whatever you did to keep the P2SH script safe ... do that to keep one or more of the private keys safe. Smiley
No_2
Hero Member
*****
Offline Offline

Activity: 804


BTC: the beginning of stake-based public resources


View Profile WWW
May 26, 2013, 12:34:38 PM
 #16

Thank you this is very helpful.

Am I correct in thinking:

1. An m-of-n transaction is signed in series because the public keys are appended to the escrow form as each party signs so this total set of keys can be logged to the transaction in the blockchain? If this is the case then surely an overseer could have a selection of escrows sign in parallel and then collate these keys into the escrow form, thereby preventing each escrow of having any knowledge of who the other escrows are and what other keys are involved in the transaction?

2. Is there any way to see if a single private key goes with a multi-signature transaction? I.e. could an attacker try single keys from a multi-signature transaction in sequence to see if it is associated with a given multi-signature transaction or do all the keys have to be used together to see if they are for a given multi-signature transaction?

3. Assuming the latter is true for Q2, to undertake this brute-force attack is the attacker trying to match a single value generated from all the keys that is publicly viewable on the blockchain or do they have to submit a request to the network for each attempt?

4. I've read up on P2SH (pay-to-script-hash) but don't fully understand it yet. Is it a number (hash) representing all the signatures for a multi-signature transaction where just that number is stored on the blockchain, resultantly keeping the set of public keys used for that multi-signature transaction obfuscated?

MetaLair: a blockchain and cryptocurrency consultancy
Twitter: @MetaLair | Facebook | Google+
TalkingAntColony
Member
**
Offline Offline

Activity: 62


View Profile
May 26, 2013, 05:28:51 PM
 #17

1. I'm not sure what you mean by "escrow form." In plain M-of-N the public keys are known to the network when funds are sent to them. In P2SH only the hash of these public keys is known. To create a Tx that spends these funds, one must know which public keys those were and also sign with the private keys. One person could collect public keys and create a P2SH address in which the other public key owners don't know about each other. The would have to trust this person to not create a different P2SH address and all owners would find out about each other's public keys when funds are spent from that address.

2. In plain M-of-N, the public key is known. In P2SH M-of-N, one must know the public keys to spend the funds. If you have a list of possible public/private keys, you have to try every possible combination. You don't even know what M and N are. This is why users of P2SH need to also store the output script (which contains the public keys) for that address.

3. They are trying to create an output script, which has public keys in it in some order, that hashes to the P2SH address.These keys are not publicly viewable on the blockchain unless funds have been spent from the address before.

4. A P2SH address is the hash of an output script. In M-of-N the output script looks like "M <PubKey1> ... <PubKeyN> M OP_CHECKMULTISIG". When a Tx spends funds from the address, nodes check that it contains the output script by checking the hash of it against the address and then check that the signatures match the public keys. When someone sends funds to a P2SH address, they are essentially saying "any script that hashes to this hash can redeem these funds." That script doesn't have to be M-of-N (though it may be non-standard if it isn't).
Pages: [1]
  Print  
 
Jump to:  

Sponsored by , a Bitcoin-accepting VPN.
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!