Welcome to HOPR's wallet integration guide. In this guide, we will be making sure you have everything you need to begin integrating your favorite wallet and HOPR.
HOPR is a privacy-preserving messaging protocol which enables the creation of a secure communication network via relay nodes powered by economic incentives using digital tokens. You run HOPR by using HOPRd (HOPR Daemon).
HOPR RPC Relay is an application you can run alongside your HOPRd node which will send all your RPC requests through HOPR, preserving your privacy.
HOPR RPC Relay acts as a translation layer between the wallet and a HOPRd node. All RPC requests made by the wallet need to be send to HOPR RPC Relay, once received, HOPR RPC Relay will send these messages through the HOPR network, and await for a response to return.
For this guide, we have created an easy to use docker-compose file which can be used to create the environment requires (5 HOPRd nodes, 5 HOPR RPC Relay) so you don't need to shuffle through all our docs and setup the environment manually.
In the following setup, we are creating a local environment where we are making 5 HOPRd nodes and 5 HOPR RPC Relays available. For every HOPRd node we have one HOPR RPC Relay, as we want every HOPRd node to have the capability of processing RPC requests. Five HOPRd nodes are enough to emulate a working HOPR network, allowing us to run everything locally.
- make
- docker
- docker-compose
- Go to HOPR RPC Relay repository
- Clone the project locally
- Run
RELAY_VERSION=v0.0.1 make devkit-run
Once steps are completed, you will have a local HOPR and HOPR Relay cluster running, ready to accept RPC requests!
Three important endpoints become available locally:
http://localhost:9001
used later on to send requests to HOPR RPC Relay, usehttp://localhost:9001/?exit-provider=https://primary.gnosis-chain.rpc.hoprtech.net
to send requests to Gnosis chain via HOPRhttp://localhost:13301
HOPRd's API endpoint, checkouthttp://localhost:13301/api/v2/_swagger
http://localhost:19501
HOPRd's admin panel, usehttp://localhost:19501/?apiEndpoint=http://localhost:13301&apiToken=^^awesomeHOPRr3l4y^^
to access
HOPR RPC Relay was designed to be a drop-in replacement from your usual provider (ex: infura). This means that within the wallet, the only changes that need to be done are:
- Switch provider URL to one of your locally running HOPR RPC Relays
Example:
https://primary.gnosis-chain.rpc.hoprtech.net
tohttp://localhost:9001/?exit-provider=https://primary.gnosis-chain.rpc.hoprtech.net
- As you can see from the example above, the only difference is that you need to specify within the URL parameters the exiting provider, which the requests will eventually be processed.
- Most importantly, is not ideal to ask users to update their existing URL such as
<hopr-rpc-relay>/?exit-provider=<exit-provider>
to finding creative ways on how to make this as user-friendly as possible is important. Possible options:- Add an input field per network
- Add an input field in the settings, and a checkbox for every network to that enables HOPR.
- While HOPR RPC Relay offers on restful API endpoint, you can use HOPRd's API endpoint
http://localhost:13301/api/v2/_swagger
to fetch various data can be complimentary to the wallet integration. For example, using APIhttp://localhost:13301/api/v2/account/balances
will show you the balance available for the running HOPRd node, which is useful to know.
You can find access to various HOPR assets such as logos and color values here.