Replace liquidd with elementsd package

This commit is contained in:
Jonas Nick 2019-08-01 15:05:07 +00:00
parent f58a2e62e3
commit 5edf0d7240
No known key found for this signature in database
GPG Key ID: 4861DBF262123605
6 changed files with 59 additions and 58 deletions

View File

@ -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

View File

@ -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 { };
}

View File

@ -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 <filename>liquid.conf</filename>.";
description = "Additional configurations to be appended to <filename>elements.conf</filename>.";
};
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";

View File

@ -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) [

View File

@ -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;
};
}

View File

@ -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;
};
}