Skip to main content

Melt Spore

In this recipe, you will learn how to melt a spore back into its locked up CKBytes.

caution

Immortal spores cannot be melted.

Melt a Spore

You can melt a regular spore using the meltSpore API from spore-sdk:

import { meltSpore } from '@spore-sdk/core';

let { txSkeleton } = await meltSpore({
outPoint: {
txHash: '0x76cede56c91f8531df0e3084b3127686c485d08ad8e86ea948417094f3f023f9',
index: '0x0',
},
changeAddress: CHANGE_ADDRESS,
});
  • outPoint - Specifies the spore you want to melt, identified by its transaction hash and index.
  • changeAddress - Specifies the destination address for receiving the capacity released from a melted spore. If not specified, the capacity will be returned to the spore's owner.

Extras

Code example

For a valid on-chain transaction, you'll need to sign the transaction skeleton and send it to the chain.

Here's a code example for how to melt a spore using CKB default lock:

meltSpore.ts
Melt an on-chain Spore
https://github.com/sporeprotocol/spore-sdk/blob/beta/examples/secp256k1/apis/meltSpore.ts