Bitcoin Forum
December 29, 2025, 02:53:20 PM *
News: Latest Bitcoin Core release: 30.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Question about BIP: 387  (Read 97 times)
angelo1oc (OP)
Newbie
*
Offline Offline

Activity: 21
Merit: 12


View Profile
April 04, 2025, 02:57:11 PM
Merited by NotATether (5), ABCbits (2)
 #1

On this BIP, there are 2 ways of creating threshold signatures, depending on the number of “k” (minimum signatures for approval)


Code:
The output script produced also depends on the value of k. If k is less than or equal to 16:
KEY_1 OP_CHECKSIG KEY_2 OP_CHECKSIGADD ... KEY_n OP_CHECKSIGADD OP_k OP_NUMEQUAL
if k is greater than 16:
KEY_1 OP_CHECKSIG KEY_2 OP_CHECKSIGADD ... KEY_n OP_CHECKSIGADD k OP_NUMEQUAL


Let’s say that K=16, then we use “OP_16” which is equal to 0x60
If K=17 what number should we use? Is it 0x61=97 or 0x11=17?
Because k is 17

Thanks
angelo
pooya87
Legendary
*
Offline Offline

Activity: 4046
Merit: 12115



View Profile
April 04, 2025, 04:50:25 PM
Merited by NeuroticFish (4), ABCbits (3), Cricktor (1)
 #2

Let’s say that K=16, then we use “OP_16” which is equal to 0x60
If K=17 what number should we use? Is it 0x61=97 or 0x11=17?
Because k is 17
https://github.com/bitcoin/bitcoin/pull/24043/files#diff-a1732fc4dc1526b294a41db3f2d3d5e863ec76e68ee3f73449618551f7a469ebR101

If I understood the code correctly, the limit on number of pubkeys will be increased to 999 and in order to push bigger numbers, we'd do it like any other time but with "minimal push" enforced. Meaning for 0 to 16 the equivalent OP codes will be used (OP_0 to OP_16) and any other number will be pushed in its shortest way possible so 17 will be 0x0111 (0x01 is telling the interpreter to push 1 byte to the stack and then 0x11 is on the stack which is equal to 17) and 999 will be 0x02e703 (note the little endian order of 999).

BTW 0x61 is OP_NOP and can't be used.

███████████████████████████
███████▄████████████▄██████
████████▄████████▄████████
███▀█████▀▄███▄▀█████▀███
█████▀█▀▄██▀▀▀██▄▀█▀█████
███████▄███████████▄███████
███████████████████████████
███████▀███████████▀███████
████▄██▄▀██▄▄▄██▀▄██▄████
████▄████▄▀███▀▄████▄████
██▄███▀▀█▀██████▀█▀███▄███
██▀█▀████████████████▀█▀███
███████████████████████████
.
.Duelbits PREDICT..
█████████████████████████
█████████████████████████
███████████▀▀░░░░▀▀██████
██████████░░▄████▄░░████
█████████░░████████░░████
█████████░░████████░░████
█████████▄▀██████▀▄████
████████▀▀░░░▀▀▀▀░░▄█████
██████▀░░░░██▄▄▄▄████████
████▀░░░░▄███████████████
█████▄▄█████████████████
█████████████████████████
█████████████████████████
.
.WHERE EVERYTHING IS A MARKET..
█████
██
██







██
██
██████
Will Bitcoin hit $200,000
before January 1st 2027?

    No @1.15         Yes @6.00    
█████
██
██







██
██
██████

  CHECK MORE > 
angelo1oc (OP)
Newbie
*
Offline Offline

Activity: 21
Merit: 12


View Profile
April 07, 2025, 07:26:29 PM
 #3

Thanks
angelo
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!