# Run with Node.js

This tutorial walks you through setting up and **running a local blockchain with a single block producer** using the XYO Layer One Protocol. This guide will have you use the command line to create and pre-fund a test wallet, run a block producer, and simulate transactions using locally generated test tokens. *This setup is fully self-contained and requires no access to the external testnet, "Sequence".*

It’s a great starting point for developers looking to:

* Explore how XL1 handles smart contract interactions
* Understand the local development experience before deploying to public infrastructure
* Test without spending real tokens or revealing production credentials

### Prerequisites

Before you begin, make sure you have the following installed:

* **Node.js version 22 or higher**
* **Google Chrome browser**
  * [Download Google Chrome](https://www.google.com/chrome/) if needed
* **Yarn**
* **Basic knowledge of Terminal / Command Line**

### Run the Sample

#### Clone the Sample Repository

{% code title="command" %}

```bash
git clone https://github.com/XYOracleNetwork/xl1-samples-nodejs
cd xl1-samples-nodejs
```

{% endcode %}

#### Install Dependencies

{% code title="command" %}

```bash
yarn install
```

{% endcode %}

#### Start the Sample

{% code title="command" %}

```bash
yarn runner
```

{% endcode %}

This command immediately triggers two important things:

* It launches a local blockchain with a single block producer
* It generates a unique test wallet and outputs a seed phrase (mnemonic)

&#x20;It will output something that looks like the following:

<figure><img src="/files/I5ntbHkj27JWrrp9C3GL" alt=""><figcaption></figcaption></figure>

The next section will say something like the following:

<figure><img src="/files/JFYjckVNDqe0De4hdG8n" alt=""><figcaption></figcaption></figure>

This is the genesis block is the first block your block producer is creating. Once it is created, you've created your own fully local and sovereign XYO Layer One Blockchain! This genesis block also gives your producer wallet address the initial block reward for starting the chain, **which becomes the tokens you can spend for transactions.**

{% hint style="info" %}
Any blocks you create will not be on the Testnet "Sequence", but instead on your local blockchain.
{% endhint %}

Once your block producer is ready, your first transaction occurs:

<figure><img src="/files/rATrBxjY3UifPuwtvW3t" alt=""><figcaption></figcaption></figure>

### Complete a Test Transaction

A transaction is created for you, is added to a created block, and is added to your blockchain.&#x20;

The process goes:

1. The Wallet creates and signs the transaction.
2. The signed transaction is submitted to your local producer, which is already running.
3. The local producer includes the transaction in a newly created block.
4. This block is then added to your new local XYO Layer One Blockchain and viewable via the Explorer.

You may see a few attempts at this stage, like the example below:

<figure><img src="/files/NJVU7VnECKoLog9r46pt" alt=""><figcaption></figcaption></figure>

#### Successful Transaction

Once the transaction is successful, you can view it on Explore using the link provided in the command line.

You’ll be able to:

* View the transaction hash
* See your wallet address as the sender
* Confirm the signature
* Verify the block ID that includes your transaction
* Optionally see reward-related metadata (even if reward = 0)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.xyo.network/developers/how-to-request-xl1-testnet-tokens-1/introduction-1.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
