Hathor headless wallet configuration
Authentication
You can enable a simple API Key verification in the config.js
file. In this case, your requests must include the header X-API-KEY
with the correct key.
If you are using cURL
to test, you can include the header using the -H
parameter:
curl -H "X-API-Key: YourKey" http://localhost:8000/wallet/balance.
It follows the Swagger Specification for API Keys.
Config Parameters
All parameters described below are in the config.js
file.
Parameter | Description | Set up |
---|---|---|
http_bind_address | IP Address of the host where the wallet is running. | Required |
http_port | Port in which the wallet is listening to HTTP requests. | Required |
http_api_key | API key authentication. | Optional |
network | Network the wallet will connect. Options: mainnet, testnet. | Required |
server | The address of the full node server. | Required |
txMiningUrl | The address of the transaction mining server. If it is not set, the wallet lib's default is used. | Optional |
default (from object seeds) | Seed of 24 words. Default value is an empty string. | Optional |
httpLogFormat | Log format for HTTP Requests. Common choices: combined, common, dev, short, tiny. Default: combined. | Optional |
consoleLevel | Console logging level. Levels: error, warn, info, http, verbose, debug, silly. Default: info. | Optional |
filename (from object logging.debug) | Filename where the logging information is stored. | Optional |
level (from object logging.debug) | Log level that will be stored in the file. | Optional |
tokenUid | Optional config to set the token to be used in the wallet. If this parameter is set, it doesn't need to pass the token when getting balance or sending tokens. | Optional |
[gapLimit](/hathor/guides/headless-wallet/custom-configuration#notes) | The maximum number of addresses to be generated in sequence without usage (no transactions). If not set the default value 20 will be used. | Optional |
connectionTimeout | Timeout of the websocket connection in milliseconds. If not set the default value 5000 will be used. | Optional |
allowPassphrase | This allows the user to set a passphrase when starting the wallet. This value is false by default and, starting a wallet with a passphrase will only be allowed if it's set to true. | Optional |
confirmFirstAddress | Enabling this requires all requests to have the X-First-Address header to confirm that the client is connected to the right wallet. The primary purpose of this parameter is to avoid operational mistakes and loss of funds. | Optional |
Notes
Gap Limit
Increasing the gap limit value to avoid potential errors with addresses generation may impact the headless wallet performance and its memory consumption. Since the wallet holds all addresses in memory (even those ones set as mark_as_used), a large gap limit value (e.g. in the order of tens of thousands) will force the wallet to load and keep a huge volume of data in memory. As a consequence, its loading time may also be affected increasing from seconds to tens of minutes easily.