Skip to main content

Python implementation of untyped plutus language core

Project description

Untyped Plutus Language Core

CI/CD PyPI version PyPI - Python Version PyPI - Status Coverage Status

This is a basic library to support creating and manipulating programs written in UPLC.

Installation

Install Python 3.9 or higher and make sure you have pip installed. Then run

pip install uplc

Secp256k1

If you want to use the builtin functions for verification of ECDSA and Schnorr signatures, follow the instructions to install libsecp256k1 with schnorr support enabled. We provide a script to do this for you on Linux and MacOS.

curl -sSL https://raw.githubusercontent.com/OpShin/uplc/refs/heads/master/install_secp256k1.sh | bash

This makes sure that the exact same version is used that is used in the cardano-node. Then, install the python bindings for secp256k1 with

pip install python-secp256k1-cardano

Usage

This tool may be used to parse, reformat (/dump), evaluate or build contract artifacts from UPLC code.

# Check validity of a source file
uplc parse examples/fibonacci.uplc

# Dump a source file in either the official plutus or legacy aiken dialect
uplc dump examples/fibonacci.uplc --dialect plutus --unique-varnames
uplc dump examples/fibonacci.uplc --dialect legacy-aiken

# Evaluate a UPLC program on UPLC input
uplc eval examples/fibonacci.uplc "(con integer 5)"

# Build smart contract artifacts from the UPLC program
uplc build examples/fibonacci.uplc

# This package can also be used to analyze built contracts (output from any Smart Contract Language)
uplc dump build/fibonacci/script.cbor --from-cbor

# You can also apply additional parameters to a script using the build command
uplc build script.cbor --from-cbor "(con integer 5)"

# Show all options
uplc --help

Running tests

To run the testsuite of UPLC, use pytest.

pytest

Scope and Contributions

This is a side product of the development of a pythonic smart contract language for the Cardano blockchain and hence much tailored to the needs of that development.

Most likely it can do what you would like to do but its not properly documented. Please do reach out via Discord or GitHub issue if you think this tool could be of use to you.

Contributions are very welcome.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

uplc-1.3.2.tar.gz (44.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

uplc-1.3.2-py3-none-any.whl (53.0 kB view details)

Uploaded Python 3

File details

Details for the file uplc-1.3.2.tar.gz.

File metadata

  • Download URL: uplc-1.3.2.tar.gz
  • Upload date:
  • Size: 44.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.5

File hashes

Hashes for uplc-1.3.2.tar.gz
Algorithm Hash digest
SHA256 3dce3badd2ba14edc41d43471f9c82de83bfe0ad05abad93fa5b9e6507e7e7d8
MD5 912d0b1cd6f661b9085680cc3bf5de78
BLAKE2b-256 40d49ca692693c9f48b6d6c31c99108079097811e2d4df8df480fb8535ec418a

See more details on using hashes here.

File details

Details for the file uplc-1.3.2-py3-none-any.whl.

File metadata

  • Download URL: uplc-1.3.2-py3-none-any.whl
  • Upload date:
  • Size: 53.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.5

File hashes

Hashes for uplc-1.3.2-py3-none-any.whl
Algorithm Hash digest
SHA256 b3bf38762c99fbb51bc855f7f257d13579a064fb74be560c166452e5a296eff9
MD5 4ae10eac8bb83f3c80c6f574f88f0bed
BLAKE2b-256 281864c1521e6f616ff847b8babaf2d3023ddbbdbc57f6695bb179ade8e0e0d1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page