Installing Madara
In this section, we will guide you through the build and run process so that you can run your own Madara client, and query the Starknet blockchain as smoothly as possible.
We want anyone to be able to launch a Madara full node, which is why we've divided this section into 3 difficulty levels:
- Low-level (from source directly)
- Mid-level (from Docker recomanded)
- High-level (Coming soon)
Low level Installation
From source
Install dependencies
We first need to make sure you have everything needed to complete this tutorial.
Dependency | Version | Installation |
---|---|---|
rust | rustc 1.74.0-nightly | curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs sh |
You can use this command to easily install all necessary dependencies:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s
Get code
Fetch the code from the Official Madara (opens in a new tab) repository in the folder of your choice.
cd <your-destination-path>
git clone https://github.com/keep-starknet-strange/madara .
Build program
Then let's build the dependencies. You can choose between 3 differents build modes:
- Debug (fastest build mode, but lower performances, for testing purpose only)
cargo build
- Release (the recomanded build mode with production performances)
cargo build --release
Run Madara
This command will start the Madara client with a basic set arguments which will begin the synchronization with Starknet mainnet automatically:
cargo run --release \
--name Madara \
--base-path /var/lib/madara \
--network main \
--l1-endpoint ${ETHEREUM_API_URL}
We recomand you to head up to the Configuration section to custom your node parameters
If you don't have an L1 endpoint url we recomand you to head up to the Verification section to get one
Mid level installation
This is the recomanded way to easily install and run Madara it only requires a terminal access.
Using Docker
Install Docker
MacOS: To install Docker on MacOS, follow these steps: 1. Visit the
Docker
Hub (opens in a new tab) and
download Docker Desktop for Mac. 2. Open the downloaded .dmg
file and drag
the Docker icon to your Applications folder to begin the installation. 3.
Once installed, launch Docker from your Applications folder. Docker will
request your admin password to complete the setup. 4. After installation,
you can open a terminal and run docker --version
to verify that Docker has
been installed successfully.
Run docker image
Once you have successfully installed Docker, you can now run Madara using the images available here: Madara-v0.1.0-nightly (opens in a new tab).
You can replace the --rpc-port
, --base-path
with your desired parameters.
This is a default configuration. For more information on possible configurations, please visit the Configuration section.
Make sure to change the volume -v
of your container if you change the
--base-path
.
docker run -d \
--name Madara
-p 9944:9944 \
-v /var/lib/madara:/var/lib/madara \
madara:latest \
--base-path /var/lib/Madara \
--network main \
--l1-endpoint ${ETHEREUM_API_URL}
If you don't have an L1 endpoint url we recomand you to head up to the Verification section to get one
Check logs
docker logs -f madara
Now you can head up to the Metrics section to easily deploy a Grafana and Prometheus dashboard
Using Docker Compose
Prerequisites
Ensure you have Docker and Docker Compose installed on your machine. You can follow the installation instructions for Docker in the previous section.
Prepare the Environment
Ensure you have the necessary environment variable ETHEREUM_API_URL
set. You can set this in your shell or in a .env
file in the same directory as your docker-compose.yml
file:
export ETHEREUM_API_URL="your-ethereum-api-url"
Or create a .env
file:
ETHEREUM_API_URL=your-ethereum-api-url
When running with sudo
, environment variables set in the current session might not be carried over. You can pass the variable directly to sudo using the -E
option to preserve the environment:
If you don't have an L1 endpoint url we recomand you to head up to the Verification section to get one
Build and Run the Container
Navigate to the cloned Madara repository containing your docker-compose.yml
file and run the following command to build and start the Madara client:
docker-compose up -d
This command will build the Docker image and start the container in detached mode.
Check Logs
You can view the logs of the running Madara service using the following command:
docker-compose logs -f Madara
Now you can head up to the Metrics section to easily deploy a Grafana and Prometheus dashboard
Now that you know how to launch a Madara full node, you might want to set some parameters in order to customize it. Therefore, you can go to the following section: Configuration (opens in a new tab)