Connect Orchard
Orchard, your sovereign bank in cyberspace: the web app that wraps the stack you just built. It connects to your Bitcoin node, your Lightning node, and your Cashu mint, and surfaces them in one dashboard for a simplified operational interface. This is the last step.
Like every other service, Orchard runs under its own user and points at endpoints you already configured.
What this step covers
Section titled “What this step covers”- An isolated
orcharduser that runs the app and reads only what it needs. - Orchard built from source and run as a service.
- Connections to the stack you built: your mint (its API, database, and management gRPC), plus your Lightning and Bitcoin nodes.
- Private access to the dashboard over your local network with HTTPS, or a Tor hidden service for remote access.
Requirements
Section titled “Requirements”- The full stack from this walkthrough running: system,
Bitcoin, Lightning, and the
Cashu mint, with the mint’s management gRPC enabled (it is, in the
mint step’s
config.toml). - Node.js 22, which Orchard requires.
- The Orchard setup key you wrote down in the System step.
Preparations
Section titled “Preparations”Check Node + NPM
Section titled “Check Node + NPM”- With user
admin, check that Node.js 22 is installed
node -vExample of expected output:
v22.14.0If the version is below 22 or Node is missing, install it with MiniBolt’s Node + NPM guide, then come back here.
Create the Orchard database role
Section titled “Create the Orchard database role”Orchard reads the mint’s database and can perform backups, but it never writes to it: changes
go through the management gRPC. Give it a dedicated role with read-only access to the
cdk_mintd database, scoped so it cannot read your Lightning node’s database on the same
instance.
- With user
admin, create the role and grant it read access. The mint created its tables on first start in the previous step, so the grants apply to them
sudo -u postgres psql <<'SQL'CREATE ROLE orchard WITH LOGIN PASSWORD 'your-orchard-db-password';GRANT CONNECT ON DATABASE cdk_mintd TO orchard;\c cdk_mintdGRANT USAGE ON SCHEMA public TO orchard;GRANT SELECT ON ALL TABLES IN SCHEMA public TO orchard;GRANT SELECT ON ALL SEQUENCES IN SCHEMA public TO orchard;ALTER DEFAULT PRIVILEGES FOR ROLE cdk_mintd IN SCHEMA public GRANT SELECT ON TABLES TO orchard;ALTER DEFAULT PRIVILEGES FOR ROLE cdk_mintd IN SCHEMA public GRANT SELECT ON SEQUENCES TO orchard;SQLA read-only role is all pg_dump needs, so the same grant both feeds the dashboard and
lets Orchard back the mint up.
Installation
Section titled “Installation”Create the orchard user & group
Section titled “Create the orchard user & group”Give Orchard its own unprivileged user, the same as every other service in the stack.
- With user
admin, create theorcharduser and group
sudo adduser --disabled-password --gecos "" orchard- Add it to the
lndgroup so it can read your Lightning node’s certificate and macaroon for health checks
sudo usermod -aG lnd orchardCreate the data directory
Section titled “Create the data directory”Keep Orchard’s data under /data, the same place the rest of the stack stores its data.
- With user
admin, create the directory and give it to theorcharduser
sudo mkdir -p /data/orchardsudo chown -R orchard:orchard /data/orchardDownload and build Orchard
Section titled “Download and build Orchard”Build as the orchard user so the app lives in its home.
- Change to the
orcharduser
sudo su - orchard- Clone Orchard and check out the latest release. Do not run from
master: it is unsupported and can leave the database in a state that will not upgrade cleanly
git clone https://github.com/cashubtc/orchard.git && cd orchardgit fetch --tagsgit checkout v1.9.0- Install the dependencies and build the app
npm installnpm run buildThe build takes a few minutes on first run. Stay as the orchard user for the next
step.
Configuration
Section titled “Configuration”Orchard is configured through a .env file. Only Orchard’s own settings are required;
each service connection is optional and switched on by filling in its section.
- As the
orcharduser, copy the template and open it
cp .env.example .envnano .env- Fill in the following. The connection values are the ones you set in earlier steps
# --------------------------------------------# Orchard Configs (required)# --------------------------------------------SETUP_KEY=your-saved-orchard-setup-keySERVER_HOST=localhostSERVER_PORT=3321LOG_LEVEL=warn
# --------------------------------------------# Orchard Configs (optional)# --------------------------------------------DATABASE_DIR=/data/orchardTOR_PROXY_SERVER=socks://127.0.0.1:9050
# --------------------------------------------# Bitcoin Configs (optional)# --------------------------------------------# valid types: coreBITCOIN_TYPE=coreBITCOIN_RPC_HOST=localhostBITCOIN_RPC_PORT=8332BITCOIN_RPC_USER=miniboltBITCOIN_RPC_PASSWORD=your-bitcoin-rpc-password
# --------------------------------------------# Lightning Configs (optional)# --------------------------------------------# valid types: lnd | clnLIGHTNING_TYPE=lndLIGHTNING_RPC_HOST=localhostLIGHTNING_RPC_PORT=10009LIGHTNING_MACAROON=/data/lnd/data/chain/bitcoin/mainnet/readonly.macaroonLIGHTNING_CERT=/data/lnd/tls.cert
# --------------------------------------------# Cashu Configs (optional)# --------------------------------------------# valid types: cdk | nutshellMINT_TYPE=cdkMINT_API=http://localhost:8085MINT_DATABASE=postgres://orchard:[email protected]:5432/cdk_mintdMINT_RPC_HOST=localhostMINT_RPC_PORT=8086MINT_RPC_MTLS=false- Save and exit, then make the Lightning macaroon readable by the
lndgroup and come back toadmin
exitsudo chmod g+r /data/lnd/data/chain/bitcoin/mainnet/readonly.macaroonCreate systemd service
Section titled “Create systemd service”Run Orchard under its own user so it starts on boot and restarts on failure.
- With user
admin, create the service file
sudo nano /etc/systemd/system/orchard.service- Paste the following configuration. Save and exit
# Orchard: systemd unit for Orchard# /etc/systemd/system/orchard.service
[Unit]Description=OrchardRequires=cdk-mintd.serviceAfter=cdk-mintd.service lnd.service bitcoind.service
[Service]WorkingDirectory=/home/orchard/orchardExecStart=/usr/bin/npm run start
User=orchardGroup=orchard
# Hardening Measures####################PrivateTmp=trueProtectSystem=fullNoNewPrivileges=truePrivateDevices=true
[Install]WantedBy=multi-user.target- Reload systemd, then enable autoboot (optional)
sudo systemctl daemon-reloadsudo systemctl enable orchard- Prepare
orchardmonitoring by the systemd journal. You can exit at any time withCtrl-C
journalctl -fu orchard- With user
admin, start the service
sudo systemctl start orchardValidation
Section titled “Validation”- Ensure Orchard is listening on its
3321port, reachable only from this machine
sudo ss -tulpn | grep 3321Example of expected output:
tcp LISTEN 0 511 127.0.0.1:3321 0.0.0.0:* users:(("node",pid=4242,fd=20))Reverse proxy & Firewall
Section titled “Reverse proxy & Firewall”You set up Nginx as a reverse proxy with a self-signed certificate in MiniBolt’s security section. Add Orchard’s configuration to reach the dashboard over HTTPS on your local network.
- With user
admin, create the reverse proxy configuration
sudo nano /etc/nginx/sites-available/orchard-reverse-proxy.conf- Paste the following. Save and exit
server { listen 4321 ssl; error_page 497 =301 https://$host:$server_port$request_uri;
location / { proxy_pass http://127.0.0.1:3321; }}- Enable the site, test the configuration, and reload Nginx
sudo ln -s /etc/nginx/sites-available/orchard-reverse-proxy.conf /etc/nginx/sites-enabled/sudo nginx -tsudo systemctl reload nginx- Allow incoming HTTPS to the dashboard
sudo ufw allow 4321/tcp comment 'allow Orchard SSL from anywhere'- Browse to
https://minibolt.local:4321(or your node’s IP, e.g.https://192.168.x.xxx:4321) and complete the first-run setup with your Orchard setup key. Your browser will warn about the self-signed certificate; click Advanced and proceed.
Extras (optional)
Section titled “Extras (optional)”Remote access over Tor
Section titled “Remote access over Tor”For access from outside your local network, add a Tor hidden service that points at Orchard.
- With user
admin, edit thetorrcfile
sudo nano +63 /etc/tor/torrc --linenumbers- Add the following in the location-hidden-services section. Save and exit
# Hidden Service OrchardHiddenServiceDir /var/lib/tor/hidden_service_orchard/HiddenServiceVersion 3HiddenServicePort 80 127.0.0.1:3321- Reload Tor and read your onion address
sudo systemctl reload torsudo cat /var/lib/tor/hidden_service_orchard/hostnameOpen that .onion address in the Tor browser from any
device. Keep it to yourself: this is your admin dashboard.
Upgrade
Section titled “Upgrade”- With user
admin, stop the service
sudo systemctl stop orchard- Change to the
orcharduser, check out the new release, and rebuild (the tag below is the latest; substitute another release tag to pin a specific version)
sudo su - orchardcd orchardgit fetch --tagsgit checkout v1.9.0npm installnpm run buildexit- With user
admin, start the service again
sudo systemctl start orchardUninstall
Section titled “Uninstall”Uninstall service
Section titled “Uninstall service”- With user
admin, stop and disable the service, then remove the unit
sudo systemctl stop orchardsudo systemctl disable orchardsudo rm /etc/systemd/system/orchard.servicesudo systemctl daemon-reloadDelete user & group
Section titled “Delete user & group”- Delete the
orcharduser. Do not worry about theuserdel: orchard mail spool (/var/mail/orchard) not foundmessage
sudo userdel -rf orchard- Remove Orchard’s data directory
sudo rm -rf /data/orchard- Drop Orchard’s read-only database role
sudo -u postgres psql -d cdk_mintd -c "DROP OWNED BY orchard;"sudo -u postgres psql -c "DROP ROLE orchard;"Uninstall Tor hidden service
Section titled “Uninstall Tor hidden service”- If you added one, comment out or delete the Orchard block in
torrcand reload Tor
sudo nano +63 /etc/tor/torrc --linenumberssudo systemctl reload torRemove the reverse proxy & firewall rule
Section titled “Remove the reverse proxy & firewall rule”- Remove Orchard’s Nginx site and its firewall rule, then reload Nginx
sudo rm /etc/nginx/sites-enabled/orchard-reverse-proxy.conf /etc/nginx/sites-available/orchard-reverse-proxy.confsudo systemctl reload nginxsudo ufw delete allow 4321/tcpPort reference
Section titled “Port reference”| Port | Protocol | Use |
|---|---|---|
| 3321 | TCP (localhost) | Orchard dashboard, behind the Nginx and Tor proxies |
| 4321 | TCP (LAN) | Nginx HTTPS reverse proxy for the dashboard |
Orchard has no internet-facing port. It is your admin dashboard, so it stays off the Cloudflare Tunnel and reachable only over your local network or Tor.
After new mint
Section titled “After new mint”Your stack is complete and managed: Bitcoin, Lightning, a mint, and Orchard tending all of it. From here, you operate from the dashboard.
New Mint Orchard
Last updated: