Author

Topic: Stack size (Read 177 times)

legendary
Activity: 3192
Merit: 2248
Top-tier crypto casino and sportsbook
August 16, 2018, 05:09:03 AM
#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
sr. member
Activity: 770
Merit: 305
August 15, 2018, 01: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
newbie
Activity: 2
Merit: 0
August 15, 2018, 10:58:09 AM
#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?
legendary
Activity: 1624
Merit: 2509
August 15, 2018, 10:01:04 AM
#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 ?
newbie
Activity: 2
Merit: 0
August 15, 2018, 09:52:48 AM
#1
What is the stack size in Bitcoin Script?
Jump to: