Running hREA Backend

These are instructions for doing set up, and running, of a holochain runtime on your device containing the hREA hApp, for the sake of a development environment.
Before trying to develop a user interface or service on top of hREA, you need to be running the hREA backend, within a holochain runtime.
Download the hrea_suite.happ file from this hREA release.
You need to install some packages to your command line, which you can do manually, or via the nix-shell dev environment manager. There are instructions for either way that you choose right below this, just click to expand the section you would like to follow.
If you have nix-shell installed already, or install it now, you can follow these instructions in order to utilize the command line utilities that you need to proceed, such as holochain hc and lair-keystore.
In your project folder, create a file called default.nix.
Add these contents to that file:
let
holonixRev = "38f74c722048f787d9faadb479978e73bb5091a1";
holonixPath = builtins.fetchTarball "https://github.com/holochain/holonix/archive/${holonixRev}.tar.gz";
holonix = import (holonixPath) {
holochainVersionId = "v0_0_162";
};
nixpkgs = holonix.pkgs;
in nixpkgs.mkShell {
inputsFrom = [ holonix.main ];
packages = with nixpkgs; [
nodejs-16_x
nodePackages.pnpm
];
}
Then, just enter the nix-shell by executing the following command:
nix-shell .
Once you are inside that nix-shell, you can verify that you have hc on your path by typing hc --version and you should see the following printed to your console:
holochain_cli 0.0.57
You are ready to proceed.
Install Rust, if you don't have it installed already.
Install the following to your system, via Rusts package manager "cargo".
The following installs a holochain developer tools binary to your system, accessible as the binary hc on your system.
cargo install holochain_cli --version 0.0.57
The following installs the core holochain runtime to your system, accessible as the binary holochain on your system. It can be used directly, or implicitly via the hc sandbox calls that we make next.
cargo install holochain --version 0.0.162
The following is the secure private key enclave that holochain uses for cryptography. It is available as a binary on your path lair-keystore, but holochain manages these subprocesses automatically on your behalf.
cargo install lair_keystore --version 0.2.0
Set up a holochain development "sandbox". A temporary directory on your file system that will store all your keys and data for the hREA happ that you are about to install and run. network quic is there to instruct holochain to use a specific kind of networking, known as quic.
hc sandbox create -n 1 -d hrea_tester network quic
Install the hREA hApp to your holochain sandbox. Make sure you use the right path to wherever on your filesystem you have hrea_suite.happ file that you downloaded.
hc sandbox call install-app-bundle ./hrea_suite.happ
Start your holochain "sandbox" runtime, attaching a port for websocket networking, on the networking port 4000.
hc sandbox run --all --ports 4000
You can safely stop and restart this particular process, and don't have to rerun the other steps. This is the process that you must have running in order to develop a user interface or service with an hREA backend.