From 5edf0d72404c38e663d02d97a59fe501e0b67964 Mon Sep 17 00:00:00 2001 From: Jonas Nick Date: Thu, 1 Aug 2019 15:05:07 +0000 Subject: [PATCH] Replace liquidd with elementsd package --- README.md | 4 ++-- default.nix | 2 +- modules/liquid.nix | 16 ++++++------- modules/nix-bitcoin.nix | 4 ++-- pkgs/elementsd/default.nix | 46 ++++++++++++++++++++++++++++++++++++++ pkgs/liquidd/default.nix | 45 ------------------------------------- 6 files changed, 59 insertions(+), 58 deletions(-) create mode 100644 pkgs/elementsd/default.nix delete mode 100644 pkgs/liquidd/default.nix diff --git a/README.md b/README.md index 384f227..8e3d8b0 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ This is a work in progress - don't expect it to be bug free or secure. The default configuration sets up a Bitcoin Core node and c-lightning. The user can enable spark-wallet in `configuration.nix` to make c-lightning accessible with a smartphone using spark-wallet. A simple webpage shows the lightning nodeid and links to nanopos letting the user receive donations. -It also includes liquid-daemon. +It also includes elements-daemon. Outbound peer-to-peer traffic is forced through Tor, and listening services are bound to onion addresses. A demo installation is running at [http://6tr4dg3f2oa7slotdjp4syvnzzcry2lqqlcvqkfxdavxo6jsuxwqpxad.onion](http://6tr4dg3f2oa7slotdjp4syvnzzcry2lqqlcvqkfxdavxo6jsuxwqpxad.onion). @@ -32,7 +32,7 @@ By default the `configuration.nix` provides: In `configuration.nix` the user can enable: * a clightning hidden service -* [liquid-daemon](https://github.com/blockstream/liquid) +* [liquid](https://github.com/elementsproject/elements) * [lightning charge](https://github.com/ElementsProject/lightning-charge) * [nanopos](https://github.com/ElementsProject/nanopos) * an index page using nginx to display node information and link to nanopos diff --git a/default.nix b/default.nix index eb88bd1..c2a6acf 100644 --- a/default.nix +++ b/default.nix @@ -10,7 +10,7 @@ nanopos = pkgs.callPackage ./pkgs/nanopos { }; spark-wallet = pkgs.callPackage ./pkgs/spark-wallet { }; electrs = (pkgs.callPackage ./pkgs/electrs { }).rootCrate.build; - liquidd = pkgs.callPackage ./pkgs/liquidd { }; + elementsd = pkgs.callPackage ./pkgs/elementsd { }; hwi = pkgs.callPackage ./pkgs/hwi { }; pylightning = pkgs.python3Packages.callPackage ./pkgs/pylightning { }; } diff --git a/modules/liquid.nix b/modules/liquid.nix index aed5789..3be3dd3 100644 --- a/modules/liquid.nix +++ b/modules/liquid.nix @@ -6,7 +6,7 @@ let nix-bitcoin-services = pkgs.callPackage ./nix-bitcoin-services.nix { }; cfg = config.services.liquidd; pidFile = "${cfg.dataDir}/liquidd.pid"; - configFile = pkgs.writeText "liquid.conf" '' + configFile = pkgs.writeText "elements.conf" '' ${optionalString cfg.testnet "testnet=1"} ${optionalString (cfg.dbCache != null) "dbcache=${toString cfg.dbCache}"} ${optionalString (cfg.prune != null) "prune=${toString cfg.prune}"} @@ -71,7 +71,7 @@ in { logips=1 ''; - description = "Additional configurations to be appended to liquid.conf."; + description = "Additional configurations to be appended to elements.conf."; }; dataDir = mkOption { type = types.path; @@ -179,7 +179,7 @@ in { }; config = mkIf cfg.enable { - environment.systemPackages = [ pkgs.liquidd ]; + environment.systemPackages = [ pkgs.elementsd ]; systemd.services.liquidd = { description = "Liquid daemon"; requires = [ "liquid-rpcpassword-key.service" ]; @@ -189,17 +189,17 @@ in { if ! test -e ${cfg.dataDir}; then mkdir -m 0770 -p '${cfg.dataDir}' fi - cp '${configFile}' '${cfg.dataDir}/liquid.conf' - chmod o-rw '${cfg.dataDir}/liquid.conf' + cp '${configFile}' '${cfg.dataDir}/elements.conf' + chmod o-rw '${cfg.dataDir}/elements.conf' chown -R '${cfg.user}:${cfg.group}' '${cfg.dataDir}' - echo "rpcpassword=$(cat /secrets/liquid-rpcpassword)" >> '${cfg.dataDir}/liquid.conf' - echo "mainchainrpcpassword=$(cat /secrets/bitcoin-rpcpassword)" >> '${cfg.dataDir}/liquid.conf' + echo "rpcpassword=$(cat /secrets/liquid-rpcpassword)" >> '${cfg.dataDir}/elements.conf' + echo "mainchainrpcpassword=$(cat /secrets/bitcoin-rpcpassword)" >> '${cfg.dataDir}/elements.conf' ''; serviceConfig = { Type = "simple"; User = "${cfg.user}"; Group = "${cfg.group}"; - ExecStart = "${pkgs.liquidd}/bin/liquidd ${cmdlineOptions}"; + ExecStart = "${pkgs.elementsd}/bin/elementsd ${cmdlineOptions}"; StateDirectory = "liquidd"; PIDFile = "${pidFile}"; Restart = "on-failure"; diff --git a/modules/nix-bitcoin.nix b/modules/nix-bitcoin.nix index b1dc528..15b10d5 100644 --- a/modules/nix-bitcoin.nix +++ b/modules/nix-bitcoin.nix @@ -113,7 +113,7 @@ in { alias bitcoin-cli='bitcoin-cli -datadir=${config.services.bitcoind.dataDir}' alias lightning-cli='sudo -u clightning lightning-cli --lightning-dir=${config.services.clightning.dataDir}' '' + (if config.services.liquidd.enable then '' - alias liquid-cli='liquid-cli -datadir=${config.services.liquidd.dataDir}' + alias elements-cli='elements-cli -datadir=${config.services.liquidd.dataDir}' '' else ""); # Unfortunately c-lightning doesn't allow setting the permissions of the rpc socket # https://github.com/ElementsProject/lightning/issues/1366 @@ -179,7 +179,7 @@ in { ++ optionals config.services.lightning-charge.enable [lightning-charge] ++ optionals config.services.nanopos.enable [nanopos] ++ optionals config.services.nix-bitcoin-webindex.enable [nginx] - ++ optionals config.services.liquidd.enable [liquidd] + ++ optionals config.services.liquidd.enable [elementsd] ++ optionals config.services.spark-wallet.enable [spark-wallet] ++ optionals config.services.electrs.enable [electrs] ++ optionals (config.services.hardware-wallets.ledger || config.services.hardware-wallets.trezor) [ diff --git a/pkgs/elementsd/default.nix b/pkgs/elementsd/default.nix new file mode 100644 index 0000000..636d4ab --- /dev/null +++ b/pkgs/elementsd/default.nix @@ -0,0 +1,46 @@ +{ stdenv, fetchurl, pkgconfig, autoreconfHook, openssl, db48, boost, zeromq +, zlib, qtbase ? null, qttools ? null, utillinux, protobuf, python3, qrencode, libevent +}: + +with stdenv.lib; +stdenv.mkDerivation rec{ + name = "elements-" + version; + version = "0.17.0.1"; + + src = fetchurl { + urls = [ + "https://github.com/ElementsProject/elements/archive/elements-${version}.tar.gz" + ]; + sha256 = "e106c26e7aaff043d389d70f0c5e246f556bce77c885dbfedddc67fcb45aeca0"; + }; + + nativeBuildInputs = [ pkgconfig autoreconfHook ] + ++ optionals doCheck [ python3 ]; + buildInputs = [ openssl db48 boost zlib zeromq + protobuf libevent] + ++ optionals stdenv.isLinux [ utillinux ]; + + configureFlags = [ "--with-boost-libdir=${boost.out}/lib" + "--disable-bench" + ] ++ optionals (!doCheck) [ + "--disable-tests" + "--disable-gui-tests" + ]; + doCheck = true; + + enableParallelBuilding = true; + + meta = { + description = "Open Source implementation of advanced blockchain features extending the Bitcoin protocol"; + longDescription= '' + The Elements blockchain platform is a collection of feature experiments and extensions to the + Bitcoin protocol. This platform enables anyone to build their own businesses or networks + pegged to Bitcoin as a sidechain or run as a standalone blockchain with arbitrary asset + tokens. + ''; + homepage = http://www.github.com/ElementsProject/elements; + license = licenses.mit; + # elements needs hexdump to build, which doesn't seem to build on darwin at the moment. + platforms = platforms.linux; + }; +} diff --git a/pkgs/liquidd/default.nix b/pkgs/liquidd/default.nix deleted file mode 100644 index b63a375..0000000 --- a/pkgs/liquidd/default.nix +++ /dev/null @@ -1,45 +0,0 @@ -{ stdenv, fetchurl, pkgconfig, autoreconfHook, openssl, db48, boost, zeromq -, zlib, miniupnpc, qtbase ? null, qttools ? null, utillinux, protobuf, python3, qrencode, libevent -}: - -with stdenv.lib; -stdenv.mkDerivation rec{ - name = "liquid-" + version; - version = "3.14.1.22"; - - src = fetchurl { - urls = [ - "https://github.com/Blockstream/liquid/releases/download/liquid.${version}/liquid-${version}.tar.gz" - ]; - sha256 = "25907a4085b7b92a0365235f059a12a3c82679b0049115b80697b438816e74de"; - }; - - nativeBuildInputs = [ pkgconfig autoreconfHook ] - ++ optionals doCheck [ python3 ]; - buildInputs = [ openssl db48 boost zlib zeromq - miniupnpc protobuf libevent] - ++ optionals stdenv.isLinux [ utillinux ]; - - configureFlags = [ "--with-boost-libdir=${boost.out}/lib" - "--disable-bench" - ] ++ optionals (!doCheck) [ - "--disable-tests" - "--disable-gui-tests" - ]; - doCheck = true; - - enableParallelBuilding = true; - - meta = { - description = "An inter-exchange settlement network based on Bitcoin"; - longDescription= '' - Liquid is an inter-exchange settlement network linking together cryptocurrency exchanges and - institutions around the world, enabling faster Bitcoin transactions and the issuance of - digital assets. - ''; - homepage = http://www.github.com/blockstream/liquid; - license = licenses.mit; - # liquid needs hexdump to build, which doesn't seem to build on darwin at the moment. - platforms = platforms.linux; - }; -}