Skip to content

hexresearch/ergvein

Folders and files

NameName
Last commit message
Last commit date

Latest commit

79d33f5 · Apr 27, 2021
Jun 4, 2020
Dec 3, 2020
Feb 3, 2021
Dec 29, 2020
Dec 29, 2020
Apr 27, 2021
Mar 28, 2021
Mar 28, 2021
Dec 29, 2020
Mar 28, 2021
Oct 19, 2020
Dec 29, 2020
Apr 27, 2021
Nov 4, 2020
Apr 27, 2021
Oct 7, 2020
Dec 29, 2020
Apr 27, 2021
Apr 27, 2021
Nov 23, 2020
Apr 27, 2021
Apr 27, 2021
Dec 29, 2020
Feb 8, 2021
Mar 28, 2021
Apr 1, 2021
Nov 24, 2020
Apr 27, 2021
Apr 27, 2021
Apr 27, 2021
Apr 6, 2021
Apr 27, 2021
Oct 2, 2019
Apr 27, 2021
Apr 27, 2021
Apr 27, 2021
Apr 27, 2021
Apr 27, 2021
Apr 27, 2021
Apr 27, 2021
Apr 27, 2021
Apr 27, 2021
Dec 29, 2020
Apr 27, 2021
Apr 27, 2021
Mar 31, 2020
Feb 3, 2020
Oct 2, 2019
Feb 5, 2021
Oct 14, 2019
Feb 12, 2021
Mar 31, 2020
Apr 27, 2021
Aug 15, 2020
Aug 15, 2020
Apr 27, 2021
May 4, 2020
Dec 9, 2019
Apr 27, 2021
Mar 15, 2020
Oct 3, 2019
Oct 2, 2019
Aug 15, 2020
Apr 27, 2021
Dec 1, 2020
Sep 9, 2020
Jan 30, 2020
Mar 28, 2021
Oct 6, 2020
Apr 6, 2021
Aug 15, 2020
Feb 4, 2021
Dec 9, 2019

Repository files navigation

Ergvein

Build all

Ergvein is MVP implementation for Cypra ecosystem. It is cryptocurrency SPV wallet that is focused on privacy, decentralized exchange and heavy usage of smart contracts. The wallet supports several currencies and provides means to perform atomic swaps between them. The project encourages users to host their own backend node. That allows node owner to get part of fees from atomic swaps and promotes privacy.

Wallet is not finished yet! Consider the product as alpha quality and subject for changes.

Features:

  • Supported currencies: Bitcoin, Ergo, ZCash, USDT (Liquid network protocol).
  • We use SPV design. Wallet doesn't trust nodes. All data is double checked: the wallet samples multiple nodes and checks results for consistency.
  • Private keys are stored in encrypted storage and never leave your device. All wallet data is encrypted and protected by your password.
  • Built-in atomic swaps, exchange your crypto in one click.
  • Built-in decentralized coin mixing: non interactive SNICKER for BTC and ErgoMix for Ergo.
  • Mobile and desktop applications
  • Decentralized public network of indexing nodes that allows users to make money when they run them.

How to build project

  1. You need nix tool to build the repo. Install with non-root user:
bash <(curl https://nixos.org/nix/install)
  1. Optional, to speed up (factor of 10 times) build, you can enable cachix binary cache. See secion below.
  2. To build desktop version:
./shells.sh
cabal new-build all
cabal new-run ergvein
  1. To build android version:
./make-android.sh
./install-apk.sh
  1. If you are using NixOS you need to manually enable reflex-platform cache:
nix.binaryCaches = [ "https://cache.nixos.org/" "https://nixcache.reflex-frp.org" ];
nix.binaryCachePublicKeys = [ "ryantrinkle.com-1:JJiAKaRv9mWgpVAz8dwewnZe0AzzEAzPkagE9SP5NWI=" ];

How to use cachix

We provide binary cache for builds via cachix.org. To start using it to speed up your builds:

nix-env -iA cachix -f https://cachix.org/api/v1/install
cachix use ergvein

Deploy index server with docker-compose

This docker-compose uses official docker image ergvein/ergvein-index-server

cd index-server/docker-compose-example

Adjust connection settings for bitcoin and ergo nodes in config.yml and run:

docker-compose up -d

Ergvein index server will listen on all network interfaces port tcp 8667.

Stop and purge all data:

docker-compose down -v

Note that you need to have running and synced bitcoin/ergo nodes.

If you have no btc/ergo nodes, you may run them along with ergvein indexer like that:

docker-compose -f docker-compose.yml -f docker-compose-btc.yml -f docker-compose-ergo.yml up -d

Also pay attention to BTCNodeUser and BTCNodePassword parameters in config.yml. In production environmnet use strong password for bitcoin node and generate rpcauth string (have a look at docker-compose-btc.yml file) with official bitcoin project python script:

curl -sSL https://raw.githubusercontent.com/bitcoin/bitcoin/master/share/rpcauth/rpcauth.py | python3 - bitcoinrpcuser

In docker-compose file you have to escape $ symbol with $ (yes, should looks like double dollar sign).

If you want to run on tesnet networks update settings in config.yml and use CHAIN=test environment variable:

CHAIN=test docker-compose -f docker-compose.yml -f docker-compose-btc.yml -f docker-compose-ergo.yml up -d

Stop and purge all data (including btc and ergo nodes):

docker-compose -f docker-compose.yml -f docker-compose-btc.yml -f docker-compose-ergo.yml up -d

Deploy indexer server with nixos module

You can use our NixOS module to deploy index server in ten minutes. Add the following to your /etc/nixos/configuration.nix:

let ergvein = pkgs.fetchFromGitHub {
      owner = "hexresearch";
      repo = "ergvein";
      rev = "35a67a64c70c73cc100c929fe32f334ca6d549aa";
      sha256 = "18rly6g6qkysw3gv3fhvicsbxv37f1hm4ll7sckpdwcfbxvyrfwn";
    };
in {
  imports = [
    "${ergvein}/nix/modules/ergvein.nix"
    "${ergvein}/nix/modules/local-secrets.nix" # remove if using nixops secrets
  ];
  services.ergvein = {
    enable = true;
    externalAddress = { host = "127.0.0.1"; port = 8667; }; # here place your ip
  };
  deployment.keys = {
    btcpassword.text = "verysecretpassword";
  };

}

UI prototyping

  • Start the server:
    • cd ui-playground
    • ./watch.sh
  • Implement the design in pure HTML+CSS in index.html
  • You may use css/extra.css for fast CSS changes
  • Alternatevly use Style.hs to mimic the Ergvein.Style module with Clay
    1. Change Style.hs
    2. ./generate-css.sh
    3. Sometimes hakyll fails to detect changes from the generate-css script. In this case, open css/style.css and press Ctrl+S

The page is accessible at 127.0.0.1:8000

Finally, transfer design choices and extra classes to the wallet.

Troubleshooting

Element inspector fails to render

If the page turns to blank when you open the element inspector or resize the window try exporting export WEBKIT_DISABLE_COMPOSITING_MODE=1 before running the app.

pg_ctl failed to start

Error: could not create lock file "/var/run/postgresql/.s.PGSQL.5434.lock": Permission denied Solution: sudo chmod a+w /var/run/postgresql