Build on Algorand
Deploy Smart Contract with AlgoKit
1. Initialize a New AlgoKit Project
Start by creating a new project using the AlgoKit CLI. Open your terminal and run:
algokit init
- When prompted, select the Smart Contracts option to use a template tailored for smart contract development.
- Choose your preferred language (for this example, select Python).
- Provide a consistent name for your project folder and smart contract app (e.g., `hello_world`).
- Select the Starter preset for a quick setup.
When prompted, you can choose to run the bootstrap process, which installs all required dependencies and sets up your project environment, ensuring your Algorand smart contract project is ready to use immediately; you can also optionally initialize a git repository with an initial commit Getting Started with AlgoKit.
2. Build the Smart Contract
Navigate to your project directory and compile your smart contract source code to generate the required build artifacts:
algokit project run build
This command compiles your contract and prepares the artifacts needed for deployment and interaction. For more information, see Smart Contract Development Lifecycle.
3. Deploy to Localnet
First, ensure your local Algorand test network (Localnet) is running:
algokit localnet start
Then, deploy your compiled smart contract to Localnet:
algokit project deploy localnet
At the end of the deployment, you should see an output similar to the following:
INFO : Called hello on HelloWorld (1002) with name=World, received: Hello, World
This indicates that the contract was deployed and called. For more information, see Run the Demo Application.
4. Interact with the Smart Contract
To interact with your deployed contract, open the `deploy_config.py` file located in the `smart_contracts/hello_world` folder. Here, you can update the value of the `name` variable to test different inputs.
5. Verify Deployment
You can further verify your deployment using a block explorer that supports Algorand Testnet, such as Lora Explorer. Use the following command to open the explorer:
algokit explore
If you click on logs, then UTF-8 you will be able to see the output of your transaction.
For more information, see Run the Demo Application.
Comments
You need to enroll in the course to be able to comment!