Creating a spore with Secp256k1 lock
In this walkthrough, we will get hands-on with the process of constructing and sending spore/cluster transactions on the Testnet (Aggron) by using the Secp256k1Blake160 lock for these transactions.
Ingredients:
Steps:
Step 1: Environment Setup
Directions:
Open your terminal and clone the spore-sdk repository:
git clone <https://github.com/ShookLyngs/spore-sdk.git>Navigate to your
spore-sdkdirectory (make sure to replace the pathname with yours) :
cd ~/projects/spore-sdkInstall dependencies by running the command:
pnpm iOnce installed, build your local packages with:
Your environment setup is now ready if all commands execute without errors!
Step 2: Explore the Example
Directions:
In your terminal, navigate to the Spore Secp256k1 examples directory:
You will find the example code stored in examples/secp256k1/apis. Feel free to experiment with the code.
Step 3: Construct and Send a Spore Transaction
Directions:
To create a spore on-chain, execute the apis/createSpore.ts example by running the command:
This script will construct and send a transaction to create a spore on-chain. If successful, a Transaction Hash will be returned. You can use this hash to review your transaction details on the CKB Explorer.
What's Next?
Congratulations! You've successfully constructed and sent a spore/cluster transaction on Testnet (Aggron) and used the Secp256k1Blake160 lock for your transactions. Use these Spore examples as a starting point to further explore and develop with the Spore SDK. Keep experimenting!
(Optional) Customize Configurations
Ingredients:
Terminal
Spore Secp256k1 example
Your testing accounts (optional)
Directions:
If you wish to use your testing accounts or modify the SporeConfig of the examples, you can do so in the examples/secp256k1/utils/config.ts file:
(Optional) Use Your Own Accounts
Ingredients:
Terminal
Spore Secp256k1 example
Generator Tool website
Nervos Faucet website
Directions:
If you prefer to start with a clean environment for testing, you can replace the default testing private keys with your own in the examples/secp256k1/utils/config.ts file:
To generate a new private key for testing, open the Generator Tool website, click the refresh icon to generate a new account, and copy the generated account's
Private Key (256-bit)from thePrivate/Public Keyblock. Replace one of the default testing private keys in theexamples/secp256k1/utils/config.tsfile with this new key.To claim faucet for your new account, copy the generated account's
Nervos CKB Addressfrom theDefault Lock (Secp256k1-Blake160) - Testnetblock, open the Nervos Faucet website, paste the address into the address input, and click theClaimbutton. Wait for the faucet process to complete.
Last updated