This is the in-development version of a LISP-like language for encumbering and releasing funds with smart-contract capabilities.
See docs/clvm.org or https://chialisp.com/ for more info.
$ pip install -e '.[dev]'
$ py.test tests
[Contract Language|Chia Lisp] Virtual Machine
License: Apache License 2.0
This is the in-development version of a LISP-like language for encumbering and releasing funds with smart-contract capabilities.
See docs/clvm.org or https://chialisp.com/ for more info.
$ pip install -e '.[dev]'
$ py.test tests
Example:
https://chialisp.com/docs/
brun '(a (i (q . 0) (q (x (q 1337) )) (q . 1)))'
gives:
FAIL: apply requires exactly 2 parameters (q)
I am trying to build an RPM from this but see no tar.gz file on pypi. Can you please upload the source tarball to pypi ?
warning: Downloading https://pypi.io/packages/source/c/clvm/clvm-0.9.6.tar.gz
curl: (22) The requested URL returned error: 404
error: Couldn't download https://pypi.io/packages/source/c/clvm/clvm-0.9.6.tar.gz
https://pypi.org/project/clvm/#files only shows a .whl file.
$python3 setup.py --help-commands | grep sdist
sdist create a source distribution (tarball, zip file, etc.)
so if you can first generate this sdist tar ball then upload it
In our workflow, we are using pep517.build
(which is deprecated) to build the wheel:
clvm/.github/workflows/publish-to-test-pypi.yml
Lines 32 to 44 in 26bb83c
pip install build
, and thenpython -m build --outdir dist/ .
, this should provide the sdist and the wheel to publish to pypi.Please add a version number in the setup() block in the setup.py file. This fixed issues when installed showing site-packages with -0.0.0- instead of -0.9.6- for the version.
setup(
name="clvm",
+ version="0.9.6",
packages=["clvm",],
author="Chia Network, Inc.",
from clvm import SExp
print(SExp.true) # This prints '01'
s1 = SExp.to((1, SExp.true))
s1.pair[1].atom = b'\2'
print(SExp.true) # This prints '02'
Probably should protect property by getter/setter.
Currently in clvm/more_ops.py
,
def op_not(args: SExp):
(i0,) = args_as_bool_list("not", args, 1)
if i0.as_atom() == b"":
r = args.true
else:
r = args.false
cost = BOOL_BASE_COST
return cost, args.to(r)
It seems if args is not an atom
, not_op
returns false and never raises EvalError.
Is this correct behaviour?
Given the following file: passwordprotect.clsp
:
(mod (
password_hash
password
receive_puzzlehash
transaction_amount
)
(defconstant CREATE_COIN 51)
(if (= (sha256 password) password_hash)
; true - password was correct
(list
(list CREATE_COIN receive_puzzlehash transaction_amount)
)
; false - password was incorrect
(x "Bad password")
)
)
brun throws an error on my machine (windows 10, powershell:
brun '(a (q 2 (i (= (sha256 11) 5) (q 4 (c 2 (c 23 (c 47 ()))) ()) (q 8 (q . "Bad password"))) 1) (c (q . 51) 1))' "(0x9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08 test 0xa11ce 1000)"
same brun command works on another machine (in the video tutorial and for another community member) :
File "/usr/local/lib/python3.8/unittest/loader.py", line 205, in loadTestsFromName
test = obj()
TypeError: run_program() missing 3 required positional arguments: 'program', 'args', and 'operator_lookup'
Are tests not wired/written for setup.py yet?
I noticed that if you have a parenthesis inside a quote in causes undefined behavior and the parenthesis is treated as if it is not inside a quote.
Example:
(if (> 10 5) ")" "(")
Causes output 41 when it should be ")"
kiss@oasis ~ % python -m timeit 'A = 74738383914845; B = 83717484' "A//B"
10000000 loops, best of 3: 0.0522 usec per loop
kiss@oasis ~ % python -m timeit 'A = 74738383914845; B = 83717484' "A%B"
10000000 loops, best of 3: 0.0512 usec per loop
kiss@oasis ~ % python -m timeit 'A = 74738383914845; B = 83717484' "(A//B, A%B)"
10000000 loops, best of 3: 0.117 usec per loop
kiss@oasis ~ % python -m timeit 'A = 74738383914845; B = 83717484' "divmod(A,B)"
10000000 loops, best of 3: 0.166 usec per loop
kiss@oasis ~ % python -m timeit 'A = 74738383914845; B = 83717484' "Q = A//B; (Q, A - B * Q)"
10000000 loops, best of 3: 0.104 usec per loop
Is there a way to generate safe random number securely in Chialisp?
Can this functionality be implemented based on VDF?
int_to_bytes
at casts.py
seems adding extra byte.
def int_to_bytes(v):
byte_count = (v.bit_length() + 8) >> 3 # Should be (v.bit_length() + 7) >> 3
if v == 0:
return b""
r = v.to_bytes(byte_count, "big", signed=True)
# make sure the string returned is minimal
# ie. no leading 00 or ff bytes that are unnecessary
while len(r) > 1 and r[0] == (0xFF if r[1] & 0x80 else 0):
r = r[1:]
return r
Because of the above implementation, str(SExp.to(131))
returns 820083
as a serialized value, where 8183
is more byte-efficient.
(integer 131 is represented 83
as a hex string. Cleary this is 1-byte value.)
More directly, int_to_bytes(131) == b'\x00\x83'
where b'\x83'
is more byte-efficient
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.