OpenViSTAI · Agents · Blockchain · Crypto
Menu
Developer Tools

Opshin

Opshin is an open-source programming language and compiler for writing Cardano smart contracts in a strict subset of Python. Its command-line tool can evaluate scripts using Python and compile them to UPLC, Cardano smart-contract assembly.

Independent OpenViST project profile, based on linked sources.

Opshin — OpenViST project profile in Developer Tools.
OpenViST project illustration. See the linked sources for product details.
Understand the project

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.
Before you choose

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.

Source-based practical guide

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

  1. Install Opshin with the command below.

    Documented command
    python3 -m pip install opshin
  2. Write a contract in Python, or start from an example in the repository’s examples directory.

  3. To evaluate the documented sample, run opshin eval examples/smart_contracts/assert_sum.py with its ScriptContext argument supplied as Plutus Data in JSON notation.

  4. 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.
Source-based practical guide

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

  1. Create hello_world.py containing from opshin.prelude import * and def validator(_: ScriptContext) -> None: print("Hello world!").

  2. Run opshin build hello_world.py.

  3. 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.
Evidence and transparency

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