2021-11-24 13:08:50 +04:00
|
|
|
Install `hsd`
|
|
|
|
|
=============
|
|
|
|
|
|
2023-01-05 00:17:35 +03:00
|
|
|
`hsd` requires Node.js v14 or higher.
|
2021-11-24 13:08:50 +04:00
|
|
|
|
|
|
|
|
Table of contents
|
|
|
|
|
-----------------
|
|
|
|
|
|
2021-11-24 14:35:00 +04:00
|
|
|
<!-- markdown-toc -i install.md -->
|
|
|
|
|
|
|
|
|
|
<!-- toc -->
|
|
|
|
|
|
|
|
|
|
- [Verifying keys](#verifying-keys)
|
|
|
|
|
- [Building From Source (git and npm)](#building-from-source-git-and-npm)
|
|
|
|
|
* [Verifying](#verifying)
|
|
|
|
|
- [npm](#npm)
|
|
|
|
|
* [Verifying](#verifying-1)
|
|
|
|
|
- [macOS](#macos)
|
|
|
|
|
* [Verifying](#verifying-2)
|
|
|
|
|
- [Docker](#docker)
|
|
|
|
|
* [Building an image](#building-an-image)
|
|
|
|
|
* [Running a container](#running-a-container)
|
|
|
|
|
* [Stopping a container](#stopping-a-container)
|
|
|
|
|
|
|
|
|
|
<!-- tocstop -->
|
2021-11-24 13:08:50 +04:00
|
|
|
|
|
|
|
|
## Verifying keys
|
|
|
|
|
Every verifying process described below will need project maintainer
|
|
|
|
|
keys. You can get keys following [Security](../SECURITY.md) document.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## Building From Source (git and npm)
|
|
|
|
|
```
|
2022-03-10 11:46:44 +04:00
|
|
|
git clone --depth 1 --branch latest https://github.com/handshake-org/hsd.git
|
2021-11-24 13:08:50 +04:00
|
|
|
cd hsd
|
2022-11-04 16:41:16 -07:00
|
|
|
npm install --omit=dev
|
2021-12-10 13:21:49 +04:00
|
|
|
# run full node in foreground with default configuration
|
2021-11-24 13:08:50 +04:00
|
|
|
./bin/hsd
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
Note that `node-gyp` must be installed. See the
|
|
|
|
|
[node-gyp](https://github.com/nodejs/node-gyp) documentation for more
|
|
|
|
|
information.
|
|
|
|
|
|
|
|
|
|
### Verifying
|
2021-11-24 16:53:12 +04:00
|
|
|
**Note this does not verify dependencies**,
|
|
|
|
|
they are downloaded from the `npm`.
|
2021-11-24 13:08:50 +04:00
|
|
|
```
|
|
|
|
|
cd hsd
|
2022-03-10 11:46:44 +04:00
|
|
|
git verify-tag latest
|
2021-11-24 13:08:50 +04:00
|
|
|
```
|
|
|
|
|
## npm
|
|
|
|
|
|
|
|
|
|
It is not recommended to install `hsd` from npm's repositories
|
|
|
|
|
but it is still possible to install with `npm` using a remote
|
|
|
|
|
`git` repository.
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
$ npm install -g https://github.com/handshake-org/hsd.git
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
A `git` ref can be used to install a particular version by appending
|
|
|
|
|
a `#` and the name of the `git` ref to the URL. For example,
|
2022-03-10 11:46:44 +04:00
|
|
|
`https://github.com/handshake-org/hsd.git#latest`. It is recommended
|
2021-11-24 13:08:50 +04:00
|
|
|
to use the [latest tagged release](https://github.com/handshake-org/hsd/releases).
|
|
|
|
|
|
|
|
|
|
If adding `hsd` as a dependency to a project, use the command:
|
|
|
|
|
|
|
|
|
|
```
|
2021-12-10 13:21:49 +04:00
|
|
|
$ npm install --save https://github.com/handshake-org/hsd.git
|
2021-11-24 13:08:50 +04:00
|
|
|
```
|
|
|
|
|
|
|
|
|
|
### Verifying
|
|
|
|
|
Not supported.
|
|
|
|
|
|
|
|
|
|
## macOS
|
|
|
|
|
|
2021-12-10 13:21:49 +04:00
|
|
|
`hsd` is available via [Homebrew](https://formulae.brew.sh/formula/hsd). This
|
|
|
|
|
will install all required dependencies as well as `unbound`.
|
2021-11-24 13:08:50 +04:00
|
|
|
|
|
|
|
|
```
|
|
|
|
|
$ brew install hsd
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
### Verifying
|
|
|
|
|
Not supported.
|
|
|
|
|
|
|
|
|
|
## Docker
|
|
|
|
|
### Building an image
|
|
|
|
|
|
|
|
|
|
To build a Docker image with the name `hsd:<version>-<commit>`, run:
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
$ VERSION=$(cat package.json | grep version | sed 's/.*"\([0-9]*\.[0-9]*\.[0-9]*\)".*/\1/')
|
|
|
|
|
$ COMMIT=$(git rev-parse --short HEAD)
|
|
|
|
|
$ docker build -t hsd:$VERSION-$COMMIT .
|
|
|
|
|
```
|
|
|
|
|
|
2022-06-30 21:27:02 +02:00
|
|
|
### GitHub Hosted images
|
|
|
|
|
|
|
|
|
|
Baked images are available [here](https://github.com/handshake-org/hsd/pkgs/container/hsd).
|
|
|
|
|
```
|
|
|
|
|
docker pull ghcr.io/handshake-org/hsd:latest
|
|
|
|
|
```
|
|
|
|
|
|
2021-11-24 13:08:50 +04:00
|
|
|
### Running a container
|
|
|
|
|
|
2022-07-25 14:19:01 -04:00
|
|
|
To start a container named `hsd` on `main` network with an exposed
|
2021-11-24 13:08:50 +04:00
|
|
|
node API server, run:
|
|
|
|
|
|
|
|
|
|
```bash
|
2022-07-25 14:19:01 -04:00
|
|
|
$ docker run --name hsd \
|
|
|
|
|
--publish 12037:12037 \
|
|
|
|
|
--volume $HOME/.hsd:/root/.hsd \
|
|
|
|
|
hsd:$VERSION-$COMMIT \
|
2021-11-24 13:08:50 +04:00
|
|
|
--http-host 0.0.0.0 \
|
|
|
|
|
--api-key=foo
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
To test connectivity, curl the info endpoint:
|
|
|
|
|
```bash
|
2022-07-25 10:35:51 -04:00
|
|
|
$ curl http://x:foo@localhost:12037/
|
2021-11-24 13:08:50 +04:00
|
|
|
```
|
|
|
|
|
|
|
|
|
|
> Note: by default, none of the container's ports are exposed. Depending
|
|
|
|
|
on the network used for your node, you will need to expose the correct ports
|
|
|
|
|
for the node's various services (node http api, wallet http api, recursive
|
|
|
|
|
name server, authoritative name server, p2p protocol, encrypted p2p protocol).
|
2021-12-10 13:21:49 +04:00
|
|
|
The default ports can be found [here](https://hsd-dev.org/api-docs/#introduction). The DNS
|
2021-11-24 13:08:50 +04:00
|
|
|
servers must also expose a UDP port. The syntax is different from TCP and can
|
|
|
|
|
be found [here](https://docs.docker.com/config/containers/container-networking/#published-ports).
|
|
|
|
|
|
|
|
|
|
### Stopping a container
|
|
|
|
|
|
|
|
|
|
To stop a container named `hsd`, run:
|
|
|
|
|
|
|
|
|
|
```bash
|
|
|
|
|
$ docker stop hsd
|
|
|
|
|
```
|
|
|
|
|
|