This commit is contained in:
Matthew Zipkin 2022-03-06 19:43:26 -05:00
parent 41eca93ee3
commit 50db541857
No known key found for this signature in database
GPG Key ID: E7E2984B6289C93A

View File

@ -11,7 +11,7 @@ It's reccomended to create a new wallet for your HIP2 server.
https://hsd-dev.org/api-docs/#get-account-information
##### hsd
`hsw-cli --id=<WALLET NAME> account get default | jq accountKey`
`hsw-cli --id=<WALLET NAME> account get default | jq -r .accountKey`
##### Bob Wallet
- Get your API key from Settings > Wallet then use hs-client:
@ -48,7 +48,44 @@ since many users may make requests without sending payments.
### NGINX
If you are using nginx as your webserver, you can configure one or even many
domains to use the same HIP2 server, and even redirect to a hard-coded flat
file (with single HNS address) in case the HIP2 server crashes!
In this example, port `60000` is the nodeJS webserver actually running the
`proofofconcept` website, which has a [hard-coded HIP2 address](https://github.com/pinheadmz/proofofconcept/blob/master/html/.well-known/wallets/HNS).
By using the `proxy_pass` and `error_page` directives in the nginx configuration,
the HIP2 address will by default come from HIP2-server but fall back to the flat
file in case of failure.
```
server {
server_name *.proofofconcept proofofconcept;
listen 443 ssl;
listen [::]:443 ssl;
ssl_certificate /root/ssl/proofofconcept/cert.crt;
ssl_certificate_key /root/ssl/proofofconcept/cert.key;
location / {
proxy_pass http://localhost:60000;
proxy_set_header Host $host;
}
location @main {
proxy_pass http://localhost:60000;
proxy_set_header Host $host;
}
location /.well-known/wallets/HNS {
proxy_pass http://localhost:20000;
error_page 500 502 @main;
}
}
```
### Build from source
@ -60,3 +97,15 @@ cd hip2-server
npm install
npm run build
```
### Wallet recovery and pitfalls
The default `lookahead` value in hsd is 200. That means that if at least one
out of every 200 HIP2 address requests results in an on-chain transaction,
the original wallet (or new wallet rescanning from the original seed) will
recover all payments. Users should monitor the value saved to `log/hip2-index`
and if it gets too large you may need to manually generate addresses in the
recovery wallet before rescanning. After the hip2-server serves `0x7fffffff`
addresses, it will start over at index `0` and recycle. The `log/hip2-index`
file will continue to increment, so users should also take action if they see
the value in that file exceed `2147483647`.