Stateless logic with grouped transactions - Algorand

Stateless logic with grouped transactions

Post by hernandp on Nov 24, 2021

I’m using a stateless logic program to verify a set of signatures for a group of app call transactions, so each app call TX0,TX1,…TXn will be checked by a stateless program that works in tandem.

I’m having difficulties crafting the group transaction to work in this manner.

What I’m doing is:


goal app call --app-id $1 --from "$STATELESS_ADDR" --app-arg "str:verify" --app-arg "b64:$GK064" --app-arg "int:19" --noteb64 "$VAABODY64" -o verify0.txn
goal app call --app-id $1 --from "$STATELESS_ADDR" --app-arg "str:verify" --app-arg "b64:$GK164" --app-arg "int:19" --noteb64 "$VAABODY64" -o verify1.txn
goal app call --app-id $1 --from "$STATELESS_ADDR" --app-arg "str:verify" --app-arg "b64:$GK264" --app-arg "int:19" --noteb64 "$VAABODY64" -o verify2.txn
goal app call --app-id $1 --from "$STATELESS_ADDR" --app-arg "str:verify" --app-arg "b64:$GK364" --app-arg "int:19" --noteb64 "$VAABODY64" -o verify3.txn

cat verify0.txn verify1.txn verify2.txn verify3.txn > verifycc.txn
goal clerk group -i verifycc.txn -o group.txn
goal clerk split -i group.txn -o verify-signed

goal clerk sign --program vaa-verify.teal --argb64 "$SIGNATURES064" --infile verify-signed-0 --outfile  verify-signed-0
goal clerk sign --program vaa-verify.teal --argb64 "$SIGNATURES164" --infile verify-signed-1 --outfile verify-signed-1
goal clerk sign --program vaa-verify.teal --argb64 "$SIGNATURES264" --infile verify-signed-2 --outfile  verify-signed-2 -
goal clerk sign --program vaa-verify.teal --argb64 "$SIGNATURES364" --infile verify-signed-3 --outfile verify-signed-3
cat verify-signed-0 verify-signed-1 verify-signed-2 verify-signed-3 > verifygroup.stxn

According to my information at hand, the logicSig can be used like this (unsigned) but if I sign the final group transaction with a standard account, goal yells me with “must be authorized by X” (X being the stateless logic).

Any tip of doing this in the right manner?

Thank you


Post by fabrice on Nov 24, 2021

Why do you want to “sign the final group transaction”?

Logicsigs replace a normal signature. You should either sign a transaction using a logicsig OR using a normal signature (OR using a multisig).

And you cannot “sign a group of transaction”: you can only sign each transaction independently.


Post by hernandp on Nov 24, 2021

Got it Fabrice, got confused in my head after a lot of work. Thank you very much, I successfully did it.