Skip to content

HathorNetwork/hathor-wallet

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Hathor Wallet

Welcome to Hathor Desktop Wallet. To view the source code of the project access Github.

Architecture

The wallet is developed using Javascript with React. We use Electron to generate native desktop apps from it.

Download

You can download the newest version of the wallet for each specific platform from the Releases page.

Screenshots

The basic view of the wallet. Note that different types of tokens are made possible in the Hathor Network. On the left hand side we see both a HTR tab and a MTK tab, for the Hathor token, and a different, ERC-20 like, token. Wallet Home

Sending tokens. Send Tokens

The wallet includes a block and transaction explorer. Explorer

A transaction is displayed. Transaction Detail

For development

Prerequisites

  • Install node v20

To install dependencies

npm install

To Run

npm start

It will start running in the browser in http://localhost:3000

NOTE: to use Hathor Wallet with Ledger, you need to run it in Electron.

NOTE: use the electron wallet for a more complete experience.

Quick start to Electron

Run the electron besides the react app. Open a new instance of the terminal and run the following command:

npm run electron-dev

If you get some error like this error while loading shared libraries: libxshmfence.so.1: cannot open shared object file: No such file or directory refer to the throubleshooting section.

To use the Chrome Dev Tools associated with Electron for debugging purposes, the unsafe mode may be enabled through CLI arguments:

npm run electron-dev -- --unsafe-mode --hathor-debug

Debug mode on installed app

To run the app in debug mode on an installed app you need to pass the flags --hathor-debug and --unsafe-mode to the app. The way to do this depends on your environment.

On Windows the app is installed in the C:\Users\<username>\AppData\Local\Programs\hathor-wallet folder. You will need to open a terminal (CMD, Powershell, etc.) and run the Hathor Wallet.exe executable with the flags above. On CMD the command would be & '.\Hathor Wallet.exe' --unsafe-mode --hathor-debug or & 'C:\Users\<username>\AppData\Local\Programs\hathor-wallet\Hathor Wallet.exe' --unsafe-mode --hathor-debug.

On Linux the app is installed in a way that it is available as the command hathor-wallet, so we can simply run hathor-wallet --unsafe-mode --hathor-debug from the terminal.

On MacOS the app is usually installed in /Applications in a way that is possible to run the following command open /Applications/Hathor\ Wallet.app --args --hathor-debug --unsafe-mode from the terminal.

To Build

npm run build and it will create a folder build with the files to use

Server

By default the wallet will connect to the server selected as the DEFAULT_SERVER in the constants file (src/constants.js). You can change this anytime in the 'Change Server' screen inside the wallet.

Documentation

To generate a html page with the documentation from the code comments run:

npm run generate-doc

It will generate a index.html file in out/index.html

Run Electron

Refer to ELECTRON.md

Sentry

Sentry is a error tracking tool, that allow us to receive error data from clients - it will be disabled on stable versions of the wallet.

DSN

On public/constants.js we have a default Sentry DSN. To override it simply set the environment variable SENTRY_DSN.

Source maps

To allow stack traces to be mapped to source code, Sentry needs the source maps. To upload the source maps, create a .sentryclirc with the format:

[defaults]
url=https://sentry.io/
org=<ORGANIZATION_NAME>
project=<PROJECT_NAME>

[auth]
token=<CLI_API_TOKEN>

You can find more information about the configuration file and its fields here. After configuring it, just run the upload_source_maps.sh script to upload the source maps.

WARNING: Please note that this will override all the source maps for the current sentry release.

The sentry release used is the version field in the package.json file. So in order to not break any released source maps, only run the script after bumping package.json to a new version. For test purposes use *-beta versions or identifiers that will not colide with semantic versioning.

Troubleshooting

When building, if you get the following error message:

FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory

Then, you can increase your memory limit running:

export NODE_OPTIONS=--max_old_space_size=4096

WSL (Windows Subsystem for Linux)

  • Make sure you have the vesion 2
    wsl -l -v
    
  • Make sure to install the WSL driver for your GPU, see at Prerequisites
  • Make sure to update the WSL after install the GPU driver, see at Existing WSL Install
  • Once the WSL is updated you are ready to go

If you still can't run, see this article.

WSL Ubuntu 18 distro

Run the following command to install necessary packages:

sudo apt install libnss3-dev libgdk-pixbuf2.0-dev libgtk-3-dev libxss-dev libasound2

WSL Debian distro

Run the following command to install necessary packages:

sudo apt install libnss3-dev libgdk-pixbuf2.0-dev libgtk-3-dev libxss-dev libasound2 libusb-1.0-0

TODO

  • The algorithm to automatically choose the unspent transactions when sending tokens is naive. For now we do not consider any anonymity factor.
  • The addresses shared with the user and the ones used in change outputs are generated by the same chain in the HD Wallet. We don't separate internal and external addresses.

i18n

We use the ttag lib. Check out the docs here.

Run make update_pot to update the pot file (locale/texts.pot). This file has all strings to be translated in the app.

Run msgmerge pt-br/texts.po texts.pot -o pt-br/texts.po to merge a pot file with a po file. This will add the new strings to be transalted and remove the deprecated ones. Any translation marked with ; fuzzy comment must be reviewed.

Finally, run make i18n to compile all po files to json files. You can use make check_po to check for problems in translations.

Release

There is a release guide in RELEASE.md.

We ship GPG signatures for all release packages. Check our guide in RELEASING.md#signature-verification to learn how to verify them.

License

Code released under the MIT license.

Copyright 2019 Hathor Labs.