An Asset Storage HTLC in TEAL : Request for Review

Dear All,

I have written an Asset Configuration and Asset Freeze Contract using the reference TEAL template for HTLC Contract. Could you please review this TEAL contract and advise me how can I do Asset Registration, Asset Ownership in this contract ?

1 Like

Can you describe how you want the contract to work? You can group a transaction from the contract with a option into an asset and then interrogate both transactions using gtxn object to get any of the two transactions fields: https://developer.algorand.org/docs/reference/teal/opcodes/#txn

1 Like

@gokulalex I’m not sure what you are intending the contract account to perform, so the following may not be what you are looking for.

Here is an example Hash Time Lock Contract (HTLC) for Algorand Standard Assets (ASA). It assumes 1) the ASA is already created on the network 2) the ASA can be sent to the escrow contract and 3) the ASA may be redeemed by the preimage or after timeout. The novel bit is the TEAL code provides a method to approve an opt-in transaction for a specific ASA, thus allowing the escrow contract to hold it.

1 Like

Thank you so much @JasonW this is a great input. I will work further on defining the activities on the asset using the grouping functionality of gtxn object and run queries on the transaction fields.

This is simply awesome reference code @ryanRfox! Thanks a ton. Please let me deep dive on this further. At the outset, I have an idea to use BLS signatures instead of Hash Pre-images. Is it possible on Algorand currently with TEAL?

Thank you for the kind words on the code sample. Currently, TEAL only supports the ed25519 signature using ed25519verify OpCode. You may review the following articles about its usage:

Algorand is contributing to the development and standardization of the BLS specification:

1 Like

Interesting, though I’m not a developer, I’m still gonna look through further to try understanding.