Goracle Default Template Example Application
June 9, 2023 ยท View on GitHub
This project has been generated using AlgoKit to help you quickly get started with a basic app to interact with the Goracle protocol and for experimenting with Beaker smart contracts against a LocalNet network.
See below for default getting started instructions.
For an understanding of the components within the template, visit the Goracle Template Description
Setup
Quick start
- Ensure you have AlgoKit installed and run
algokit bootstrap allin this directory - Open this directory in Visual Studio Code
- Open the sample contract at
default_app/default_app.py - Hit F5
- It will: start LocalNet, build the smart contract, deploy the contract, call the contract.
Detailed instructions
Initial setup
- Clone this repository locally
- Install pre-requisites:
- Install
AlgoKit- Link: Ensure you can executealgokit --version. - Docker - Docker Compose (and by association, Docker) is used to run the AlgoKit LocalNet environment, we require Docker Compose 2.5.0+
- Bootstrap your local environment; run
algokit bootstrap allwithin this folder, which will:- Install
Poetry- Link: The minimum required version is1.2. Ensure you can executepoetry -Vand get1.2+ - Run
poetry installin the root directory, which will set up a.venvfolder with a Python virtual environment and also install all Python dependencies - Copy
.env.templateto.env
- Install
- Install
- Open the project and start debugging / developing via:
- VS Code
- Open the repository root in VS Code
- Install recommended extensions
- Hit F5 (or whatever you have debug mapped to) while you have a contract open (default:
default_app/default_app.py) and it should by default (using theDemo current contract (+ LocalNet)configuration) start running thedemo.pyfile in the same folder as that contract, which will start LocalNet, build the contract, and deploy the contract to LocalNet.Note If using Windows: Before running for the first time you will need to select the Python Interpreter.
- Open the command palette (Cmd/Ctrl + Shift + P)
- Search for
Python: Select Interpreter - Select
./.venv/Scripts/python.exe
- IDEA (e.g. PyCharm)
- Open the repository root in the IDE
- It should automatically detect it's a Poetry project and set up a Python interpreter and virtual environment.
- Hit Shift+F9 (or whatever you have debug mapped to) and it should start running with breakpoint debugging.
- Other
- Open the repository root in your text editor of choice
- In a terminal run
poetry shell - Run the demo script
python default_app/demo.pythrough your debugger of choice
- VS Code
Subsequently
- If you update to the latest source code and there are new dependencies you will need to run
algokit bootstrap allagain - Follow step 3 above
Tools
The following tools are used in this project:
- Algorand - Layer 1 Blockchain; Developer portal, Why Algorand?
- AlgoKit - One-stop shop tool for developers building on the Algorand network; docs, intro tutorial
- Beaker - Smart contract development framework for PyTeal; docs, examples
- PyTEAL - Python language binding for Algorand smart contracts; docs
- AlgoKit Utils - A set of core Algorand utilities that make it easier to build solutions on Algorand.
- Poetry: Python packaging and dependency management.