Creating your first spore from scratch

This step-by-step guide will help you create your first spore on CKB testnet using the SDK of Spore Protocol. To follow along, you should be familiar with basic typescript and know how to install and configure Node.js dev environment.

Ingredients

Make sure you have the following ingredients ready:

Tools You Need

Project Ingredients

Gather Your Ingredients

1. Create a CKB Address

Method 1

You can use this generator tool to create a CKB testnet address.

Method 2

You can explore your options in the land of CKB Wallets.

Method 3

To create an account via ckb-cli, you need use a testnet RPC node, make sure you have git and cargo installed. Then, in your terminal, run the following commands to install ckb-cli:

Create a CKB account

Get your private key with the follow command by replacing <lock-arg> with your lock_arg ☝ and <extended-privkey-path> with where you want the key to be stored on your device. We’ll need it later when constructing the transaction.

The output will give you 2 strings, the top one will be your private key.

For a more detailed guide on ckb-cli setup and interaction, take a peek at the ckb-cli GitHub.

2. Get Some CKBytes

You'll need to reserve some CKBytes to mint your spore on-chain,

  1. Head over to the faucet

  2. Input your CKB Testnet Address for some testnet tokens

3. Select Digital Content

Choose your digital ingredient – an image, video, text or something else. Check and note down the MIME type of your content (e.g., image/png). Just keep it under 500KB for a successful mint.


Now that we've created a testnet wallet, filled it with test CKBytes and a file ready to rock on the blockchain, we are ready to do some action.

Let's craft your first spore by following these steps:

Step 1: Set Up the Project

We'll use yarn as the package manager.

  1. Create a project folder (e.g., my-spore-project) and navigate into it.

  1. Initialize your project with yarn:

  1. Install required packages:

  1. Create an index.ts file in your project's root folder.

Step 2: Mix in the Ingredients

Copy and edit the following code into your index.ts file, make sure to add your private key in line 107, specify the content type and filename:

Step 3: Send Your Spore On-chain!

  1. Save the changes to your index.ts file.

  2. Run the Script

  1. Check your transaction on https://pudge.explorer.nervos.org by searching for your transaction hash to see the transaction details and your Spore cell.

In this tutorial, you learned how to:

  1. Create a CKB address and obtain CKBytes tokens.

  2. Set up your project with Spore Protocol SDK.

  3. Mint your spore on-chain and verify the transaction.

Last updated

Was this helpful?