Goal: use a logic program as appcall sender - Algorand

Goal: use a logic program as appcall sender

post by hernandp on Nov 17, 2021

I would like to use goal to do an app call but use a stateless logic program as sender to trigger some checks. I know there is a --from-program argument in the goal clerk send but not in goal app call or goal clerk rawsend command forms.

How I can do this in goal, if it’s possible? Thanks.

post by fabrice on Nov 17, 2021

You can always do it in two steps:


goal clerk send ... --out transaction.tx --from ADDRESS_OF_SMART_SIGNATURE
goal clerk sign --program ... --infile transaction.tx --outfile transaction.sig

post by hernandp on Nov 17, 2021

Yes, for standard ALGO transactions it would work.

But I would like to do something like


goal app call ... --from-program ADDRESS_OF_SMARTSIGNATURE --argb64 "argument" -o appcall.tx
algokey -t appcall.tx -o appcall.stxn sign  -m "$OWNER_MNEMO"
goal clerk rawsend -f appcall.stxn

Or maybe I misunderstood your example

post by fabrice on Nov 17, 2021

The following should work:


goal app call ... --from ADDRESS_OF_SMARTSIGNATURE -o appcall.txn
goal clerk sign --program ...  --argb64 "argument" --infile appcall.txn --outfile appcall.stxn
goal clerk rawsend -f appcall.stxn

(Edited to fix the code according to @hernandp comment)

post by hernandp on Nov 17, 2021

Fabrice thanks, but --argb64 is not a valid argument for goal app call.

post by fabrice on Nov 17, 2021

Oups, indeed. Code fixed above.

And actually I realized I left algokey sign, that you don’t need if you sign using a program.

post by hernandp on Nov 17, 2021

Challenging question: it is possible to issue a dryrun dump with a transaction signed by a stateless program like the above?

post by fabrice on Nov 17, 2021

I don’t think there is an issue.

post by hernandp on Nov 22, 2021

Sorry for reviving this thread, I’m trying to do a dryrun dump for an app-call that must pass a stateless logic check first,

#!/bin/bash
source setvars.sh
export SIGNATURES64=`node -e "console.log(Buffer.from('$2','hex').toString('base64'))"
export VAABODY=$3
export VAABODY64=`node -e "console.log(Buffer.from('$VAABODY',  'hex').toString('base64'))"
rm verify.txn verify.stxn
goal app call --app-id $1 --from "$STATELESS_ADDR" --app-arg "str:verify" --app-arg "b64:$GKEYSBASE64" --app-arg "int:3" --noteb64 "$VAABODY64" -o verify.txn
goal clerk sign --program vaa-verify.teal --argb64 "$SIGNATURES64" --infile verify.txn --outfile verify.stxn
goal clerk dryrun -t verify.stxn

The dryrun passes OK but only checks for the stateless logic, how I can run a dryrun for the app-call after the stateless check?

Do I need dryrun-remote instead of offline?

post by fabrice on Nov 22, 2021

Yes, you need dryrun-remote.

See Make goal clerk dryrun directly work with application calls · Issue #1653 · algorand/go-algorand · GitHub