Atomic Transfers question - is it possible to make it so that everyone only needs to sign once when they submit?

I’m thinking of building this game on Algorand using atomic transfers:

  • There’s an escrow account that has a secret password that guards the funds. If someone can solve the account’s respective puzzle, they can find the solution that is the password that unlocks the funds.
  • Anyone can raise the stakes by sending algos to the escrow fund to increase the prize pool. Once the puzzle is solved, all of these transactions are approved and the prize pool is released to the winner.
  • But if the puzzle is not solved by a specific date/time, then everyone gets their money back.

Is this possible to do with atomic transfers? Looking at the docs, it sounds like all of the people who submit transactions submit them unsigned and then need to actively sign the group of transactions when it’s ready to be submitted, but for this to work, people would need to be able to sign transactions ahead of time and then know that they will automatically be approved or denied when the escrow account smart contract executes and passes without having to each sign the group of transactions when it’s ready to be approved.

Hi,

I don’t see how to use atomic transfers alone for that purpose, as atomic transfers can be seen as group of transactions that execute all at once.

However, you should be able to do it by combining Group transactions / Atomic transfers, ASC, and ASA (Algorand Smart Asset).
The idea is the following:

  1. The creator of the escrow account also creates an asset, called PUZZLE. There are as many PUZZLE as Algos in the world. At the beginning, all the PUZZLE belong to the escrow account.
  2. When you deposit x Algos to the escrow account, you get back a x PUZZLE. (You can do it using Atomic Transfers / Group transactions and ASC, as TEAL scripts can check all the transactions in a group of transactions - so a deposit must now be a group of two transactions: x Algos to the escrow account, and x PUZZLE back to the sender)
  3. After some round, the TEAL script of the escrow account allows to exchange back PUZZLE for Algos. (The mechanism is exactly the same as for 2., except in the other direction and allowed only starting from some round.)

Disclaimer: I have not checked all the details, and there might be issues with this idea.