Practical overview
When it fits
Use Opshin when developing Cardano smart contracts and you want a Python-based language with a documented command-line path for script evaluation and UPLC compilation.
Who it is for
- Developers writing Cardano smart-contract validators
- Python developers who want to use familiar tooling and testing practices in validator development
Documented uses
- Write Cardano smart-contract validators in a Python-based language.
- Evaluate a contract script in Python with a transaction ScriptContext.
- Compile a Python-source contract to UPLC.
- Use Python ecosystem tools such as linting, debugging, unit testing and property-based testing with contract development.
Requirements & limits
The project is published under the MIT license. Installation is documented through Python's pip package installer.
- Opshin supports a strict subset of Python rather than unrestricted Python.
- The documented contract workflow uses Plutus Data in JSON notation for script arguments and a ScriptContext to represent the transaction.
- The README directs developers to the Opshin Book for contract-writing instruction.
- The repository describes a deployment stage that generates artifacts, but the available instructions do not detail its steps.
Check current requirements in the official documentation. Source-based guidance does not mean OpenViST has run or independently tested this project.
Install Opshin and compile a sample validator
Install Opshin and compile the documented example contract to UPLC.
Before you start
- Python 3.9–3.13
- Basic familiarity with Python
- A terminal with pip available
Steps
Install Opshin with the command below.
python3 -m pip install opshinWrite a contract in Python, or start from an example in the repository’s
examplesdirectory.To evaluate the documented sample, run
opshin eval examples/smart_contracts/assert_sum.pywith its ScriptContext argument supplied as Plutus Data in JSON notation.Compile the sample with
opshin compile examples/smart_contracts/assert_sum.py.
Expected outcome
The sample can be evaluated through Opshin and compiled to UPLC, the Cardano smart-contract assembly.
Guide limitations
- The documented evaluation example requires a ScriptContext argument; the repository provides a long encoded sample argument, but this guide does not reproduce it.
- Evaluation is described as a way to check for obvious errors, not as a complete correctness or security verification.
- Deployment is not covered by these steps.
Build a Hello World validator and generate build artifacts
Follow the getting-started example to build a minimal validator and produce its build folder.
Before you start
- Python 3.9–3.13
- Basic familiarity with Python
- Opshin installed with pip
Steps
Create
hello_world.pycontainingfrom opshin.prelude import *anddef validator(_: ScriptContext) -> None: print("Hello world!").Run
opshin build hello_world.py.Inspect the generated
build/hello_world/folder for the listed address and script artifacts.
Expected outcome
The guide says the command creates a `build` folder containing a `hello_world` subfolder with mainnet and testnet addresses, a CBOR script, a Plutus script, and a policy ID.
Guide limitations
- The example documents artifact generation only; it does not cover deploying the contract or using the artifacts in a transaction.
- The meanings of the generated files are deferred to later documentation.
Sources & review
Source record details
- Source availability
- Active
- Sources checked
- 9 October 2026
- Original website title
- OpShin/opshin · Official homepage title · retained in its source language

