{"id":37083163,"url":"https://github.com/opshin/hebi","last_synced_at":"2026-01-14T10:04:18.862Z","repository":{"id":104306578,"uuid":"608850542","full_name":"OpShin/hebi","owner":"OpShin","description":"A simple and fast pythonic programming language for cardano","archived":true,"fork":false,"pushed_at":"2024-04-05T06:35:35.000Z","size":5054,"stargazers_count":5,"open_issues_count":7,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-27T07:22:13.422Z","etag":null,"topics":["cardano","plutus","python","smart-contracts"],"latest_commit_sha":null,"homepage":"http://hebi.opshin.dev/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/OpShin.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"github":["nielstron"]}},"created_at":"2023-03-02T21:38:30.000Z","updated_at":"2024-04-05T06:35:49.000Z","dependencies_parsed_at":"2024-01-28T11:24:04.222Z","dependency_job_id":"f342d1d8-632b-44c0-82f5-a4e2df1cbdea","html_url":"https://github.com/OpShin/hebi","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/OpShin/hebi","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OpShin%2Fhebi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OpShin%2Fhebi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OpShin%2Fhebi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OpShin%2Fhebi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/OpShin","download_url":"https://codeload.github.com/OpShin/hebi/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OpShin%2Fhebi/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28416549,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T08:38:59.149Z","status":"ssl_error","status_checked_at":"2026-01-14T08:38:43.588Z","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":["cardano","plutus","python","smart-contracts"],"created_at":"2026-01-14T10:04:18.000Z","updated_at":"2026-01-14T10:04:18.857Z","avatar_url":"https://github.com/OpShin.png","language":"Python","funding_links":["https://github.com/sponsors/nielstron"],"categories":[],"sub_categories":[],"readme":"\n\u003cdiv align=\"center\"\u003e\n\n\u003cimg  src=\"https://raw.githubusercontent.com/OpShin/hebi/master/hebi.png\" width=\"240\" /\u003e\n\u003ch1 style=\"text-align: center;\"\u003ehebi\u003c/h1\u003e\u003c/br\u003e\n\n\n\u003ca href=\"https://app.travis-ci.com/OpShin/hebi\"\u003e\u003cimg alt=\"Build Status\" src=\"https://app.travis-ci.com/OpShin/hebi.svg?branch=main\"/\u003e\u003c/a\u003e\n\u003ca href=\"https://pypi.org/project/hebi/\"\u003e\u003cimg alt=\"PyPI version\" src=\"https://badge.fury.io/py/hebi.svg\"/\u003e\u003c/a\u003e\n\u003cimg alt=\"PyPI - Python Version\" src=\"https://img.shields.io/pypi/pyversions/hebi.svg\" /\u003e\n\u003ca href=\"https://pypi.org/project/hebi/\"\u003e\u003cimg alt=\"PyPI - Status\" src=\"https://img.shields.io/pypi/status/hebi.svg\" /\u003e\u003c/a\u003e\n\u003ca href=\"https://coveralls.io/github/OpShin/hebi?branch=main\"\u003e\u003cimg alt=\"Coverage Status\" src=\"https://coveralls.io/repos/github/OpShin/hebi/badge.svg?branch=main\" /\u003e\u003c/a\u003e\n\n\u003c/div\u003e\n\n\u003e NOTE: This project is discontinued. The significant gains in performance of hebi are now also present in [opshin](https://github.com/opshin/opshin), while also allowing to use loops etc.\n\u003e This project does therefore not provide any added value anymore.\n\n\u003e You are building what you want. Why not also build **how** you want?\n\n\nThis is an implementation of smart contracts for Cardano which are written in a very strict subset of valid Python.\nThe general philosophy of this project is to write a compiler that \nensure the following:\n\nIf the program compiles then:\n\n1. it is a valid Python program\n2. the output running it with python is the same as running it on-chain.\n\n\n\u003e Note this is the sister project of [opshin](https://github.com/OpShin/opshin).\nIt uses an even more restricted subset of python (for example no while loops).\nThe benefit is that the resulting code is greatly reduced in size and cpu/memory consumption.\n\n\n### Why hebi?\n- 100% valid Python. Leverage the existing tool stack for Python, syntax highlighting, linting, debugging, unit-testing, [property-based testing](https://hypothesis.readthedocs.io/), [verification](https://github.com/marcoeilers/nagini)\n- Intuitive. Just like Python.\n- Functional. Forces you to write elegant, functional code in Python.\n- Efficient \u0026 Secure. Static type inference ensures strict typing and optimized code\n\nEopsin is more comfortable to use than hebi.\nIf you want to start building, write your contract in eopsin first.\nThen, after everything works to your pleasing, try to port to hebi and enjoy the performance gains.\n\n### Getting Started\n\n#### OpShin Pioneer Program\n\nCheck out the [opshin-pioneer-program](\nhttps://github.com/OpShin/opshin-pioneer-program) for a host of educational example contracts, test cases and off-chain code.\n\n#### Example repository\n\nCheck out the [opshin-starter-kit](\nhttps://github.com/OpShin/opshin-starter-kit) repository for a quick start in setting up a development environment\nand compiling some sample contracts yourself.\n\n\nYou can replace the contracts in your local copy of the repository with code from the\n`examples` section here to start exploring different contracts.\n\n#### Developer Community and Questions\n\nThe eopsin repository contains a discussions page.\nFeel free to open up a new discussion with questions regarding development using hebi and using certain features.\nOthers may be able to help you and will also benefit from the previously shared questions.\n\nCheck out the community [here](https://github.com/OpShin/opshin/discussions)\n\nYou can also chat with other developers [in the welcoming discord\ncommunity](https://discord.gg/umR3A2g4uw) of OpShin\n\n#### Installation\n\nInstall Python 3.8, 3.9 or 3.10. Then run\n\n```bash\npython3 -m pip install hebi\n```\n\n#### Writing a Smart Contract\n\nA short non-complete introduction in starting to write smart contracts follows.\n\n1. Make sure you understand EUTxOs, Addresses, Validators etc on Cardano. [There is a wonderful crashcourse by @KtorZ](https://aiken-lang.org/fundamentals/eutxo). The contract will work on these concepts\n2. Make sure you understand python. hebi works like python and uses python. There are tons of tutorials for python, choose what suits you best.\n3. Make sure your contract is valid python and the types check out. Write simple contracts first and run them using `hebi eval` to get a feeling for how they work.\n4. Make sure your contract is valid hebi code. Run `hebi compile` and look at the compiler erros for guidance along what works and doesn't work and why.\n5. Dig into the [`examples`](https://github.com/OpShin/hebi/tree/main/examples) to understand common patterns. Check out the [`prelude`](https://hebi.opshin.dev/hebi/prelude.html) for understanding how the Script Context is structured and how complex datums are defined.\n6. Check out the [sample repository](https://github.com/OpShin/opshin-starter-kit) to find a sample setup for developing your own contract.\n\n\nIn summary, a smart contract in hebi is defined by the function `validator` in your contract file.\nThe function validates that a specific value can be spent, minted, burned, withdrawn etc, depending\non where it is invoked/used as a credential.\nIf the function fails (i.e. raises an error of any kind such as a `KeyError` or `AssertionError`)\nthe validation is denied, and the funds can not be spent, minted, burned etc.\n\n\u003e There is a subtle difference here in comparison to most other Smart Contract languages.\n\u003e In hebi a validator may return anything (in particular also `False`) - as long as it does not fail, the execution is considered valid.\n\u003e This is more similar to how contracts in Solidity always pass, unless they run out of gas or hit an error.\n\u003e So make sure to `assert` what you want to ensure to hold for validation!\n\nA simple contract called the \"Gift Contract\" verifies that only specific wallets can withdraw money.\nThey are authenticated by a signature.\nIf you don't understand what a pubkeyhash is and how this validates anything, check out [this gentle introduction into Cardanos EUTxO](https://aiken-lang.org/fundamentals/eutxo).\nAlso see the [tutorial by `pycardano`](https://pycardano.readthedocs.io/en/latest/guides/plutus.html) for explanations on what each of the parameters to the validator means\nand how to build transactions with the contract.\n\n```python3\nfrom hebi.prelude import *\n\n@dataclass\nclass WithdrawDatum(PlutusData):\n    pubkeyhash: bytes\n\n\ndef validator(datum: WithdrawDatum, redeemer: None, context: ScriptContext) -\u003e None:\n    assert datum.pubkeyhash in context.tx_info.signatories, \"Required signature missing\"\n```\n\nAll contracts written in hebi are 100% valid python.\nMinting policies expect only a redeemer and script context as argument.\nCheck out the [Architecture guide](https://github.com/OpShin/hebi/blob/main/ARCHITECTURE.md#minting-policy---spending-validator-double-function)\nfor details on how to write double functioning contracts.\nThe [`examples`](https://github.com/OpShin/hebi/blob/main/examples) folder contains more examples.\nAlso check out the [opshin-pioneer-program](\nhttps://github.com/OpShin/opshin-pioneer-program)\nand [opshin-starter-kit](\nhttps://github.com/OpShin/opshin-starter-kit) repo.\n\n### Compiling\n\nWrite your program in python. You may start with the content of `examples`.\nArguments to scripts are passed in as Plutus Data objects in JSON notation.\n\nYou can run any of the following commands\n```bash\n# Evaluate script in Python - this can be used to make sure there are no obvious errors\nhebi eval examples/smart_contracts/assert_sum.py \"{\\\"int\\\": 4}\" \"{\\\"int\\\": 38}\" \"{\\\"constructor\\\": 0, \\\"fields\\\": []}\"\n\n# Compile script to 'uplc', the Cardano Smart Contract assembly\nhebi compile examples/smart_contracts/assert_sum.py\n```\n\n### Deploying\n\nThe deploy process generates all artifacts required for usage with common libraries like [pycardano](https://github.com/Python-Cardano/pycardano), [lucid](https://github.com/spacebudz/lucid) and the [cardano-cli](https://github.com/input-output-hk/cardano-node).\n\n```bash\n# Automatically generate all artifacts needed for using this contract\nhebi build examples/smart_contracts/assert_sum.py\n```\n\nSee the [tutorial by `pycardano`](https://pycardano.readthedocs.io/en/latest/guides/plutus.html) for explanations how to build transactions with `opshin` contracts.\n\n### The small print\n\n_Not every valid python program is a valid smart contract_.\nNot all language features of python will or can be supported.\nThe reasons are mainly of practical nature (i.e. we can't infer types when functions like `eval` are allowed).\nSpecifically, only a pure subset of python is allowed.\nFurther, only immutable objects may be generated.\n\nFor your program to be accepted, make sure to only make use of language constructs supported by the compiler.\nYou will be notified of which constructs are not supported when trying to compile.\n\n### Name\n\nHebi is japanese for \"snake\", which is a play on words on `python`, the underlying language.\n\n### Versioning scheme\n\nSince this project builds on top of eopsin, it has a particular versioning scheme.\nThe first three numbers indicate the version of `hebi` (starting at `0.1.0`).\nThen follows the latest version number of `eopsin` which was merged into the project (starting at `0.9.3`).\nThis is intended to help navigating releases among both packages, where it might be important\nthat a recent eopsin release is integrated that contains a security patch.\n\n## Contributing\n\n### Architecture\n\nThis program consists of a few independent components:\n\n1. An aggressive static type inferencer\n2. Rewriting tools to simplify complex python expressions\n3. A compiler from a subset of python into UPLC\n\n### Debugging artefacts\n\nFor debugging purposes, you can also run\n\n```bash\n# Compile script to 'uplc', and evaluate the script in UPLC (for debugging purposes)\npython3 -m hebi eval_uplc examples/smart_contracts/assert_sum.py \"{\\\"int\\\": 4}\" \"{\\\"int\\\": 38}\" \"{\\\"constructor\\\": 0, \\\"fields\\\": []}\"\n\n# Compile script to 'pluto', an intermediate language (for debugging purposes)\npython3 -m hebi compile_pluto examples/smart_contracts/assert_sum.py\n```\n\n### Sponsoring\n\nYou can sponsor the development of hebi through GitHub or [Teiki](https://alpha.teiki.network/projects/opshin) or just by sending ADA. Drop me a message on social media and let me know what it is for.\n\n- **[Kreate](https://beta.kreate.community/projects/opshin)** Stake your ada to support OpShin at [Kreate](https://beta.kreate.community/projects/opshin)\n- **GitHub** Sponsor the developers of this project through the button \"Sponsor\" next to them\n- **ADA** Donation in ADA can be submitted to `$opshin` or `addr1qyz3vgd5xxevjy2rvqevz9n7n7dney8n6hqggp23479fm6vwpj9clsvsf85cd4xc59zjztr5zwpummwckmzr2myjwjns74lhmr`.\n\n### Supporters\n\n\u003ca href=\"https://github.com/inversion-dev\"\u003e\u003cimg src=\"https://avatars.githubusercontent.com/u/127298233?s=200\u0026v=4\" width=\"50\"\u003e\u003c/a\u003e\n\u003ca href=\"https://github.com/MuesliSwapTeam/\"\u003e\u003cimg  src=\"https://avatars.githubusercontent.com/u/91151317?v=4\" width=\"50\" /\u003e\u003c/a\u003e\n\u003ca href=\"https://github.com/AadaFinance/\"\u003e\u003cimg  src=\"https://avatars.githubusercontent.com/u/89693711?v=4\" width=\"50\" /\u003e\u003c/a\u003e\n\nThe main sponsor of this project is [Inversion](https://inversion.dev/cardano/). Here is a word from them!\n\n\u003e At Inversion, we pride ourselves on our passion for life and our ability to create exceptional software solutions for our clients. Our team of experts, with over a century of cumulative experience, is dedicated to harnessing the power of the Cardano blockchain to bring innovative and scalable decentralized applications to life. We've successfully built applications for NFT management, staking and delegation, chain data monitoring, analytics, and web3 integrations, as well as countless non-blockchain systems. With a focus on security, transparency, and sustainability, our team is excited to contribute to the Cardano ecosystem, pushing the boundaries of decentralized technologies to improve lives worldwide. Trust Inversion to be your go-to partner for robust, effective, and forward-thinking solutions, whether blockchain based, traditional systems, or a mix of the two.\n\nThey have recently started a podcast, called \"Africa On Chain\", which you can check out here:\nhttps://www.youtube.com/@africaonchain\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopshin%2Fhebi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fopshin%2Fhebi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopshin%2Fhebi/lists"}