Merge branch 'update-liquid-2'
This commit is contained in:
commit
46aa88c71c
|
@ -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
|
||||
|
|
|
@ -43,10 +43,11 @@
|
|||
# services.electrs.enable = true;
|
||||
|
||||
### LIQUIDD
|
||||
# Enable this module to use liquidd, a daemon for an inter-exchange
|
||||
# Enable this module to use Liquid, a sidechain for an inter-exchange
|
||||
# settlement network linking together cryptocurrency exchanges and
|
||||
# institutions around the world.
|
||||
# services.liquidd.enable = true;
|
||||
# institutions around the world. Liquid is accessed with the elements-cli
|
||||
# tool run as user operator.
|
||||
services.liquidd.enable = true;
|
||||
|
||||
### LIGHTNING CHARGE
|
||||
# Enable this module to use lightning-charge, a simple drop-in solution for
|
||||
|
|
|
@ -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 { };
|
||||
}
|
||||
|
|
|
@ -6,7 +6,8 @@ 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" ''
|
||||
chain=liquidv1
|
||||
${optionalString cfg.testnet "testnet=1"}
|
||||
${optionalString (cfg.dbCache != null) "dbcache=${toString cfg.dbCache}"}
|
||||
${optionalString (cfg.prune != null) "prune=${toString cfg.prune}"}
|
||||
|
@ -60,7 +61,7 @@ in {
|
|||
options = {
|
||||
|
||||
services.liquidd = {
|
||||
enable = mkEnableOption "Liquid daemon";
|
||||
enable = mkEnableOption "Liquid sidechain";
|
||||
|
||||
extraConfig = mkOption {
|
||||
type = types.lines;
|
||||
|
@ -71,7 +72,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,9 +180,9 @@ in {
|
|||
};
|
||||
|
||||
config = mkIf cfg.enable {
|
||||
environment.systemPackages = [ pkgs.liquidd ];
|
||||
environment.systemPackages = [ pkgs.elementsd ];
|
||||
systemd.services.liquidd = {
|
||||
description = "Liquid daemon";
|
||||
description = "Elements daemon providing access to the Liquid sidechain";
|
||||
requires = [ "liquid-rpcpassword-key.service" ];
|
||||
after = [ "network.target" "liquid-rpcpassword-key.service" ];
|
||||
wantedBy = [ "multi-user.target" ];
|
||||
|
@ -189,17 +190,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";
|
||||
|
@ -216,7 +217,7 @@ in {
|
|||
name = cfg.user;
|
||||
group = cfg.group;
|
||||
extraGroups = [ "keys" ];
|
||||
description = "Liquid daemon user";
|
||||
description = "Liquid sidechain user";
|
||||
home = cfg.dataDir;
|
||||
};
|
||||
users.groups.${cfg.group} = {
|
||||
|
|
|
@ -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) [
|
||||
|
|
46
pkgs/elementsd/default.nix
Normal file
46
pkgs/elementsd/default.nix
Normal 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;
|
||||
};
|
||||
}
|
|
@ -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;
|
||||
};
|
||||
}
|
Loading…
Reference in New Issue
Block a user