Installing Shared Libraries
Cardano Node requires the following shared libraries:
- Sodium is a cryptographic library for which IOHK maintains a release.
- libsecp256k1 is a library for digital signatures and other cryptographic primitives on the secp256k1 elliptic curve.
- blst is a BLS12-381 signature library.
To install the libsodium release that IOHK maintains:
- To create a working directory to store source code and builds related to Cardano Node, type the following commands using a terminal window:mkdir $HOME/gitcd $HOME/git
- To download, compile and install Sodium, type:git clone https://github.com/IntersectMBO/libsodiumcd libsodiumgit checkout dbb48cc./autogen.sh./configure --build=x86_64-linux-gnumakesudo make install
Note

To resolve a
cannot find -lnumaerror message when compiling Sodium, type:sudo apt-get install libnuma-dev - On each computer hosting a relay or block-producing node in your stake pool configuration, repeat steps 1 to 2
To download, compile and install the libsecp256k1 library:
- Using a terminal window, type:cd $HOME/gitgit clone --depth 1 --branch v0.3.2 https://github.com/bitcoin-core/secp256k1cd secp256k1./autogen.sh./configure --enable-module-schnorrsig --enable-experimentalmakemake checksudo make installsudo ldconfig
- On each computer hosting a relay or block-producing node in your stake pool configuration, repeat step 1
To download, compile and install the blst library:
- Using a terminal window, type:cd $HOME/gitgit clone https://github.com/supranational/blstcd blstgit checkout v0.3.14./build.shcat > libblst.pc << EOFprefix=/usr/localexec_prefix=\${prefix}libdir=\${exec_prefix}/libincludedir=\${prefix}/includeName: libblstDescription: Multilingual BLS12-381 signature libraryURL: https://github.com/supranational/blstVersion: 0.3.14Cflags: -I\${includedir}Libs: -L\${libdir} -lblstEOFsudo cp libblst.pc /usr/local/lib/pkgconfig/sudo cp bindings/blst_aux.h bindings/blst.h bindings/blst.hpp /usr/local/include/sudo cp libblst.a /usr/local/lib/sudo chmod u=rw,go=r /usr/local/{lib/{libblst.a,pkgconfig/libblst.pc},include/{blst.{h,hpp},blst_aux.h}}
- On each computer hosting a relay or block-producing node in your stake pool configuration, repeat step 1
Installing shared libraries involves editing the $HOME/.bashrc file. The $HOME environment variable or ~ tilde prefix refers to the home directory associated with your user name. The .bashrc file is a Bash script that runs each time you open a new terminal window. In the .bashrc file, you can add any command that you may type at the command prompt. Use .bashrc to set up the shell as needed for your environment.
Note | Prefixing a file or folder name using a period ( |
To edit the $HOME/.bashrc file:
- Using a text editor, open the
$HOME/.bashrcfile, and then add the following lines at the end of the file:# Set environment variables so that the compiler finds libsodium, libsecp256k1 and blst libraries on your computerexport LD_LIBRARY_PATH="/usr/local/lib:$LD_LIBRARY_PATH"export PKG_CONFIG_PATH="/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH"# Set an environment variable indicating the file path to configuration files and scripts# related to operating Cardano Nodeexport NODE_HOME="$HOME/cardano-node"# Set an environment variable indicating the Cardano network environment where the node runsexport NODE_CONFIG="mainnet"# Set an environment variable indicating where the Cardano node socket file is locatedexport CARDANO_NODE_SOCKET_PATH="$NODE_HOME/db/socket"Note

If you plan to use Cardano Node in a Testnet environment instead of Mainnet, then replace the line
export NODE_CONFIG="mainnet"in your$HOME/.bashrcfile withexport NODE_CONFIG="testnet"Also, when working through the How to Set Up a Cardano Stake Pool guide, replace every instance of the command option‑‑mainnetwith‑‑testnet‑magic <MagicNumber>where<MagicNumber>is the network magic number for the Testnet that you use. For details on available Testnets, see Environments. - Save and close the
$HOME/.bashrcfile. - To create the folder set for the
NODE_HOMEenvironment variable in your$HOME/.bashrcfile, type:mkdir $HOME/cardano-node - To reload your shell profile, type:source $HOME/.bashrc
- On each computer hosting a relay or block-producing node in your stake pool configuration, repeat steps 1 to 4