Quick Start
Get up and running with AlgoKit Utils in 5 minutes.
Prerequisites
Section titled “Prerequisites”- Python 3.10+
- AlgoKit CLI installed
- LocalNet running (
algokit localnet start)
Installation
Section titled “Installation”pip install algokit-utils# orpoetry add algokit-utils# oruv add algokit-utilsYour First Transaction
Section titled “Your First Transaction”Create a file called hello_algorand.py:
from algokit_utils import AlgorandClient, AlgoAmount, PaymentParams
# 1. Connect to LocalNetalgorand = AlgorandClient.default_localnet()
# 2. Create a new random accountsender = algorand.account.random()print(f"Created account: {sender.addr}")
# 3. Fund the account from the LocalNet dispenseralgorand.account.ensure_funded(sender, algorand.account.localnet_dispenser(), min_spending_balance=AlgoAmount.from_algo(10))print("Funded account with 10 ALGO")
# 4. Check the balanceinfo = algorand.account.get_information(sender)print(f"Balance: {info.amount.algo} ALGO")
# 5. Create a second account and send a paymentreceiver = algorand.account.random()
result = algorand.send.payment( PaymentParams( sender=sender.addr, receiver=receiver.addr, amount=AlgoAmount.from_algo(1), ))
print(f"Payment sent! Transaction ID: {result.tx_id}")
# 6. Check receiver balancereceiver_info = algorand.account.get_information(receiver)print(f"Receiver balance: {receiver_info.amount.algo} ALGO")Run it:
python hello_algorand.pyDeploy a Smart Contract
Section titled “Deploy a Smart Contract”Use AppFactory to deploy an ARC-32 or ARC-56 compatible smart contract.
from pathlib import Pathfrom algokit_utils import ( AlgorandClient, AlgoAmount, AppClientMethodCallParams, OnUpdate, OnSchemaBreak,)
# 1. Connect to LocalNet and set up a deployer accountalgorand = AlgorandClient.default_localnet()deployer = algorand.account.random()algorand.account.ensure_funded( account_to_fund=deployer, dispenser_account=algorand.account.localnet_dispenser(), min_spending_balance=AlgoAmount.from_algo(10),)
# 2. Load the app spec (ARC-32 or ARC-56 JSON)app_spec = Path("artifacts/HelloWorld/app_spec.arc32.json").read_text()
# 3. Create a factoryfactory = algorand.client.get_app_factory( app_spec=app_spec, default_sender=deployer.addr,)
# 4. Deploy (idempotent — creates on first run, updates on subsequent runs)app_client, deploy_result = factory.deploy( on_update=OnUpdate.UpdateApp, on_schema_break=OnSchemaBreak.ReplaceApp,)
print(f"App ID: {deploy_result.app.app_id}")print(f"Operation: {deploy_result.operation_performed.name}") # Create, Update, etc.
# 5. Call the appresponse = app_client.send.call( AppClientMethodCallParams(method="hello", args=["world"]),)print(f"Response: {response.abi_return}") # "Hello, world"[!NOTE]
deploy()is idempotent — it looks up existing deployments by app name and creator, creating a new app only if one doesn’t exist yet. On subsequent runs it detects changes and applies theon_update/on_schema_breakstrategy you specify.
What’s Next?
Section titled “What’s Next?”- AlgorandClient — Learn about the main entry point
- Account Management — Different ways to create and manage accounts
- Transaction Management — Build and send transactions
- App Client — Deploy and interact with smart contracts