{"id":38152156,"url":"https://github.com/block-foundation/teal-template","last_synced_at":"2026-01-16T23:02:43.160Z","repository":{"id":183431763,"uuid":"669948158","full_name":"block-foundation/teal-template","owner":"block-foundation","description":"Teal Smart Contract: Template","archived":false,"fork":false,"pushed_at":"2024-10-07T07:15:50.000Z","size":59,"stargazers_count":0,"open_issues_count":6,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-09-04T22:21:26.799Z","etag":null,"topics":["algo","algorand","block-foundation","blockchain","blockfoundation","pyteal","smart-contract","teal","template"],"latest_commit_sha":null,"homepage":"https://www.blockfoundation.io","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"cc-by-sa-4.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/block-foundation.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":".github/CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":".github/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":"CITATION.cff","codeowners":".github/CODEOWNERS","security":".github/SECURITY.md","support":".github/SUPPORT.md","governance":".github/GOVERNANCE.md","roadmap":null,"authors":"AUTHORS","dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"github":"block-foundation","open_collective":"block"}},"created_at":"2023-07-24T00:16:48.000Z","updated_at":"2024-08-11T11:16:50.000Z","dependencies_parsed_at":"2025-04-12T01:25:19.896Z","dependency_job_id":"f09e7e83-45af-48d0-8b3f-d3e40267c6fa","html_url":"https://github.com/block-foundation/teal-template","commit_stats":null,"previous_names":["block-foundation/teal-template"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/block-foundation/teal-template","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/block-foundation%2Fteal-template","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/block-foundation%2Fteal-template/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/block-foundation%2Fteal-template/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/block-foundation%2Fteal-template/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/block-foundation","download_url":"https://codeload.github.com/block-foundation/teal-template/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/block-foundation%2Fteal-template/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28487098,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-16T22:54:02.790Z","status":"ssl_error","status_checked_at":"2026-01-16T22:50:10.344Z","response_time":107,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["algo","algorand","block-foundation","blockchain","blockfoundation","pyteal","smart-contract","teal","template"],"created_at":"2026-01-16T23:02:42.289Z","updated_at":"2026-01-16T23:02:43.136Z","avatar_url":"https://github.com/block-foundation.png","language":"Python","funding_links":["https://github.com/sponsors/block-foundation","https://opencollective.com/block"],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"right\"\u003e\n\n[![GitHub License](https://img.shields.io/github/license/block-foundation/blocktxt?style=flat-square\u0026logo=readthedocs\u0026logoColor=FFFFFF\u0026label=\u0026labelColor=%23041B26\u0026color=%23041B26\u0026link=LICENSE)](https://github.com/block-foundation/teal-template/blob/main/LICENSE)\n[![devContainer](https://img.shields.io/badge/Container-Remote?style=flat-square\u0026logo=visualstudiocode\u0026logoColor=%23FFFFFF\u0026label=Remote\u0026labelColor=%23041B26\u0026color=%23041B26)](https://vscode.dev/redirect?url=vscode://ms-vscode-remote.remote-containers/cloneInVolume?url=https://github.com/block-foundation/teal-template)\n\n\u003c/div\u003e\n\n---\n\n\u003cdiv\u003e\n    \u003cimg align=\"right\" src=\"https://raw.githubusercontent.com/block-foundation/brand/master/src/logo/logo_gray.png\" width=\"96\" alt=\"Block Foundation Logo\"\u003e\n    \u003ch1 align=\"left\"\u003ePyTeal Template\u003c/h1\u003e\n    \u003ch3 align=\"left\"\u003eBlock Foundation Smart Contract Series [Teal]\u003c/h3\u003e\n\u003c/div\u003e\n\n---\n\n\u003cimg align=\"right\" width=\"75%\" src=\"https://raw.githubusercontent.com/block-foundation/brand/master/src/image/repository_cover/block_foundation-structure-03-accent.jpg\"  alt=\"Block Foundation Brand\"\u003e\n\n### Contents\n\n- [Introduction](#introduction)\n- [Colophon](#colophon)\n\n\u003cbr clear=\"both\"/\u003e\n\n---\n\n\u003cdiv align=\"right\"\u003e\n\n[![Report a Bug](https://img.shields.io/badge/Report%20a%20Bug-GitHub?style=flat-square\u0026\u0026logoColor=%23FFFFFF\u0026color=%23E1E4E5)](https://github.com/block-foundation/teal-template/issues/new?assignees=\u0026labels=Needs%3A+Triage+%3Amag%3A%2Ctype%3Abug-suspected\u0026projects=\u0026template=bug_report.yml)\n[![Request a Feature](https://img.shields.io/badge/Request%20a%20Feature-GitHub?style=flat-square\u0026\u0026logoColor=%23FFFFFF\u0026color=%23E1E4E5)](https://github.com/block-foundation/teal-template/issues/new?assignees=\u0026labels=Needs%3A+Triage+%3Amag%3A%2Ctype%3Abug-suspected\u0026projects=\u0026template=feature_request.yml)\n[![Ask a Question](https://img.shields.io/badge/Ask%20a%20Question-GitHub?style=flat-square\u0026\u0026logoColor=%23FFFFFF\u0026color=%23E1E4E5)](https://github.com/block-foundation/teal-template/issues/new?assignees=\u0026labels=Needs%3A+Triage+%3Amag%3A%2Ctype%3Abug-suspected\u0026projects=\u0026template=question.yml)\n[![Make a Suggestion](https://img.shields.io/badge/Make%20a%20Suggestion-GitHub?style=flat-square\u0026\u0026logoColor=%23FFFFFF\u0026color=%23E1E4E5)](https://github.com/block-foundation/teal-template/issues/new?assignees=\u0026labels=Needs%3A+Triage+%3Amag%3A%2Ctype%3Abug-suspected\u0026projects=\u0026template=suggestion.yml)\n[![Start a Discussion](https://img.shields.io/badge/Start%20a%20Discussion-GitHub?style=flat-square\u0026\u0026logoColor=%23FFFFFF\u0026color=%23E1E4E5)](https://github.com/block-foundation/teal-template/issues/new?assignees=\u0026labels=Needs%3A+Triage+%3Amag%3A%2Ctype%3Abug-suspected\u0026projects=\u0026template=discussion.yml)\n\n\u003c/div\u003e\n\n## Introduction\n\nThis is a very simple example of a stateful smart contract on the Algorand blockchain. Stateful smart contracts have access to both global state (shared by all users of the contract) and local state (unique to each user), but this example only uses local state. The \"counter\" variable is stored in each user's local state, and is incremented by 1 each time that user calls the contract. \n\n```python\nfrom pyteal import *\n\ndef approval_program():\n    # This block executes when the smart contract is first initialized.\n    # It sets a local variable \"counter\" to 0 for the sender of the transaction.\n    on_initialization = Seq([\n        App.localPut(Int(0), Bytes(\"counter\"), Int(0)),\n        Return(Int(1))  # This indicates that the initialization was successful.\n    ])\n\n    # This block executes on each call to the smart contract after it has been initialized.\n    # It increments the \"counter\" variable by 1 for the sender of the transaction.\n    on_call = Seq([\n        App.localGetEx(Int(0), App.id(), Bytes(\"counter\")),\n        App.localPut(Int(0), Bytes(\"counter\"), Add(Int(1), App.localGet(Int(0), Bytes(\"counter\")))),\n        Return(Int(1))  # This indicates that the call was successful.\n    ])\n\n    # The Cond function routes execution depending on whether the application is being initialized or called.\n    # If the application_id of the transaction is 0, that means the application is being initialized.\n    # Otherwise, the application is being called.\n    program = Cond(\n        [Txn.application_id() == Int(0), on_initialization],\n        [Txn.application_id() != Int(0), on_call]\n    )\n\n    return program\n\nif __name__ == \"__main__\":\n    # This line compiles the PyTeal code into TEAL (Transaction Execution Approval Language), the bytecode language that Algorand smart contracts are executed in.\n    print(compileTeal(approval_program(), mode=Mode.Application))\n```\n\nYou can find more information on stateful smart contracts and PyTeal in the [Algorand developer documentation](https://developer.algorand.org/docs/features/asc1/stateful/).\n\n---\n\n## Colophon\n\n### Authors\n\nThis is an open-source project by the **[Block Foundation](https://www.blockfoundation.io \"Block Foundation website\")**.\n\nThe Block Foundation mission is enabling architects to take back initiative and contribute in solving the mismatch in housing through blockchain technology. Therefore the Block Foundation seeks to unschackle the traditional constraints and construct middle ground between rent and the rigidity of traditional mortgages.\n\nwebsite: [www.blockfoundation.io](https://www.blockfoundation.io \"Block Foundation website\")\n\n### Development Resources\n\n#### Contributing\n\nWe'd love for you to contribute and to make this project even better than it is today!\nPlease refer to the [contribution guidelines](.github/CONTRIBUTING.md) for information.\n\n### Legal Information\n\n#### Copyright\n\nCopyright \u0026copy; 2023 [Stichting Block Foundation](https://www.blockfoundation.io/ \"Block Foundation website\"). All Rights Reserved.\n\n#### License\n\nExcept as otherwise noted, the content in this repository is licensed under the\n[Creative Commons Attribution 4.0 International (CC BY 4.0) License](https://creativecommons.org/licenses/by/4.0/), and\ncode samples are licensed under the [Apache 2.0 License](http://www.apache.org/licenses/LICENSE-2.0).\n\nAlso see [LICENSE](https://github.com/block-foundation/community/blob/master/src/LICENSE) and [LICENSE-CODE](https://github.com/block-foundation/community/blob/master/src/LICENSE-CODE).\n\n#### Disclaimer\n\n**THIS SOFTWARE IS PROVIDED AS IS WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING ANY IMPLIED WARRANTIES OF FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABILITY, OR NON-INFRINGEMENT.**\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fblock-foundation%2Fteal-template","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fblock-foundation%2Fteal-template","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fblock-foundation%2Fteal-template/lists"}