Skip to main content

Transfer Spore

In this recipe, you will learn how to transfer a spore to another owner. This process allows you to change the ownership of a spore.

Transfer a Spore

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

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

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

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 spore with CKB default lock:

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