Bitcoin Forum
June 14, 2024, 08:07:30 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Stack size  (Read 172 times)
alkurbatov97 (OP)
Newbie
*
Offline Offline

Activity: 2
Merit: 0


View Profile
August 15, 2018, 02:52:48 PM
 #1

What is the stack size in Bitcoin Script?
bob123
Legendary
*
Offline Offline

Activity: 1624
Merit: 2481



View Profile WWW
August 15, 2018, 03:01:04 PM
Merited by ABCbits (1), AdolfinWolf (1)
 #2

That's a weird question with no clear answer.
Do you get an error when signing a transaction (e.g. 'operation not valid with the current stack size'), or why are you asking this question ?

If you somehow encounter an error and want to get a detailed helpful reply, you should include every necessary information into your post.


In case of you getting 'operation not valid with the current stack size' when signing a transaction with core, you are somehow either missing private keys to sign the TX or the script verification failed for any other reason.
Are you trying to sign a multisig tx ?

alkurbatov97 (OP)
Newbie
*
Offline Offline

Activity: 2
Merit: 0


View Profile
August 15, 2018, 03:58:09 PM
 #3

Hi
Thank you for comment.
Just I read in one source that the stack size when using Bitcoin Script is limited to 16 values.
Is it so?
amaclin1
Sr. Member
****
Offline Offline

Activity: 784
Merit: 305


View Profile
August 15, 2018, 06:00:45 PM
 #4

Hi
Thank you for comment.
Just I read in one source that the stack size when using Bitcoin Script is limited to 16 values.
Is it so?

No, this is definetely wrong

Bitcoin SV GUI client for Windows and Linux
https://github.com/AlisterMaclin/bitcoin-sv/releases
HeRetiK
Legendary
*
Offline Offline

Activity: 2968
Merit: 2103



View Profile
August 16, 2018, 10:09:03 AM
Merited by ABCbits (1)
 #5

The maximum stack size for a Bitcoin script to be still considered valid is 1000:

Code:
// Maximum number of values on script interpreter stack
static const int MAX_STACK_SIZE = 1000;


Depending on your script you are more likely to run into the maximum script size in bytes though:

Code:
// Maximum script length in bytes
static const int MAX_SCRIPT_SIZE = 10000;


For reference:

https://github.com/bitcoin/bitcoin/blob/78dae8caccd82cfbfd76557f1fb7d7557c7b5edb/src/script/script.h

https://github.com/bitcoin/bitcoin/blob/78dae8caccd82cfbfd76557f1fb7d7557c7b5edb/src/script/interpreter.cpp
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!