Basic Operations
The operations of Spore encompass three fundamental types: mint, transfer, and destroy.
It is important to follow these rules when operating:
- An operation is a transaction that adhere to specific rules defined by Spore protocol;
- The same Spore should not undergo more than one operation in a single transaction. For example, performing both transfer and destroy operation on a spore in a single transaction is not allowed;
- Each operation must include the rules governing the Input Cell, Output Cell, and CellDeps fields of a transaction.
Mint
Minting consumes capacities from inputs, thus establishing the direct relationship between Spore’s content and the intrinsic value.
Think of minting as filling a container by “transferring” capacity into it and locking it. This action declares the capacity and occupies the space. The extra capacity can be unlocked later and serve any purpose, which is the mechanism that enables zero-fee transactions.
A mint operation creates a new spore. It must follow:
- There shall be a spore cell in the Outputs;
- The spore cell in rule 1 shall not be in the Inputs;
- The type args of the spore cell in rule 1 shall follow the TypeID rules;
If a spore cell’s cluster_id
was set during minting, the operation should follow these additional rules:
- The referenced cluster with the target
cluster_id
must exists in CellDeps; - The transaction should include an ownership proof of the referenced cluster. Valid proofs can be either of the following:
- Existence in Inputs and Outputs of the referenced cluster;
- Existence in Inputs of a cell with the same lock script to the referenced cluster;
Transfer
The transfer operation can be think of as "refresh." It involves consuming a spore cell and creating another with the same Spore ID, ensuring all fields remain unchanged.
This process does not result in any extra fees since the expenses are deducted from the cell's capacity.
To execute a transfer operation successfully, the following conditions must be satisfied:
- There shall be a spore cell in the Inputs.
- The spore cell in rule 1 shall be unlockable.
- The spore cell in rule 1 shall be in the Outputs.
Additionally, it's important to note that a transfer operation modifies the lock script of a spore, particularly when dealing with dynamic content. Changes to parameters, such as block number and height, may influence the resulting output.
Destroy
The destroy operation is like undoing the creation, consuming a specific spore cell and returning the capacity it held.
It must follow:
- There shall be a spore cell in the Inputs;
- The spore cell in rule 1 shall exclude the
immortal=true
parameter in thecontent-type
field. - The spore cell in rule 1 shall not be in the Outputs;