Skip to main content

How to install Hathor headless wallet from source code

Objective

This article will guide you to install Hathor headless wallet from source code.

Prerequisite

Before you begin, make sure you meet this prerequisite:

  • Have Node.js v20.0.0 or later.

Step-by-step

  1. Download the latest release of Hathor headless wallet.
  2. Install dependencies.
  3. Set up configurations.
  4. Launch the application.

Step 1: Download the latest release of Hathor headless wallet

  1. Choose a directory to store the application.
  2. Open the command line from that directory.
  3. Run the command to clone the application repository:
git clone https://github.com/HathorNetwork/hathor-wallet-headless.git

Step 2: Install dependencies

  1. Open the command line from the hathor-wallet-headless directory.
  2. Run the command to install the dependencies:
npm install

Step 3: Set up configurations

  1. Open the command line from the hathor-wallet-headless directory.
  2. Run the command to copy the config.js.template file to src/, renaming it to config.js:
cp config.js.template src/config.js

Once you have Hathor headless wallet running, there will be three alternatives to start a wallet in the application: (1) by its seed phrase; (2) by its seed key; or (3) by its extended public key (in case of a read-only wallet). To start a wallet by its seed key, you must had previously added such seed key with an associated seed phrase into the config.js file.

If you already have a previously generated seed phrase (i.e., wallet), you may use it. Otherwise, you must generate a new seed phrase.

  1. (Optional) If you don't have a wallet seed phrase, run the command to generate a new one:
npm run generate_words

The output will be a string of 24 random words.

danger

Anyone with access to a seed phrase can manage the funds of the associated wallet. Also, you cannot manage your wallet without access to the seed phrase or the private keys generated from it. Thus, we strongly recommend storing a backup file (either digital or physical or both) of the seed phrase and keeping the backup and the chosen installation directory secure against unauthorized access.

  1. Open the config.js file.
  2. (Optional) Change the default configuration values of the application.
  3. (Optional) To be able to start a wallet by its seed key, add a key/value pair my_seed_nr_1: <24_words_seed_phrase_string> into the seeds object, replacing the my_seed_nr_1 with the desired key and the <24_words_seed_phrase_string> placeholder with its associated seed phrase:
hathor-wallet-headless/src/config.js
module.exports = {

...

seeds: {
my_seed_nr_1: '<24_words_seed_phrase_string>',
},

...

};
  1. (Optional) You may repeat the last step as many times you want. In other words, you may define multiple seed keys in the seeds object, in order to start multiple wallets using them.

Step 4: Launch the application

  1. Open the command line from the hathor-wallet-headless directory.
  2. Run the command to start the wallet application:
npm start

By default, the application starts listening to port 8000 and connects to a public full node of the Hathor Network mainnet.

Task completed

You now have a running instance of Hathor headless wallet. To know how to operate and use this application, see Hathor headless wallet pathway.