Expand description
§Puzzles
Chia coins have a puzzle, which controls how it can be spent. The solution is used as the arguments to the puzzle, and the output is a list of conditions.
A puzzle consists of multiple layers composed together.
§Layers
A layer is a subset of the logic that makes up a smart coin in Chia. They are also referred to as “inner puzzles”, and the solution can be broken up into “inner solutions” as well.
Generally, you can parse and construct the individual layers separately.
This allows them to be composed together freely. However, there are sometimes
additional restraints which limit the ways they can be mixed. For example,
the CatLayer
cannot have another CatLayer
as its inner puzzle, due to the
way it’s written. This would create an error when validating the announcements.
§P2 Puzzles
A p2 puzzle (meaning “pay to”) controls the ownership of the coin.
The simplest example of this is p2_conditions.clsp
, which requires a signature
from a single public key and outputs a list of conditions from the solution.
The “standard transaction” (which is p2_delegated_puzzle_or_hidden_puzzle.clsp
)
is a kind of p2 puzzle that adds additional flexibility. Specifically, support
for an inner puzzle, and usage of a delegated puzzle instead of directly conditions.
Generally, the p2 puzzle is the base layer in a coin’s puzzle, and everything else builds on top of it to restrict the way it can be spent or attach state.
§Primitives
A Primitive
uses one or more Layer
to parse info from a parent’s coin spend.
Generally, Layer
has the ability to parse and construct individual puzzles and solutions,
and the composed Primitive
struct can parse all of the information required to spend a coin.
The Primitive
should also provide a way to spend the coin, and other utilities necessary.
Structs§
- Action
Layer - Action
Layer Solution - Arbitrage
- Arbitrage
Side - Asset
Info - Augmented
Condition Layer - The augmented condition
Layer
allows for adding a condition to a puzzle’s output. - Cat
- Contains all information needed to spend the outer puzzles of CAT coins.
The
CatInfo
is used to construct the puzzle, but theLineageProof
is needed for the solution. - CatAsset
Info - CatInfo
- Information needed to construct the outer puzzle of a CAT.
This includes the
CatLayer
andRevocationLayer
if present. However, it does not include the inner puzzle, which must be stored separately. - CatLayer
- The CAT
Layer
enforces restrictions on the supply of a token. Specifically, unless the TAIL program is run, the supply cannot change. - CatSpend
- Catalog
Pending Spend Info - Catalog
Precommit Value - Catalog
Refund Action - Catalog
Register Action - Catalog
Registry - Catalog
Registry Constants - Catalog
Registry Info - Catalog
Registry State - Child
DidInfo - Child
NftInfo - Child
Option Info - Clawback
- Clawback
V2 - Condition
Config - Conditions
Layer - The Conditions
Layer
is a puzzle that simply returns the conditions - Conditions
Spend - Create
DidAction - Curried
Puzzle - Data
Store - Everything that is required to spend a
DataStore
coin. - Data
Store Info - Data
Store Metadata - Delegated
State Action - Delegation
Layer - The Delegation
Layer
is used to enable DataLayer delegation capabilities For more information, see CHIP-0035. - Delta
- Deltas
- DidInfo
- Information needed to construct the outer puzzle of a DID. It does not include the inner puzzle, which must be stored separately.
- DidLayer
- The DID
Layer
keeps track of metadata and handles recovery capabilities. It’s typically an inner layer of theSingletonLayer
. - DlLauncher
KvList - FeeAction
- Force1of2
Restricted Variable Memo - Fungible
Spend - Fungible
Spends - Hashed
Ptr - Inner
Puzzle Memo - Inner
Puzzle Spend - Intermediate
Launcher - An intermediate launcher is a coin that is created prior to the actual launcher coin. In this case, it automatically creates the launcher coin upon being spent.
- Issue
CatAction - Launcher
- A singleton launcher is a coin that is spent within the same block to create a singleton.
The first coin that is created is known as an “eve” singleton.
The
Launcher
type allows you to get the launcher id before committing to creating the singleton. - MOfN
Layer - Medieval
Vault Hint - Medieval
Vault Info - Melt
Singleton Action - Member
Memo - Mint
NftAction - Mint
Option Action - Mips
Memo - Mips
Memo Context - Mips
Spend - MofN
- MofN
Memo - NftAsset
Info - NftInfo
- Information needed to construct the outer puzzle of an NFT. It does not include the inner puzzle, which must be stored separately.
- NftMint
- NftOwnership
Layer - The NFT ownership
Layer
keeps track of the current DID that owns the NFT. It also contains a transfer layer, which is used to transfer ownership of the NFT. The inner puzzle layer is commonly used for determining ownership (in the key sense, not DID). - NftState
Layer - The NFT state
Layer
keeps track of the current metadata of the NFT and how to change it. It’s typically an inner layer of theSingletonLayer
. - Offer
- Offer
Amounts - Offer
Coins - OldDl
Launcher KvList - Option
Asset Info - Option
Contract Layer - The option contract
Layer
keeps track of the underlying coin and right to exercise the option. It’s typically an inner layer of theSingletonLayer
. - Option
Info - Option
Launcher - Option
Launcher Info - Option
Metadata - Option
Underlying - Oracle
Layer - The Oracle
Layer
enables anyone to spend a coin provided they pay an XCH fee to an address. It’s typically used withDelegationLayer
. - Output
- Output
Constraints - Outputs
- P2Curried
Layer - The p2 curried
Layer
allows for . - P2Delegated
BySingleton Layer - P2Delegated
Conditions Layer - The p2 delegated conditions
Layer
allows a certain key to spend the coin. To do so, a list of additional conditions is signed and passed in the solution. Typically, theStandardLayer
is used instead, since it adds more flexibility. - P2One
OfMany Layer - The p2 1 of n
Layer
allows for picking from several delegated puzzles at runtime without revealing up front. - P2Singleton
Layer - The p2 singleton
Layer
allows for requiring that a singleton be spent alongside this coin to authorize it. - Precommit
Coin - Precommit
Layer - RawPuzzle
- Ready
Option - Requested
Payments - Reserve
- Restriction
- Restriction
Memo - Revocation
Layer - The revocation
Layer
allows the issuer to revoke the asset. - Reward
Distributor - Reward
Distributor AddEntry Action - Reward
Distributor AddIncentives Action - Reward
Distributor Commit Incentives Action - Reward
Distributor Constants - Reward
Distributor Info - Reward
Distributor Initiate Payout Action - Reward
Distributor NewEpoch Action - Reward
Distributor Pending Spend Info - Reward
Distributor Remove Entry Action - Reward
Distributor Stake Action - Reward
Distributor State - Reward
Distributor Sync Action - Reward
Distributor Unstake Action - Reward
Distributor Withdraw Incentives Action - Round
Reward Info - Round
Time Info - Royalty
Info - Royalty
Transfer Layer - The royalty transfer
Layer
is used to transfer NFTs with royalties. When an NFT is transferred, a percentage of the transfer amount is paid to an address. This address can for example be the creator, or a royalty split puzzle. - RunTail
Action - Send
Action - Settle
Action - Settlement
Layer - The settlement
Layer
is used to spend coins that are part of an offer. - Settlement
Spend - Single
CatSpend - Singleton
- A generic singleton primitive, which can be extended with the
SingletonInfo
trait. - Singleton
Layer - The singleton
Layer
enforces uniqueness on a coin, which is identified by the launcher id. It contains an inner puzzle layer, which determines the actual behavior of the coin. Only one singleton can be created when the coin is spent, preserving the lineage of the asset. - Singleton
Spend - Singleton
Spends - Slot
- Spend
- Spend
Context - A wrapper around
Allocator
that caches puzzles and keeps track of a list ofCoinSpend
. It’s used to construct spend bundles in an easy and efficient way. - Spends
- Standard
Layer - The standard
Layer
is used for most coins on the Chia blockchain. It allows a single key to spend the coin by providing a delegated puzzle (for example to outputConditions
). - State
Scheduler - State
Scheduler Info - State
Scheduler Launcher Hints - State
Scheduler Layer - Stream
Layer - Stream
Puzzle1st Curry Args - Stream
Puzzle2nd Curry Args - Stream
Puzzle Solution - Streamed
Asset - Streaming
Puzzle Info - Transfer
NftBy Id - Uniqueness
Prelauncher - Unspecified
Option - Update
DidAction - Update
NftAction - Vault
Info - Verification
- Verification
Asserter - Verification
Info - Verification
LauncherKV List - Verification
Layer - Verified
Data - Versioned
Blob - Wrapper
Memo - Writer
Layer - The Writer
Layer
removes an authorized puzzle’s ability to change the list of authorized puzzles. It’s typically used withDelegationLayer
. - Xchandles
Constants - Xchandles
Expire Action - Xchandles
Expire Pricing Puzzle - Xchandles
Extend Action - Xchandles
Oracle Action - Xchandles
Pending Spend Info - Xchandles
Precommit Value - Xchandles
Refund Action - Xchandles
Register Action - Xchandles
Registry - Xchandles
Registry Info - Xchandles
Registry State - Xchandles
Update Action
Enums§
- Action
- CatMaker
- Delegated
Puzzle - Driver
Error - Finalizer
- Hint
Type - Id
- Represents either XCH, an existing CAT or singleton, or a new CAT or singleton.
- Memo
Kind - Metadata
Update - Mips
Spend Kind - Option
Type - Parsed
Member - Parsed
Restriction - Parsed
Wrapper - Puzzle
- Relation
- Restriction
Kind - Reward
Distributor Type - Singleton
Destination - Spend
Kind - Spendable
Asset - Tail
Issuance
Constants§
Traits§
- Action
Singleton - AddAsset
- Asset
- Fungible
Asset - Layer
- An individual layer in a puzzle’s hierarchy.
- Metadata
With Root Hash - Output
Set - Reserveful
- Singleton
Action - Singleton
Asset - Singleton
Info - Spend
Action - Spend
With Conditions
Functions§
- assignment_
puzzle_ announcement_ id - calculate_
nft_ royalty - calculate_
nft_ trace_ price - calculate_
royalty_ amounts - calculate_
royalty_ payments - calculate_
trade_ price_ amounts - calculate_
trade_ prices - compress_
offer - compress_
offer_ bytes - create_
security_ coin - decode_
offer - decode_
offer_ data - decompress_
offer - decompress_
offer_ bytes - encode_
offer - encode_
offer_ data - eve_
singleton_ inner_ puzzle - get_
merkle_ tree - launch_
catalog_ registry - launch_
reward_ distributor - launch_
xchandles_ registry - mips_
puzzle_ hash - new_sk
- sign_
standard_ transaction - spend_
security_ coin - spend_
settlement_ cats - spend_
settlement_ nft - zlib_
compress - zlib_
decompress
Type Aliases§
- Catalog
Registry Layers - Did
- Contains all information needed to spend the outer puzzles of DID coins.
The
DidInfo
is used to construct the puzzle, but theProof
is needed for the solution. - Medieval
Vault - Nft
- Contains all information needed to spend the outer puzzles of NFT coins.
The
NftInfo
is used to construct the puzzle, but theProof
is needed for the solution. - Option
Contract - Option
Contract Layers - Option
Delegated Puzzle - P2Delegated
OrHidden Layer - This is the actual puzzle name for the
StandardLayer
. - Push
Through Path - Reward
Distributor Layers - Standard
Data Store Layers - Standard
DidLayers - Standard
NftLayers - Vault
- Xchandles
Registry Layers