Merge branch 'master' into dcg-latest

This commit is contained in:
nicolas.dorier
2018-12-04 14:01:30 +09:00
36 changed files with 1345 additions and 15 deletions

1
bitcore-cli.ps1 Executable file
View File

@@ -0,0 +1 @@
docker exec -ti btcpayserver_bitcored bitcore-cli -datadir="/data" $args

3
bitcore-cli.sh Executable file
View File

@@ -0,0 +1,3 @@
#!/bin/bash
docker exec -ti btcpayserver_bitcored bitcore-cli -datadir="/data" "$@"

View File

@@ -52,7 +52,7 @@ Environment variables:
LETSENCRYPT_EMAIL: A mail will be sent to this address if certificate expires and fail to renew automatically (eg. me@example.com)
NBITCOIN_NETWORK: The type of network to use (eg. mainnet, testnet or regtest. Default: mainnet)
LIGHTNING_ALIAS: An alias for your lightning network node if used
BTCPAYGEN_CRYPTO1: First supported crypto currency (eg. btc, ltc, btg, grs, ftc, via, none. Default: btc)
BTCPAYGEN_CRYPTO1: First supported crypto currency (eg. btc, ltc, btx, btg, grs, ftc, via, doge, mona, dash, none. Default: btc)
BTCPAYGEN_CRYPTO2: Second supported crypto currency (Default: empty)
BTCPAYGEN_CRYPTON: N th supported crypto currency where N is maximum at maximum 9. (Default: none)
BTCPAYGEN_REVERSEPROXY: Whether to use or not a reverse proxy. NGinx setup HTTPS for you. (eg. nginx, traefik, none. Default: nginx)
@@ -234,14 +234,14 @@ if ! [ -x "$(command -v docker)" ] || ! [ -x "$(command -v docker-compose)" ]; t
fi
if ! [ -x "$(command -v docker-compose)" ]; then
if [[ "$(uname -m)" == "x86_64" ]]; then
DOCKER_COMPOSE_DOWNLOAD="https://github.com/docker/compose/releases/download/1.17.1/docker-compose-$(uname -s)-$(uname -m)"
DOCKER_COMPOSE_DOWNLOAD="https://github.com/docker/compose/releases/download/1.23.2/docker-compose-`uname -s`-`uname -m`"
echo "Trying to install docker-compose by downloading on $DOCKER_COMPOSE_DOWNLOAD ($(uname -m))"
curl -L "$DOCKER_COMPOSE_DOWNLOAD" -o /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
else
echo "Trying to install docker-compose by using the docker-compose-builder ($(uname -m))"
! [ -d "dist" ] && mkdir dist
docker run --rm -ti -v "$(pwd)/dist:/dist" btcpayserver/docker-compose-builder:1.22.0
docker run --rm -ti -v "$(pwd)/dist:/dist" btcpayserver/docker-compose-builder:1.23.2
mv dist/docker-compose /usr/local/bin/docker-compose
chmod +x /usr/local/bin/docker-compose
rm -rf "dist"

View File

@@ -0,0 +1,38 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace DockerFileBuildHelper
{
public class DockerFile
{
public string DockerFileName { get; private set; }
public string DockerDirectoryPath { get; private set; }
public string DockerFullPath
{
get
{
if (DockerDirectoryPath == ".")
return $"{DockerFileName}";
else
return $"{DockerDirectoryPath}/{DockerFileName}";
}
}
public static DockerFile Parse(string str)
{
var file = new DockerFile();
var lastPart = str.LastIndexOf('/');
file.DockerFileName = str.Substring(lastPart + 1);
if (lastPart == -1)
{
file.DockerDirectoryPath = ".";
}
else
{
file.DockerDirectoryPath = str.Substring(0, lastPart);
}
return file;
}
}
}

View File

@@ -0,0 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>netcoreapp2.1</TargetFramework>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="YamlDotNet" Version="5.2.1" />
</ItemGroup>
</Project>

View File

@@ -0,0 +1,22 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace DockerFileBuildHelper
{
public class DockerInfo
{
public string DockerFilePath { get; set; }
public string DockerFilePathARM32v7 { get; set; }
public string DockerFilePathARM64v8 { get; set; }
public string DockerHubLink { get; set; }
public string GitLink { get; set; }
public string GitRef { get; set; }
public Image Image { get; internal set; }
public string GetGithubLinkOf(string path)
{
return $"https://raw.githubusercontent.com/{GitLink.Substring("https://github.com/".Length)}/{GitRef}/{path}";
}
}
}

View File

@@ -0,0 +1,19 @@
using System;
using System.Collections.Generic;
using System.Text;
using YamlDotNet.RepresentationModel;
namespace DockerFileBuildHelper
{
public static class Extensions
{
public static YamlNode TryGet(this YamlNode node, string key)
{
try
{
return node[key];
}
catch (KeyNotFoundException) { return null; }
}
}
}

View File

@@ -0,0 +1,55 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Text.RegularExpressions;
namespace DockerFileBuildHelper
{
public class Image
{
public string User { get; private set; }
public string Name { get; private set; }
public string Tag { get; private set; }
public string DockerHubLink
{
get
{
return User == string.Empty ?
$"https://hub.docker.com/_/{Name}" :
$"https://hub.docker.com/r/{User}/{Name}";
}
}
public static Image Parse(string str)
{
//${BTCPAY_IMAGE: -btcpayserver / btcpayserver:1.0.3.21}
var variableMatch = Regex.Match(str, @"\$\{[^-]+-([^\}]+)\}");
if(variableMatch.Success)
{
str = variableMatch.Groups[1].Value;
}
Image img = new Image();
var match = Regex.Match(str, "([^/]*/)?([^:]+):?(.*)");
if (!match.Success)
throw new FormatException();
img.User = match.Groups[1].Length == 0 ? string.Empty : match.Groups[1].Value.Substring(0, match.Groups[1].Value.Length - 1);
img.Name = match.Groups[2].Value;
img.Tag = match.Groups[3].Value;
if (img.Tag == string.Empty)
img.Tag = "latest";
return img;
}
public override string ToString()
{
StringBuilder builder = new StringBuilder();
if (!String.IsNullOrWhiteSpace(User))
builder.Append($"{User}/");
builder.Append($"{Name}");
if (!String.IsNullOrWhiteSpace(Tag))
builder.Append($":{Tag}");
return builder.ToString();
}
}
}

View File

@@ -0,0 +1,315 @@
using System;
using YamlDotNet;
using YamlDotNet.Helpers;
using System.Linq;
using System.Collections.Generic;
using System.IO;
using YamlDotNet.RepresentationModel;
using YamlDotNet.Serialization;
using System.Net.Http;
using System.Threading.Tasks;
using System.Text;
namespace DockerFileBuildHelper
{
class Program
{
static int Main(string[] args)
{
string outputFile = null;
for (int i = 0; i < args.Length; i++)
{
if (args[i] == "-o")
outputFile = args[i + 1];
}
return new Program().Run(outputFile) ? 0 : 1;
}
private bool Run(string outputFile)
{
var fragmentDirectory = Path.GetFullPath(Path.Combine(FindRoot("contrib"), "..", "docker-compose-generator", "docker-fragments"));
List<Task<bool>> downloading = new List<Task<bool>>();
List<DockerInfo> dockerInfos = new List<DockerInfo>();
foreach(var image in new[]
{
Image.Parse("btcpayserver/docker-compose-generator"),
Image.Parse("btcpayserver/docker-compose-builder:1.23.2"),
}.Concat(GetImages(fragmentDirectory)))
{
Console.WriteLine($"Image: {image.ToString()}");
var info = GetDockerInfo(image);
if (info == null)
{
Console.WriteLine($"Missing image info: {image}");
return false;
}
dockerInfos.Add(info);
downloading.Add(CheckLink(info, info.DockerFilePath));
downloading.Add(CheckLink(info, info.DockerFilePathARM32v7));
downloading.Add(CheckLink(info, info.DockerFilePathARM64v8));
}
Task.WaitAll(downloading.ToArray());
var canDownloadEverything = downloading.All(o => o.Result);
if (!canDownloadEverything)
return false;
var builder = new StringBuilderEx();
builder.AppendLine("#!/bin/bash");
builder.AppendLine();
builder.AppendLine("# This file is automatically generated by the DockerFileBuildHelper tool, run DockerFileBuildHelper/update-repo.sh to update it");
builder.AppendLine("set -e");
builder.AppendLine("DOCKERFILE=\"\"");
builder.AppendLine();
builder.AppendLine();
foreach (var info in dockerInfos)
{
builder.AppendLine($"# Build {info.Image.Name}");
bool mightBeUnavailable = false;
if (info.DockerFilePath != null)
{
var dockerFile = DockerFile.Parse(info.DockerFilePath);
builder.AppendLine($"# {info.GetGithubLinkOf(dockerFile.DockerFullPath)}");
builder.AppendLine($"DOCKERFILE=\"{dockerFile.DockerFullPath}\"");
}
else
{
builder.AppendLine($"DOCKERFILE=\"\"");
mightBeUnavailable = true;
}
if (info.DockerFilePathARM32v7 != null)
{
var dockerFile = DockerFile.Parse(info.DockerFilePathARM32v7);
builder.AppendLine($"# {info.GetGithubLinkOf(dockerFile.DockerFullPath)}");
builder.AppendLine($"[[ \"$(uname -m)\" == \"armv7l\" ]] && DOCKERFILE=\"{dockerFile.DockerFullPath}\"");
}
if (info.DockerFilePathARM64v8 != null)
{
var dockerFile = DockerFile.Parse(info.DockerFilePathARM64v8);
builder.AppendLine($"# {info.GetGithubLinkOf(dockerFile.DockerFullPath)}");
builder.AppendLine($"[[ \"$(uname -m)\" == \"aarch64\" ]] && DOCKERFILE=\"{dockerFile.DockerFullPath}\"");
}
if(mightBeUnavailable)
{
builder.AppendLine($"if [[ \"$DOCKERFILE\" ]]; then");
builder.Indent++;
}
builder.AppendLine($"echo \"Building {info.Image.ToString()}\"");
builder.AppendLine($"git clone {info.GitLink} {info.Image.Name}");
builder.AppendLine($"cd {info.Image.Name}");
builder.AppendLine($"git checkout {info.GitRef}");
builder.AppendLine($"cd \"$(dirname $DOCKERFILE)\"");
builder.AppendLine($"docker build -f \"$DOCKERFILE\" -t \"{info.Image}\" .");
builder.AppendLine($"cd - && cd ..");
if (mightBeUnavailable)
{
builder.Indent--;
builder.AppendLine($"fi");
}
builder.AppendLine();
builder.AppendLine();
}
var script = builder.ToString().Replace("\r\n", "\n");
if (string.IsNullOrEmpty(outputFile))
outputFile = "build-all.sh";
File.WriteAllText(outputFile, script);
Console.WriteLine($"Generated file \"{Path.GetFullPath(outputFile)}\"");
return true;
}
HttpClient client = new HttpClient();
private async Task<bool> CheckLink(DockerInfo info, string path)
{
if (path == null)
return true;
var link = info.GetGithubLinkOf(path);
var resp = await client.GetAsync(link);
if(!resp.IsSuccessStatusCode)
{
Console.WriteLine($"\tBroken link detected for image {info.Image} ({link})");
return false;
}
return true;
}
private IEnumerable<Image> GetImages(string fragmentDirectory)
{
var deserializer = new DeserializerBuilder().Build();
var serializer = new SerializerBuilder().Build();
foreach (var file in Directory.EnumerateFiles(fragmentDirectory, "*.yml"))
{
var root = ParseDocument(file);
if (root.TryGet("services") == null)
continue;
foreach (var service in ((YamlMappingNode)root["services"]).Children)
{
var imageStr = service.Value.TryGet("image");
if (imageStr == null)
continue;
var image = Image.Parse(imageStr.ToString());
yield return image;
}
}
}
private DockerInfo GetDockerInfo(Image image)
{
DockerInfo dockerInfo = new DockerInfo();
switch (image.Name)
{
case "btglnd":
dockerInfo.DockerFilePath = "BTCPayServer.Dockerfile";
dockerInfo.GitLink = "https://github.com/vutov/lnd";
dockerInfo.GitRef = "master";
break;
case "docker-compose-builder":
dockerInfo.DockerFilePathARM32v7 = "linuxarm32v7.Dockerfile";
dockerInfo.GitLink = "https://github.com/btcpayserver/docker-compose-builder";
dockerInfo.GitRef = $"v{image.Tag}";
break;
case "docker-compose-generator":
dockerInfo.DockerFilePath = "docker-compose-generator/linuxamd64.Dockerfile";
dockerInfo.DockerFilePathARM32v7 = "docker-compose-generator/linuxarm32v7.Dockerfile";
dockerInfo.GitLink = "https://github.com/btcpayserver/btcpayserver-docker";
dockerInfo.GitRef = $"dcg-latest";
break;
case "docker-bitcoingold":
dockerInfo.DockerFilePath = $"bitcoingold/{image.Tag}/Dockerfile";
dockerInfo.GitLink = "https://github.com/Vutov/docker-bitcoin";
dockerInfo.GitRef = "master";
break;
case "clightning":
dockerInfo.DockerFilePath = $"Dockerfile";
dockerInfo.GitLink = "https://github.com/NicolasDorier/lightning";
dockerInfo.GitRef = $"basedon-{image.Tag}";
break;
case "lnd":
dockerInfo.DockerFilePath = "BTCPayServer.Dockerfile";
dockerInfo.GitLink = "https://github.com/btcpayserver/lnd";
dockerInfo.GitRef = $"basedon-v{image.Tag}";
break;
case "bitcoin":
dockerInfo.DockerFilePath = $"Bitcoin/{image.Tag}/linuxamd64.Dockerfile";
dockerInfo.DockerFilePathARM32v7 = $"Bitcoin/{image.Tag}/linuxarm32v7.Dockerfile";
dockerInfo.DockerFilePathARM64v8 = $"Bitcoin/{image.Tag}/linuxarm64v8.Dockerfile";
dockerInfo.GitLink = "https://github.com/btcpayserver/dockerfile-deps";
dockerInfo.GitRef = $"Bitcoin/{image.Tag}";
break;
case "dash":
dockerInfo.DockerFilePath = $"Dash/{image.Tag}/linuxamd64.Dockerfile";
dockerInfo.DockerFilePathARM32v7 = $"Dash/{image.Tag}/linuxarm32v7.Dockerfile";
dockerInfo.DockerFilePathARM64v8 = $"Dash/{image.Tag}/linuxarm64v8.Dockerfile";
dockerInfo.GitLink = "https://github.com/btcpayserver/dockerfile-deps";
dockerInfo.GitRef = $"Dash/{image.Tag}";
break;
case "btcpayserver":
dockerInfo.DockerFilePath = "Dockerfile.linuxamd64";
dockerInfo.DockerFilePathARM32v7 = "Dockerfile.linuxarm32v7";
dockerInfo.GitLink = "https://github.com/btcpayserver/btcpayserver";
dockerInfo.GitRef = $"v{image.Tag}";
break;
case "nbxplorer":
dockerInfo.DockerFilePath = "Dockerfile.linuxamd64";
dockerInfo.DockerFilePathARM32v7 = "Dockerfile.linuxarm32v7";
dockerInfo.GitLink = "https://github.com/dgarage/nbxplorer";
dockerInfo.GitRef = $"v{image.Tag}";
break;
case "dogecoin":
dockerInfo.DockerFilePath = $"dogecoin/{image.Tag}/Dockerfile";
dockerInfo.GitLink = "https://github.com/rockstardev/docker-bitcoin";
dockerInfo.GitRef = "feature/dogecoin";
break;
case "docker-feathercoin":
dockerInfo.DockerFilePath = $"feathercoin/{image.Tag}/Dockerfile";
dockerInfo.GitLink = "https://github.com/ChekaZ/docker";
dockerInfo.GitRef = "master";
break;
case "docker-groestlcoin":
dockerInfo.DockerFilePath = $"groestlcoin/{image.Tag}/Dockerfile";
dockerInfo.GitLink = "https://github.com/NicolasDorier/docker-bitcoin";
dockerInfo.GitRef = "master";
break;
case "docker-viacoin":
dockerInfo.DockerFilePath = $"viacoin/{image.Tag}/docker-viacoin";
dockerInfo.GitLink = "https://github.com/viacoin/docker-viacoin";
dockerInfo.GitRef = "master";
break;
case "docker-litecoin":
dockerInfo.DockerFilePath = $"litecoin/{image.Tag}/Dockerfile";
dockerInfo.GitLink = "https://github.com/NicolasDorier/docker-bitcoin";
dockerInfo.GitRef = "master";
break;
case "docker-monacoin":
dockerInfo.DockerFilePath = $"monacoin/{image.Tag}/Dockerfile";
dockerInfo.GitLink = "https://github.com/wakiyamap/docker-bitcoin";
dockerInfo.GitRef = "master";
break;
case "nginx":
dockerInfo.DockerFilePath = $"stable/stretch/Dockerfile";
dockerInfo.GitLink = "https://github.com/nginxinc/docker-nginx";
dockerInfo.GitRef = $"master";
break;
case "docker-gen":
dockerInfo.DockerFilePath = $"linuxamd64.Dockerfile";
dockerInfo.DockerFilePathARM32v7 = $"linuxarm32v7.Dockerfile";
dockerInfo.GitLink = "https://github.com/btcpayserver/docker-gen";
dockerInfo.GitRef = $"v{image.Tag}";
break;
case "letsencrypt-nginx-proxy-companion":
dockerInfo.DockerFilePath = $"linuxamd64.Dockerfile";
dockerInfo.DockerFilePathARM32v7 = $"linuxarm32v7.Dockerfile";
dockerInfo.GitLink = "https://github.com/btcpayserver/docker-letsencrypt-nginx-proxy-companion";
dockerInfo.GitRef = $"v{image.Tag}";
break;
case "postgres":
dockerInfo.DockerFilePath = $"9.6/Dockerfile";
dockerInfo.DockerFilePathARM32v7 = $"9.6/Dockerfile";
dockerInfo.GitLink = "https://github.com/docker-library/postgres";
dockerInfo.GitRef = $"b7cb3c6eacea93be2259381033be3cc435649369";
break;
case "traefik":
dockerInfo.DockerFilePath = $"scratch/amd64/Dockerfile";
dockerInfo.DockerFilePathARM32v7 = $"scratch/arm/Dockerfile";
dockerInfo.GitLink = "https://github.com/containous/traefik-library-image";
dockerInfo.GitRef = $"master";
break;
default:
return null;
}
dockerInfo.DockerHubLink = image.DockerHubLink;
dockerInfo.Image = image;
return dockerInfo;
}
private YamlMappingNode ParseDocument(string fragment)
{
var input = new StringReader(File.ReadAllText(fragment));
YamlStream stream = new YamlStream();
stream.Load(input);
return (YamlMappingNode)stream.Documents[0].RootNode;
}
private static void DeleteDirectory(string outputDirectory)
{
try
{
Directory.Delete(outputDirectory, true);
}
catch
{
}
}
private static string FindRoot(string rootDirectory)
{
string directory = Directory.GetCurrentDirectory();
int i = 0;
while (true)
{
if (i > 10)
throw new DirectoryNotFoundException(rootDirectory);
if (directory.EndsWith(rootDirectory))
return directory;
directory = Path.GetFullPath(Path.Combine(directory, ".."));
i++;
}
}
}
}

