Setup L1X Development Environment
Check the Video version of the 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:
ProtoBuff
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:
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:
Add your user to the docker group:
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:
If Docker is installed correctly, you should see a message confirming that the installation is working.
l1x-forge
l1x-forge
is a smart SDE command-line utility that streamlines L1X smart contract development. You can install it using the command:To upgrade the
l1x sde
binary, use this command:The
l1x-forge
tool is installed to$CARGO_HOME/bin
. Make sure to update your system'sPATH
environment settings:
Step 1: Setting Up Your Environment
1.1. Create an empty folder for this demonstration.
1.2. Change your current directory to the newly created folder.
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:
2.2. Now, let's take a look at the official supported templates available. Run the following command:
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":3.2. After executing the command, you'll see a message confirming the creation of the contract "demo01_ft":
3.3 Reference workspace populated from the template:
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:ConfigurationDefaultDescriptionL1X_CFG_CHAIN_TYPE
beta_mainnet
Specifies the chain type for deploying and working with the workspace contract. You can choose between
beta_mainnet
orlocal_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:
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:
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:
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:
Last updated