Skip to main content

Transfer Cluster

In this recipe, you will learn how to transfer ownership of a cluster using the spore-sdk. Owning a cluster doesn’t grant ownership of the spores associated with that cluster.

Transfer a Cluster

You can execute a transfer using the transferCluster API from spore-sdk:

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

let { txSkeleton } = await transferCluster({
outPoint: {
txHash: '0x<transaction_hash>',
index: '0x0',
},
toLock: RECEIVER_LOCK_SCRIPT,
});
  • outPoint - Specifies the target cluster for the transfer, identified by its transaction hash and index.
  • toLock - The lock script of the new owner/recipient of the cluster.

Extras

Code example

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

Here's a code example for how to transfer a cluster with CKB default lock:

transferCluster.ts
Transfer a Cluster
https://github.com/sporeprotocol/spore-sdk/blob/beta/examples/secp256k1/apis/transferCluster.ts