Run with React

This tutorial walks you through setting up and running a local blockchain with a single block producer using the XYO Layer One Protocol. You’ll use a React-based sample app, connect it to a test wallet, and simulate transactions using locally generated test tokens. This setup is fully self-contained and requires no access to an external testnet.

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:

Terminal #1: Run the Sample Website

Clone the Sample Repository

command
git clone https://github.com/XYOracleNetwork/xl1-samples-react.git
cd xl1-samples-react

Install Dependencies

Start the React Sample

This launches a sample website, usually on http://localhost:3000, unless that port is already in use.

circle-info

If you see a red alert regarding the "XYO Client", you can still continue with no issue! This alert is used to inform developers who are looking to debug the sample or dive into the details of the code.

Terminal 2: Run the Local Blockchain Producer

In a new terminal window, start the local blockchain producer.

If you are not in the sample already, be sure to run cd xl1-samples-react to get your second terminal into the correct repository with before attempting to start the blockchain producer.

Once you're inside the repository, run the following command:

This command does 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)

Example output:

circle-exclamation

After this, you'll see the following in the sample website:

Congrats on starting your pre-funded test wallet! As you can see above, your next step will be setting up your XYO Layer One (XL1) Wallet!

You can also click the "Done" button on any of the steps to remove the alerts for the steps you've already completed.

Connect the Pre-Funded Test Wallet

1. Install the XL1 Wallet Extension

Install the Chrome extension from the Web Store: XL1 Wallet - Chrome Extensionarrow-up-right

circle-exclamation

2. Import the Seed Phrase

Copy the mnemonic (seed phrase) from your terminal and paste it into the XL1 Wallet. This links the extension to your local blockchain identity.

Want a walkthrough on importing or replacing a seed phrase? See this guide.

circle-exclamation

Once your wallet has been imported, you should see XL1 Tokens appear in the "Localhost" version of your test wallet. It will look something like this:

The sample website will also update, recognizing that your wallet is detected and ready to make a test transaction.

Initiate a Test Transaction

Now, click the “Submit Transaction” button!

When you click the “Submit Transaction” button in the sample app, it triggers the following process:

  1. The Wallet creates and signs the transaction.

  2. The signed transaction is submitted to your local producer, which is already running in Terminal #2.

  3. The local producer includes the transaction in a newly created block.

  4. This block is then added to the blockchain and viewable via the Explorer.

The XL1 Wallet will pop up and request your approval to sign the transaction using the private key derived from your imported seed phrase.

Preview Transaction

Once you click “Authorize”, your transaction will be attempted. You'll see a preview of the payloads you're including in your transaction.

You may notice two generated icons for "On-Chain Payloads" and another two in "Referenced Payloads". These icons are generated from the unique payload and are a visual representation of a payload, similar to the generated purple and yellow icon representing my wallet address. This means that no two will ever be exactly the same! The XYO Team uses Blockiesarrow-up-right to generate the wallet address avatar, and identicons for payloads.

You can use the "info" icon button to see the JSON of each payload.

Click "Approve" to attempt the transaction. If successful, you’ll see a success alert in the wallet UI.

Successful Transaction

After a short period of loading, a successful transaction will look like this:

triangle-exclamation

If your transaction failed, please let us know! We'd love to learn more about the bug you experienced. You can report the bug herearrow-up-right.

Follow the instructions below to view your transaction.

View your Transaction on Explorer

Once your transaction is complete, you can view it on Explore! Use the “View Transaction” link shown on the sample website interface after submitting. This opens the Explore UI connected to your local chain.

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)

Last updated