View File

@@ -0,0 +1,16 @@
# DockerFile build helper
By default, when you use docker deployment, you are fetching pre-built docker images hosted on dockerhub.
While this bring the advantage that deployment is fast and reliable, this also mean that you are ultimately trusting the owner of the docker images.
This repository generate a script that you can use to build all images from the sources by yourself.
## How to use?
Install [.NET Core SDK](https://dotnet.microsoft.com/download) and run:
```bash
./run.sh
```
This will build a `build-all.sh` file.
Note that the

View File

@@ -0,0 +1,45 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace DockerFileBuildHelper
{
public class StringBuilderEx
{
StringBuilder _Builder = new StringBuilder();
public StringBuilderEx()
{
}
public int Indent { get; set; }
public void Append(string str)
{
_Builder.Append(GetIndents());
_Builder.Append(str);
}
private string GetIndents()
{
return new String(Enumerable.Range(0, Indent).Select(_ => '\t').ToArray());
}
public void AppendLine(string str)
{
_Builder.Append(GetIndents());
_Builder.AppendLine(str);
}
public override string ToString()
{
return _Builder.ToString();
}
internal void AppendLine()
{
_Builder.AppendLine();
}
}
}

View File

@@ -0,0 +1,3 @@
#!/bin/bash
dotnet run --no-launch-profile -c Release -- $@

View File

@@ -0,0 +1 @@
dotnet run --no-launch-profile -c Release -- -o "../build-all-images.sh"

View File

@@ -0,0 +1,3 @@
#!/bin/bash
dotnet run --no-launch-profile -c Release -- -o "../build-all-images.sh"

170
contrib/FastSync/README.md Normal file
View File

@@ -0,0 +1,170 @@
# Fast sync for Bitcoin
## What problem does Fast Sync solve?
When you start a new BTCPay Server, you need to synchronize your Bitcoin node from the genesis block.
Validating from the genesis blocks takes in general 1 or 2 days on affordable servers. (around 10$ per months)
However, on some low powered devices like raspberry PI, synchronization time will take around 2 weeks nowadays. (and it will linearly increase with time)
Fast sync provides a solution to decrease dramatically the synchronization time to minutes or few hours.
## How does Fast Sync solve it?
In order for Bitcoin software to operate, you do not need all the history of blocks from the genesis.
What you need is the state of Bitcoin up to a certain block (this state is called `UTXO Set`), and around 300 blocks before this point.
Fast Sync downloads the UTXO Set at a specific block on an external server, and deploy it on your node. We call this file a `UTXO Set snapshot`.
When your node start up again, it will only need to synchronize from the snapshot, to the latest blocks.
## What are the downsides of Fast Sync?
### Malicious UTXO Set
Fast Sync can be potentially abused:
1. The attacker gives you an `UTXO Set snapshot` which does not follow Bitcoin consensus
2. The attacker makes a purchase to your store.
3. Nodes following the consensus would not recognize the payment as valid, but your node will.
4. The coins the attacker sent you are just worthless
Other attacks can completely bring down your node.
### Lightning Network routing issues
As a merchant, you generally do not care about this issue. Merchants are mainly receiving payment, so they don't need to do any routing.
However, if you plan to send payments from your lightning node, you may have issues:
Because you do not have old blocks, then your lightning node won't see any channels which have been created prior to the snapshot.
If this is a problem for you, just use an older snapshot.
## How to verify that the UTXO Set snapshot follows the consensus?
### If you trust the owner of this repository....
The snapshots recognized as valid by the `btcpayserver-docker` repository you cloned can be found on [utxo-sets](utxo-sets).
The script [load-utxo-set.sh](load-utxo-set.sh) will download the utxo-set from the environment variable `UTXO_DOWNLOAD_LINK`.
If `UTXO_DOWNLOAD_LINK` is empty, `NBITCOIN_NETWORK` (with value set to `mainnet` or `testnet`) will be used to take a default `UTXO_DOWNLOAD_LINK` that we hard coded inside [load-utxo-set.sh](load-utxo-set.sh).
Once the files are downloaded, the hash will be checked against those in [utxo-sets](utxo-sets).
However: This only prove that `if the owner of this git repository is honest`, then the utxo-set are correct.
NOTE: **Completing those steps does not mean that the UTXO set snapshot is legit**. It only mean that you trust the owner of this git repositoy to have verified that it is legit.
### If you trust someone else...
This repository contains the signatures of some developers, for example [sigs/NicolasDorier.utxo-sets.asc](sigs/NicolasDorier.utxo-sets.asc) contains the hashes that `NicolasDorier` verified himself.
You need to verify with [KeyBase command line](https://keybase.io/docs/command_line) that the signature is legit:
```bash
keybase pgp verify -i sigs/NicolasDorier.utxo-sets.asc
```
If you don't like command line, you can verify against [keybase verify page](https://keybase.io/verify) by just copying and pasting the content of [sigs/NicolasDorier.utxo-sets.asc](sigs/NicolasDorier.utxo-sets.asc).
You can verify that the handle `NicolasDorier` refers to the person who controls `NicolasDorier` twitter, github and reddit handle on [the keybase profile page](https://keybase.io/NicolasDorier).
NOTE: **Completing those steps does not mean that the UTXO set snapshot is legit**. It only mean that you trust the owner of a Keybase account who has proved access to some social media accounts in the past.
### Don't trust, verify!<a name="donttrust"></a>
If you don't trust anybody, which should be the case as much as possible, then here are the steps to verify that the UTXO set is not malicious.
1. You need another node that you own, `under your control`, that `you synchronized from the genesis block`. Let's call this node `Trusty`.
2. You need to create a new node which use `Fast Sync` with the UTXO snapshot you want to verify. Let's call this node, `Synchy`.
3. Wait that `Synchy` is fully synched.
4. Now on `Synchy` and `Trusty` run at the same time:
```bash
bitcoin-cli gettxoutsetinfo
```
If `Synchy` or `Trusty` are using BTCPay Server use:
```bash
bitcoin-cli.sh gettxoutsetinfo
```
5. Verify that the output of `Synchy` and `Trusty` are **exactly** identical.
NOTE: Completing those steps, under the assumption the software you are running is not malicious, **correctly prove that the UTXO set snapshot is legit**.
## FAQ
### Can I add my signature to this repository?
If you are a bitcoin developer or public figure, feel free to add your signature. For this you need:
1. A [keybase account](http://keybase.io) linked to your social media accounts.
2. Follow the steps described in the [Don't trust, verify!](#donttrust) section each snapshots you want to sign.
3. Create a file with same format as [utxo-sets](utxo-sets) with the snapshots you validated. (Let's call this file `YOU.utxo-sets`)
4. Run the following command line
```bash
# Assuming your are inside the FastSync directory
keybase pgp sign -i YOU.utxo-sets -c -t -o sigs/YOU.utxo-sets.asc
rm YOU.utxo-sets
git add sigs/YOU.utxo-sets.asc
git commit -m "Add YOU utxo-set signature" -all
```
And make a pull request to `btcpayserver-docker` repository.
### Where can I download UTXO set snapshots
You should not need to do this, because [load-utxo-set.sh](load-utxo-set.sh) do the hard work for you.
But if you really want, just browse on [this listing](http://utxosets.blob.core.windows.net/public?restype=container&comp=list&include=metadata).
Select the snapshot you want, and download it by querying `http://utxosets.blob.core.windows.net/public/{blobName}`.
### How can I create my own snapshot?
Assuming you have a node running on a docker deployment of BTCPay Server, you just need to run [save-utxo-set.sh](save-utxo-set.sh).
This script shows the steps to create an archive of the current UTXO Set
It will:
1. Shutdown BTCPay Server
2. Start bitcoind
3. Prune it to up to 289 blocks from the tip
4. Stop bitcoind
5. Archive in a tarball the blocks and chainstate directories
6. Restart BTCPay
7. If `AZURE_STORAGE_CONNECTION_STRING` is set, then upload to azure storage and make the blob public, else print hash and tarball
### How can I do this for my altcoin?
Your altcoin does not need it, almost nobody use it compared to bitcoin.
However, if you insist, follow what we did for Bitcoin, we can't hand hold you on this.
### Do you plan to destroy Bitcoin?
This feature may be controversial, because of the risk that almost nobody will follow the [Don't trust, verify!](#donttrust) step.
What if somebody start spreading a corrupted snapshot on wild scale?
I think this issue can be mitigated at the social layer. If several person start using social media for spreading their `bitcoin-cli getutxosetinfo` every 10 000 blocks, any corrupt snapshot would be soon detected. We plan to make expose the hash via `BTCPayServer` and make it easy for people to share.
### Why you don't just: Make BTCPayServer rely on SPV
All SPV solution brings a systemic risk to Bitcoin. If everybody relies on SPV to accept payment and miners want to change consensus rules, then you will have no leverage as individual, nor as a community to decide against.
Even with `UTXO Set snapshots` you continue to validate consensus rules from the block of the snapshot.
### Why you don't just: Make BTCPayServer rely on an external trusted node
Why not just hosting BTCPayServer on the raspberry pi, but the bitcoin full node on another machine?
For two reasons:
First, `BTCPayServer` is trying to bring down the technical barriers to operate payments on your own. Running on an external node means that the user need the technical skills to set it up.
`BTCPayServer` also relies on Bitcoin's RPC which is not meant to be exposed on internet. We can't see any simple enough solution which would allow normal people to run an external node somewhere else.
The second reason is about reliability: You want your service to be self contained. If you host a node on another server, and for some reason this server goes down, then your `BTCPayServer` hosted on the raspberry PI will also cease to function.

View File

@@ -0,0 +1,85 @@
#!/bin/bash
# This script shows the steps to download and deploy an archive of the current UTXO Set
# It will:
# 1. Download the UTXO Set from UTXO_DOWNLOAD_LINK, if UTXO_DOWNLOAD_LINK is empty, use NBITCOIN_NETWORK to find a default
# 2. Check the tarball against trusted hashes
# 3. Create the container's folders for blocks and chainstate, or empty them if they exists
# 4. Unzip the tarball
if ! [ "$0" = "$BASH_SOURCE" ]; then
echo "This script must not be sourced"
exit 1
fi
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root after running \"sudo su -\""
exit 1
fi
if ! [[ "$NBITCOIN_NETWORK" ]]; then
echo "NBITCOIN_NETWORK should be set to mainnet, testnet or regtest"
exit 1
fi
if ! [[ "$UTXO_DOWNLOAD_LINK" ]]; then
[[ $NBITCOIN_NETWORK == "mainnet" ]] && UTXO_DOWNLOAD_LINK="http://utxosets.blob.core.windows.net/public/utxo-snapshot-bitcoin-mainnet-551636.tar"
[[ $NBITCOIN_NETWORK == "testnet" ]] && UTXO_DOWNLOAD_LINK="http://utxosets.blob.core.windows.net/public/utxo-snapshot-bitcoin-testnet-1445586.tar"
fi
if ! [[ "$UTXO_DOWNLOAD_LINK" ]]; then
echo "No default UTXO_DOWNLOAD_LINK for $NBITCOIN_NETWORK"
exit 1
fi
BITCOIN_DATA_DIR="/var/lib/docker/volumes/generated_bitcoin_datadir/_data"
[ ! -d "$BITCOIN_DATA_DIR" ] && mkdir -p "$BITCOIN_DATA_DIR"
TAR_NAME="$(basename $UTXO_DOWNLOAD_LINK)"
TAR_FILE="$BITCOIN_DATA_DIR/$TAR_NAME"
cp "utxo-sets" "$BITCOIN_DATA_DIR/utxo-sets"
cd "$BITCOIN_DATA_DIR"
if [ ! -f "$TAR_FILE" ]; then
echo "Downloading $UTXO_DOWNLOAD_LINK to $TAR_FILE"
wget "$UTXO_DOWNLOAD_LINK" -q --show-progress
else
echo "$TAR_FILE already exists"
fi
grep "$TAR_NAME" "utxo-sets" | tee "utxo-set"
rm "utxo-sets"
if ! sha256sum -c "utxo-set"; then
echo "$TAR_FILE is not trusted"
rm "utxo-set"
cd -
exit 1
fi
rm "utxo-set"
cd -
NETWORK_DIRECTORY=$NBITCOIN_NETWORK
if [[ $NBITCOIN_NETWORK == "mainnet" ]]; then
NETWORK_DIRECTORY="."
fi
if [[ $NBITCOIN_NETWORK == "testnet" ]]; then
NETWORK_DIRECTORY="testnet3"
fi
NETWORK_DIRECTORY="$BITCOIN_DATA_DIR/$NETWORK_DIRECTORY"
[ -d "$NETWORK_DIRECTORY/blocks" ] && rm -rf "$NETWORK_DIRECTORY/blocks"
[ -d "$NETWORK_DIRECTORY/chainstate" ] && rm -rf "$NETWORK_DIRECTORY/chainstate"
[ ! -d "$NETWORK_DIRECTORY" ] && mkdir "$NETWORK_DIRECTORY"
echo "Extracting..."
if ! tar -xf "$TAR_FILE" -C "$BITCOIN_DATA_DIR"; then
echo "Failed extracting, did you turned bitcoin off? (btcpay-down.sh)"
exit 1
fi
rm "$TAR_FILE"
BTCPAY_DATA_DIR="/var/lib/docker/volumes/generated_btcpay_datadir/_data"
[ ! -d "$BTCPAY_DATA_DIR" ] && mkdir -p "$BTCPAY_DATA_DIR"
echo "$TAR_NAME" > "$BTCPAY_DATA_DIR/FastSynced"
echo "Successfully downloaded and extracted, you can run btcpay again (btcpay-up.sh)"

View File

@@ -0,0 +1,30 @@
# This file is internal and meant to be run by save-utxo-set.sh
BITCOIND="bitcoind -datadir=/data"
BITCOIN_CLI="bitcoin-cli -datadir=/data"
$BITCOIND &
BITCOIND_PID=$!
CURRENT_HEIGHT="$($BITCOIN_CLI -rpcwait getblockcount)"
let "PRUNED_HEIGHT=$CURRENT_HEIGHT - 289"
echo "Pruning to $PRUNED_HEIGHT"
$BITCOIN_CLI pruneblockchain "$PRUNED_HEIGHT"
echo "Waiting bitcoind to stop..."
$BITCOIN_CLI stop
wait $BITCOIND_PID
NETWORK_DIRECTORY=$NBITCOIN_NETWORK
if [[ $NBITCOIN_NETWORK == "mainnet" ]]; then
NETWORK_DIRECTORY="."
fi
if [[ $NBITCOIN_NETWORK == "testnet" ]]; then
NETWORK_DIRECTORY="testnet3"
fi
cd /data
TAR_NAME="utxo-snapshot-bitcoin-$NBITCOIN_NETWORK-$PRUNED_HEIGHT.tar"
echo "Creating $TAR_NAME..."
tar -cf "$TAR_NAME" "$NETWORK_DIRECTORY/blocks/"
tar -rf "$TAR_NAME" "$NETWORK_DIRECTORY/chainstate/"
exit

View File

@@ -0,0 +1,55 @@
#!/bin/bash
# This script shows the steps to create an archive of the current UTXO Set
# It will:
# 1. Shutdown BTCPay Server
# 2. Start bitcoind
# 3. Prune it to up to 289 blocks from the tip
# 4. Stop bitcoind
# 5. Archive in a tarball the blocks and chainstate directories
# 6. Restart BTCPay
# 7. If AZURE_STORAGE_CONNECTION_STRING is set, then upload to azure storage and make the blob public, else print hash and tarball
: "${AZURE_STORAGE_CONTAINER:=public}"
btcpay-down.sh
for i in /var/lib/docker/volumes/generated_bitcoin_datadir/_data/utxo-snapshot-*; do
echo "Deleting $i"
rm $i
done
rm /var/lib/docker/volumes/generated_bitcoin_datadir/_data/utxo-snapshot-*
# Run only bitcoind and connect to it
SCRIPT="$(cat save-utxo-set-in-bitcoind.sh)"
cd "`dirname $BTCPAY_ENV_FILE`"
docker-compose -f $BTCPAY_DOCKER_COMPOSE run -e "NBITCOIN_NETWORK=$NBITCOIN_NETWORK" bitcoind bash -c "$SCRIPT"
btcpay-up.sh
echo "Calculating the hash of the tar file..."
TAR_FILE="$(echo /var/lib/docker/volumes/generated_bitcoin_datadir/_data/utxo-snapshot-*)"
TAR_FILE_HASH="$(sha256sum "$TAR_FILE" | cut -d " " -f 1)"
if [[ "$AZURE_STORAGE_CONNECTION_STRING" ]]; then
echo "Uploading to azure..."
# Install az from https://docs.microsoft.com/en-us/cli/azure/install-azure-cli?view=azure-cli-latest
BLOB_NAME="$(basename -- $TAR_FILE)"
az storage container create --name "$AZURE_STORAGE_CONTAINER" --public-access "blob"
az storage blob upload -f "$TAR_FILE" \
-c "$AZURE_STORAGE_CONTAINER" \
-n "$BLOB_NAME" \
--content-type "application/x-tar"
az storage blob metadata update --container-name "$AZURE_STORAGE_CONTAINER" --name "$BLOB_NAME" --metadata "sha256=$TAR_FILE_HASH"
# Print the sha256sum. Downloaders will need to verify this
STORAGE_URL="$(az storage blob url --container-name "$AZURE_STORAGE_CONTAINER" --name "$BLOB_NAME" --protocol "http")"
echo "You can now download the UTXO on $STORAGE_URL"
echo "Please, after download, verify the sha256 with:"
echo "echo "$TAR_FILE_HASH $BLOB_NAME" | sha256sum -c -"
rm "$TAR_FILE"
else
echo "SHA256: $TAR_FILE_HASH"
echo "File at: $TAR_FILE"
fi

View File

@@ -0,0 +1,21 @@
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
fab994299273080bf7124c8c45c4ada867974ca747900178496a69e450cf713f utxo-snapshot-bitcoin-mainnet-551636.tar
eabaaa717bb8eeaf603e383dd8642d9d34df8e767fccbd208b0c936b79c82742 utxo-snapshot-bitcoin-testnet-1445586.tar
-----BEGIN PGP SIGNATURE-----
wsFcBAEBCAAQBQJcALGMCRBmGHY+8JGG/gAA0YsQAJgfTLHy/z+5c7pumb7QGl5y
afs7KrDUpc5jM6c6jeaKaysWm/aQmWXYtTYMFeN2+vexVLvbMiYSVMl5ts2zRScl
tY+HQ2aYlUP754S98gjFrWNner5wpREhu+UILtzB79ph/Baw2iOm0NJIsr3SA8B6
VJ/JRRiaG4PW6TNJumiYVRZ7RCx+DnWveq+ombPDrjp7sbABx2s8tyIxFf7IW2wb
bOHA2FNjRu2+gd6PNVlNYVX+i0tx+q8f7yuCOxxSux5DvfK5p+TE2XqWoc3TbtqZ
9SXKeoUVDvhWjY7nH8D0LehYobh0LzCIpdsm1wqDpR3DOMlNAY+5OHA0+4BAoY+K
hPOyWA5TWLrlC6yMuz6ttVFvjOHGd7HwLqlU3NU4aj9oxLIjaHHHOcxvf+v0GrvL
QTd7YfyFeEpMQjwK/ueYlswxRqMHMFVLg/F0sAcwJ4W3F9yakz8mS341IDSWPoUR
Kc1KArFH4SqW2oc3ChzFwU/Om7rv5rZelJRRTzW8lJZFPysiLtUoEe1PeiYiikCL
Am40XX62EF+MG+TKQkYkTGlSPjNEE+ko9cQcAzMWVz1BZCUjcJH+dI/7uNsMOtp3
y1ytX+Asv2KiLGAKzQvKBIrJzYuwuStVxUIZguJpb20bo8CkLOUKORjwsiQ4ktna
gHoN2GLHvDzOq4cixubg
=65Dw
-----END PGP SIGNATURE-----

View File

@@ -0,0 +1,21 @@
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
fab994299273080bf7124c8c45c4ada867974ca747900178496a69e450cf713f utxo-snapshot-bitcoin-mainnet-551636.tar
eabaaa717bb8eeaf603e383dd8642d9d34df8e767fccbd208b0c936b79c82742 utxo-snapshot-bitcoin-testnet-1445586.tar
-----BEGIN PGP SIGNATURE-----
wsFcBAEBCAAQBQJcAN7+CRB5wjOsK6943QAAvx8QADXzOsU/tfn0h2fDwNWCVI+D
VxoWCc+WshOu7vAH0qm/oUSjs99+FS0nP6eHSsBy+vO6h6cdI6CC8I062faAy/oH
8eyH1WIxjLs8cXySImR60M804u7906Jmf9ouUu0jqlNJVHE34utIXfrzhlf3cZoj
737Y9gRDLYZuiFK7h9H1hInD8h9CpkOachglbBKjErZ/E53q3EVxk6jjbOp1fvfk
2KekrZThiUHa0aRD1OfyDiCA611TsAplfF/2OpXeBB8yQKm2qgkz+xLXW68noQnC
0ErxAHycqgvgeYKGZr9JQNCBvrv9ArZY15TJiGkse2P/YmisEOpePzh16kQkJARU
W5ew3cCOwDnhUtV1oZAoVLu75XlIdRn404EKjHr7JbwlT9RI1EsFb+ESG9wtiTur
a743yczsNXePfD1yO/nm2n6O/CW4HeKMDbKakL0FT3hLaoo3Yc72YItJw93zVWdL
tO7aCRFtBXKUGG1rAbvXQIBr4JDEMq4H8/aE8dBJXneRn9wMlFVEpM5Yi9OMzf1M
QoelL0vkj79Hfx13jQCAY/z3gadZ12XNMlsWembPFUpSxGwGEDra41olsUkjedcm
0ZAHzRjIXcY18HSxEHjqiOnU2lFaBZffXr8GlUgMmUepEV/MbKkgL9JOo+6JsizF
tYLN91o5MaDkR4Tf2TCj
=aSFC
-----END PGP SIGNATURE-----

View File

@@ -0,0 +1,2 @@
fab994299273080bf7124c8c45c4ada867974ca747900178496a69e450cf713f utxo-snapshot-bitcoin-mainnet-551636.tar
eabaaa717bb8eeaf603e383dd8642d9d34df8e767fccbd208b0c936b79c82742 utxo-snapshot-bitcoin-testnet-1445586.tar

292
contrib/build-all-images.sh Executable file
View File

@@ -0,0 +1,292 @@
#!/bin/bash
# This file is automatically generated by the DockerFileBuildHelper tool, run DockerFileBuildHelper/update-repo.sh to update it
set -e
DOCKERFILE=""
# Build docker-compose-generator
# https://raw.githubusercontent.com/btcpayserver/btcpayserver-docker/dcg-latest/docker-compose-generator/linuxamd64.Dockerfile
DOCKERFILE="docker-compose-generator/linuxamd64.Dockerfile"
# https://raw.githubusercontent.com/btcpayserver/btcpayserver-docker/dcg-latest/docker-compose-generator/linuxarm32v7.Dockerfile
[[ "$(uname -m)" == "armv7l" ]] && DOCKERFILE="docker-compose-generator/linuxarm32v7.Dockerfile"
echo "Building btcpayserver/docker-compose-generator:latest"
git clone https://github.com/btcpayserver/btcpayserver-docker docker-compose-generator
cd docker-compose-generator
git checkout dcg-latest
cd "$(dirname $DOCKERFILE)"
docker build -f "$DOCKERFILE" -t "btcpayserver/docker-compose-generator:latest" .
cd - && cd ..
# Build docker-compose-builder
DOCKERFILE=""
# https://raw.githubusercontent.com/btcpayserver/docker-compose-builder/v1.23.2/linuxarm32v7.Dockerfile
[[ "$(uname -m)" == "armv7l" ]] && DOCKERFILE="linuxarm32v7.Dockerfile"
if [[ "$DOCKERFILE" ]]; then
echo "Building btcpayserver/docker-compose-builder:1.23.2"
git clone https://github.com/btcpayserver/docker-compose-builder docker-compose-builder
cd docker-compose-builder
git checkout v1.23.2
cd "$(dirname $DOCKERFILE)"
docker build -f "$DOCKERFILE" -t "btcpayserver/docker-compose-builder:1.23.2" .
cd - && cd ..
fi
# Build btglnd
# https://raw.githubusercontent.com/vutov/lnd/master/BTCPayServer.Dockerfile
DOCKERFILE="BTCPayServer.Dockerfile"
echo "Building kamigawabul/btglnd:latest"
git clone https://github.com/vutov/lnd btglnd
cd btglnd
git checkout master
cd "$(dirname $DOCKERFILE)"
docker build -f "$DOCKERFILE" -t "kamigawabul/btglnd:latest" .
cd - && cd ..
# Build docker-bitcoingold
# https://raw.githubusercontent.com/Vutov/docker-bitcoin/master/bitcoingold/0.15.2/Dockerfile
DOCKERFILE="bitcoingold/0.15.2/Dockerfile"
echo "Building kamigawabul/docker-bitcoingold:0.15.2"
git clone https://github.com/Vutov/docker-bitcoin docker-bitcoingold
cd docker-bitcoingold
git checkout master
cd "$(dirname $DOCKERFILE)"
docker build -f "$DOCKERFILE" -t "kamigawabul/docker-bitcoingold:0.15.2" .
cd - && cd ..
# Build clightning
# https://raw.githubusercontent.com/NicolasDorier/lightning/basedon-v0.6.2-3/Dockerfile
DOCKERFILE="Dockerfile"
echo "Building nicolasdorier/clightning:v0.6.2-3"
git clone https://github.com/NicolasDorier/lightning clightning
cd clightning
git checkout basedon-v0.6.2-3
cd "$(dirname $DOCKERFILE)"
docker build -f "$DOCKERFILE" -t "nicolasdorier/clightning:v0.6.2-3" .
cd - && cd ..
# Build lnd
# https://raw.githubusercontent.com/btcpayserver/lnd/basedon-v0.5-beta-2/BTCPayServer.Dockerfile
DOCKERFILE="BTCPayServer.Dockerfile"
echo "Building btcpayserver/lnd:0.5-beta-2"
git clone https://github.com/btcpayserver/lnd lnd
cd lnd
git checkout basedon-v0.5-beta-2
cd "$(dirname $DOCKERFILE)"
docker build -f "$DOCKERFILE" -t "btcpayserver/lnd:0.5-beta-2" .
cd - && cd ..
# Build bitcoin
# https://raw.githubusercontent.com/btcpayserver/dockerfile-deps/Bitcoin/0.17.0/Bitcoin/0.17.0/linuxamd64.Dockerfile
DOCKERFILE="Bitcoin/0.17.0/linuxamd64.Dockerfile"
# https://raw.githubusercontent.com/btcpayserver/dockerfile-deps/Bitcoin/0.17.0/Bitcoin/0.17.0/linuxarm32v7.Dockerfile
[[ "$(uname -m)" == "armv7l" ]] && DOCKERFILE="Bitcoin/0.17.0/linuxarm32v7.Dockerfile"
# https://raw.githubusercontent.com/btcpayserver/dockerfile-deps/Bitcoin/0.17.0/Bitcoin/0.17.0/linuxarm64v8.Dockerfile
[[ "$(uname -m)" == "aarch64" ]] && DOCKERFILE="Bitcoin/0.17.0/linuxarm64v8.Dockerfile"
echo "Building btcpayserver/bitcoin:0.17.0"
git clone https://github.com/btcpayserver/dockerfile-deps bitcoin
cd bitcoin
git checkout Bitcoin/0.17.0
cd "$(dirname $DOCKERFILE)"
docker build -f "$DOCKERFILE" -t "btcpayserver/bitcoin:0.17.0" .
cd - && cd ..
# Build btcpayserver
# https://raw.githubusercontent.com/btcpayserver/btcpayserver/v1.0.3.23/Dockerfile.linuxamd64
DOCKERFILE="Dockerfile.linuxamd64"
# https://raw.githubusercontent.com/btcpayserver/btcpayserver/v1.0.3.23/Dockerfile.linuxarm32v7
[[ "$(uname -m)" == "armv7l" ]] && DOCKERFILE="Dockerfile.linuxarm32v7"
echo "Building btcpayserver/btcpayserver:1.0.3.23"
git clone https://github.com/btcpayserver/btcpayserver btcpayserver
cd btcpayserver
git checkout v1.0.3.23
cd "$(dirname $DOCKERFILE)"
docker build -f "$DOCKERFILE" -t "btcpayserver/btcpayserver:1.0.3.23" .
cd - && cd ..
# Build dogecoin
# https://raw.githubusercontent.com/rockstardev/docker-bitcoin/feature/dogecoin/dogecoin/1.10.0/Dockerfile
DOCKERFILE="dogecoin/1.10.0/Dockerfile"
echo "Building rockstardev/dogecoin:1.10.0"
git clone https://github.com/rockstardev/docker-bitcoin dogecoin
cd dogecoin
git checkout feature/dogecoin
cd "$(dirname $DOCKERFILE)"
docker build -f "$DOCKERFILE" -t "rockstardev/dogecoin:1.10.0" .
cd - && cd ..
# Build docker-feathercoin
# https://raw.githubusercontent.com/ChekaZ/docker/master/feathercoin/0.16.3/Dockerfile
DOCKERFILE="feathercoin/0.16.3/Dockerfile"
echo "Building chekaz/docker-feathercoin:0.16.3"
git clone https://github.com/ChekaZ/docker docker-feathercoin
cd docker-feathercoin
git checkout master
cd "$(dirname $DOCKERFILE)"
docker build -f "$DOCKERFILE" -t "chekaz/docker-feathercoin:0.16.3" .
cd - && cd ..
# Build docker-groestlcoin
# https://raw.githubusercontent.com/NicolasDorier/docker-bitcoin/master/groestlcoin/2.16.3/Dockerfile
DOCKERFILE="groestlcoin/2.16.3/Dockerfile"
echo "Building nicolasdorier/docker-groestlcoin:2.16.3"
git clone https://github.com/NicolasDorier/docker-bitcoin docker-groestlcoin
cd docker-groestlcoin
git checkout master
cd "$(dirname $DOCKERFILE)"
docker build -f "$DOCKERFILE" -t "nicolasdorier/docker-groestlcoin:2.16.3" .
cd - && cd ..
# Build clightning
# https://raw.githubusercontent.com/NicolasDorier/lightning/basedon-v0.6.2-3/Dockerfile
DOCKERFILE="Dockerfile"
echo "Building nicolasdorier/clightning:v0.6.2-3"
git clone https://github.com/NicolasDorier/lightning clightning
cd clightning
git checkout basedon-v0.6.2-3
cd "$(dirname $DOCKERFILE)"
docker build -f "$DOCKERFILE" -t "nicolasdorier/clightning:v0.6.2-3" .
cd - && cd ..
# Build lnd
# https://raw.githubusercontent.com/btcpayserver/lnd/basedon-v0.5-beta-2/BTCPayServer.Dockerfile
DOCKERFILE="BTCPayServer.Dockerfile"
echo "Building btcpayserver/lnd:0.5-beta-2"
git clone https://github.com/btcpayserver/lnd lnd
cd lnd
git checkout basedon-v0.5-beta-2
cd "$(dirname $DOCKERFILE)"
docker build -f "$DOCKERFILE" -t "btcpayserver/lnd:0.5-beta-2" .
cd - && cd ..
# Build docker-litecoin
# https://raw.githubusercontent.com/NicolasDorier/docker-bitcoin/master/litecoin/0.16.3/Dockerfile
DOCKERFILE="litecoin/0.16.3/Dockerfile"
echo "Building nicolasdorier/docker-litecoin:0.16.3"
git clone https://github.com/NicolasDorier/docker-bitcoin docker-litecoin
cd docker-litecoin
git checkout master
cd "$(dirname $DOCKERFILE)"
docker build -f "$DOCKERFILE" -t "nicolasdorier/docker-litecoin:0.16.3" .
cd - && cd ..
# Build docker-monacoin
# https://raw.githubusercontent.com/wakiyamap/docker-bitcoin/master/monacoin/0.16.3/Dockerfile
DOCKERFILE="monacoin/0.16.3/Dockerfile"
echo "Building wakiyamap/docker-monacoin:0.16.3"
git clone https://github.com/wakiyamap/docker-bitcoin docker-monacoin
cd docker-monacoin
git checkout master
cd "$(dirname $DOCKERFILE)"
docker build -f "$DOCKERFILE" -t "wakiyamap/docker-monacoin:0.16.3" .
cd - && cd ..
# Build nbxplorer
# https://raw.githubusercontent.com/dgarage/nbxplorer/v2.0.0.1/Dockerfile.linuxamd64
DOCKERFILE="Dockerfile.linuxamd64"
# https://raw.githubusercontent.com/dgarage/nbxplorer/v2.0.0.1/Dockerfile.linuxarm32v7
[[ "$(uname -m)" == "armv7l" ]] && DOCKERFILE="Dockerfile.linuxarm32v7"
echo "Building nicolasdorier/nbxplorer:2.0.0.1"
git clone https://github.com/dgarage/nbxplorer nbxplorer
cd nbxplorer
git checkout v2.0.0.1
cd "$(dirname $DOCKERFILE)"
docker build -f "$DOCKERFILE" -t "nicolasdorier/nbxplorer:2.0.0.1" .
cd - && cd ..
# Build nginx
# https://raw.githubusercontent.com/nginxinc/docker-nginx/master/stable/stretch/Dockerfile
DOCKERFILE="stable/stretch/Dockerfile"
echo "Building nginx:stable"
git clone https://github.com/nginxinc/docker-nginx nginx
cd nginx
git checkout master
cd "$(dirname $DOCKERFILE)"
docker build -f "$DOCKERFILE" -t "nginx:stable" .
cd - && cd ..
# Build docker-gen
# https://raw.githubusercontent.com/btcpayserver/docker-gen/v0.7.4/linuxamd64.Dockerfile
DOCKERFILE="linuxamd64.Dockerfile"
# https://raw.githubusercontent.com/btcpayserver/docker-gen/v0.7.4/linuxarm32v7.Dockerfile
[[ "$(uname -m)" == "armv7l" ]] && DOCKERFILE="linuxarm32v7.Dockerfile"
echo "Building btcpayserver/docker-gen:0.7.4"
git clone https://github.com/btcpayserver/docker-gen docker-gen
cd docker-gen
git checkout v0.7.4
cd "$(dirname $DOCKERFILE)"
docker build -f "$DOCKERFILE" -t "btcpayserver/docker-gen:0.7.4" .
cd - && cd ..
# Build letsencrypt-nginx-proxy-companion
# https://raw.githubusercontent.com/btcpayserver/docker-letsencrypt-nginx-proxy-companion/v1.10.0/linuxamd64.Dockerfile
DOCKERFILE="linuxamd64.Dockerfile"
# https://raw.githubusercontent.com/btcpayserver/docker-letsencrypt-nginx-proxy-companion/v1.10.0/linuxarm32v7.Dockerfile
[[ "$(uname -m)" == "armv7l" ]] && DOCKERFILE="linuxarm32v7.Dockerfile"
echo "Building btcpayserver/letsencrypt-nginx-proxy-companion:1.10.0"
git clone https://github.com/btcpayserver/docker-letsencrypt-nginx-proxy-companion letsencrypt-nginx-proxy-companion
cd letsencrypt-nginx-proxy-companion
git checkout v1.10.0
cd "$(dirname $DOCKERFILE)"
docker build -f "$DOCKERFILE" -t "btcpayserver/letsencrypt-nginx-proxy-companion:1.10.0" .
cd - && cd ..
# Build postgres
# https://raw.githubusercontent.com/docker-library/postgres/b7cb3c6eacea93be2259381033be3cc435649369/9.6/Dockerfile
DOCKERFILE="9.6/Dockerfile"
# https://raw.githubusercontent.com/docker-library/postgres/b7cb3c6eacea93be2259381033be3cc435649369/9.6/Dockerfile
[[ "$(uname -m)" == "armv7l" ]] && DOCKERFILE="9.6/Dockerfile"
echo "Building postgres:9.6.5"
git clone https://github.com/docker-library/postgres postgres
cd postgres
git checkout b7cb3c6eacea93be2259381033be3cc435649369
cd "$(dirname $DOCKERFILE)"
docker build -f "$DOCKERFILE" -t "postgres:9.6.5" .
cd - && cd ..
# Build traefik
# https://raw.githubusercontent.com/containous/traefik-library-image/master/scratch/amd64/Dockerfile
DOCKERFILE="scratch/amd64/Dockerfile"
# https://raw.githubusercontent.com/containous/traefik-library-image/master/scratch/arm/Dockerfile
[[ "$(uname -m)" == "armv7l" ]] && DOCKERFILE="scratch/arm/Dockerfile"
echo "Building traefik:latest"
git clone https://github.com/containous/traefik-library-image traefik
cd traefik
git checkout master
cd "$(dirname $DOCKERFILE)"
docker build -f "$DOCKERFILE" -t "traefik:latest" .
cd - && cd ..
# Build docker-viacoin
# https://raw.githubusercontent.com/viacoin/docker-viacoin/master/viacoin/0.15.2/docker-viacoin
DOCKERFILE="viacoin/0.15.2/docker-viacoin"
echo "Building romanornr/docker-viacoin:0.15.2"
git clone https://github.com/viacoin/docker-viacoin docker-viacoin
cd docker-viacoin
git checkout master
cd "$(dirname $DOCKERFILE)"
docker build -f "$DOCKERFILE" -t "romanornr/docker-viacoin:0.15.2" .
cd - && cd ..

View File

@@ -8,9 +8,9 @@ services:
environment:
BITCOIN_NETWORK: ${NBITCOIN_NETWORK:-regtest}
BITCOIN_EXTRA_ARGS: |
deprecatedrpc=signrawtransaction
rpcport=43782
port=39388
disablewallet=1
whitelist=0.0.0.0/0
expose:
- "43782"

View File

@@ -0,0 +1,34 @@
version: "3"
services:
bitcored:
restart: unless-stopped
container_name: btcpayserver_bitcored
image: dalijolijo/docker-bitcore:0.15.2
environment:
BITCOIN_EXTRA_ARGS: |
rpcport=43782
${NBITCOIN_NETWORK:-regtest}=1
port=39388
whitelist=0.0.0.0/0
expose:
- "43782"
- "39388"
volumes:
- "bitcore_datadir:/data"
nbxplorer:
environment:
NBXPLORER_CHAINS: "btx"
NBXPLORER_BTXRPCURL: http://bitcored:43782/
NBXPLORER_BTXNODEENDPOINT: bitcored:39388
links:
- bitcored
volumes:
- "bitcore_datadir:/root/.bitcore"
btcpayserver:
environment:
BTCPAY_BTXEXPLORERURL: http://nbxplorer:32838/
BTCPAY_CHAINS: "btx"
volumes:
bitcore_datadir:

View File

@@ -4,7 +4,7 @@ services:
btcpayserver:
restart: unless-stopped
image: ${BTCPAY_IMAGE:-btcpayserver/btcpayserver:1.0.3.17}
image: ${BTCPAY_IMAGE:-btcpayserver/btcpayserver:1.0.3.23}
expose:
- "49392"
environment:

View File

@@ -27,8 +27,8 @@ services:
nbxplorer:
environment:
NBXPLORER_CHAINS: "doge"
NBXPLORER_VIARPCURL: http://dogecoind:22555/
NBXPLORER_VIANODEENDPOINT: dogecoind:22556
NBXPLORER_DOGERPCURL: http://dogecoind:22555/
NBXPLORER_DOGENODEENDPOINT: dogecoind:22556
NBXPLORER_DOGERPCUSER: ceiwHEbqWI83
NBXPLORER_DOGERPCPASSWORD: DwubwWsoo3
links:

View File

@@ -0,0 +1,34 @@
version: "3"
services:
monacoind:
restart: unless-stopped
container_name: btcpayserver_monacoind
image: wakiyamap/docker-monacoin:0.16.3
environment:
BITCOIN_EXTRA_ARGS: |
rpcport=43782
${NBITCOIN_NETWORK:-regtest}=1
port=39388
whitelist=0.0.0.0/0
expose:
- "43782"
- "39388"
volumes:
- "monacoin_datadir:/data"
nbxplorer:
environment:
NBXPLORER_CHAINS: "mona"
NBXPLORER_MONARPCURL: http://monacoind:43782/
NBXPLORER_MONANODEENDPOINT: monacoind:39388
links:
- monacoind
volumes:
- "monacoin_datadir:/root/.monacoin"
btcpayserver:
environment:
BTCPAY_MONAEXPLORERURL: http://nbxplorer:32838/
BTCPAY_CHAINS: "mona"
volumes:
monacoin_datadir:

View File

@@ -4,7 +4,7 @@ services:
nbxplorer:
restart: unless-stopped
image: nicolasdorier/nbxplorer:2.0.0.1
image: nicolasdorier/nbxplorer:2.0.0.2
expose:
- "32838"
environment:
@@ -14,4 +14,4 @@ services:
- "nbxplorer_datadir:/datadir"
volumes:
nbxplorer_datadir:
nbxplorer_datadir:

View File

@@ -31,4 +31,9 @@ services:
environment:
BITCOIN_EXTRA_ARGS: |
dbcache=150
maxmempool=100
maxmempool=100
monacoind:
environment:
BITCOIN_EXTRA_ARGS: |
dbcache=150
maxmempool=100

View File

@@ -6,6 +6,9 @@ services:
bitcoind:
environment:
BITCOIN_EXTRA_ARGS: prune=50000
bitcored:
environment:
BITCOIN_EXTRA_ARGS: prune=50000
bgoldd:
environment:
BITCOIN_EXTRA_ARGS: prune=50000
@@ -20,4 +23,10 @@ services:
BITCOIN_EXTRA_ARGS: prune=50000
viacoind:
environment:
BITCOIN_EXTRA_ARGS: prune=50000
BITCOIN_EXTRA_ARGS: prune=50000
dogecoind:
environment:
DOGECOIN_EXTRA_ARGS: prune=50000
monacoind:
environment:
BITCOIN_EXTRA_ARGS: prune=50000

View File

@@ -6,6 +6,9 @@ services:
bitcoind:
environment:
BITCOIN_EXTRA_ARGS: prune=25000
bitcored:
environment:
BITCOIN_EXTRA_ARGS: prune=25000
bgoldd:
environment:
BITCOIN_EXTRA_ARGS: prune=25000
@@ -20,4 +23,10 @@ services:
BITCOIN_EXTRA_ARGS: prune=25000
viacoind:
environment:
BITCOIN_EXTRA_ARGS: prune=25000
BITCOIN_EXTRA_ARGS: prune=25000
dogecoind:
environment:
DOGECOIN_EXTRA_ARGS: prune=25000
monacoind:
environment:
BITCOIN_EXTRA_ARGS: prune=25000

View File

@@ -6,6 +6,9 @@ services:
bitcoind:
environment:
BITCOIN_EXTRA_ARGS: prune=5000
bitcored:
environment:
BITCOIN_EXTRA_ARGS: prune=5000
bgoldd:
environment:
BITCOIN_EXTRA_ARGS: prune=5000
@@ -20,4 +23,10 @@ services:
BITCOIN_EXTRA_ARGS: prune=5000
viacoind:
environment:
BITCOIN_EXTRA_ARGS: prune=5000
BITCOIN_EXTRA_ARGS: prune=5000
dogecoind:
environment:
DOGECOIN_EXTRA_ARGS: prune=5000
monacoind:
environment:
BITCOIN_EXTRA_ARGS: prune=5000

View File

@@ -6,6 +6,9 @@ services:
bitcoind:
environment:
BITCOIN_EXTRA_ARGS: prune=100000
bitcored:
environment:
BITCOIN_EXTRA_ARGS: prune=100000
bgoldd:
environment:
BITCOIN_EXTRA_ARGS: prune=100000
@@ -20,4 +23,10 @@ services:
BITCOIN_EXTRA_ARGS: prune=100000
viacoind:
environment:
BITCOIN_EXTRA_ARGS: prune=100000
BITCOIN_EXTRA_ARGS: prune=100000
dogecoind:
environment:
DOGECOIN_EXTRA_ARGS: prune=100000
monacoind:
environment:
BITCOIN_EXTRA_ARGS: prune=100000

View File

@@ -46,6 +46,11 @@ namespace DockerGenerator
LNDFragment = "bitcoin-lnd"
},
new CryptoDefinition()
{
Crypto = "btx",
CryptoFragment = "bitcore",
},
new CryptoDefinition()
{
Crypto = "btg",
CryptoFragment = "bgold",
@@ -66,10 +71,15 @@ namespace DockerGenerator
Crypto = "via",
CryptoFragment = "viacoin"
},
new CryptoDefinition()
new CryptoDefinition()
{
Crypto = "doge",
CryptoFragment = "dogecoin"
},
new CryptoDefinition()
{
Crypto = "mona",
CryptoFragment = "monacoin"
}
};
}

1
monacoin-cli.ps1 Executable file
View File

@@ -0,0 +1 @@
docker exec -ti btcpayserver_monacoind monacoin-cli -datadir="/data" $args

3
monacoin-cli.sh Executable file
View File

@@ -0,0 +1,3 @@
#!/bin/bash
docker exec -ti btcpayserver_monacoind monacoin-cli -datadir="/data" "$@"