Algorand Smart Contract Stack limits

I have been working on writing smart contracts using pyteal since a month now. The docs state that the stack depth is limited to 1000 and a byte array element is limited to 4096 bytes. Can someone please clarify what the byte array element limit of 4096 byte means? Does it mean one byte array can be upto 4096 bytes, or that the total number of byte array elements should not exceed 4096 bytes?

PS: I would have to work with data from boxes as big as 32KB.

It means that any byte array can be up to 4096 bytes.

But you can have many byte arrays.

To work with boxes larger than 4096 bytes, you need to use box_extract and box_replace instead of box_get and box_put.
The former indeed allows to work on part of the box instead of the whole box.

1 Like