Skip to content

Build

We're now going to discuss how to build strfry.

Dependencies

Before building the binary, we need to install the following dependencies

apt install git g++ make libssl-dev zlib1g-dev liblmdb-dev libflatbuffers-dev libsecp256k1-dev libzstd-dev

Clone the Repository

Before cloning the strfry repository, we're going to first create the following directories in the $HOME directory:

mkdir -p $HOME/nostr/relays

We can now navigate to the relays directory:

cd $HOME/nostr/relays

We're now ready to clone the strfry repository:

git clone https://github.com/hoytech/strfry.git

After cloning the repository, navigate to the strfry directory:

cd strfry

You can use the repository to update strfry, so we're going to keep the repository on the relay.

Build strfry

We're now ready to build strfry.

First, initialize and update the git submodule:

git submodule update --init

Now, we're going to run:

make setup-golpe

Finally, run:

make -j4

The compilation could take a while depending on your server's specs, so be patient while the binary is being built.

When the compilation is finished the binary will be located in the strfry directory.

You can list out the contents of that directory to see the binary:

ls

You should see the binary file which should be named strfry.

Check Version

At the time of writing, the latest version of strfy is v1.0.1 which is what the rest of the guide is currently based on.

Run Binary

You can now run the binary:

./strfry relay

strfry should now be listening on 127.0.0.1:7777 and by default only accepts connections from localhost. The relay uses the database in your current directory called strfry-db along with a config file called strfry.conf which is also located in your current directory.

To stop the relay press Ctrl+C.

Troubleshooting

If you get the following error when running the binary:

strfry error: Unable to set NOFILES limit to 1000000, exceeds max of 524288

Open the strfry config file:

nano $HOME/nostr/relays/strfry/strfry.conf

Navigate to the line that says:

nofiles = 1000000

Set the nofiles setting to 0 which prevents strfry from attempting to set the value:

nofiles = 0

Save and exit the file.

You should now be able to run the binary.