How about automatic payments on a schedule?

Suppose we have a utility – water, electricity, phone, gas, ISP, whatever – or perhaps a charity. And we want customers (or donors, in the case of a charity) to be able to set up scheduled payments (certainly common enough; my ISP bill works that way, dinging my debit card once a month; my dad has something similar with DirecTV). How would that work with Algorand? (Obviously having the customers share enough information to allow impersonation would be an insanely stupid way to accomplish this; they’d be begging for identity theft!)

Perhaps something with a Smart Contract? Or with a wallet? Or is there something else to support scheduled pre-authorized payments?

You could have the utility get them to sign a smart signature which then allows the utility to submit a transaction on their behalf. The logic in the smart signature would check the amount, fee, and use a lease and a few other things. That is what smart signatures are used for, ie delegation.

Interesting.

So a Smart Signature is a type of Smart Contract, and all Smart Contracts are written in TEAL.

I haven’t looked very deeply into this yet, but what I see about recurring payments seems to be based on “rounds,” rather than on the passage of a specified amount of time. Wouldn’t that result in erratic scheduling? Or do I not yet understand the concept of a “round”?

Smart Signatures are written in TEAL or Python (using Pyteal) just like smart contracts but they are evaluated when they are submitted. Smart contracts “live” on the blockchain. Rounds happen approx every 4.5 seconds. Smart contracts can get the time of the last round but smart signatures don’t yet have this capability (hopefully soon). You may want to take a look at the getting started guide for dapps here: What is a dApp? - Algorand Developer Portal

1 Like

I’m now studying the “Alice’s Auction” case study, in order to try and wrap my mind around smart contracts, and I’m puzzled by a statement in the " Deploy and communicate with the smart contract" section:

 approval, clear = getContracts(client)

I was able to find information on the “tuple assignment” syntax, but I don’t see “getContracts” defined anywhere (and a Google search on “getContracts algorand” just finds pages about gig employment). So where is this “getContracts” function defined, and what does it return, that it can be on the right side of a Python tuple assignment?

Link to the full source code is usually provided at the bottom of all documentation pages.

1 Like

Thanks.
Even the nice folks at the Midrange Lists aren’t usually this patient with me (and those at some of the StackExchange forums certainly aren’t!)

Now looking at the Reach version. Am I to understand that the Reach version completely supplants not only the Python code in the Python version, but also the TEAL code generated by the PyTeal calls in the Python version?

Also, once a smart contract is up and active, how does one use it? In the “Alice’s Auction” scenario, would bidders bid through a web site? A wallet? Something else?

At the end of the day the code will be TEAL.
You have two ways to produce TEAL code:

  1. using PyTEAL
  2. using Reach

It is one or the other.
Yes, the Reach code supplants the PyTEAL code.

https://developer.algorand.org/docs/get-started/dapps/pyteal/#deploy-and-communicate-with-the-smart-contract explains how to do it by writing a Python script.

But yes, in practice, you want to add a web UI on top of that.
Most simple dApps actually write the above directly in JS (+HTML/CSS).
More complex dApps may use a backend in whatever they want (e.g., Python like the scripts above) and a frontend in HTML/JS/CSS.