Bitcoin Forum
May 06, 2024, 01:35:31 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: M-Of-N Addressess - Can we check how many 'N's & 'M's?  (Read 1343 times)
This is a self-moderated topic. If you do not want to be moderated by the person who started this topic, create a new topic.
Muhammed Zakir (OP)
Hero Member
*****
Offline Offline

Activity: 560
Merit: 506


I prefer Zakir over Muhammed when mentioning me!


View Profile WWW
March 06, 2015, 10:44:24 AM
 #1

Hello,

Can we check how many 'N's & 'M's are there for a multisig address? There are a few wallets which offer multisig addresses, one key with us and one in server, according to them a 2-of-2 address. But to be sure, I would like to check whether it is true? i.e., whether it is really a 2-of-2 or 2+-of-3+. Any suggestions/opinions are helpful. Smiley

Kindly,
Muhammed Zakir

1715002531
Hero Member
*
Offline Offline

Posts: 1715002531

View Profile Personal Message (Offline)

Ignore
1715002531
Reply with quote  #2

1715002531
Report to moderator
1715002531
Hero Member
*
Offline Offline

Posts: 1715002531

View Profile Personal Message (Offline)

Ignore
1715002531
Reply with quote  #2

1715002531
Report to moderator
1715002531
Hero Member
*
Offline Offline

Posts: 1715002531

View Profile Personal Message (Offline)

Ignore
1715002531
Reply with quote  #2

1715002531
Report to moderator
The forum strives to allow free discussion of any ideas. All policies are built around this principle. This doesn't mean you can post garbage, though: posts should actually contain ideas, and these ideas should be argued reasonably.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1715002531
Hero Member
*
Offline Offline

Posts: 1715002531

View Profile Personal Message (Offline)

Ignore
1715002531
Reply with quote  #2

1715002531
Report to moderator
1715002531
Hero Member
*
Offline Offline

Posts: 1715002531

View Profile Personal Message (Offline)

Ignore
1715002531
Reply with quote  #2

1715002531
Report to moderator
1715002531
Hero Member
*
Offline Offline

Posts: 1715002531

View Profile Personal Message (Offline)

Ignore
1715002531
Reply with quote  #2

1715002531
Report to moderator
FabioCarpi
Sr. Member
****
Offline Offline

Activity: 375
Merit: 254



View Profile
March 06, 2015, 01:55:18 PM
 #2

only with a redeem script...
laurentmt
Sr. Member
****
Offline Offline

Activity: 384
Merit: 258


View Profile
March 06, 2015, 02:27:18 PM
 #3

I make the hypothesis that you're talking about P2SH addresses (starting with a 3)*

Unfortunately, the scriptpubkey (script stored in the unspent output) of a P2SH can't be used to retrieve the M & N values.
The scriptpubkey contains a hash of the redeem script (the multisig script) and this hash can't be reversed and interpreted.
The redeem script will be provided in clear in the scriptsig when the utxo is spent. But that may be too late...

Providing a proof that a P2SH is legit is a good feature which should be proposed by all multisig online wallets.
It just requires you have access to the redeem script and the hash before sending funds to the P2SH address.

*: old multisig scripts don't have this "problem" since the multisig script can be found in clear in the scriptpubkey.  
Muhammed Zakir (OP)
Hero Member
*****
Offline Offline

Activity: 560
Merit: 506


I prefer Zakir over Muhammed when mentioning me!


View Profile WWW
March 06, 2015, 02:58:55 PM
 #4

I make the hypothesis that you're talking about P2SH addresses (starting with a 3)*

Yes, I am.

Unfortunately, the scriptpubkey (script stored in the unspent output) of a P2SH can't be used to retrieve the M & N values.
The scriptpubkey contains a hash of the redeem script (the multisig script) and this hash can't be reversed and interpreted.
The redeem script will be provided in clear in the scriptsig when the utxo is spent. But that may be too late...

It's okay! Can you tell me how to find M & N values after UTXO is spent?

Providing a proof that a P2SH is legit is a good feature which should be proposed by all multisig online wallets.
It just requires you have access to the redeem script and the hash before sending funds to the P2SH address.

Hard part. It can be faked.

*: old multisig scripts don't have this "problem" since the multisig script can be found in clear in the scriptpubkey. 

I didn't there was two different multisig. Can you please give more info about the multisig you are talking about? Thank you!

   -MZ

FabioCarpi
Sr. Member
****
Offline Offline

Activity: 375
Merit: 254



