Replies - Activity - pheathwa - Algorand

Protecting Funds in Smart Signature Contract Accounts

Ok great, so just to clarify, everything pretty much stays the same except for how the keypairs get generated, i.e. no need to use nacltweet directly, just use the equivalent algorand account functionality, which includes wrappers to nacltweet. So, the current approach seems OK, the above is more o…


I believe I am already doing this one " You can also have the smart signature takes as input a signature of the recipient address, signed under a public key stored in the contract." - see code section below. The contract is setup such that the secret key is known only to the recipient, which is use…


Thanks for these insights - not what I expected, and very edge case, but obviously needs to be respected. My scenario involves only knowing who the receiver is AFTER funds are already in the contract account. So, in an attempt to wrap this up, please clarify whether following is an accurate statem…


Really appreciate you leaning into this. To unpack this a bit … The TEAL is written to distribute all funds to the recipient (and close out the account) when the recipient submits the transaction using the correct secret key (signature). So, in order to break this, the attacker would have to obser…


Ed25519verify_bare Implementation

Yes - that appears to be it. The TEAL is unchanged, but it worked after replacing:

const signature = nacl.sign.detached(Buffer.from(recipientAddress), secretKeyBytes);

with:

const signature = nacl.sign.detached( algosdk.decodeAddress(recipientAddress).publicKey, secretKeyBytes);

So, the lesson i…


WalletConnect + Atomic Transactions + logicsig

It seems Walletconnect returns an empty array entry for those that were submitted with signers: . With the additional check bolded below, this all seems to work, including having logicsigs with user-signed sigs in an atomic transaction - pretty cool.

// signedTxns contains empty rows where any sub…


What do you like and dislike about developing on Algorand? Give our Product & Engineering team your feedback!

Cloud sandbox with screens to “goal-lessly” inspect and manipulate accounts, debug teal, all to speed iteration. I’ve been thinking about writing an article on all the techniques required to do an end-to-end solution, such as (1) integration with wallets (2) integration with AWS lambda (3) serializ…


Conditional callsubs or retsubs

Super helpful - following is my abbreviated working example. Thank you!

callsub handle_sub1
handle_sub1:
load 2
pushint 0
<=
bnz handle_retsub // Early return
// Do other stuff here
retsub // Normal return
handle_retsub:
retsub

Asset Optin Teal Code

I got it working as below. I re-read the docs and the reminder (for me) was that for Inner Transactions, the Sender defaults to the Application (Smart Contract) itself. But, when trying to use the AssetSender explicitly, it thinks it is a clawback. So, the below facilitates the Application Optin to …