> For the complete documentation index, see [llms.txt](https://l1x-sdk.gitbook.io/l1x-master-sdk/ubTvs7ITP4emn1uocqF8/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://l1x-sdk.gitbook.io/l1x-master-sdk/ubTvs7ITP4emn1uocqF8/l1x-documentation/setup-l1x-development-environment.md).

# Setup L1X Development Environment

Check the Video version of the Setup

[Link to the Video](https://l1x.vids.io/videos/4d90d2bd131de5c7c4/l1x-development-environment-setup)

Before you start using L1X SDE, make sure you have the following prerequisites installed on your system:

**Note: The current version of L1X SDE is compatible with the following Host OS: Linux | MacOS | Windows (WSL2)**

* **Rust and Cargo**
  * You can follow the installation guide: <https://doc.rust-lang.org/cargo/getting-started/installation.html> to install Rust and Cargo.
  * To install Rust and Cargo, run the command below in your terminal:

    ```
    curl https://sh.rustup.rs -sSf | sh
    ```
* **ProtoBuff**

  &#x20;   `sudo apt-get install protobuf`
* **Devbox**
  * Devbox is required for using L1X SDE. You can find the installation guide: <https://www.jetpack.io/devbox/docs/quickstart/> to set up Devbox.
  * To install Devbox, run the command below in your terminal:

    ```
    curl -fsSL https://get.jetpack.io/devbox | bash
    ```
  * Devbox also needs the Nix Package Manager. If your system doesn't have Nix installed, Devbox will automatically install it for you with the default settings for your operating system.
* **Docker Engine & docker-compose**
  * Docker Engine & `docker-compose` is essential for running **L1X SDE Local Devnet**. You can follow the installation guide: <https://docs.docker.com/engine/install/> to set up Docker Engine & docker-compose <https://docs.docker.com/compose/install/> on your system.
  * Additionally, ensure that you can run the Docker daemon as a non-root user by adding user to Docker group.
    * Create a docker group if there isn’t one:

      ```
      sudo groupadd docker
      ```
    * Add your user to the docker group:

      ```
      sudo usermod -aG docker $USER
      ```
    * Log out and log back in so that your group membership is re-evaluated.
  * To verify Docker installation, run the command below in your terminal:

    ```
    $ docker run --rm hello-world
    ```

    If Docker is installed correctly, you should see a message confirming that the installation is working.

    ```
     Hello from Docker!

     This message shows that your installation appears to be working correctly ...
    ```
* **l1x-forge**
  * `l1x-forge` is a smart SDE command-line utility that streamlines L1X smart contract development. You can install it using the command:

    ```
    cargo install --locked --git https://github.com/L1X-Foundation-VM/l1x-cargo-sde-tools
    ```
  * To upgrade the `l1x sde` binary, use this command:

    ```
    cargo install --locked --force --git https://github.com/L1X-Foundation-VM/l1x-cargo-sde-tools
    ```
  * The `l1x-forge` tool is installed to `$CARGO_HOME/bin`. Make sure to update your system's `PATH` environment settings:

    ```
    PATH=$CARGO_HOME/bin:$PATH
    ```

#### **Step 1: Setting Up Your Environment**

* 1.1. Create an empty folder for this demonstration.

  ```
  mkdir -p $HOME/l1x-home/l1x-sde-demo
  ```
* 1.2. Change your current directory to the newly created folder.

  ```
  cd $HOME/l1x-home/l1x-sde-demo
  ```

#### **Step 2: Checking the L1X Tool**

* 2.1. Ensure that the `l1x-forge` tool is accessible from your command line. And run the following command to see usage instructions for the tool:

```
l1x-forge --help

Usage: l1x-forge <COMMAND>

Commands:
  new   Create a new project workspace from a template.
  help  Print this message or the help of the given subcommand(s)

Options:
  -h, --help  Print help
```

* 2.2. Now, let's take a look at the official supported templates available. Run the following command:

```
l1x-forge new --name demo01-ft --template hello

Supported Templates ...
l1x-cross-chain-swap :: https://github.com/L1X-Foundation-VM/l1x-templ-cross-chain-swap.git
l1x-nft :: https://github.com/L1X-Foundation-VM/l1x-templ-nft.git
l1x-ft :: https://github.com/L1X-Foundation-VM/l1x-templ-ft.git
Template 'hello' not found:
```

#### **Step 3: Creating Your Smart Contract Workspace**

* 3.1. Use the `l1x-forge` command to create a new project workspace. Here, we'll name it "demo01\_ft" and use the template "l1x-ft":

  ```
  l1x-forge new --name demo01_ft --template l1x-ft
  ```
* 3.2. After executing the command, you'll see a message confirming the creation of the contract "demo01\_ft":

  ```
  Created contract demo01_ft
  ```
* 3.3 Reference workspace populated from the template:

  ```
   	$ exa -T -L 1 ./demo01_ft
   	./demo01_ft
   	├── Cargo.lock
   	├── Cargo.toml
   	├── devbox.json
   	├── devbox.lock
   	├── devnet-services-dc.yml
   	├── l1x-conf
   	├── l1x-contracts
   	├── process-compose.yaml
   	├── README.md
   	├── rust-toolchain.toml
   	└── rustfmt.toml
  ```

#### **Step 4: Understanding Configuration Files and Default Settings**

In this section, we'll provide a quick and simple overview of the configuration files and their default values. These files are crucial for setting up your workspace effectively.

* **4.1 devbox.json:** The `devbox.json` file contains important configuration settings for your workspace and workflow script commands. Here are some key properties:

  | Configuration             | Default                            | Description                                                                                                                              |
  | ------------------------- | ---------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------- |
  | `L1X_CFG_CHAIN_TYPE`      | `beta_mainnet`                     | Specifies the chain type for deploying and working with the workspace contract. You can choose between `beta_mainnet` or `local_devnet`. |
  | `L1X_CFG_TOOLS`           | `kevincoutinho007/l1x-toolkit:0.1` | Indicates the version of the Docker toolkit tested with the template. It's recommended to use the same version for this demonstration.   |
  | `L1X_CFG_ARTIFACTS`       | `./l1x-artifacts`                  | Points to the directory where your L1X artifacts are stored.                                                                             |
  | `L1X_CFG_CONTRACT`        | `l1x_ft`                           | Specifies the name of the contract you'll be working with.                                                                               |
  | `L1X_CFG_DC_FILE`         | `./devnet-services-dc.yml`         | Refers to the location of the `docker-compose` configuration file for devnet services.                                                   |
  | `L1X_CFG_CASSANDRA1_DATA` | `./l1x-conf/cassandra1_data`       | Defines the directory for Cassandra 1 data.                                                                                              |
  | `L1X_CFG_CASSANDRA2_DATA` | `./l1x-conf/cassandra2_data`       | Specifies the directory for Cassandra 2 data.                                                                                            |
  | `L1X_CFG_CASSANDRA_HOST`  | `127.0.0.1`                        | Specifies the Cassandra 1 Host Address.                                                                                                  |
  | `L1X_CFG_CASSANDRA_PORT`  | `9042`                             | Defines the Cassandra 1 Port ID.                                                                                                         |
* **4.2 l1x-conf/l1x\_chain\_config.yaml:** Inside the `l1x-conf/l1x_chain_config.yaml` file, you'll find L1X chain-specific properties, including JSON RPC endpoints. By default, the template is set to work with the Beta Mainnet using the setting `"L1X_CFG_CHAIN_TYPE": "beta_mainnet"`. If you want to switch to a local development network, simply update this setting to `"L1X_CFG_CHAIN_TYPE": "local_devnet"`.

These configuration files and default values are vital for configuring your workspace to match your specific requirements easily.

#### **Step 5: Getting Started with the Devbox Shell**

* **5.1 Activating the Devbox Shell**: To begin, you'll need to activate the Devbox shell. During the initial activation, Devbox will automatically install all the necessary packages for your workspace. Here's how to do it:
* &#x20;**Choose the Chain Type**: Begin by selecting the `"L1X_CFG_CHAIN_TYPE": "local_devnet"` option. Then, open a new terminal and activate the devbox shell:
* Open your terminal and enter the following command:

```
devbox shell
```

* **5.2 Package Installation**: The system will ensure that all the required packages are installed. Here is a list of the packages that will be installed:

  ```
  Ensuring packages are installed.

  Installing package: cassandra_4@4.1.2.

  [1/1] cassandra_4@4.1.2
  [1/1] cassandra_4@4.1.2: Success
  Starting a Devbox shell...
  ```
* **5.3 Sanity Testing**: To make sure that the template and default configurations work correctly on your system, you can perform the following sanity tests:

  * To check the latest block height from the live Beta Mainnet, use this command:

  <pre><code><strong>devbox run 08_check_chain_stat
  </strong></code></pre>

Next: [Let's Deploy your First Contract](/l1x-master-sdk/ubTvs7ITP4emn1uocqF8/get-started-with-l1x-sde/development-workspace-environment-and-contract-types/1-contemporary-contracts.md)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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://l1x-sdk.gitbook.io/l1x-master-sdk/ubTvs7ITP4emn1uocqF8/l1x-documentation/setup-l1x-development-environment.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.
