Docker setup
This guide will help you set up and run a Masa Node using Docker ready for configuration and deployment.
Prerequisites
Before you begin, ensure you have the following installed:
- Docker
- Docker Compose
- Sepolia ETH (you will need 0.01 Sepolia ETH in your node’s wallet for the sepolia Masa faucet to function)
:::caution
You need to have 0.01 Sepolia ETH on hand to stake sepolia Masa with your node.
:::
Docker Desktop for Windows and Mac includes Docker Compose. On Linux, you may need to install it separately.
Clone the repository
Environment Configuration
Set up environment variables to connect your node to run your node in local bootnode configuration
This guide will configure your node as a Local Bootnode, for a list of network bootnodes, please refer to the Bootnode Configuration bootnode configuration documentation.
Create a .env
file in the root directory with these essential variables:
For more .env options, see our Environment Configuration Guide.
Building the Docker Image
With Docker and Docker Compose installed and your .env
file configured, build the Docker image using the following command:
This command builds the Docker image based on the instructions in the provided Dockerfile
and docker-compose.yaml
.
4. Start the node
You will see the following output:
You now have a running node in Local Bootnode configuration
Masa Protocol Configuration
You can now configure your node to start scraping data as a miner, to fetch data from the network or to start participating in the network as a validator.
Configure your node
Stake your node
The Masa Protocol currently supports staking on Sepolia only.
After starting the node, you must stake sepolia Masa tokens to participate in the network; the node comes with a faucet to get sepolia Masa tokens you need Sepolia ETH in your wallet to get Sepolia MASA tokens from the faucet.
Masa Protocol Configuration
You can now configure your node to start scraping data as a miner, to fetch data from the network or to start participating in the network as a validator.
Configure your node
Stake your node
The Masa Protocol currently supports staking on Sepolia only.
After starting the node, you must stake sepolia Masa tokens to participate in the network; the node comes with a faucet to get sepolia Masa tokens you need Sepolia ETH in your wallet to get Sepolia MASA tokens from the faucet.
-
Get your node’s public key from the logs.
-
Send Sepolia ETH to your node’s public key address.
-
Run the
make faucet
command to get Sepolia MASA: -
Run the
make stake
command to stake your node: -
Run the container in detached mode:
-
Check the logs to verify the node is running properly:
Accessing Your Node Keys
The node generates keys that are stored in the /home/masa/.masa/
inside the Docker container, ensuring that your keys are safely stored on your host machine.
-
Open a shell inside the container:
-
Navigate to the keys directory:
-
List the keys:
-
Copy the keys to your host machine:
Custom configuration
You can customize your node’s configuration by modifying the .env
file inside the Docker container. Follow these steps to make changes:
-
SSH into the running container:
-
Navigate to the directory containing the
.env
file: -
Edit the
.env
file using a text editor likenano
orvi
: -
Make your desired changes to the
.env
file. You can modify existing variables or add new ones as needed. -
Save the changes and exit the text editor.
-
Exit the container:
-
Restart the container to apply the changes:
After following these steps, your node will restart with the updated configuration from the modified .env
file.
Remember to consult the Environment Configuration Guide for a list of available environment variables and their purposes.
Configure a Twitter Scraper
To set up your node as a Twitter scraper, you need to add a twitter_cookies.json
file to the container. For more information on obtaining Twitter cookies refer to our Twitter Scraper Configuration Guide.
Follow these steps:
-
Prepare your
twitter_cookies.json
file on your local machine. -
Copy the file into the running container:
-
SSH into the running container:
-
Verify the file has been copied correctly:
-
Ensure the file has the correct permissions:
-
Exit the container:
-
Modify your
.env
file to enable Twitter scraping: -
Restart the container to apply the changes:
-
Your node should now be configured as a Twitter scraper. You can verify this by checking the logs:
-
Look for a line indicating that the Twitter scraper is active:
:::warning
Ensure that your twitter_cookies.json
file contains valid Twitter credentials. Using invalid or expired credentials may result in the scraper failing to function properly.
:::
For more information on obtaining Twitter cookies and the format of the twitter_cookies.json
file, refer to our Twitter Scraper Configuration Guide.