[Contract Language | Chialisp] Virtual Machine
Project description
This is the in-development version of a LISP-like language for encumbering and releasing funds with smart-contract capabilities.
See docs/clvm.org for more info.
Testing
$ pip install -e '.[dev]'
$ py.test tests
Example
Here's an example on how to create a script and invoke it from python.
$ python
>>> from clvm import to_sexp_f, run_program, KEYWORD_TO_ATOM
>>> program = to_sexp_f([KEYWORD_TO_ATOM["q"], 100]) # (q 100)
>>> args = to_sexp_f([])
>>> r = run_program(program, args)
>>> print(r.listp())
False
>>> print(r.as_int())
100
>>>
>>> program = to_sexp_f([KEYWORD_TO_ATOM["+"], [KEYWORD_TO_ATOM["q"], 500], \
... [KEYWORD_TO_ATOM["f"], [KEYWORD_TO_ATOM["a"]]]]) # (+ (q 500) (f (a)))
>>> args = to_sexp_f([25]) # (25)
>>> r = run_program(program, args)
>>> print(r.listp())
False
>>> print(r.as_int())
525
>>>
>>> program = to_sexp_f([KEYWORD_TO_ATOM["c"], \
... [KEYWORD_TO_ATOM["f"], [KEYWORD_TO_ATOM["r"], [KEYWORD_TO_ATOM["a"]]]], \
... [KEYWORD_TO_ATOM["f"], [KEYWORD_TO_ATOM["a"]]]]) # (c (f (r (a))) (f (a)))
>>> args = to_sexp_f([45, 55])
>>> r = run_program(program, args)
>>> print(r.listp())
True
>>> print(r.first().as_int())
55
>>> print(r.rest().as_int())
45
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
clvm-0.5.2-py3-none-any.whl
(14.1 kB
view hashes)