Bitcoin Forum
April 25, 2024, 06:07:00 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: How to do MuSig verify ?  (Read 86 times)
mamuu (OP)
Member
**
Offline Offline

Activity: 71
Merit: 19


View Profile
November 09, 2020, 03:31:18 AM
Merited by AB de Royse777 (5), Husna QA (1)
 #1

I was very curious about your mathematics. How MuSig works. How to works hash () funciton M in signatures. Could you share it over a sample signature? I looked at the examples but did not understand. I think I'm learning by applying. Thank you


example transaction

https://www.blockchain.com/btc/tx/0b6b75af54df2311ab718779e06968e3b5d2f53224ffc64282e81116e17094e6


we have

G = EC Generator Point

r1 = 0x17beb671b4a2e7688fc357b7ade7f72bf24eff073bb42950d0fc23c6a7f2af63
s1 = 0x31741ae73667b21ea0229cb8950b9d950d248c26cef0f4871506ff1c47b6e0b9
r2 = 0x71f1950fc6dfa95d4466164e6a8ed7bded41f723733a9799e4e371a868fd3c78
s2 = 0x010820bfbaf0591116076799ba7d30c7e6cd5fa02090de0deb6926a4f7f49e47


P1 = 0325937706eb4d50c16fc2f0ab3ee0b53e1513ebf14e0509bc5b4b09abd395c90a
P2 = 022a1f8e2169dfc64655fa0657537e70d32c584013dd2b8da9a53ab2d260c79ad3
P3 = 02cfc77d383647a00703250f53339bfc2885668daeee3f6c0d34d9f1b2f7a740ab




1DWA3Sa8i6eHVWV4AG4UP2SBhYB2XrfiHW
1714025220
Hero Member
*
Offline Offline

Posts: 1714025220

View Profile Personal Message (Offline)

Ignore
1714025220
Reply with quote  #2

1714025220
Report to moderator
1714025220
Hero Member
*
Offline Offline

Posts: 1714025220

View Profile Personal Message (Offline)

Ignore
1714025220
Reply with quote  #2

1714025220
Report to moderator
You can see the statistics of your reports to moderators on the "Report to moderator" pages.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1714025220
Hero Member
*
Offline Offline

Posts: 1714025220

View Profile Personal Message (Offline)

Ignore
1714025220
Reply with quote  #2

1714025220
Report to moderator
achow101
Moderator
Legendary
*
expert
Offline Offline

Activity: 3374
Merit: 6535


Just writing some code


View Profile WWW
November 09, 2020, 03:53:09 AM
 #2

Do you mean multisig? MuSig is a particular scheme that uses Schnorr signatures and is not available in Bitcoin. The transaction that you refer to is a standard Bitcoin multisig, not MuSig.



Multisigs are verified as normal ecdsa signatures. There are multiple signatures and each one verifies with one of the pubkeys in the multisig. Verification is just normal ECDSA.

mamuu (OP)
Member
**
Offline Offline

Activity: 71
Merit: 19


View Profile
November 09, 2020, 05:33:05 AM
 #3

Do you mean multisig? MuSig is a particular scheme that uses Schnorr signatures and is not available in Bitcoin. The transaction that you refer to is a standard Bitcoin multisig, not MuSig.



Multisigs are verified as normal ecdsa signatures. There are multiple signatures and each one verifies with one of the pubkeys in the multisig. Verification is just normal ECDSA.

I can see pubkey (EllipticCurve Point) belonging to the bitcoin address in standard signatures. but I could not see it in the signature.

actually i was wondering, this is 3LpvrH24YmEAmJ1MUfawDu6pPsm14r2FtV address pubkey

thanks achow101

1DWA3Sa8i6eHVWV4AG4UP2SBhYB2XrfiHW
achow101
Moderator
Legendary
*
expert
Offline Offline

Activity: 3374
Merit: 6535


Just writing some code


View Profile WWW
November 09, 2020, 06:11:14 AM
Merited by AB de Royse777 (5), ABCbits (3), nc50lc (1), Husna QA (1), Heisenberg_Hunter (1), mamuu (1)
 #4

I can see pubkey (EllipticCurve Point) belonging to the bitcoin address in standard signatures. but I could not see it in the signature.
Public keys are not part of the signature. They are found alongside signatures, but can be specified in many different ways in Bitcoin that are not directly next to signatures.

actually i was wondering, this is 3LpvrH24YmEAmJ1MUfawDu6pPsm14r2FtV address pubkey
No. This is a P2SH address. It encodes the hash of a script. This script can specify many things, including pubkeys for a signature.

The P2SH address corresponds to the scriptPubKey (output script) OP_HASH160 d1e97b7dbe9a6579c88b529561643e1361c4ed13 OP_EQUAL. This specifies that the scriptSig (input script) must push to the stack a script whose hash160 is d1e97b7dbe9a6579c88b529561643e1361c4ed13. For this address, that script is 0020af6ec7b21e884eda9630f95a8d4c30b9f25e3286f62f666e61d4e8226c4bda50.

This script is  P2WSH script which means that it specifies another script. If we decode the opcodes, it is OP_0 af6ec7b21e884eda9630f95a8d4c30b9f25e3286f62f666e61d4e8226c4bda50. This indicates that the top stack item of the scriptWitness must have a sha256 of af6ec7b21e884eda9630f95a8d4c30b9f25e3286f62f666e61d4e8226c4bda50.

That script is 52210325937706eb4d50c16fc2f0ab3ee0b53e1513ebf14e0509bc5b4b09abd395c90a21022a1f8 e2169dfc64655fa0657537e70d32c584013dd2b8da9a53ab2d260c79ad32102cfc77d383647a007 03250f53339bfc2885668daeee3f6c0d34d9f1b2f7a740ab53ae. This can be decoded to OP_P2 0325937706eb4d50c16fc2f0ab3ee0b53e1513ebf14e0509bc5b4b09abd395c90a 022a1f8e2169dfc64655fa0657537e70d32c584013dd2b8da9a53ab2d260c79ad3 02cfc77d383647a00703250f53339bfc2885668daeee3f6c0d34d9f1b2f7a740ab OP_3 OP_CHECKMULTISIG. This is the mlutisig script. The public keys are found in this script. The remaining items in the scriptWitness are the signatures.

The signatures, in order, are 3044022071f1950fc6dfa95d4466164e6a8ed7bded41f723733a9799e4e371a868fd3c780220010 820bfbaf0591116076799ba7d30c7e6cd5fa02090de0deb6926a4f7f49e4701 and 3044022017beb671b4a2e7688fc357b7ade7f72bf24eff073bb42950d0fc23c6a7f2af630220317 41ae73667b21ea0229cb8950b9d950d248c26cef0f4871506ff1c47b6e0b901.

When this input is being verified, first the hash of the script in the scriptSig is checked. Then the hash of the script in the scriptWitness is checked. Then the signatures are verified. Since the pubkeys are not directly next to the signatures, the script interpreter does a bit of guessing to figure verify them.

The script interpreter will try the first signature with the first pubkey. If this fails, it then tries the next pubkey, and so on until either no pubkeys remain, or the signature verifies. Once the signature verifies, it goes to the next signature and tries the next pubkey. For example, it will try sig 1 with pubkey 1, and suppose this fails. Then it will try sig 1 with pubkey 2, and suppose this passes. Then it will try sig 2 with pubkey 3. If there were a pubkey 4, and verifying with pubkey 3 failed, then it would move to pubkey 4. But because there are only 3 pubkeys, if pubkey 3 failed, then the whole script fails.

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!