View Profile
March 06, 2015, 03:07:33 PM
Last edit: March 08, 2015, 10:23:22 AM by FabioCarpi
 #5

the redeem script format:

the byte 50 + required Keys
pubkey1 count
pubkey1
(...)
byte 50 + pubkey count
byte ae

example (2 of 3)
52 21 035b641b667aded965c2f7c2be17c736e6d960e3316a5c2d46ccacf6ff9fa87edd 21 02b94370211403cac9378dfbc414df44842523e120e5301d3d593a370cf6b9fb38 21 0260b26aa4d0e921f322bcad0f04c1bcd475a70e4553f3bda007eb1534081ead46 53 ae
Muhammed Zakir (OP)
Hero Member
*****
Offline Offline

Activity: 560
Merit: 506


I prefer Zakir over Muhammed when mentioning me!


View Profile WWW
March 06, 2015, 03:14:13 PM
 #6

the redeem script format:

the byte 50 + required Keys
pubkey1 count
pubkey1
(...)
byte 50 + pubkey count
byte ae

example (2 of 3)
52 33 035b641b667aded965c2f7c2be17c736e6d960e3316a5c2d46ccacf6ff9fa87edd 33 02b94370211403cac9378dfbc414df44842523e120e5301d3d593a370cf6b9fb38 33 0260b26aa4d0e921f322bcad0f04c1bcd475a70e4553f3bda007eb1534081ead46 53 ae

Thanks! How did you know that is 2-of-3 and not 1-of-3 or 3-of-3? Thank you and sorry for my stupid questions.

   -MZ

laurentmt
Sr. Member
****
Offline Offline

Activity: 384
Merit: 258


View Profile
March 06, 2015, 03:16:25 PM
 #7

A few useful resources on the subject:
- Bip16 : easy to read and contains everything required to understand P2SH.
- the wiki page about scripts.
- webbtc explorer which has a very useful script debugger (here's a page with P2SH multisig examples)

WRT to old multisig scripts: Basically they have the same structure as P2SH multisig redeem script ("2 pubkey1 pubkey2 2 OP_CHECKMULTISIG" for a 2of2 multisig) but the script is used directly in the scriptpubkey.


FabioCarpi
Sr. Member
****
Offline Offline

Activity: 375
Merit: 254



View Profile
March 06, 2015, 03:18:39 PM
 #8

the first byte, 52, is the M (52-50=2) and the second last byte, 53, is tne N (53-50=3)
DeathAndTaxes
Donator
Legendary
*
Offline Offline

Activity: 1218
Merit: 1079


Gerald Davis


View Profile
March 06, 2015, 07:04:16 PM
Last edit: March 07, 2015, 07:07:07 AM by DeathAndTaxes
 #9

Providing a proof that a P2SH is legit is a good feature which should be proposed by all multisig online wallets.
It just requires you have access to the redeem script and the hash before sending funds to the P2SH address.

Hard part. It can be faked.
Fakes can be trivially detected.   If you need to authenticate the script you should hash the redeemScript provided and compare it to the ScriptHash decoded from the P2SH address you were given.
Muhammed Zakir (OP)
Hero Member
*****
Offline Offline

Activity: 560
Merit: 506


I prefer Zakir over Muhammed when mentioning me!


View Profile WWW
March 07, 2015, 07:06:15 AM
 #10

Thanks all! It helped me!

/thread

   -MZ

FabioCarpi
Sr. Member
****
Offline Offline

Activity: 375
Merit: 254



View Profile
March 08, 2015, 10:22:51 AM
 #11

the redeem script format:

the byte 50 + required Keys
pubkey1 count
pubkey1
(...)
byte 50 + pubkey count
byte ae

example (2 of 3)
52 33 035b641b667aded965c2f7c2be17c736e6d960e3316a5c2d46ccacf6ff9fa87edd 33 02b94370211403cac9378dfbc414df44842523e120e5301d3d593a370cf6b9fb38 33 0260b26aa4d0e921f322bcad0f04c1bcd475a70e4553f3bda007eb1534081ead46 53 ae

i made a mistake
the pubkey count is in hex
so is 21, not 33

52 21 035b641b667aded965c2f7c2be17c736e6d960e3316a5c2d46ccacf6ff9fa87edd 21 02b94370211403cac9378dfbc414df44842523e120e5301d3d593a370cf6b9fb38 21 0260b26aa4d0e921f322bcad0f04c1bcd475a70e4553f3bda007eb1534081ead46 53 ae
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!