Avoiding Double Spend in Transactions

Hi everyone, I have a question here. I’m trying to avoid double spend in my transactions specifically into keyreg, assetTransfer and payment txns.

I’ve red in transaction reference in algorand documentation that lease can be useful on this situation. As a common field I’m expecting to set and pass it when I create each transaction.

Unfortunately I can’t do this. The problem is that these methods that return my Transaction objects are not getting lease as params:

  • makeKeyRegistrationTxnWithSuggestedParams (here)
  • makePaymentTxnWithSuggestedParams(at the same folder)
  • makeAssetTransferTxnWithSuggestedParams (at the same folder)

Also I checked out that there is a suggestedParams but this implements an algosdk interface (here) which neither implements lease.

So my question is , is that right ? Is that well implemented or should I recommend to algoSDK team to add it ?

Thanks in advance !

Here is the lease reference in algo documentation

You can add the least to any transaction using: js-algorand-sdk/transaction.ts at 9e2997006d0e237641710e2ae1849c535f4b1b58 · algorand/js-algorand-sdk · GitHub

Leases are mostly useful with stateless smart contracts.

If you sign a transaction using a secret key, it cannot be double spent, as the same transaction cannot be committed twice to the blockchain.

1 Like

Thank you this solved my issue! :ok_hand: