diff --git a/.devcontainer.json b/.devcontainer.json index 3d0dfc0f..99c32406 100644 --- a/.devcontainer.json +++ b/.devcontainer.json @@ -1,22 +1,20 @@ { - "forwardPorts": [4001, 4002, 8980, 5173], - "portsAttributes": { - "4001": { - "label": "algod" - }, - "4002": { - "label": "kmd" - }, - "8980": { - "label": "indexer" - }, - "5173": { - "label": "vite" - } + "forwardPorts": [4001, 4002, 8980, 5173], + "portsAttributes": { + "4001": { + "label": "algod" }, - - "postCreateCommand": "pipx install algokit", - "postStartCommand": "algokit localnet start" - - } + "4002": { + "label": "kmd" + }, + "8980": { + "label": "indexer" + }, + "5173": { + "label": "vite" + } + }, + "postCreateCommand": "pip3 install py-algorand-sdk python-dotenv && pipx install algokit && pip install algokit-utils", + "postStartCommand": "algokit localnet start" +} diff --git a/README.md b/README.md index c4caaa11..b16dc35a 100644 --- a/README.md +++ b/README.md @@ -1 +1,86 @@ -# codespace_algorand \ No newline at end of file +# The All-in-One Algorand Codespace + +Welcome to the all-in-one Algorand Codespace! This repository is designed to provide you with everything you need to start developing on the Algorand blockchain, whether you're attending a workshop, completing a challenge, or just exploring on your own. + +## ๐ŸŒŸ Quick Start Guide + +### **Fork the Repo:** + +To create your own copy of this repository: + +a. **Go to the GitHub Repository:** + - Navigate to the main page which is the current one your on. + +b. **Click the "Fork" Button:** + - In the top-right corner of the page, click the **Fork** button. This will create a copy of the repository under your GitHub account. + +c. **Wait for the Forking Process to Complete:** + - GitHub will take a few moments to create the fork. Once complete, youโ€™ll be redirected to your newly created fork. + +## ๐Ÿš€ Start with Codespaces +This is the fastest way to get up and running! + +1. **Create a Codespace:** + +https://github.com/user-attachments/assets/42b0f758-b05b-4d81-9950-b316c4330907 + + + - Click the green "Code" button at the top right of your forked repo. + - Select "Create codespace on main". + - Once your Codespace is fully loaded, you are ready to go! + +2. **Start Coding:** + - Open the `main.py` file to start coding and interact with the Algorand blockchain (no smart contracts needed). + - If you notice your codespace loaded with a similar error to the screenshot below, no worries! Just run ``` algokit localnet start ``` + +Screenshot 2024-12-10 at 14 58 16 + + - Lastly the ```main.py``` file is pre-populated with a simple script to quickly set up a local dispenser on the Algorand blockchain. This helps you get started immediately by connecting to the localnet and printing the dispenser address. Run it! ```python main.py``` like any other Python file :) + +3. **Workshop Follow-Along:** + - If you're participating in a workshop, the code weโ€™ll be using is available [here](https://github.com/Ganainmtech/python_algokit_demo). Feel free to use this as your experiemntation starting point too, we create an asset! + +4. **Explore on Your Own:** + - Use this environment to write your own scripts or modify existing ones. + +5. **Smart Contracts and Apps on-chain:** + - To start a smart contract or full stack App project, run: + - Note: If you are at this point, I recommend you get AlgoKit locally - codespaces are a premium feture of github and can get deleted! + ```bash + algokit init + ``` + +## ๐Ÿ’ป Advanced Setup for Local Development + +Prefer a local environment? Follow these steps: + +#### ๐Ÿงฐ Prerequisites + +- Install Python 3.12 or higher. +- Install [AlgoKit](https://developer.algorand.org/algokit/?utm_source=af_employee&utm_medium=social&utm_campaign=algokit_sarajane&utm_content=download&utm_term=EME). +- Install Docker (for running a local Algorand network). + +## ๐ŸŽ“ Workshop Challenges + +If youโ€™re taking part in a workshop challenge you can choose to fork and enter codespace or fork and work locally: + +1. **Live coding follow along:** + - Complete the task provided during the workshop. + +2. **Submit Your Answer:** + - Push your changes to your forked GitHub repository. + - Create a Pull Request (PR) to the original repository. + - In your PR, include: + - What your script achieves. (Optional) + +## ๐Ÿ“š Additional Resources + +- **Level Up:** Move to a local development environment when you're ready! Check out the [AlgoKit Landing Page](https://developer.algorand.org/algokit/?utm_source=af_employee&utm_medium=social&utm_campaign=algokit_sarajane&utm_content=download&utm_term=EME) for a quick setup guide. +- **Join the Community:** + - [![Join Algorand Discord](https://img.shields.io/discord/discord_channel_id?logo=discord)](https://discord.com/invite/algorand) + - [![Follow Algodevs on Twitter](https://img.shields.io/twitter/follow/algodevs?style=social)](https://x.com/algodevs) + +## ๐Ÿ Conclusion + +This repository serves as both a playground for exploration and a platform for structured learning through workshops and challenges. Whether you're a beginner or an experienced developer, I hope you find this environment useful and engaging. Happy coding! + diff --git a/main.py b/main.py index 8b137891..2966b170 100644 --- a/main.py +++ b/main.py @@ -1 +1,8 @@ +from algokit_utils.beta.algorand_client import (AlgorandClient, ) # Import what you need here +# Client to connect to localnet +algorand = AlgorandClient.default_local_net() + +# Import dispenser from KMD +dispenser = algorand.account.dispenser() +print("Dispenser Address: ", dispenser.address) diff --git a/post-create.sh b/post-create.sh deleted file mode 100644 index f4bebbdf..00000000 --- a/post-create.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/bash - -echo "running" -pipx install poetry -pip install typing-extensions -poetry init -n -poetry add git+https://github.com/algorandfoundation/algokit-utils-py#feat/algorand_client -poetry env use python3.12 -poetry shell - - - -