Getting Started with Opshin
Prequisites
This guide tries to assume as little knowledge as possible but there are certain assumptions:
- You should understand Python. Opshin is basically Python so we assume some basic knowledge of Python.
Installation
Install Python 3.8
, 3.9
, 3.10
or 3.11
.
Then run:
python3 -m pip install opshin
Compiling Opshin Code
-
Make a file called
hello_world.py
and copy:# hello_world.py def validator(_: None) -> None: print("Hello world!")
-
Run this command:
$ opshin build hello_world.py
This should create a
build
folder in the current directory. Thebuild
folder should look like this:build/ └-hello_world/ ├-mainnet.addr ├-script.cbor ├-script.plutus ├-script.policy_id └-testnet.addr
We'll cover what all these files in the
hello_world
sub-folder mean later in the book.
Compatibility
All OpShin versions are tightly tied to specific versions of PyCardano. Due to a change of the default value of constructor ids, all OpShin versions < 0.20.0
are only compatible with PyCardano < 0.10.0
.
All versions >= 0.20.0
are only compatible with PyCardano >= 0.10.0
.