# 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**:

* [ ] Node.js version 18.0.0 or above
* [ ] PNPM version 8.0.0 or above
* [ ] Terminal
* [ ] spore-sdk repository

## Steps:

### **Step 1: Environment Setup**

**Directions:**

1. Open your terminal and clone the spore-sdk repository:

```bash
git clone <https://github.com/ShookLyngs/spore-sdk.git>
```

2. Navigate to your **`spore-sdk`** directory (make sure to replace the pathname with yours) :

```bash
cd ~/projects/spore-sdk
```

3. Install dependencies by running the command:

```bash
pnpm i
```

4. Once installed, build your local packages with:

```bash
pnpm run build:packages
```

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:

```bash
cd examples/secp256k1
```

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:

```bash
ts-node apis/createSpore.ts
```

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!

***

<details>

<summary>(Optional) Customize Configurations</summary>

**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:

```javascript
// Inside utils/config.ts

export const defaultSporeConfig: SporeConfig = {
  /* Your custom SporeConfig */
};

export const accounts: string[] = [
  /* Your private keys */
];
```

</details>

<details>

<summary>(Optional) Use Your Own Accounts</summary>

**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:

```jsx
// Inside utils/config.ts

export const accounts: string[] = [
  /* Your private keys */
];
```

1. 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 the **`Private/Public Key`** block. Replace one of the default testing private keys in the **`examples/secp256k1/utils/config.ts`** file with this new key.
2. To claim faucet for your new account, copy the generated account's **`Nervos CKB Address`** from the **`Default Lock (Secp256k1-Blake160) - Testnet`** block, open the Nervos Faucet website, paste the address into the address input, and click the **`Claim`** button. Wait for the faucet process to complete.

</details>

{% hint style="info" %}
**Your Feedback Matters!**

Get in touch by:

* Email: <contact@spore.pro>
* Submitting an [issue](https://github.com/sporeprotocol/spore-sdk/issues) on GitHub
  {% endhint %}
