Boxes in Inner Transactions

I am trying the new feature “Boxes” that it could really benefit our project.
But I am struggling with something:
I am unable to find in the PyTeal or teal how do you send a box reference in an inner transaction.

Is there any docs of how can this be achieved?

Thank you!

Boxes use the outer tx group for the references. IE you can change whats already available inside an inner tx.

Hi. Thanks for the answer.
Is there any plan to change that and allow to send the boxes field in an inner tx like the rest of the arrays (assets, accounts, applications) ?

I’ll describe the use case just in case it helps to understand why I am asking this.

Right now, I have a contract, that creates an asset and another contract with two Inner TXs, so the whole process is atomic and in a single outer tx.
I want to do the same with boxes, but I am unable to send the box name (in this case the assetId) in an inner tx.

Thanks

I understand the use case. Right now you can set 8 box names per outer tx that can be used by the inner tx as well. That said if you are creating the asset in the first call and want to use that with the inner as the box name that is currently not possible as you won’t know beforehand what the id is. I don’t think there are any plans to change that behavior. This limitation is in place to maintain performance.

I understand, is there any way the max amount of boxes be validated in a group but allow to add them in an Inner Tx?
That way the max amount of boxes will be the same, the performance should not suffer, but will allow more flexibility for the boxes.

I think it’s very useful for implementations of ARC-20 and ARC-18.

We could use 2 separate transactions, but we lose one of the best (IMHO) features of Algorand, the atomic transactions.

Thanks again!

To my knowledge, the main reason boxes are specified in the outer transaction is to allow nodes to pre-fetch their values ahead of time. Fetching data from the state of the blockchain / account table (which is concretely a sqlite DB) is an expensive operation (compared to executing instructions of the smart contract). If it needs to be done at block construction would slow down block construction and the blockchain.