Using your own Blokli
Gnosis VPN reads everything it needs from Gnosis Chain, such as your Safe, your balances, your payment channels, your PIX payments and the exit nodes registered on-chain, through Blokli, the HOPR on-chain indexer and GraphQL API. By default, the client uses the hosted Blokli for its network, https://blokli.piz-palu.gnosisvpn.io for piz-palu-prod.
You can run your own Blokli and point the client at it instead. The client then sends its on-chain queries to your Blokli and no longer depends on the hosted one.
Where to run Blokli
Run Blokli on a separate machine: one on your local network, or a server or a VPS.
Gnosis VPN can't use a Blokli on the same computer yet. When you connect, it routes Blokli traffic outside the tunnel through your router, which cuts off localhost on macOS.
Set up Blokli
-
Follow the HOPR guide's setup. On the machine that will run Blokli, follow Set up Blokli in the HOPR guide Run Blokli locally. Keep
network = "piz-palu-prod"in the configuration: it is the network the current release runs on. The client names your identity folder after the network Blokli reports, so a Blokli that indexes another network gives you a new, unfunded identity instead of your funded one. -
Turn on Curvy indexing before the first start. Gnosis VPN pays for traffic with PIX payments, which settle through the Curvy contracts on Gnosis Chain. The client reads its PIX payment notes from Blokli, so without Curvy indexing, payments fail. Blokli indexes these contracts only when you turn this on.
Open
docker-compose.ymlin thedockerfolder of the Blokli repository. Under thebloklidservice, add two lines to itsenvironmentsection and keep the line already there:docker-compose.ymlbloklid:environment:RUST_LOG: info,blokli_chain_indexer=debugBLOKLI_CURVY_AGGREGATOR: "0x3f2B578C6844b8D65b67dba4107db61D51b9020C"BLOKLI_INDEXER_ENABLE_CURVY_INDEXING: "true"BLOKLI_CURVY_AGGREGATORis the Curvy Aggregator contract. Blokli finds the other Curvy contracts from it when it starts.BLOKLI_INDEXER_ENABLE_CURVY_INDEXINGmakes Blokli index the Curvy notes and nullifiers that PIX payments create, along with the HOPR data.
-
Start Blokli and wait for the first sync. Follow the guide's Start Blokli and Wait for the first sync. In the configuration Blokli prints at startup, next to
network: piz-palu-prod, check for:indexer.enable_curvy_indexing: trueSkip the guide's Connect your node to Blokli section: it is for HOPRd nodes, and this page replaces it for Gnosis VPN.
-
Check that Blokli is ready. On the machine running Blokli, run:
curl http://localhost:8080/readyzContinue when the response shows
"status":"ready". Until then, the client can't start and keeps retrying.
Blokli can't add Curvy indexing to data it has already indexed without it. If you add the settings to a Blokli that has synced before, it refuses to index, and its log shows Missing address/topic info in log topic info table. To fix this, delete the indexed data and sync again from the start. This repeats the whole first sync.
docker compose down -v
docker compose up -d
Choose your Blokli URL
Reach Blokli through an internal IP address, a public IP address or a domain. The client needs Blokli's base URL, without /graphql:
| Address | Blokli URL |
|---|---|
| An internal IP address on your local network | http://<INTERNAL_IP>:8080 |
| A public IP address | http://<PUBLIC_IP>:8080 |
| A domain, behind an HTTPS proxy | https://<your-blokli-domain> |
<INTERNAL_IP>is the local IPv4 address of the machine running Blokli, such as192.168.1.20. Use it when Blokli runs on the same local network as the computer running Gnosis VPN.<PUBLIC_IP>is the public IPv4 address of the machine running Blokli, or of the router in front of it. A domain must point at that same address.
Before you use the URL, make sure that:
- The port is forwarded, for a public IP or a domain. If the machine running Blokli is behind a router, for example at home or in an office, forward Blokli's port on that router to the machine:
8080for a public IP, or your HTTPS proxy's port, usually443, for a domain. A VPS with its own public IP needs no forwarding, and neither does an internal IP. - The firewall allows the port on the machine running Blokli.
- The URL has the right port. If you changed Blokli's port or forward a different one, use that port instead of
8080. - The address is IPv4. The client doesn't connect to Blokli over IPv6, so a domain needs an IPv4 (
A) record.
The HOPR guide serves Blokli over plain HTTP. With an internal IP, use it only on a local network you trust. With a public IP, anyone on the way can read and change your on-chain queries. A domain with an HTTPS proxy avoids this.
If Blokli runs behind the same router as the computer running Gnosis VPN, use its internal IP. Its public IP works there only if the router supports NAT loopback, also called hairpin NAT.
Point the client at your Blokli
The Blokli URL is a setting of the client service, so it applies to every user on the computer. Changing it restarts the service, which drops an active VPN connection.
- macOS
- Debian / Ubuntu
The URL is set in the service definition, /Library/LaunchDaemons/com.gnosisvpn.gnosisvpnclient.plist.
-
Replace the URL, using your Blokli URL in place of
https://blokli.example.com:sudo plutil -replace EnvironmentVariables.GNOSISVPN_HOPR_BLOKLI_URL -string "https://blokli.example.com" /Library/LaunchDaemons/com.gnosisvpn.gnosisvpnclient.plist -
Check the new value:
plutil -extract EnvironmentVariables.GNOSISVPN_HOPR_BLOKLI_URL raw /Library/LaunchDaemons/com.gnosisvpn.gnosisvpnclient.plist -
Reload the service so it reads the changed file. A restart with
launchctl kickstartkeeps the old URL.sudo launchctl bootout system /Library/LaunchDaemons/com.gnosisvpn.gnosisvpnclient.plistsudo launchctl bootstrap system /Library/LaunchDaemons/com.gnosisvpn.gnosisvpnclient.plistIf
bootstrapfails withInput/output error, the service hasn't finished stopping yet. Wait a few seconds and run it again.
Installing a new version of Gnosis VPN replaces this file and sets the hosted Blokli again. Repeat these steps after every upgrade.
The URL is set in /etc/gnosisvpn/gnosisvpn-dynamic.env, which the package writes during installation. To change it, reinstall the package with your URL, using your Blokli URL in place of https://blokli.example.com:
-
Refresh the package list:
sudo apt update -
Reinstall Gnosis VPN with your Blokli URL:
sudo env GNOSISVPN_HOPR_BLOKLI_URL=https://blokli.example.com apt-get install --reinstall gnosisvpnThe package checks the URL, writes it and starts the service again.
-
Check the new value:
cat /etc/gnosisvpn/gnosisvpn-dynamic.envThe file should contain
GNOSISVPN_HOPR_BLOKLI_URL=followed by your URL.
Upgrades with apt upgrade keep your URL. Re-running the install script with --network replaces it with the hosted Blokli of that network.
Check that the client uses your Blokli
Start the client from the app or with gnosis_vpn-ctl, then open your worker log.
- A line with
blokli networkandpiz-palu-prodmeans the client reached your Blokli and runs on the right network. blokli network not queryable - retrying, followed by your URL, means the client can't query your Blokli yet. Check that Blokli is running, that/readyzreportsready, and that the URL and port are right. The client keeps retrying, so it starts on its own once Blokli answers.
Switch back to the hosted Blokli
Repeat the steps in Point the client at your Blokli with the hosted URL, https://blokli.piz-palu.gnosisvpn.io.
On macOS, installing Gnosis VPN again also restores it.