blockchainalgorand

Can I automatically opt in a user with LogicSig? (Algorand)


I am trying to execute a group with an asset create in the beginning and automatically opt-in a user.

I was hoping I could do it with a LogicSig but couldn't find a way to reference the created asset id. I tried to make simple application with GeneratedID which I call and issue an inner transaction to opt them in referencing that GeneratedID. But it seems like it will only work if I actually rekey their account - it says unauthorized.

I think I can use my LogicSig but it will need to wait 5-8 seconds because I can't get the created asset id before that, and so the creation won't be in the group. Unless there is another way to issue transactions in a group that reference an asset creation in the first transaction (without using an app).

Anyone have any ideas?


Solution

  • Currently, I think the only way to do it would be for the user to rekey to the smart contract, which opts in to the newly created asset on their behalf whilst also rekeying back to them.

    Unless a new way is introduced in the future, where a user can sign a transaction for an unknown asset ID in the same group, it's not really possible without two separate transactions after the first is confirmed.