What is OpShin?
OpShin is a new programming language and toolchain for developing
smart contracts on the Cardano blockchain. It is focusing on accessability and
OpShin is 100% valid Python 3. In this way it can seamlessly integrate
with off-chain tools built in Python such as PyCardano.
It can also leverage the existing testing frameworks and IDEs
and allows developers to re-use knowledge or focus on attaining
knowledge about a simple and general purpose language.
Why build another smart contract language?
Haskell is hard and almost no developer is used to it.
On the other hand, Python is praised for its simplicity and
used in almost 25% of all projects on the internet (compare that to roughly 0.65% for Haskell).
So the ecosystem for Python is huge and full of interesting tools
that leverage the developer experience.
The toolchain based on python can leverage these tools
to provide a safe and enjoyable developer experience.
Is Python the right language for smart contracts? It's not even type safe right?
We chose Python because it is simple and intuitive.
This is a great basis to improve security of contracts -
if they are easy to read and understand, a larger group of people can interpret them.
To combat the problems that come with dynamically typed languages,
OpShin enforces a strict type system on top of Python, similar to the Haskell type system.
Hence, you enjoy the simplicy of Python programming and the safety of properly typed code.
I thought Cardano smart contracts had to be written in Haskell?
This is a common misconception. The current Cardano node implementation
does indeed happen to be written in Haskell. The virtual machine for
executing smart contracts that comes baked into the node is also
implemented in Haskell. But that does not mean that it is Haskell which
is executed by the smart contract virtual machine.
The virtual machine is a language interpreter which executes a
smart contract language called 'Untyped Plutus Core' (abbrev.
UPLC) often referred to simply as 'Plutus'.
Yet UPLC isn't something developers are expected to write by hand.
Instead, it is a compilation target (like WebAssembly for the world wide
web). Oddly enough, until recently, the only established framework that
produced UPLC from a high-level syntax was called 'Plutus-Tx' and
happened to be a Haskell framework.
OpShin changes the game by introducing a new framework that compiles
straight to UPLC.
Can I write off-chain/backend code with OpShin?
No, but you can use the off-chain library PyCardano
with which OpShin is closely integrated!
In PyCardano, you can natively import and handle the functions and classes you defined for your contract -
this lets you build off-chain code that matches the contract frictionless.
The OpShin Starter Kit provides a practical example
on how to use PyCardano and OpShin in symbiosis.