Launch Forta node using Blast API

AlexM
2 min readMay 25, 2022

--

Hi guys! Today I will tell you how to launch a Forta node using Blast, a new tool from the Bware Labs team.
You will need a 4/8 server or more

So, let’s get started

sudo apt update && sudo apt upgradesudo curl https://dist.forta.network/pgp.public -o /usr/share/keyrings/forta-keyring.asc -s 
echo 'deb [signed-by=/usr/share/keyrings/forta-keyring.asc] https://dist.forta.network/repositories/apt stable main' | sudo tee -a /etc/apt/sources.list.d/forta.list
sudo apt-get update
sudo apt-get install forta
. <(wget -qO- https://raw.githubusercontent.com/SecorD0/utils/main/installers/golang.sh)

Next try

forta version

You will get sth like

#example of output 
#{
# "commit": "6120c5c7749c906f0eb6b923070bc358fcc1d15a",
# "ipfs": "QmUzGJL4iJt1qgK4W6yUidEG59Gq6D1GbdQgeVWP6CLYVt",
# "version": "v0.4.9"
#}

Next init your node

Replace <your_passphrase> with your password

forta init --passphrase <your_passphrase>

And now let’s get down to the most important thing — to using Blast.
So, why do I recommend using it? The result from using it is no worse than from using Alchemy or someone else, but it is still free.
So, first we need to choose the network in which we will work. We’ll look at Polygon, but it works with other networks as well.
Let’s open it https://blastapi.io /, click the “Connect” button and connect your wallet.
Now you need to click on “Add Project” and create a new project
Now you need to go to the “Available Endpoints” section and select the network we are interested in, in our case it is Polygon.
Click on this network and click “Activate”.
Now in the “Active Endpoints” tab, click on Polygon and copy the address in the RPC Endpoint section

Next

nano $HOME/.forta/config.yml

In this file, you need to replace the following parameters(for other networks a little differently)
Replace <your_rpc_endpoint_from_blast> with the address that we just copied

chainId: 137  # The scan settings are used to retrieve the transactions that are analyzed 
scan:
jsonRpc:
url: <your_rpc_endpoint_from_blast># The trace endpoint must support trace_block (such as alchemy)
trace:
jsonRpc:
url: <your_rpc_endpoint_from_blast>

Now let’s register your node (there should be a little matic on owner_address)
Replace <owner_address> with your wallet address
Replace <your_passphrase> with your password

forta register --owner-address <owner_address> --passphrase=<your_passphrase>

Now it’s time to launch your node
Replace <your_passphrase> with your password
Create a service

sudo tee /etc/systemd/system/fortad.service > /dev/null <<EOF
[Unit]
Description=fortad Node
After=network.target[Service]
Type=simple
User=root
WorkingDirectory=/root/
ExecStart=$(which forta) run --passphrase <your_passphrase>
Restart=on-failure
RestartSec=3
LimitNOFILE=10000[Install]
WantedBy=multi-user.target
EOF

Start the service

sudo systemctl daemon-reload 
sudo systemctl enable fortad
sudo systemctl restart fortad

A convenient command for viewing logs

. <(wget -qO- https://raw.githubusercontent.com/SecorD0/utils/main/miscellaneous/insert_variable.sh) -n forta_log -v "sudo journalctl -fn 100 -u fortad" -aforta_log

Check the node status

forta status

Congratulations! Everything works thanks to very convenient and cool Blast API!

--

--

No responses yet