PyTeal Contracts Compiled to Teal and used with Javascript SDK

I am very confused on the entire process on using an Algorand smart contract with javascript.

As I understand I must first (if I want to use Python):

  1. Write the program in PyTeal.
  2. Use PyTeal to compile the program to TEAL.
  3. Use the TEAL code in my javascript sdk to deploy and interact with the program

Is this the correct process? I can’t seem to find any documentation that shows how this is done.

Does anyone have any examples of this I can look at?

Hi @elijahhampton

You are correct. Since PyTeal is just a Python language binding for TEAL, the first compiling step (PyTeal -> TEAL) will create a TEAL artefact that can be compiled (TEAL -> bytecode) for the AVM and deployed on-chain.

Since the bytecode is generated by a node, you can use any SDK (or even the goal CLI) to compile the TEAL source code.

Then you can just use any SDK to built the interaction you need, such as: creating application call transactions, grouping transactions, signing transactions, submitting transactions to the network and so on.

All you need is just a valid node API end-point and node API token synced with the network you want to interact with (could be the MainNet, TestNet, BetaNet or even a Sandbox private net for debugging).

Programming the ASC1 (via TEAL, PyTeal or Reach) is conceptually orthogonal with respect interacting with the ASC1 (via goal, SDKs, APIs).

Of course the combination of PyTeal & Algorand Python SDK let you have a seamless integration of those two steps in a unique environment.