> For the complete documentation index, see [llms.txt](https://docs.konsortech.xyz/node/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.konsortech.xyz/node/mainnet/massa.md).

# How to Run Massa Node

## Update and Install Dependencies

```
sudo apt-get update && apt-get upgrade -y
sudo apt-get install clang librocksdb-dev screen libssl-dev pkg-config curl git build-essential libclang-dev librocksdb-dev -y
```

## Add Environment Variable

```
echo "export PASSWORD=<input_your_password>" >> $HOME/.bash_profile
source $HOME/.bash_profile
```

## Download Latest Binary

```
cd $HOME
wget https://github.com/massalabs/massa/releases/download/MAIN.2.1/massa_MAIN.2.1_release_linux.tar.gz
tar -xzvf massa_MAIN.2.1_release_linux.tar.gz && rm massa_MAIN.2.1_release_linux.tar.gz
```

## Create Running Script

```
sudo tee /root/massa/massa-node/run.sh > /dev/null <<EOF
#!/bin/bash
cd ~/massa/massa-node/
./massa-node -p $PASSWORD |& tee logs.txt
EOF
```

## Set Script for Executable

```
chmod +x /root/massa/massa-node/run.sh
```

## Create Daemon Services

```
sudo tee /etc/systemd/system/massad.service > /dev/null <<EOF
[Unit]
Description=Massa Node
After=network-online.target
[Service]
Environment="RUST_BACKTRACE=full"
User=$USER
ExecStart=/root/massa/massa-node/run.sh
Restart=always
RestartSec=3
[Install]
WantedBy=multi-user.target
EOF
```

## Start Node

```
systemctl daemon-reload 
systemctl enable massad 
systemctl restart massad && journalctl -fu massad -o cat
```

## Restore wallet operations

```
$HOME/massa/massa-client/massa-client -p $PASSWORD 
wallet_add_secret_keys <input_your_private_key_wallet>
```

## Start staking

```
node_start_staking <your_public_wallet_address>
```

## Buy Rolls

```
buy_rolls <your_public_wallet_address> 1 0
```


---

# 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, and the optional `goal` query parameter:

```
GET https://docs.konsortech.xyz/node/mainnet/massa.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
