<div align="center">
<img src="https://raw.githubusercontent.com/OpShin/opshin/main/opshin.png" width="240" />
<h1 style="text-align: center;">opshin</h1></br>
[![Tests & QA](https://github.com/OpShin/opshin/actions/workflows/tests.yml/badge.svg?branch=main)](https://github.com/OpShin/opshin/actions/workflows/tests.yml)
<a href="https://pypi.org/project/opshin/"><img alt="PyPI version" src="https://badge.fury.io/py/opshin.svg"/></a>
<img alt="PyPI - Python Version" src="https://img.shields.io/pypi/pyversions/opshin.svg" />
<a href="https://pypi.org/project/opshin/"><img alt="PyPI - Status" src="https://img.shields.io/pypi/status/opshin.svg" /></a>
<a href="https://coveralls.io/github/OpShin/opshin?branch=main"><img alt="Coverage Status" src="https://coveralls.io/repos/github/OpShin/opshin/badge.svg?branch=main" /></a>
<a href="https://github.com/OpShin/awesome-opshin"><img src="https://img.shields.io/badge/awesome-opshin-blue?logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB4AAAAcCAYAAAB2+A+pAAAGQklEQVRIx52Ve2yVdxnHP8/vPe+59U5pqdwqFxFpwbVzHesgWVwZrsJKZRMd4ObMkjkVDIst3ZSEzU0mNkv8wzGXoazFWc1YRA0MBsNuZg4lZXRgay3QcisF2lJoT8/pe97HP87pVUDPfsmb35vf7ft8n8v3kfu//HCR40TzgUvA4f1v110kPn6wJyxu2C1BWQXcCUwFXOAkcAD4RXV5oJ1PMKRy4+an3z303vPh8ADJSanRYFLKH4HdiPHm3PPVR73+7IV2MBNfahYeX3D8/RCwvro88GrCwEuWrrqjuanhcFdXBwB5+QtJTc0gEgnT030JMQa/P0gwmELOzPmkz1lEvycFJxolKzcPY9kA364uD2xLBNgAJwKBpMGhBVUl78mnQtd6u2ltbeTfLR/xceMHHG2oZ+BKK3J6D9+5W/A0vsKRPw1jvfTUW6FZCQHvf7uuLy0tszYYTCUYTOXTJV8iO68gkJz9qTEHI5EB2trPcODgISoqKqiqqmJFQTKoAviBdYkyJi098/EFny9eM3/BXT/P/9rafcbjYe7Kb5CRkT3msO318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JU49cTGZ2EfaBmOP3G+6TrVlM9Q2z4ww9lrTUARXwVVC6h/D9kYjxQtJAmFRSgeP4Lf638GVLQjrHOPDlnjcY6wniMQMEeHdEWDb6him5iqZch3jDsviaIkcjufx/tj8gKeRqXLqI4x5SKasUb1QezIg/QSSwYkA0Zi7RcAykGOcXw8Di3/lBdXd76G6GFeZYbczxcym0w2MAZZRRRjA4T49Rq77rw9BlknW6p6YLMk7fhM6P8P0TD6XnI7rxAxOZ4DFoYY3J2cU/21MHav+eR7wPmgGKD1uBrvDRVyL2kMxRgR8EmWBOc8C/Ri/9r1G1P2epK0KjXmr+7dfiJjgrrPemdN6TCo+jZAbbj2YPNhVLhO/3vvfAqJ7PwtsB4pBcbA4FZ1BjxvAQsk2XeSY83g0fBRXK8Uu33dTvb/2uwCwFMgBmnH1kKSt0lt2J9X9i4Ay0DtAJ4EK6EXQw+D+AfSvIsuVTzj+AwGKaSmc5OLIAAAAAElFTkSuQmCC"></a>
</div>
> You are building what you want. Why not also build **how** you want?
This is an implementation of smart contracts for Cardano which are written in a strict subset of valid Python.
The general philosophy of this project is to write a compiler that
ensure the following:
If the program compiles then:
1. it is a valid Python program
2. the output running it with python is the same as running it on-chain.
## Why opshin?
- 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)
- Intuitive. Just like Python.
- Flexible. Imperative, functional, the way you want it.
- Efficient & Secure. Static type inference ensures strict typing and optimized code
## Getting Started
Check out the [OpShin Book](https://book.opshin.dev) for an introduction to this tool and details into writing smart contracts.
This document will just outline the basic usage of the tool.
### Installation
Install Python 3.8, 3.9, 3.10 or 3.11. Then run
```bash
python3 -m pip install opshin
```
### Writing a Smart Contract
Check out the [OpShin Book](https://book.opshin.dev) for an introduction to this tool and details into writing smart contracts.
### Compiling
Write your program in python. You may start with the content of `examples`.
Arguments to scripts are passed in as Plutus Data objects in JSON notation.
You can run any of the following commands
```bash
# Evaluate script in Python - this can be used to make sure there are no obvious errors
opshin eval spending examples/smart_contracts/assert_sum.py "{\"int\": 4}" "{\"int\": 38}" d8799fd8799f9fd8799fd8799fd8799f582055d353acacaab6460b37ed0f0e3a1a0aabf056df4a7fa1e265d21149ccacc527ff01ffd8799fd8799fd87a9f581cdbe769758f26efb21f008dc097bb194cffc622acc37fcefc5372eee3ffd87a80ffa140a1401a00989680d87a9f5820dfab81872ce2bbe6ee5af9bbfee4047f91c1f57db5e30da727d5fef1e7f02f4dffd87a80ffffff809fd8799fd8799fd8799f581cdc315c289fee4484eda07038393f21dc4e572aff292d7926018725c2ffd87a80ffa140a14000d87980d87a80ffffa140a14000a140a1400080a0d8799fd8799fd87980d87a80ffd8799fd87b80d87a80ffff80a1d87a9fd8799fd8799f582055d353acacaab6460b37ed0f0e3a1a0aabf056df4a7fa1e265d21149ccacc527ff01ffffd87980a15820dfab81872ce2bbe6ee5af9bbfee4047f91c1f57db5e30da727d5fef1e7f02f4dd8799f581cdc315c289fee4484eda07038393f21dc4e572aff292d7926018725c2ffd8799f5820746957f0eb57f2b11119684e611a98f373afea93473fefbb7632d579af2f6259ffffd87a9fd8799fd8799f582055d353acacaab6460b37ed0f0e3a1a0aabf056df4a7fa1e265d21149ccacc527ff01ffffff
# Compile script to 'uplc', the Cardano Smart Contract assembly
opshin compile spending examples/smart_contracts/assert_sum.py
```
Furthermore, you can add a shebang to the first line of the python file to indicate that it represents an opshin smart contract.
You can choose from the following options:
- a general shebang: `#!opshin`, which represents `opshin eval any`
- or a more specific purpose: `#!/usr/bin/env -S opshin eval minting`
By doing so, you can transform your python file to an executable: `chmod +x your_file.py` and execute it with `./your_file.py`, which will run `opshin eval any ./your_file.py` under the hood.
### Deploying
The 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).
```bash
# Automatically generate all artifacts needed for using this contract
opshin build spending examples/smart_contracts/assert_sum.py
```
See the [tutorial by `pycardano`](https://pycardano.readthedocs.io/en/latest/guides/plutus.html) for explanations how to build transactions with `opshin` contracts.
## API for Smart Contracts
The python interface offers a simple API to compile, load, apply parameters and evaluate smart contracts.
```python3
from opshin.builder import *
# Build a validator script from a python file that contains a validator function
contract = build("path/to/contract.py")
# You can apply parameters to the contract during compilation
contract = build("path/to/contract.py", arg1, arg2, arg3)
# Store the compilation artifacts in a folder
contract.dump("path/to/store")
# You can also load a compiled contract from a path
contract = load("path/to/store")
# And apply parameters after loading a contract
contract = contract.apply_parameters(arg1, arg2, arg3)
# The artifacts contain the compiled script, the policy ID and the addresses and blueprint
contract_addr = contract.mainnet_addr
contract_blueprint = contract.blueprint
```
## Debugging artefacts
For debugging purposes, you can also run
```bash
# Compile script to 'uplc', and evaluate the script in UPLC (for debugging purposes)
opshin eval_uplc spending examples/smart_contracts/assert_sum.py "{\"int\": 4}" "{\"int\": 38}" d8799fd8799f9fd8799fd8799fd8799f582055d353acacaab6460b37ed0f0e3a1a0aabf056df4a7fa1e265d21149ccacc527ff01ffd8799fd8799fd87a9f581cdbe769758f26efb21f008dc097bb194cffc622acc37fcefc5372eee3ffd87a80ffa140a1401a00989680d87a9f5820dfab81872ce2bbe6ee5af9bbfee4047f91c1f57db5e30da727d5fef1e7f02f4dffd87a80ffffff809fd8799fd8799fd8799f581cdc315c289fee4484eda07038393f21dc4e572aff292d7926018725c2ffd87a80ffa140a14000d87980d87a80ffffa140a14000a140a1400080a0d8799fd8799fd87980d87a80ffd8799fd87b80d87a80ffff80a1d87a9fd8799fd8799f582055d353acacaab6460b37ed0f0e3a1a0aabf056df4a7fa1e265d21149ccacc527ff01ffffd87980a15820dfab81872ce2bbe6ee5af9bbfee4047f91c1f57db5e30da727d5fef1e7f02f4dd8799f581cdc315c289fee4484eda07038393f21dc4e572aff292d7926018725c2ffd8799f5820746957f0eb57f2b11119684e611a98f373afea93473fefbb7632d579af2f6259ffffd87a9fd8799fd8799f582055d353acacaab6460b37ed0f0e3a1a0aabf056df4a7fa1e265d21149ccacc527ff01ffffff
# Compile script to 'pluto', an intermediate language (for debugging purposes)
opshin compile_pluto spending examples/smart_contracts/assert_sum.py
```
## Contributing
### Developing and Technical Documentation
Generally, all contributions on the code side are very welcome.
To get an overview over the architecture and idea behind OpShin, check out [the Technical Documentation](./ARCHITECTURE.md).
A bug bounty has been set up and funded by Project Catalyst, which awards [Github issue](https://github.com/OpShin/opshin/labels/bug%20bounty) resolution wiht ADA rewards.
This is a great opportunity to get involved and earn some ADA.
Check out the [detailed introduction to the bounty program](./BUG_BOUNTY.md) for more information.
### Sponsoring
You can sponsor the development of opshin through GitHub or [Patreon](https://patreon.com/OpShin) or just by sending ADA. Drop me a message on social media and let me know what it is for.
- **Patreon** Support OpShin at [Patreon](https://patreon.com/OpShin) to enjoy member benefits!
- **GitHub** Sponsor the developers of this project through the button "Sponsor" next to them
- **ADA** Donation in ADA can be submitted to `$opshin` or `addr1qyz3vgd5xxevjy2rvqevz9n7n7dney8n6hqggp23479fm6vwpj9clsvsf85cd4xc59zjztr5zwpummwckmzr2myjwjns74lhmr`.
### Supporters
<a href="https://github.com/inversion-dev"><img src="https://avatars.githubusercontent.com/u/127298233?s=200&v=4" width="50"></a>
<a href="https://github.com/MuesliSwapTeam/"><img src="https://avatars.githubusercontent.com/u/91151317?v=4" width="50" /></a>
<a href="https://github.com/AadaFinance/"><img src="https://avatars.githubusercontent.com/u/89693711?v=4" width="50" /></a>
<a href="https://github.com/kreate-community/"><img src="https://avatars.githubusercontent.com/u/118675270?v=4" width="50" /></a>
The main sponsor of this project is [Inversion](https://inversion.dev/cardano/). Here is a word from them!
> 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.
They have recently started a podcast, called "Africa On Chain", which you can check out here:
https://www.youtube.com/@africaonchain
Raw data
{
"_id": null,
"home_page": "https://github.com/opshin/opshin",
"name": "opshin",
"maintainer": null,
"docs_url": null,
"requires_python": "<3.12,>=3.8.1",
"maintainer_email": null,
"keywords": "python, language, programming-language, compiler, validator, smart-contracts, cardano",
"author": "nielstron",
"author_email": "n.muendler@web.de",
"download_url": "https://files.pythonhosted.org/packages/7a/21/884fce3df949164c34a4347300ee0f3daeb5d1f726d9113b1d481637abb6/opshin-0.24.0.tar.gz",
"platform": null,
"description": "\n<div align=\"center\">\n\n<img src=\"https://raw.githubusercontent.com/OpShin/opshin/main/opshin.png\" width=\"240\" />\n<h1 style=\"text-align: center;\">opshin</h1></br>\n\n\n[![Tests & QA](https://github.com/OpShin/opshin/actions/workflows/tests.yml/badge.svg?branch=main)](https://github.com/OpShin/opshin/actions/workflows/tests.yml)\n<a href=\"https://pypi.org/project/opshin/\"><img alt=\"PyPI version\" src=\"https://badge.fury.io/py/opshin.svg\"/></a>\n<img alt=\"PyPI - Python Version\" src=\"https://img.shields.io/pypi/pyversions/opshin.svg\" />\n<a href=\"https://pypi.org/project/opshin/\"><img alt=\"PyPI - Status\" src=\"https://img.shields.io/pypi/status/opshin.svg\" /></a>\n<a href=\"https://coveralls.io/github/OpShin/opshin?branch=main\"><img alt=\"Coverage Status\" src=\"https://coveralls.io/repos/github/OpShin/opshin/badge.svg?branch=main\" /></a>\n<a href=\"https://github.com/OpShin/awesome-opshin\"><img src=\"https://img.shields.io/badge/awesome-opshin-blue?logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAB4AAAAcCAYAAAB2+A+pAAAGQklEQVRIx52Ve2yVdxnHP8/vPe+59U5pqdwqFxFpwbVzHesgWVwZrsJKZR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gaqgGUATdfmUt8/FeMzGK8ZmruMz5RvXeYLVdVHN4oldeKRCWLHDbMEscQjHtm2sd4p/J8CEmd7D/AsQLeTxZt9hVgBKxabWHBCGmXFC3eb1h/+QytRfqKuxvcFjen3aIxngJW3jLG27ZgEHAVyolj86moZZ6LJFGTA6evQPUhYXVY8d7vs3XRUH0XZjiDoDRJIhjoeAyKkb75NwjdnLGxHyQFoDs/jrJsMQI8DjhICVjx3u+zbfFyXoPxyyHjVWF2jUGh30jqYzlW8Q/b4gXlAw6YGfVAMi8YA69nXv4JSioCqUB+di+WNPdYeBlWefLZA9v24WRersksEG4lneNx/ZaaRfLuBi85UtvV9MZb4AoVZ5G4+ric0yhYgOJaxZSpipkOHO40uTwBrrOs6nm/R9cAWY/DH6xgExEC+XiLfaog1G8957MCIyx0P6baPFxVmoYSGgfXKGxNxtShWo0pnJBuxRulEjNUeMSNgs5OhPQJqIJUIJU49cTGZ2EfaBmOP3G+6TrVlM9Q2z4ww9lrTUARXwVVC6h/D9kYjxQtJAmFRSgeP4Lf638GVLQjrHOPDlnjcY6wniMQMEeHdEWDb6him5iqZch3jDsviaIkcjufx/tj8gKeRqXLqI4x5SKasUb1QezIg/QSSwYkA0Zi7RcAykGOcXw8Di3/lBdXd76G6GFeZYbczxcym0w2MAZZRRRjA4T49Rq77rw9BlknW6p6YLMk7fhM6P8P0TD6XnI7rxAxOZ4DFoYY3J2cU/21MHav+eR7wPmgGKD1uBrvDRVyL2kMxRgR8EmWBOc8C/Ri/9r1G1P2epK0KjXmr+7dfiJjgrrPemdN6TCo+jZAbbj2YPNhVLhO/3vvfAqJ7PwtsB4pBcbA4FZ1BjxvAQsk2XeSY83g0fBRXK8Uu33dTvb/2uwCwFMgBmnH1kKSt0lt2J9X9i4Ay0DtAJ4EK6EXQw+D+AfSvIsuVTzj+AwGKaSmc5OLIAAAAAElFTkSuQmCC\"></a>\n</div>\n\n> You are building what you want. Why not also build **how** you want?\n\nThis is an implementation of smart contracts for Cardano which are written in a 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## Why opshin?\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- Flexible. Imperative, functional, the way you want it.\n- Efficient & Secure. Static type inference ensures strict typing and optimized code\n\n\n## Getting Started\n\nCheck out the [OpShin Book](https://book.opshin.dev) for an introduction to this tool and details into writing smart contracts.\nThis document will just outline the basic usage of the tool.\n\n### Installation\n\nInstall Python 3.8, 3.9, 3.10 or 3.11. Then run\n\n```bash\npython3 -m pip install opshin\n```\n\n### Writing a Smart Contract\n\nCheck out the [OpShin Book](https://book.opshin.dev) for an introduction to this tool and details into writing smart contracts.\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\nopshin eval spending examples/smart_contracts/assert_sum.py \"{\\\"int\\\": 4}\" \"{\\\"int\\\": 38}\" d8799fd8799f9fd8799fd8799fd8799f582055d353acacaab6460b37ed0f0e3a1a0aabf056df4a7fa1e265d21149ccacc527ff01ffd8799fd8799fd87a9f581cdbe769758f26efb21f008dc097bb194cffc622acc37fcefc5372eee3ffd87a80ffa140a1401a00989680d87a9f5820dfab81872ce2bbe6ee5af9bbfee4047f91c1f57db5e30da727d5fef1e7f02f4dffd87a80ffffff809fd8799fd8799fd8799f581cdc315c289fee4484eda07038393f21dc4e572aff292d7926018725c2ffd87a80ffa140a14000d87980d87a80ffffa140a14000a140a1400080a0d8799fd8799fd87980d87a80ffd8799fd87b80d87a80ffff80a1d87a9fd8799fd8799f582055d353acacaab6460b37ed0f0e3a1a0aabf056df4a7fa1e265d21149ccacc527ff01ffffd87980a15820dfab81872ce2bbe6ee5af9bbfee4047f91c1f57db5e30da727d5fef1e7f02f4dd8799f581cdc315c289fee4484eda07038393f21dc4e572aff292d7926018725c2ffd8799f5820746957f0eb57f2b11119684e611a98f373afea93473fefbb7632d579af2f6259ffffd87a9fd8799fd8799f582055d353acacaab6460b37ed0f0e3a1a0aabf056df4a7fa1e265d21149ccacc527ff01ffffff\n\n# Compile script to 'uplc', the Cardano Smart Contract assembly\nopshin compile spending examples/smart_contracts/assert_sum.py\n```\n\nFurthermore, you can add a shebang to the first line of the python file to indicate that it represents an opshin smart contract.\nYou can choose from the following options:\n\n- a general shebang: `#!opshin`, which represents `opshin eval any`\n- or a more specific purpose: `#!/usr/bin/env -S opshin eval minting`\n\nBy doing so, you can transform your python file to an executable: `chmod +x your_file.py` and execute it with `./your_file.py`, which will run `opshin eval any ./your_file.py` under the hood.\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\nopshin build spending 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## API for Smart Contracts\n\nThe python interface offers a simple API to compile, load, apply parameters and evaluate smart contracts.\n\n```python3\nfrom opshin.builder import *\n\n# Build a validator script from a python file that contains a validator function\ncontract = build(\"path/to/contract.py\")\n\n# You can apply parameters to the contract during compilation\ncontract = build(\"path/to/contract.py\", arg1, arg2, arg3)\n\n# Store the compilation artifacts in a folder\ncontract.dump(\"path/to/store\")\n\n# You can also load a compiled contract from a path\ncontract = load(\"path/to/store\")\n\n# And apply parameters after loading a contract\ncontract = contract.apply_parameters(arg1, arg2, arg3)\n\n# The artifacts contain the compiled script, the policy ID and the addresses and blueprint\ncontract_addr = contract.mainnet_addr\ncontract_blueprint = contract.blueprint\n```\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)\nopshin eval_uplc spending examples/smart_contracts/assert_sum.py \"{\\\"int\\\": 4}\" \"{\\\"int\\\": 38}\" d8799fd8799f9fd8799fd8799fd8799f582055d353acacaab6460b37ed0f0e3a1a0aabf056df4a7fa1e265d21149ccacc527ff01ffd8799fd8799fd87a9f581cdbe769758f26efb21f008dc097bb194cffc622acc37fcefc5372eee3ffd87a80ffa140a1401a00989680d87a9f5820dfab81872ce2bbe6ee5af9bbfee4047f91c1f57db5e30da727d5fef1e7f02f4dffd87a80ffffff809fd8799fd8799fd8799f581cdc315c289fee4484eda07038393f21dc4e572aff292d7926018725c2ffd87a80ffa140a14000d87980d87a80ffffa140a14000a140a1400080a0d8799fd8799fd87980d87a80ffd8799fd87b80d87a80ffff80a1d87a9fd8799fd8799f582055d353acacaab6460b37ed0f0e3a1a0aabf056df4a7fa1e265d21149ccacc527ff01ffffd87980a15820dfab81872ce2bbe6ee5af9bbfee4047f91c1f57db5e30da727d5fef1e7f02f4dd8799f581cdc315c289fee4484eda07038393f21dc4e572aff292d7926018725c2ffd8799f5820746957f0eb57f2b11119684e611a98f373afea93473fefbb7632d579af2f6259ffffd87a9fd8799fd8799f582055d353acacaab6460b37ed0f0e3a1a0aabf056df4a7fa1e265d21149ccacc527ff01ffffff\n\n# Compile script to 'pluto', an intermediate language (for debugging purposes)\nopshin compile_pluto spending examples/smart_contracts/assert_sum.py\n```\n\n\n## Contributing\n\n### Developing and Technical Documentation\n\nGenerally, all contributions on the code side are very welcome.\nTo get an overview over the architecture and idea behind OpShin, check out [the Technical Documentation](./ARCHITECTURE.md).\nA bug bounty has been set up and funded by Project Catalyst, which awards [Github issue](https://github.com/OpShin/opshin/labels/bug%20bounty) resolution wiht ADA rewards.\nThis is a great opportunity to get involved and earn some ADA.\nCheck out the [detailed introduction to the bounty program](./BUG_BOUNTY.md) for more information.\n\n### Sponsoring\n\nYou can sponsor the development of opshin through GitHub or [Patreon](https://patreon.com/OpShin) or just by sending ADA. Drop me a message on social media and let me know what it is for.\n\n- **Patreon** Support OpShin at [Patreon](https://patreon.com/OpShin) to enjoy member benefits!\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<a href=\"https://github.com/inversion-dev\"><img src=\"https://avatars.githubusercontent.com/u/127298233?s=200&v=4\" width=\"50\"></a>\n<a href=\"https://github.com/MuesliSwapTeam/\"><img src=\"https://avatars.githubusercontent.com/u/91151317?v=4\" width=\"50\" /></a>\n<a href=\"https://github.com/AadaFinance/\"><img src=\"https://avatars.githubusercontent.com/u/89693711?v=4\" width=\"50\" /></a>\n<a href=\"https://github.com/kreate-community/\"><img src=\"https://avatars.githubusercontent.com/u/118675270?v=4\" width=\"50\" /></a>\n\nThe main sponsor of this project is [Inversion](https://inversion.dev/cardano/). Here is a word from them!\n\n> 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",
"bugtrack_url": null,
"license": "MIT",
"summary": "A simple pythonic programming language for Smart Contracts on Cardano",
"version": "0.24.0",
"project_urls": {
"Documentation": "https://opshin.opshin.dev/",
"Homepage": "https://github.com/opshin/opshin",
"Repository": "https://github.com/opshin/opshin"
},
"split_keywords": [
"python",
" language",
" programming-language",
" compiler",
" validator",
" smart-contracts",
" cardano"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "716e004df51bd10a46aa6cd2b57ef865898a7d0a655881df71830aa6d91f4a54",
"md5": "2967c561c171f172621f11a6c11b9c29",
"sha256": "c1ec1fd89666274d0f797553114ceb9a6d9b21b8d5820977657de0be47372ae1"
},
"downloads": -1,
"filename": "opshin-0.24.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "2967c561c171f172621f11a6c11b9c29",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": "<3.12,>=3.8.1",
"size": 94258,
"upload_time": "2024-10-31T20:58:56",
"upload_time_iso_8601": "2024-10-31T20:58:56.287873Z",
"url": "https://files.pythonhosted.org/packages/71/6e/004df51bd10a46aa6cd2b57ef865898a7d0a655881df71830aa6d91f4a54/opshin-0.24.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "7a21884fce3df949164c34a4347300ee0f3daeb5d1f726d9113b1d481637abb6",
"md5": "f5d52ee0c573b11ce305e6681c53d8df",
"sha256": "78287b079a274928989aef868dda564f7d1759255a8c3aea8eecc8043c5b9efb"
},
"downloads": -1,
"filename": "opshin-0.24.0.tar.gz",
"has_sig": false,
"md5_digest": "f5d52ee0c573b11ce305e6681c53d8df",
"packagetype": "sdist",
"python_version": "source",
"requires_python": "<3.12,>=3.8.1",
"size": 83040,
"upload_time": "2024-10-31T20:58:58",
"upload_time_iso_8601": "2024-10-31T20:58:58.037954Z",
"url": "https://files.pythonhosted.org/packages/7a/21/884fce3df949164c34a4347300ee0f3daeb5d1f726d9113b1d481637abb6/opshin-0.24.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-10-31 20:58:58",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "opshin",
"github_project": "opshin",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "opshin"
}