The best way to learn and develop the HOPR protocol is by interacting with a HOPR node connected inside the HOPR network. A series of HOPR nodes interconnected (i.e. reachable and with channels opened against each other) is called a HOPR cluster. Without a HOPR cluster, app developers can only fake interactions with a HOPR node by mocking their API1, and core protocol developers can't replicate critical functionality over messaging such as ticket redemption and packet relaying.
Although the HOPR Association provides a production HOPR cluster anyone could talk to in production2, this setup is not ideal for development as doing so would incur on costs for executing basic operations. Staging networks such as görli are too slow to provide meaningful feedback, so the ideal setup for properly interacting with the HOPR ecosystem toolset is running a local HOPR cluster, either in your workstation or via a cloud environment like Gitpod. This way contributors are not constrained by internet connection or blockchain RPC providers.
As of the time of writing, the best way to set up a local HOPR cluster is by following these steps3. Please bear in mind that these steps
had been tested only on macOS
and Linux
devices, for Windows please use our cloud setup instead.
- Download the latest version of the repository: Download a local version of our GitHub repository monorepo4
and unzip it in your local folder (roughly
~30 Mbs
at the time of writing). For the next tasks, we will assume you are within that folder.
wget https://github.com/hoprnet/hoprnet/archive/refs/heads/master.zip
unzip master.zip
cd hoprnet-master
- Install the dependencies of the project and build it: Make sure you have
nodejs@16
(we suggest installing it via nvm, ienvm install lts/gallium
), andyarn
(included innodejs@16
by runningcorepack enable
) to install and build the required packages and project modules. Ideally, you also have setup your computer with basic development toolset5. Please bear in mind that this process will take at least 5-10 minutes depending on your computer.
make -j deps && make -j build
- Run the one-line setup script: Proceed to run the following script. If you are planning to run MyneChat
alongside, then make sure to pass the
-m
flag with your MyneChat instance URL. Please wait while this script creates the local blockchain network and deploys the project contracts. In average, the process can take between 2-6 minutes, depending on your computer capacity. Important, make sure to have bothcurl
andjq
installed in your computer before running the script, as both are used. Please be aware you also need a version ofbash
of5.x
or superior, which in most macOS devices require an upgrade, the easiest being viabrew bash
.
./scripts/setup-local-cluster.sh -m "http://app.myne.chat" -i topologies/full_interconnected_cluster.sh
Afterwards, a set off accounts with their respective HTTP REST API, HOPR Admin, and WebSocket interface will be displayed
in your screen. If this is your first time using HOPR, I suggest navigating to the HOPR Admin
URL to get familiar with
the basic commands. Afterwards, it might also make sense to check the API v2 Swagger URL.
Footnotes
-
The demo application MyneChat uses a mock server to simplify it’s development workflow. Nevertheless, to fully experience the extend of its features, it relies on a HOPR cluster, either a local or a public one. ↩
-
Production is to be understood as a "live" network where HOPR tokens can be exchanged or used as means to power its network
HoprChannels.sol
smart contract. As of time of writing, the only live network is the Gnosis Chain (previously known as xDai Chain), with the only available publicly traded utility token beingwxHOPR
. ↩ -
Tasks #167, #168, and #169 are alternatives to the current setup. Whenever these tasks are completed, these instructions will be updated in #170. ↩
-
By using the
master
tag, you are downloading the latest version ofhoprnet
to spin up your nodes, which might be ideal to your particular use case. However, due to the rapid development done on the project, you might be better off using a stable release. The latest stable release known at the time of writing isprovidence
. ↩ -
If you have installed and built another
node.js
application from your computer in the past, you likely will not need to do anything else. However, in the case your are only starting to develop innode.js
, there's a high chance you might need to install a few extra tools. For instance, inLinux
-based OS, you will likely also need to installbuild-essentials
(e.g. in Ubuntu doapt-get install build-essentials
), whereas inmacOS
you need Xcode developer tools, installable viaxcode-select --install
. ↩