-
Notifications
You must be signed in to change notification settings - Fork 2k
ChiaLisp
The official documentation is here
Additional notes may appear in the wiki and merged into official documentation later.
The softfork
operator takes at least one parameter cost
. So (softfork cost arg_1 ... arg_n)
.
At the moment, softfork
always returns 0
(aka ()
or nil), and takes cost
amount of cost.
At first glance, it seems pretty useless since it doesn't do anything, and just wastes cost doing it.
The idea is, after a soft fork, the meaning of the arguments may change. In fact, we can hide completely new dialects of ChiaLisp inside here, that has new operators that calculate new things.
For example, suppose we want to add secp256k1
operators like +s
for adding two points on this ECDSA curve for bitcoin compatibility. We can't just do this in vanilla clvm because that would make a program (+s p1 p2)
return different values before and after the soft fork. So instead we hide it under softfork
.
(mod (cost p1 p2 p3 p4) (softfork cost 1 (assert (= (+s p1 p2) (+s p3 p4)))))
Pre-softfork, this always passes and returns ()
at a cost of COST
(plus a bit of overhead).
Post-softfork, this also returns ()
at a cost of COST
... but may also fail if p1 + p2 ≠ p3 + p4
! We can't export the sum outside the softfork
boundary, but we can calculate the sum and compare it to another thing inside.
One more thing -- we take the cost of running the program inside the softfork
boundary and ensure it exactly matches COST
, and raise an exception if it's wrong. That way, the program really does have the same cost pre and post-softfork (or it fails post-softfork).
Chia Network - Green money for a digital world.
- Home
- Beginners Guide
- Install instructions
- Quick Start Guide
- FAQ - Frequently Asked Questions
- Pooling FAQ
- Pooling User Guide
- Chia Project FAQ
- Plotting Basics
- Alternate Plotters
- Plot Sizes (k-sizes)
- CLI Commands Reference
- Windows Tips & Tricks
- How to Check if Everything is Working (or Not)
- SSD Endurance - Info on SSD's and plotting
- Reference Plotting Hardware
- Reference Farming Hardware
- Farming on Many Machines
- Good Security Practices on Many Machines
- Chialisp Documentation (Official)
- How to Connect to Testnet
- Timelords and Cluster Timelords
- Release Notes
- RPC Interfaces
- Resolve Sync Issues - Port 8444