├── CNAME ├── README-RPi.md ├── README.md ├── _config.yml ├── assets └── img │ └── SP_Letter_White_BG.png ├── bitcoin-core ├── Dockerfile ├── README.md └── docker-build.sh ├── bitcoin-utils ├── electrum-personal-server │ ├── Dockerfile │ └── README.md ├── hd-wallet-derive │ ├── Dockerfile │ └── README.md ├── pycoin │ ├── Dockerfile │ ├── README.md │ └── ku └── specter │ ├── Dockerfile │ ├── README.md │ ├── docker-build.sh │ └── entrypoint.sh ├── c-lightning ├── Dockerfile ├── README.md ├── bitcoin.conf ├── config └── docker-build.sh ├── lightning-utils └── sparkwallet │ ├── Dockerfile │ └── docker-build.sh ├── liquid ├── Dockerfile ├── README.md └── docker-build.sh └── ots ├── README.md ├── docker-compose.yml ├── env.properties ├── otsclient ├── Dockerfile └── Dockerfile-js └── otsserver └── Dockerfile /CNAME: -------------------------------------------------------------------------------- 1 | www.bitcoindockers.com 2 | -------------------------------------------------------------------------------- /README-RPi.md: -------------------------------------------------------------------------------- 1 | # Have a working RPi 2 | 3 | - Download and dd Raspbian Lite (Debian Stretch) on a microSD card 4 | - Plug the RPi with screen and keyboard (SSH is disabled by default) 5 | - Log into RPi and set it up (sudo raspi-config: Expand Filesystem, enable SSH (Interfacing Options), downgrade GPU memory (Advanced Options, Memory Split, 16), update it (sudo rpi-update, sudo apt-get update, sudo apt-get upgrade, sudo apt-get dist-upgrade), whatever you want…) 6 | - Reboot without screen and keyboard 7 | 8 | From now on, use SSH to log into RPi. We are using user `pi`. 9 | 10 | ## Log in RPi and install Docker 11 | 12 | ```shell 13 | curl -sSL https://get.docker.com | sh ; sudo usermod -aG docker pi 14 | ``` 15 | 16 | ## Logout + re-login (usermod taking effect) 17 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Bitcoin-related Dockerfiles and configurations 2 | 3 | This is the public repository of dockerfiles used **in production** by [Satoshi Portal](https://www.satoshiportal.com/) for the Bitcoin applications it develops and operates, including [Bylls](https://www.bylls.com/) and [Bull Bitcoin](https://www.bullbitcoin.com/). 4 | 5 | We regularily update the existing Dockerfiles and add more. 6 |
See subdirectories for what you are looking for. 7 | 8 | **Please submit improvements and post your comments, we definitely want to get better with your help!** 9 | 10 | This repo is hosted at [bitcoindockers.com](http://www.bitcoindockers.com/) 11 | 12 | # Features 13 | 14 | - Lightweight alpine-based docker containers (runnable on RPi’s and other small devices) 15 | - Using less possible new code, most possible existing OS built-in/well-known softwares 16 | - Using container OS as running platform instead of language-based interpreter 17 | - Encrypting everything through Docker Encrypted Overlay Network 18 | - Distributing everything through Docker Swarm to maximize scallability 19 | - Exposing nothing outside the overlay network 20 | 21 | Our philosophy: Security, Lightweight, Performance & Scalability. 22 | 23 |
24 |
25 | 26 | # List of Dockerfiles 27 | 28 | - [**Bitcoin Core**:](https://github.com/SatoshiPortal/dockers/tree/master/bitcoin-core) the Bitcoin reference implementation (full node) of Bitcoin from [Bitcoin Core](https://bitcoincore.org/) 29 | - [**Elements**:](https://github.com/SatoshiPortal/dockers/tree/master/liquid) the Elements (Liquid) reference implementation (full node) of Elements sidechains from [Elements Project](https://elementsproject.org/) 30 | - [**C-Lightning**:](https://github.com/SatoshiPortal/dockers/tree/master/c-lightning) one of the major Lightning Network implementations 31 | - [**Pycoin**:](https://github.com/SatoshiPortal/dockers/tree/master/bitcoin-utils/pycoin) a crypto-utility useful for deriving Bitcoin addresses in Python. 32 | - [**Electrum Personal Server**:] 33 | - [**HD address derivation (segwit, bech32, etc.)**:](https://github.com/SatoshiPortal/dockers/tree/master/bitcoin-utils/hd-wallet-derive) a command-line tool to derive bitcoin addresses using master public keys. This is useful for generating Bitcoin receiving addresses. 34 | - [**OpenTimestamp Server**:](https://github.com/SatoshiPortal/dockers/tree/master/ots/otsserver) a network calendar and aggregation utility service for scalable timestamping of hashed data using the Bitcoin blockchain as a notary, from [Open Timestamps](https://www.opentimestamps.org/) 35 | - [**OpenTimestamp Client**:](https://github.com/SatoshiPortal/dockers/tree/master/ots/otsclient) software to communicate with OTS server and Bitcoin Core to generate and verify timestamps compliant with the [Open Timestamps](https://www.opentimestamps.org/) protocol 36 | 37 | ## Install git to clone this project 38 | 39 | ```shell 40 | sudo apt-get install git 41 | ``` 42 | 43 | ## Extract this project on the machine 44 | 45 | ```shell 46 | git clone https://github.com/SatoshiPortal/dockers.git 47 | ``` 48 |
49 |
50 | 51 | # TODO 52 | 53 | - Update LND 54 | - A lot of improvements 55 | - More details in the docs 56 | - Electrum Personal Server 57 | - Electrum Server 58 | 59 | # Contributions are welcome! 60 | 61 | Thanks for the pull requests :) 62 | 63 | For questions and comments please create an issue. 64 | 65 | # Wishlist 66 | 67 | If you want us to add a docker, please create an issue this way: 68 | 69 | - Paste the source code of the repository you want us to add 70 | - Tell us why you think this is useful and/or how you (or you think someone else) may want to use it. This will help us prioritize and think of the actual usage. 71 | - Put the label "wishlist" on the issue. 72 | -------------------------------------------------------------------------------- /_config.yml: -------------------------------------------------------------------------------- 1 | title: [Bitcoin Dockers] 2 | description: [Satoshi Portal's Bitcoin-related dockerfiles and configurations] 3 | theme: jekyll-theme-minimal 4 | logo: assets/img/SP_Letter_White_BG.png -------------------------------------------------------------------------------- /assets/img/SP_Letter_White_BG.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SatoshiPortal/dockers/cc5e08d48d90475d554a12f0926ab5e7255847a3/assets/img/SP_Letter_White_BG.png -------------------------------------------------------------------------------- /bitcoin-core/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM cyphernode/alpine-glibc-base:v3.12.4_2.31-0 2 | 3 | ARG CORE_VERSION="0.21.1" 4 | 5 | # x86_64, arm or aarch64 6 | ARG ARCH 7 | ENV URL https://bitcoincore.org/bin/bitcoin-core-${CORE_VERSION} 8 | 9 | RUN apk add --update --no-cache \ 10 | curl \ 11 | su-exec \ 12 | gnupg 13 | 14 | VOLUME ["/.bitcoin"] 15 | 16 | WORKDIR /usr/bin 17 | 18 | RUN wget ${URL}/SHA256SUMS.asc \ 19 | && gpg --keyserver hkp://keyserver.ubuntu.com --recv-keys "01EA5486DE18A882D4C2684590C8019E36C2E964" \ 20 | && gpg --verify SHA256SUMS.asc \ 21 | && GNU=$([ "${ARCH}" = "arm" ] && echo eabihf || true) \ 22 | && TARBALL=bitcoin-${CORE_VERSION}-${ARCH}-linux-gnu${GNU}.tar.gz \ 23 | && wget ${URL}/$TARBALL \ 24 | && grep $TARBALL SHA256SUMS.asc | sha256sum -c - \ 25 | && tar -xzC . -f $TARBALL bitcoin-${CORE_VERSION}/bin/bitcoind bitcoin-${CORE_VERSION}/bin/bitcoin-cli --strip-components=2 \ 26 | && rm -rf $TARBALL SHA256SUMS.asc \ 27 | && apk del gnupg 28 | 29 | ENV HOME / 30 | EXPOSE 8332 8333 18332 18333 29000 31 | 32 | ENTRYPOINT ["su-exec"] 33 | 34 | # mkdir /home/pi/btcdata ; sudo chown bitcoinuser:bitcoinuser /home/pi/btcdata 35 | # docker run --rm -d -v /home/pi/btcdata:/.bitcoin btcnode `id -u bitcoinuser`:`id -g bitcoinuser` bitcoind 36 | -------------------------------------------------------------------------------- /bitcoin-core/README.md: -------------------------------------------------------------------------------- 1 | 2 | # How to install a Bitcoin Core full node on a Linux machine using Docker 3 | 4 | ## Nota 5 | 6 | Don't just copy and paste. Understand what you are doing. 7 | 8 | Note: We can't change ownership of files if directory is mounted from a vfat filesystem. You will have to use root user instead of bitcoinuser or set all files in .bitcoin directory to world-writable. 9 | 10 | ## Assumptions if on RPi 11 | 12 | [You have a working RPi.](../README-RPi.md) 13 | 14 | ## Log in with a sudoer, create bitcoinuser 15 | 16 | ```shell 17 | sudo useradd bitcoinuser 18 | ``` 19 | 20 | ## Mounting... if you want to use an external drive/stick for the blockchain 21 | 22 | ### If you're stuck with a ntfs external drive... 23 | 24 | ```shell 25 | sudo apt-get install ntfs-3g 26 | ``` 27 | 28 | ```shell 29 | sudo blkid 30 | /dev/sda1: LABEL="My Passport" UUID="3C02BB6502BB2336" TYPE="ntfs" PARTLABEL="My Passport" PARTUUID="3e1d9372-dada-4a7f-9542-ea32591373fd" 31 | ``` 32 | 33 | ```shell 34 | mkdir -m 2770 -p ~/btcdata 35 | sudo mount -t ntfs-3g -o rw,uid=$(id -u bitcoinuser),gid=$(id -g),umask=007 /dev/sda1 ~/btcdata 36 | ``` 37 | 38 | ### If you're stuck with a fat drive... 39 | 40 | Adapt the docs and Dockerfiles so that Docker user root will be used. Too bad for you. 41 | 42 | ## (if not using existing files): Create bitcoin working directory 43 | 44 | ```shell 45 | mkdir -m 2770 -p ~/btcdata 46 | ``` 47 | 48 | ## Apply permissions to bitcoin working directory 49 | (this cannot be done on a vfat mounted filesystem) 50 | 51 | ```shell 52 | sudo chown -R bitcoinuser:`id -gn` ~/btcdata 53 | ``` 54 | 55 | ## (if using existing files): Recursively apply permissions to existing files 56 | (this cannot be done on a vfat mounted filesystem) 57 | 58 | ```shell 59 | sudo find ~/btcdata -type f -exec chmod g+rw {} \; ; sudo find ~/btcdata -type d -exec chmod g+rwx {} \; 60 | ``` 61 | 62 | ## Create bitcoin.conf in ~/btcdata/ with following content: 63 | (replacing `rpcusername`, `rpcpassword`, `10.0.0.0/24` and others by your actual values) 64 | 65 | ```properties 66 | testnet=1 67 | txindex=1 68 | rpcuser=rpcusername 69 | rpcpassword=rpcpassword 70 | rpcallowip=10.0.0.0/24 71 | #printtoconsole=1 72 | maxmempool=64 73 | dbcache=64 74 | zmqpubrawblock=tcp://0.0.0.0:29000 75 | zmqpubrawtx=tcp://0.0.0.0:29000 76 | ``` 77 | 78 | ## Build docker image 79 | (replacing Bitcoin Core version by the one you want) 80 | 81 | ```shell 82 | docker build -t btcnode --build-arg ARCH=x86_64 . 83 | docker build -t btcnode --build-arg ARCH=arm . 84 | docker build -t btcnode --build-arg ARCH=aarch64 . 85 | ``` 86 | 87 | ## Run docker container 88 | 89 | ```shell 90 | docker run --rm -d --name btcnode -p 18333:18333 -p 18332:18332 -p 29000:29000 -v /home/pi/btcdata:/.bitcoin btcnode `id -u bitcoinuser`:`id -g bitcoinuser` bitcoind 91 | ``` 92 | 93 | ## If needed, re-apply permissions to newly created files 94 | 95 | ```shell 96 | sudo find ~/btcdata -type f -exec chmod g+rw {} \; ; sudo find ~/btcdata -type d -exec chmod g+rwx {} \; 97 | ``` 98 | 99 | ## Show logs or info 100 | 101 | With `printtoconsole=1` in bitcoin.conf: 102 | 103 | ```shell 104 | docker logs -f btcnode 105 | ``` 106 | 107 | Without `printtoconsole=1` in bitcoin.conf: 108 | 109 | ```shell 110 | sudo tail -f ~/btcdata/testnet3/debug.log 111 | ``` 112 | 113 | Invoking bitcoin-cli… 114 | 115 | ```shell 116 | docker exec -it btcnode bitcoin-cli -datadir=/.bitcoin stop 117 | ``` 118 | 119 | --- 120 | 121 | # Installing and using LVM to combine several storage devices into one big volume 122 | 123 | A full archival (transactions indexed) Mainnet Bitcoin node needs a lot of disk space. I have a bunch of old USB flash drives… I’d like to combine them all in one big disk and use that virtual disk for my node. Sounds like a fun hacky step! 124 | 125 | ## Install lvm2 (Logical Volume Manager) 126 | 127 | ```shell 128 | sudo apt-get install lvm2 129 | ``` 130 | 131 | ## Get USB device IDs: 132 | 133 | ```shell 134 | sudo blkid 135 | ``` 136 | 137 | ## Create physical volumes for those devices 138 | 139 | ```shell 140 | sudo pvcreate /dev/sda1 141 | sudo pvcreate /dev/sdb1 142 | sudo pvs 143 | ``` 144 | 145 | ## Create a virtual group and put physical volumes in it 146 | 147 | ```shell 148 | sudo vgcreate btcVG /dev/sda1 149 | sudo vgextend btcVG /dev/sdb1 150 | sudo vgdisplay 151 | ``` 152 | 153 | ## Create logical volume within the group, using all space, and format it 154 | 155 | ```shell 156 | sudo lvcreate -n btcLV -l 100%FREE btcVG 157 | sudo mkfs -t ext4 /dev/mapper/btcVG-btcLV 158 | ``` 159 | 160 | ## If uncleanly unmounted (“can't read superblock” message on mount), try 161 | 162 | ```shell 163 | sudo fsck /dev/btcVG/btcLV 164 | ``` 165 | 166 | ## Mount new volume for our .bitcoin directory 167 | 168 | ```shell 169 | sudo mount /dev/btcVG/btcLV ~/btcdata 170 | sudo lvdisplay 171 | ``` 172 | 173 | ## Unplug your device 174 | 175 | ```shell 176 | sudo umount ~/btcdata 177 | sudo vgchange -an btcVG 178 | sudo lvdisplay 179 | ``` 180 | 181 | ## Adding the mounting instruction in fstab is a good idea 182 | 183 | ```shell 184 | echo "/dev/btcVG/btcLV ${HOME}/btcdata" | sudo tee --append /etc/fstab > /dev/null 185 | ``` 186 | 187 | ## Adding more space (because the blockchain increases over time)... 188 | 189 | ```shell 190 | sudo pvcreate /dev/sdc1 191 | sudo vgextend btcVG /dev/sdc1 192 | sudo lvextend /dev/btcVG/btcLV /dev/sdc1 193 | sudo e2fsck -f /dev/btcVG/btcLV 194 | sudo resize2fs /dev/btcVG/btcLV 195 | ``` 196 | -------------------------------------------------------------------------------- /bitcoin-core/docker-build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Must be logged to docker hub: 4 | # docker login -u cyphernode 5 | 6 | # Must enable experimental cli features 7 | # "experimental": "enabled" in ~/.docker/config.json 8 | 9 | image() { 10 | local arch=$1 11 | local arch2=$2 12 | 13 | echo "Building and pushing cyphernode/bitcoin for $arch tagging as ${version} alpine arch ${arch2}..." 14 | 15 | docker build --no-cache -t cyphernode/bitcoin:${arch}-${version} --build-arg ARCH=${arch2} . \ 16 | && docker push cyphernode/bitcoin:${arch}-${version} 17 | 18 | return $? 19 | } 20 | 21 | manifest() { 22 | echo "Creating and pushing manifest for cyphernode/bitcoin for version ${version}..." 23 | 24 | docker manifest create cyphernode/bitcoin:${version} \ 25 | cyphernode/bitcoin:${x86_docker}-${version} \ 26 | cyphernode/bitcoin:${arm_docker}-${version} \ 27 | cyphernode/bitcoin:${aarch64_docker}-${version} \ 28 | && docker manifest annotate cyphernode/bitcoin:${version} cyphernode/bitcoin:${arm_docker}-${version} --os linux --arch ${arm_docker} \ 29 | && docker manifest annotate cyphernode/bitcoin:${version} cyphernode/bitcoin:${x86_docker}-${version} --os linux --arch ${x86_docker} \ 30 | && docker manifest annotate cyphernode/bitcoin:${version} cyphernode/bitcoin:${aarch64_docker}-${version} --os linux --arch ${aarch64_docker} \ 31 | && docker manifest push -p cyphernode/bitcoin:${version} 32 | 33 | return $? 34 | } 35 | 36 | x86_docker="amd64" 37 | x86_alpine="x86_64" 38 | arm_docker="arm" 39 | arm_alpine="arm" 40 | aarch64_docker="arm64" 41 | aarch64_alpine="aarch64" 42 | 43 | # Build amd64 and arm64 first, building for arm will trigger the manifest creation and push on hub 44 | 45 | #arch_docker=${arm_docker} ; arch_alpine=${arm_alpine} 46 | #arch_docker=${aarch64_docker} ; arch_alpine=${aarch64_alpine} 47 | arch_docker=${x86_docker} ; arch_alpine=${x86_alpine} 48 | 49 | version="v0.21.1" 50 | 51 | echo "arch_docker=$arch_docker, arch_alpine=$arch_alpine" 52 | 53 | image ${arch_docker} ${arch_alpine} 54 | 55 | [ $? -ne 0 ] && echo "Error" && exit 1 56 | 57 | [ "${arch_docker}" = "${x86_docker}" ] && echo "Built and pushed ${arch_docker} only" && exit 0 58 | [ "${arch_docker}" = "${aarch64_docker}" ] && echo "Built and pushed ${arch_docker} only" && exit 0 59 | [ "${arch_docker}" = "${arm_docker}" ] && echo "Built and pushed images, now building and pushing manifest for all archs..." 60 | 61 | manifest 62 | 63 | [ $? -ne 0 ] && echo "Error" && exit 1 64 | -------------------------------------------------------------------------------- /bitcoin-utils/electrum-personal-server/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM python:alpine 2 | 3 | # Get belchers pubkey 4 | RUN wget https://raw.githubusercontent.com/chris-belcher/electrum-personal-server/master/docs/pubkeys/belcher.asc 5 | 6 | # Latest release of electum private server from https://github.com/chris-belcher/electrum-personal-server/releases 7 | ENV VERSION 0.2.0 8 | 9 | RUN wget https://github.com/chris-belcher/electrum-personal-server/releases/download/eps-v${VERSION}/eps-v${VERSION}.tar.gz.asc 10 | RUN wget https://github.com/chris-belcher/electrum-personal-server/archive/eps-v${VERSION}.tar.gz 11 | 12 | RUN apk add --no-cache gnupg 13 | RUN gpg --import belcher.asc 14 | RUN gpg --batch --verify eps-v${VERSION}.tar.gz.asc eps-v${VERSION}.tar.gz 15 | 16 | RUN tar -xvf eps-v${VERSION}.tar.gz 17 | RUN mv electrum-personal-server-eps-v${VERSION}/ eps 18 | 19 | WORKDIR eps 20 | RUN cp config.ini_sample config.ini 21 | 22 | RUN pip3 install . 23 | ENTRYPOINT ["electrum-personal-server"] 24 | CMD ["./config.ini"] 25 | -------------------------------------------------------------------------------- /bitcoin-utils/electrum-personal-server/README.md: -------------------------------------------------------------------------------- 1 | # EPS 2 | 3 | ## Setup 4 | 5 | First, do something like this: 6 | 7 | ``` 8 | sudo useradd bitcoinuser 9 | ``` 10 | 11 | ...to create the user Bitcoin Core will run as. 12 | 13 | ``` 14 | docker swarm init --task-history-limit 1 15 | docker network create --driver=overlay --attachable --opt encrypted epsnet 16 | ``` 17 | 18 | ...to create the network within which EPS and Bitcoin Core will talk to each other. 19 | 20 | ## Start Bitcoin 21 | 22 | ``` 23 | docker run --name bitcoin --rm -d -v "$PWD/.bitcoin:/.bitcoin" --network epsnet cyphernode/bitcoin:v0.19.0.1 `id -u bitcoinuser`:`id -g bitcoinuser` bitcoind 24 | ``` 25 | 26 | ## Start EPS 27 | 28 | ``` 29 | docker run -it --name eps -p 50002:50002 --network epsnet -v "$PWD/eps/config.ini:/eps/config.ini" eps 30 | ``` 31 | 32 | Or if you want to do some manipulations with EPS: 33 | 34 | ``` 35 | docker run -it --name eps -p 50002:50002 --network epsnet -v "$PWD/eps/config.ini:/eps/config.ini" --entrypoint ash eps 36 | ``` 37 | -------------------------------------------------------------------------------- /bitcoin-utils/hd-wallet-derive/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM php:alpine3.8 2 | 3 | RUN apk add --update --no-cache git gmp gmp-dev \ 4 | && cd && git clone https://github.com/dan-da/hd-wallet-derive.git \ 5 | && cd hd-wallet-derive \ 6 | && php -r "readfile('https://getcomposer.org/installer');" | php \ 7 | && docker-php-ext-install gmp \ 8 | && php composer.phar install 9 | 10 | WORKDIR /root/hd-wallet-derive 11 | 12 | ENTRYPOINT ["ash"] 13 | -------------------------------------------------------------------------------- /bitcoin-utils/hd-wallet-derive/README.md: -------------------------------------------------------------------------------- 1 | # Build image 2 | 3 | ```shell 4 | docker build -t hdwd . 5 | ``` 6 | 7 | # Run container 8 | 9 | ```shell 10 | docker run -it --rm hdwd 11 | ``` 12 | 13 | # Usefull examples 14 | 15 | See https://github.com/dan-da/hd-wallet-derive 16 | 17 | List of the first 10 SegWit addresses for a pub32: 18 | 19 | ```shell 20 | ./hd-wallet-derive.php -g --key=upub5GtUcgGed1aGH4HKQ3vMYrsmLXwmHhS1AeX33ZvDgZiyvkGhNTvGd2TA5Lr4v239Fzjj4ZY48t6wTtXUy2yRgapf37QHgt6KWEZ6bgsCLpb --coin=btc-test --path="m/0" --numderive=10 21 | ``` 22 | -------------------------------------------------------------------------------- /bitcoin-utils/pycoin/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM python:3.6-alpine3.8 2 | 3 | RUN apk add --update --no-cache git \ 4 | && cd && git clone https://github.com/Kexkey/pycoin.git \ 5 | && mkdir /usr/local/lib/python3.6/site-packages/pycoin \ 6 | && cp -rf pycoin/pycoin/* /usr/local/lib/python3.6/site-packages/pycoin 7 | 8 | COPY ku /usr/local/bin/ku 9 | 10 | RUN chmod +x /usr/local/bin/ku 11 | 12 | ENTRYPOINT ["ash"] 13 | -------------------------------------------------------------------------------- /bitcoin-utils/pycoin/README.md: -------------------------------------------------------------------------------- 1 | # Build image 2 | 3 | ```shell 4 | docker build -t pycoin . 5 | ``` 6 | 7 | # Run container 8 | 9 | ```shell 10 | docker run -it --rm pycoin 11 | ``` 12 | 13 | # Usefull examples 14 | 15 | See https://github.com/shivaenigma/pycoin 16 | 17 | List of the first 10 SegWit addresses for a pub32: 18 | 19 | ```shell 20 | ku -s 0/0-9 -a E:upub5GtUcgGed1aGH4HKQ3vMYrsmLXwmHhS1AeX33ZvDgZiyvkGhNTvGd2TA5Lr4v239Fzjj4ZY48t6wTtXUy2yRgapf37QHgt6KWEZ6bgsCLpb 21 | ``` 22 | -------------------------------------------------------------------------------- /bitcoin-utils/pycoin/ku: -------------------------------------------------------------------------------- 1 | #!/usr/local/bin/python 2 | # -*- coding: utf-8 -*- 3 | import re 4 | import sys 5 | 6 | from pycoin.cmds.ku import main 7 | 8 | if __name__ == '__main__': 9 | sys.argv[0] = re.sub(r'(-script\.pyw?|\.exe)?$', '', sys.argv[0]) 10 | sys.exit(main()) 11 | -------------------------------------------------------------------------------- /bitcoin-utils/specter/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM python:3.8.6-alpine3.12 AS builder 2 | 3 | ENV HOME / 4 | ENV VERSION=v1.3.1 5 | ENV BRANCH=v1.3.1 6 | 7 | RUN apk add --update --no-cache git g++ libffi-dev openssl-dev libusb-dev eudev-dev \ 8 | && git clone --single-branch --branch ${BRANCH} https://github.com/cryptoadvance/specter-desktop.git \ 9 | && cd specter-desktop 10 | 11 | WORKDIR /specter-desktop 12 | 13 | RUN sed -i "s/vx.y.z-get-replaced-by-release-script/${VERSION}/g; " setup.py \ 14 | && pip3 install . 15 | 16 | FROM python:3.8.6-alpine3.12 17 | 18 | ENV HOME / 19 | 20 | RUN apk add --update --no-cache libusb-dev eudev-dev su-exec 21 | 22 | COPY --from=builder /usr/local/lib/python3.8 /usr/local/lib/python3.8 23 | COPY --from=builder /usr/local/bin /usr/local/bin 24 | COPY ./entrypoint.sh / 25 | 26 | EXPOSE 25441 25442 25443 27 | 28 | ENTRYPOINT ["su-exec"] 29 | -------------------------------------------------------------------------------- /bitcoin-utils/specter/README.md: -------------------------------------------------------------------------------- 1 | # Specter Docker Container 2 | 3 | This Docker container is based on Alpine. It will run the whole container as the specified user. 4 | 5 | ## Build 6 | 7 | ```bash 8 | docker build -t cyphernode/specter:v1.3.1 . 9 | ``` 10 | 11 | ## Run 12 | 13 | ```bash 14 | docker run --rm -d -p 25441:25441 -v "$YOUR_DATAPATH/data:/.specter" -v "$BITCOIN_DATAPATH/bitcoin-client.conf:/.bitcoin/bitcoin.conf:ro" cyphernode/specter:v1.3.1 $(id -u):$(id -g) /entrypoint.sh "0.0.0.0" 15 | ``` 16 | 17 | Then point your browser to http://localhost:25441 and enjoy! 18 | 19 | ## Cyphernode integration 20 | 21 | Please see https://github.com/SatoshiPortal/cypherapps/blob/features/specter/specter/docker-compose.yaml to see how Specter is integrated as a cypherapp in Cyphernode. 22 | 23 | -------------------------------------------------------------------------------- /bitcoin-utils/specter/docker-build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Must be logged to docker hub: 4 | # docker login -u cyphernode 5 | 6 | # Must enable experimental cli features 7 | # "experimental": "enabled" in ~/.docker/config.json 8 | 9 | image() { 10 | local arch=$1 11 | 12 | echo "Building and pushing cyphernode/specter for $arch tagging as ${version}..." 13 | 14 | docker build --no-cache -t cyphernode/specter:${arch}-${version} . \ 15 | && docker push cyphernode/specter:${arch}-${version} 16 | 17 | return $? 18 | } 19 | 20 | manifest() { 21 | echo "Creating and pushing manifest for cyphernode/clightning for version ${version}..." 22 | 23 | docker manifest create cyphernode/specter:${version} \ 24 | cyphernode/specter:${x86_docker}-${version} \ 25 | cyphernode/specter:${arm_docker}-${version} \ 26 | cyphernode/specter:${aarch64_docker}-${version} \ 27 | && docker manifest annotate cyphernode/specter:${version} cyphernode/specter:${arm_docker}-${version} --os linux --arch ${arm_docker} \ 28 | && docker manifest annotate cyphernode/specter:${version} cyphernode/specter:${x86_docker}-${version} --os linux --arch ${x86_docker} \ 29 | && docker manifest annotate cyphernode/specter:${version} cyphernode/specter:${aarch64_docker}-${version} --os linux --arch ${aarch64_docker} \ 30 | && docker manifest push -p cyphernode/specter:${version} 31 | 32 | return $? 33 | } 34 | 35 | x86_docker="amd64" 36 | arm_docker="arm" 37 | aarch64_docker="arm64" 38 | 39 | # Build amd64 and arm64 first, building for arm will trigger the manifest creation and push on hub 40 | 41 | #arch_docker=${arm_docker} 42 | #arch_docker=${aarch64_docker} 43 | arch_docker=${x86_docker} 44 | 45 | version="v1.3.1" 46 | 47 | echo "arch_docker=$arch_docker" 48 | 49 | image ${arch_docker} 50 | 51 | [ $? -ne 0 ] && echo "Error" && exit 1 52 | 53 | [ "${arch_docker}" = "${x86_docker}" ] && echo "Built and pushed ${arch_docker} only" && exit 0 54 | [ "${arch_docker}" = "${aarch64_docker}" ] && echo "Built and pushed ${arch_docker} only" && exit 0 55 | [ "${arch_docker}" = "${arm_docker}" ] && echo "Built and pushed images, now building and pushing manifest for all archs..." 56 | 57 | manifest 58 | 59 | [ $? -ne 0 ] && echo "Error" && exit 1 60 | -------------------------------------------------------------------------------- /bitcoin-utils/specter/entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | ip=${1} 4 | 5 | [ -n "${ip}" ] && python3 -m cryptoadvance.specter server --host ${ip} 6 | [ -z "${ip}" ] && python3 -m cryptoadvance.specter server 7 | -------------------------------------------------------------------------------- /c-lightning/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM alpine:3.12.4 as builder 2 | 3 | ARG CLN_VERSION="v0.10.0" 4 | 5 | ENV LIGHTNINGD_VERSION=master 6 | 7 | RUN apk add --update --no-cache \ 8 | ca-certificates \ 9 | alpine-sdk \ 10 | autoconf \ 11 | automake \ 12 | git \ 13 | libtool \ 14 | gmp-dev \ 15 | sqlite-dev \ 16 | python3-dev \ 17 | py3-mako \ 18 | net-tools \ 19 | zlib-dev \ 20 | libsodium \ 21 | gettext \ 22 | postgresql-dev \ 23 | libffi-dev \ 24 | py3-cryptography \ 25 | py3-pip \ 26 | cargo 27 | 28 | ARG DEVELOPER=1 29 | ENV PYTHON_VERSION=3 30 | 31 | RUN git clone https://github.com/ElementsProject/lightning.git \ 32 | && cd lightning && git checkout ${CLN_VERSION} \ 33 | && git submodule update --init --recursive \ 34 | && pip3 install -r requirements.txt \ 35 | && ./configure --prefix=/tmp/lightning_install --enable-developer \ 36 | && make -j3 DEVELOPER=${DEVELOPER} \ 37 | && make install 38 | 39 | # Let's create the actual image that will be run 40 | 41 | FROM cyphernode/alpine-glibc-base:v3.12.4_2.31-0 42 | 43 | RUN apk add --update --no-cache \ 44 | gmp-dev \ 45 | sqlite-dev \ 46 | postgresql-dev \ 47 | inotify-tools \ 48 | socat \ 49 | bash \ 50 | zlib-dev \ 51 | py3-pip \ 52 | python3-dev \ 53 | g++ \ 54 | linux-headers \ 55 | su-exec 56 | 57 | RUN pip install pyln-client pyln-testing 58 | 59 | ENV LIGHTNINGD_DATA=/.lightning 60 | ENV LIGHTNINGD_RPC_PORT=9835 61 | 62 | VOLUME ["/.bitcoin", "/.lightning"] 63 | 64 | COPY --from=builder /tmp/lightning_install/ /usr/local/ 65 | COPY --from=cyphernode/bitcoin:v0.21.1 /usr/bin/bitcoin-cli /usr/bin 66 | COPY bitcoin.conf /.bitcoin/bitcoin.conf 67 | 68 | EXPOSE 9735 69 | 70 | ENTRYPOINT ["su-exec"] 71 | # docker run -d --rm --name cln -p 9735:9735 -v /home/pi/lndata:/.lightning clnimg `id -u lnuser`:`id -g lnuser` lightningd 72 | -------------------------------------------------------------------------------- /c-lightning/README.md: -------------------------------------------------------------------------------- 1 | # C-lightning LN implementation 2 | 3 | ## Assumptions if on RPi 4 | 5 | [You have a working RPi.](../README-RPi.md) 6 | 7 | ## Create lnuser that will run the processes 8 | 9 | Log in and: 10 | 11 | ```shell 12 | sudo useradd lnuser 13 | ``` 14 | 15 | ## (if not using existing files): Create lightning and bitcoin working directories 16 | 17 | ```shell 18 | mkdir -m 2770 -p ~/lndata 19 | cp config ~/lndata 20 | ``` 21 | 22 | ## Apply permissions to working directories 23 | 24 | ```shell 25 | sudo chown -R lnuser:`id -gn` ~/lndata 26 | ``` 27 | 28 | ## (if using existing files): Recursively apply permissions to existing files 29 | 30 | ```shell 31 | sudo find ~/lndata -type f -exec chmod g+rw {} \; ; sudo find ~/lndata -type d -exec chmod g+rwx {} \; 32 | ``` 33 | 34 | ## Edit file bitcoin.conf (will be .bitcoin/bitcoin.conf) 35 | (replacing `btcnode` with Bitcoin node IP/name and `rpcusername/rpcpassword` with RPC username/password) 36 | 37 | ```properties 38 | rpcconnect=btcnode 39 | rpcuser=rpcusername 40 | rpcpassword=rpcpassword 41 | testnet=1 42 | rpcwallet=ln01.dat 43 | ``` 44 | 45 | ## Edit file config (will be .lightning/config), using your node alias, color, port and network 46 | 47 | ```properties 48 | alias=SatoshiPortal01 49 | rgb=008000 50 | #port=9735 51 | network=testnet 52 | ``` 53 | 54 | ## Build image 55 | 56 | ```shell 57 | docker build -t clnimg . 58 | ``` 59 | 60 | ## Start LN server in container 61 | 62 | ```shell 63 | docker run -d --rm --name cln -p 9735:9735 -v /home/pi/lndata:/.lightning clnimg `id -u lnuser`:`id -g lnuser` lightningd 64 | ``` 65 | 66 | ## If needed, re-apply permissions to newly created files 67 | 68 | ```shell 69 | sudo find ~/lndata -type f -exec chmod g+rw {} \; ; sudo find ~/lndata -type d -exec chmod g+rwx {} \; 70 | ``` 71 | 72 | ## To get the node public key, type 73 | 74 | ```shell 75 | docker logs -f cln 76 | docker exec -it cln lightning-cli getinfo 77 | docker exec -it cln lightning-cli stop 78 | ``` 79 | -------------------------------------------------------------------------------- /c-lightning/bitcoin.conf: -------------------------------------------------------------------------------- 1 | rpcconnect=btcnode 2 | rpcuser=rpcuser 3 | rpcpassword=rpcpassword 4 | testnet=1 5 | rpcwallet=ln01.dat 6 | -------------------------------------------------------------------------------- /c-lightning/config: -------------------------------------------------------------------------------- 1 | alias=SatoshiPortal01 2 | rgb=008000 3 | #port=9735 4 | network=testnet 5 | -------------------------------------------------------------------------------- /c-lightning/docker-build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Must be logged to docker hub: 4 | # docker login -u cyphernode 5 | 6 | # Must enable experimental cli features 7 | # "experimental": "enabled" in ~/.docker/config.json 8 | 9 | image() { 10 | local arch=$1 11 | 12 | echo "Building and pushing cyphernode/clightning for $arch tagging as ${version}..." 13 | 14 | docker build --no-cache -t cyphernode/clightning:${arch}-${version} . \ 15 | && docker push cyphernode/clightning:${arch}-${version} 16 | 17 | return $? 18 | } 19 | 20 | manifest() { 21 | echo "Creating and pushing manifest for cyphernode/clightning for version ${version}..." 22 | 23 | docker manifest create cyphernode/clightning:${version} \ 24 | cyphernode/clightning:${x86_docker}-${version} \ 25 | cyphernode/clightning:${arm_docker}-${version} \ 26 | cyphernode/clightning:${aarch64_docker}-${version} \ 27 | && docker manifest annotate cyphernode/clightning:${version} cyphernode/clightning:${arm_docker}-${version} --os linux --arch ${arm_docker} \ 28 | && docker manifest annotate cyphernode/clightning:${version} cyphernode/clightning:${x86_docker}-${version} --os linux --arch ${x86_docker} \ 29 | && docker manifest annotate cyphernode/clightning:${version} cyphernode/clightning:${aarch64_docker}-${version} --os linux --arch ${aarch64_docker} \ 30 | && docker manifest push -p cyphernode/clightning:${version} 31 | 32 | return $? 33 | } 34 | 35 | x86_docker="amd64" 36 | arm_docker="arm" 37 | aarch64_docker="arm64" 38 | 39 | # Build amd64 and arm64 first, building for arm will trigger the manifest creation and push on hub 40 | 41 | #arch_docker=${arm_docker} 42 | #arch_docker=${aarch64_docker} 43 | arch_docker=${x86_docker} 44 | 45 | version="v0.10.0" 46 | 47 | echo "arch_docker=$arch_docker" 48 | 49 | image ${arch_docker} 50 | 51 | [ $? -ne 0 ] && echo "Error" && exit 1 52 | 53 | [ "${arch_docker}" = "${x86_docker}" ] && echo "Built and pushed ${arch_docker} only" && exit 0 54 | [ "${arch_docker}" = "${aarch64_docker}" ] && echo "Built and pushed ${arch_docker} only" && exit 0 55 | [ "${arch_docker}" = "${arm_docker}" ] && echo "Built and pushed images, now building and pushing manifest for all archs..." 56 | 57 | manifest 58 | 59 | [ $? -ne 0 ] && echo "Error" && exit 1 60 | -------------------------------------------------------------------------------- /lightning-utils/sparkwallet/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM node:14.10.1-buster-slim as builder 2 | 3 | RUN apt-get update && apt-get install -y --no-install-recommends ca-certificates git python3 build-essential 4 | 5 | # npm doesn't normally like running as root, allow it since we're in docker 6 | RUN npm config set unsafe-perm true 7 | 8 | # Install Spark 9 | WORKDIR /opt 10 | RUN git clone -b v0.2.17 https://github.com/shesek/spark-wallet.git spark \ 11 | && cd spark/client \ 12 | && npm install 13 | 14 | WORKDIR /opt/spark 15 | RUN npm install 16 | 17 | # Build production NPM package 18 | RUN npm run dist:npm \ 19 | && npm prune --production \ 20 | && find . -mindepth 1 -maxdepth 1 \ 21 | ! -name '*.json' ! -name dist ! -name LICENSE ! -name node_modules ! -name scripts \ 22 | -exec rm -r "{}" \; 23 | 24 | 25 | FROM node:14.10.1-alpine3.11 26 | 27 | WORKDIR /opt/spark 28 | 29 | RUN apk add --update --no-cache bash xz inotify-tools tini netcat-openbsd \ 30 | && ln -s /opt/spark/dist/cli.js /usr/bin/spark-wallet \ 31 | && mkdir /data \ 32 | && ln -s /data/lightning $HOME/.lightning 33 | 34 | COPY --from=builder /opt/spark /opt/spark 35 | 36 | ENV CONFIG=/data/spark/config TLS_PATH=/data/spark/tls TOR_PATH=/data/spark/tor COOKIE_FILE=/data/spark/cookie HOST=0.0.0.0 37 | 38 | VOLUME /data 39 | ENTRYPOINT [ "tini", "-g", "--", "scripts/docker-entrypoint.sh" ] 40 | 41 | EXPOSE 9737 42 | 43 | -------------------------------------------------------------------------------- /lightning-utils/sparkwallet/docker-build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Must be logged to docker hub: 4 | # docker login -u cyphernode 5 | 6 | # Must enable experimental cli features 7 | # "experimental": "enabled" in ~/.docker/config.json 8 | 9 | image() { 10 | local arch=$1 11 | 12 | echo "Building and pushing cyphernode/sparkwallet for $arch tagging as ${version}..." 13 | 14 | docker build --no-cache -t cyphernode/sparkwallet:${arch}-${version} . \ 15 | && docker push cyphernode/sparkwallet:${arch}-${version} 16 | 17 | return $? 18 | } 19 | 20 | manifest() { 21 | echo "Creating and pushing manifest for cyphernode/sparkwallet for version ${version}..." 22 | 23 | docker manifest create cyphernode/sparkwallet:${version} \ 24 | cyphernode/sparkwallet:${x86_docker}-${version} \ 25 | cyphernode/sparkwallet:${arm_docker}-${version} \ 26 | cyphernode/sparkwallet:${aarch64_docker}-${version} \ 27 | && docker manifest annotate cyphernode/sparkwallet:${version} cyphernode/sparkwallet:${arm_docker}-${version} --os linux --arch ${arm_docker} \ 28 | && docker manifest annotate cyphernode/sparkwallet:${version} cyphernode/sparkwallet:${x86_docker}-${version} --os linux --arch ${x86_docker} \ 29 | && docker manifest annotate cyphernode/sparkwallet:${version} cyphernode/sparkwallet:${aarch64_docker}-${version} --os linux --arch ${aarch64_docker} \ 30 | && docker manifest push -p cyphernode/sparkwallet:${version} 31 | 32 | return $? 33 | } 34 | 35 | x86_docker="amd64" 36 | arm_docker="arm" 37 | aarch64_docker="arm64" 38 | 39 | # Build amd64 and arm64 first, building for arm will trigger the manifest creation and push on hub 40 | 41 | #arch_docker=${arm_docker} 42 | #arch_docker=${aarch64_docker} 43 | arch_docker=${x86_docker} 44 | 45 | version="v0.2.17" 46 | 47 | echo "arch_docker=$arch_docker" 48 | 49 | image ${arch_docker} 50 | 51 | [ $? -ne 0 ] && echo "Error" && exit 1 52 | 53 | [ "${arch_docker}" = "${x86_docker}" ] && echo "Built and pushed ${arch_docker} only" && exit 0 54 | [ "${arch_docker}" = "${aarch64_docker}" ] && echo "Built and pushed ${arch_docker} only" && exit 0 55 | [ "${arch_docker}" = "${arm_docker}" ] && echo "Built and pushed images, now building and pushing manifest for all archs..." 56 | 57 | manifest 58 | 59 | [ $? -ne 0 ] && echo "Error" && exit 1 60 | -------------------------------------------------------------------------------- /liquid/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM cyphernode/alpine-glibc-base:v3.12.4_2.31-0 2 | 3 | ARG ELEMENTS_VERSION="0.18.1.11" 4 | 5 | # x86_64, arm or aarch64 6 | ARG ARCH=x86_64 7 | 8 | # https://github.com/ElementsProject/elements/releases/download/elements-0.18.1.3/elements-0.18.1.3-arm-linux-gnueabihf.tar.gz 9 | # https://github.com/ElementsProject/elements/releases/download/elements-0.18.1.3/elements-0.18.1.3-aarch64-linux-gnu.tar.gz 10 | # https://github.com/ElementsProject/elements/releases/download/elements-0.18.1.3/elements-0.18.1.3-x86_64-linux-gnu.tar.gz 11 | # https://github.com/ElementsProject/elements/releases/download/elements-0.18.1.3/SHA256SUMS.asc 12 | 13 | ENV URL https://github.com/ElementsProject/elements/releases/download/elements-${ELEMENTS_VERSION} 14 | 15 | RUN apk add --update --no-cache \ 16 | curl \ 17 | su-exec \ 18 | gnupg 19 | 20 | VOLUME ["/.elements"] 21 | 22 | WORKDIR /usr/bin 23 | 24 | RUN wget ${URL}/SHA256SUMS.asc \ 25 | && gpg --keyserver hkp://keyserver.ubuntu.com --recv-keys 11D43A27826A421212108BF66BE2CED14A9917BC DE10E82629A8CAD55B700B972F2A88D7F8D68E87 \ 26 | && gpg --verify SHA256SUMS.asc \ 27 | && GNU=$([ "${ARCH}" = "arm" ] && echo eabihf || true) \ 28 | && TARBALL=elements-${ELEMENTS_VERSION}-${ARCH}-linux-gnu${GNU}.tar.gz \ 29 | && echo ${URL}/$TARBALL \ 30 | && wget ${URL}/$TARBALL \ 31 | && grep $TARBALL SHA256SUMS.asc | sha256sum -c - \ 32 | && tar -xzC . -f $TARBALL elements-${ELEMENTS_VERSION}/bin/elementsd elements-${ELEMENTS_VERSION}/bin/elements-cli --strip-components=2 \ 33 | && rm -rf $TARBALL SHA256SUMS.asc \ 34 | && apk del gnupg 35 | 36 | ENV HOME / 37 | EXPOSE 18885 18886 7041 7042 38 | 39 | ENTRYPOINT ["su-exec"] 40 | -------------------------------------------------------------------------------- /liquid/README.md: -------------------------------------------------------------------------------- 1 | # Build 2 | 3 | docker build -t cyphernode/elements:v0.18.1.11 --build-arg ARCH=x86_64 . 4 | -------------------------------------------------------------------------------- /liquid/docker-build.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # Must be logged to docker hub: 4 | # docker login -u cyphernode 5 | 6 | # Must enable experimental cli features 7 | # "experimental": "enabled" in ~/.docker/config.json 8 | 9 | image() { 10 | local arch=$1 11 | local arch2=$2 12 | 13 | echo "Building and pushing cyphernode/elements for $arch tagging as ${version} alpine arch ${arch2}..." 14 | 15 | docker build -t cyphernode/elements:${arch}-${version} --build-arg ARCH=${arch2} . \ 16 | && docker push cyphernode/elements:${arch}-${version} 17 | 18 | return $? 19 | } 20 | 21 | manifest() { 22 | echo "Creating and pushing manifest for cyphernode/elements for version ${version}..." 23 | 24 | docker manifest create cyphernode/elements:${version} \ 25 | cyphernode/elements:${x86_docker}-${version} \ 26 | cyphernode/elements:${arm_docker}-${version} \ 27 | cyphernode/elements:${aarch64_docker}-${version} \ 28 | && docker manifest annotate cyphernode/elements:${version} cyphernode/elements:${arm_docker}-${version} --os linux --arch ${arm_docker} \ 29 | && docker manifest annotate cyphernode/elements:${version} cyphernode/elements:${x86_docker}-${version} --os linux --arch ${x86_docker} \ 30 | && docker manifest annotate cyphernode/elements:${version} cyphernode/elements:${aarch64_docker}-${version} --os linux --arch ${aarch64_docker} \ 31 | && docker manifest push -p cyphernode/elements:${version} 32 | 33 | return $? 34 | } 35 | 36 | x86_docker="amd64" 37 | x86_alpine="x86_64" 38 | arm_docker="arm" 39 | arm_alpine="arm" 40 | aarch64_docker="arm64" 41 | aarch64_alpine="aarch64" 42 | 43 | # Build amd64 and arm64 first, building for arm will trigger the manifest creation and push on hub 44 | 45 | #arch_docker=${arm_docker} ; arch_alpine=${arm_alpine} 46 | #arch_docker=${aarch64_docker} ; arch_alpine=${aarch64_alpine} 47 | arch_docker=${x86_docker} ; arch_alpine=${x86_alpine} 48 | 49 | version="v0.18.1.11" 50 | 51 | echo "arch_docker=$arch_docker, arch_alpine=$arch_alpine" 52 | 53 | image ${arch_docker} ${arch_alpine} 54 | 55 | [ $? -ne 0 ] && echo "Error" && exit 1 56 | 57 | [ "${arch_docker}" = "${x86_docker}" ] && echo "Built and pushed ${arch_docker} only" && exit 0 58 | [ "${arch_docker}" = "${aarch64_docker}" ] && echo "Built and pushed ${arch_docker} only" && exit 0 59 | [ "${arch_docker}" = "${arm_docker}" ] && echo "Built and pushed images, now building and pushing manifest for all archs..." 60 | 61 | manifest 62 | 63 | [ $? -ne 0 ] && echo "Error" && exit 1 64 | -------------------------------------------------------------------------------- /ots/README.md: -------------------------------------------------------------------------------- 1 | # OTS setup on x86 2 | 3 | ## Bitcoin Node 4 | 5 | ### Attach Lunanode volume to instance 6 | (using a volume makes it easy to backup or retrieve data if something happens to VM) 7 | 8 | ...in the Lunanode control panel 9 | 10 | ### Format the volumes 11 | (one for OTS data, the other for the pruned Bitcoin node) 12 | 13 | ```shell 14 | debian@ots01:~$ sudo mkfs.ext4 /dev/vdc 15 | mke2fs 1.43.4 (31-Jan-2017) 16 | Creating filesystem with 13107200 4k blocks and 3276800 inodes 17 | Filesystem UUID: d2af1fd1-8b72-4702-84c7-83739500ecf9 18 | Superblock backups stored on blocks: 19 | 32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 20 | 4096000, 7962624, 11239424 21 | 22 | Allocating group tables: done 23 | Writing inode tables: done 24 | Creating journal (65536 blocks): done 25 | Writing superblocks and filesystem accounting information: done 26 | ``` 27 | 28 | ```shell 29 | debian@ots01:~$ sudo mkfs.ext4 /dev/vdd 30 | mke2fs 1.43.4 (31-Jan-2017) 31 | Creating filesystem with 4194304 4k blocks and 1048576 inodes 32 | Filesystem UUID: dac2c051-b53c-432d-bf75-79ed8c11e1fc 33 | Superblock backups stored on blocks: 34 | 32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, 35 | 4096000 36 | 37 | Allocating group tables: done 38 | Writing inode tables: done 39 | Creating journal (32768 blocks): done 40 | Writing superblocks and filesystem accounting information: done 41 | ``` 42 | 43 | ### Set volumes and directories... 44 | 45 | ```shell 46 | mkdir ~/.bitcoin 47 | sudo mount /dev/vdc ~/.bitcoin/ 48 | mkdir ~/otsd 49 | sudo mount /dev/vdd ~/otsd/ 50 | ``` 51 | 52 | ### Install server packages: git and docker 53 | 54 | #### GIT 55 | 56 | ```shell 57 | sudo apt-get update ; sudo apt-get upgrade ; sudo apt-get install git 58 | ``` 59 | 60 | #### DOCKER installation 61 | 62 | See Docker's web site for insllation instructions: https://docs.docker.com/install/linux/docker-ce/debian/ 63 | 64 | #### Create Docker Swarm and overlay network used by our containers 65 | 66 | ```shell 67 | docker swarm init --task-history-limit 1 68 | docker network create --driver=overlay --attachable --opt encrypted spbtcnodenet 69 | ``` 70 | 71 | #### Our Bitcoin Node Container 72 | 73 | ```shell 74 | sudo useradd bitcoinuser 75 | sudo chown -R bitcoinuser:debian ~/.bitcoin ; sudo chmod g+ws ~/.bitcoin 76 | sudo find ~/.bitcoin -type d -exec chmod 2775 {} \; ; sudo find ~/.bitcoin -type f -exec chmod g+rw {} \; 77 | vi ~/.bitcoin/bitcoin.conf 78 | ``` 79 | ```console 80 | prune=550 81 | rpcuser=username 82 | rpcpassword=password 83 | rpcallowip=10.0.0.0/24 84 | maxmempool=64 85 | dbcache=64 86 | rpcconnect=btcnode-ots 87 | ``` 88 | ```shell 89 | git clone https://github.com/SatoshiPortal/dockers.git 90 | vi dockers/x86_64/bitcoin-core/Dockerfile 91 | docker build -t btcnode --build-arg USER_ID=$(id -u bitcoinuser) --build-arg GROUP_ID=$(id -g bitcoinuser) --build-arg CORE_VERSION="0.16.2" dockers/x86_64/bitcoin-core/. 92 | docker run -d --rm --mount type=bind,source="$HOME/.bitcoin",target="/bitcoin/.bitcoin" --name btcnode-ots --network spbtcnodenet btcnode 93 | ``` 94 | 95 | ## Our nginx instance 96 | (Setting up web server + SSL certificates from Let's Encrypt) 97 | 98 | ```shell 99 | docker run -d -p 80:80 -p 443:443 --name nginx -v /home/debian/otsd/nginx/certs:/etc/nginx/certs:ro -v /etc/nginx/conf.d -v /etc/nginx/vhost.d -v /usr/share/nginx/html --network spbtcnodenet nginx:alpine 100 | ``` 101 | 102 | ## Our nginx-gen instance 103 | 104 | ```shell 105 | sudo chown -R debian:debian ~/otsd/nginx 106 | curl https://raw.githubusercontent.com/jwilder/nginx-proxy/master/nginx.tmpl > ~/otsd/nginx/nginx.tmpl 107 | 108 | docker run -d --name nginx-gen --volumes-from nginx -v /home/debian/otsd/nginx/nginx.tmpl:/etc/docker-gen/templates/nginx.tmpl:ro -v /var/run/docker.sock:/tmp/docker.sock:ro --network spbtcnodenet jwilder/docker-gen -notify-sighup nginx -watch -wait 5s:30s /etc/docker-gen/templates/nginx.tmpl /etc/nginx/conf.d/default.conf 109 | ``` 110 | 111 | ## Our Let's Encrypt companion! 112 | 113 | ```shell 114 | docker run -d --name nginx-letsencrypt --volumes-from nginx -v /home/debian/otsd/nginx/certs:/etc/nginx/certs:rw -v /var/run/docker.sock:/var/run/docker.sock:ro --network spbtcnodenet -e NGINX_DOCKER_GEN_CONTAINER=nginx-gen -e NGINX_PROXY_CONTAINER=nginx jrcs/letsencrypt-nginx-proxy-companion 115 | ``` 116 | 117 | ## Our OTS Node Container 118 | 119 | ### First time only 120 | 121 | ```shell 122 | mkdir -p ~/otsd/otsserver01/calendar/ 123 | echo "https://btc.calendar.otsserver01.com/" > ~/otsd/otsserver01/calendar/uri 124 | dd if=/dev/random of=~/otsd/otsserver01/calendar/hmac-key bs=32 count=1 125 | sudo useradd otsuser 126 | ``` 127 | 128 | #### Only if you want more than one OTS server on the machine... 129 | 130 | ```shell 131 | mkdir -p ~/otsd/otsserver02/calendar/ 132 | echo "https://btc.calendar.otsserver02.com/" > ~/otsd/otsserver02/calendar/uri 133 | dd if=/dev/random of=~/otsd/otsserver02/calendar/hmac-key bs=32 count=1 134 | ``` 135 | 136 | #### Set OTS server image and directory access 137 | 138 | ```shell 139 | sudo chown -R otsuser:debian ~/otsd ; sudo chmod g+ws ~/otsd 140 | sudo find ~/otsd -type d -exec chmod 2775 {} \; ; sudo find ~/otsd -type f -exec chmod g+rw {} \; 141 | git clone https://github.com/SatoshiPortal/dockers.git 142 | vi dockers/x86_64/ots/otsserver/Dockerfile 143 | docker build -t otsserver --build-arg USER_ID=$(id -u otsuser) --build-arg GROUP_ID=$(id -g otsuser) dockers/x86_64/ots/otsserver/. 144 | ``` 145 | 146 | ### ots.btc.otsserver01.com OTS server 147 | 148 | ```shell 149 | docker run -d --rm --mount type=bind,source="$HOME/.bitcoin",target="/otsuser/.bitcoin" --mount type=bind,source="$HOME/otsd/otsserver01",target="/otsuser/.otsd" --name otsnode-otsserver01 --network spbtcnodenet -e "VIRTUAL_HOST=ots.btc.otsserver01.com,btc.calendar.otsserver01.com" -e "LETSENCRYPT_HOST=ots.btc.otsserver01.com,btc.calendar.otsserver01.com" -e "LETSENCRYPT_EMAIL=security@otsserver01.com" --expose 14788 otsserver 150 | ``` 151 | 152 | ### btc.ots.otsserver02.com OTS server 153 | 154 | ```shell 155 | docker run -d --rm --mount type=bind,source="$HOME/.bitcoin",target="/otsuser/.bitcoin" --mount type=bind,source="$HOME/otsd/otsserver02",target="/otsuser/.otsd" --name otsnode-otsserver02 --network spbtcnodenet -e "VIRTUAL_HOST=ots.btc.otsserver02.com,btc.calendar.otsserver02.com" -e "LETSENCRYPT_HOST=ots.btc.otsserver02.com,btc.calendar.otsserver02.com" -e "LETSENCRYPT_EMAIL=security@otsserver02.com" --expose 14789 otsserver 156 | ``` 157 | 158 | ## Our OTS Client 159 | (please make copies of your OTS files, they may be deleted when you remove this container) 160 | 161 | ```shell 162 | docker build -t otsclient dockers/x86_64/ots/otsclient/. 163 | docker run --rm -it --name otsclient otsclient 164 | ``` 165 | 166 | ### Client examples 167 | 168 | ```shell 169 | ots -v stamp -m 1 myfile1.ext 170 | ots -v info myfile1.ext.ots 171 | ots -v upgrade myfile1.ext.ots 172 | ots -v info myfile1.ext.ots 173 | ots -v -l "https://btc.ots.otsserver01.com" stamp -c "https://btc.ots.otsserver01.com" -m 1 myfile2.ext 174 | ots -v info myfile2.ext.ots 175 | ots -v -l "https://btc.ots.otsserver01.com" upgrade myfile2.ext.ots 176 | ots -v info myfile2.ext.ots 177 | ``` 178 | -------------------------------------------------------------------------------- /ots/docker-compose.yml: -------------------------------------------------------------------------------- 1 | version: "3" 2 | 3 | services: 4 | btcnode-ots: 5 | networks: 6 | - spbtcnodenet 7 | 8 | nginx: 9 | networks: 10 | -spbtcnodenet 11 | 12 | nginx-gen: 13 | networks: 14 | -spbtcnodenet 15 | 16 | nginx-letsencrypt: 17 | networks: 18 | -spbtcnodenet 19 | 20 | otsnode: 21 | networks: 22 | - spbtcnodenet 23 | 24 | otsnode-satoshiportal: 25 | networks: 26 | - spbtcnodenet 27 | 28 | 29 | networks: 30 | spbtcnodenet: 31 | external: true 32 | -------------------------------------------------------------------------------- /ots/env.properties: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SatoshiPortal/dockers/cc5e08d48d90475d554a12f0926ab5e7255847a3/ots/env.properties -------------------------------------------------------------------------------- /ots/otsclient/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM python:3.6-alpine3.8 2 | 3 | ARG USER_ID 4 | ARG GROUP_ID 5 | ENV USERNAME otsuser 6 | ENV HOME /${USERNAME} 7 | ENV USER_ID ${USER_ID:-1000} 8 | ENV GROUP_ID ${GROUP_ID:-1000} 9 | 10 | RUN addgroup -g ${GROUP_ID} ${USERNAME} \ 11 | && adduser -u ${USER_ID} -G ${USERNAME} -D -s /bin/sh -h ${HOME} ${USERNAME} \ 12 | && apk add --update --no-cache git g++ libressl-dev 13 | 14 | RUN git clone https://github.com/opentimestamps/opentimestamps-client.git \ 15 | && cd opentimestamps-client \ 16 | && python3 setup.py install 17 | 18 | USER ${USERNAME} 19 | WORKDIR ${HOME} 20 | 21 | ENTRYPOINT ["ash"] 22 | -------------------------------------------------------------------------------- /ots/otsclient/Dockerfile-js: -------------------------------------------------------------------------------- 1 | FROM node:11.1-alpine3.8 2 | 3 | RUN apk add --update --no-cache \ 4 | git \ 5 | su-exec \ 6 | && yarn global add javascript-opentimestamps 7 | 8 | WORKDIR /otsfiles 9 | 10 | ENTRYPOINT ["su-exec"] 11 | # docker build -t otsclient-js -f Dockerfile-js . 12 | # docker run -it --rm --name otsclient-js -v /home/debian/otsfiles:/otsfiles otsclient-js `id -u otsuser`:`id -g otsuser` ash 13 | 14 | # ots-cli.js stamp -d 1ddfb769eb0b8876bc570e25580e6a53afcf973362ee1ee4b54a807da2e5eed7 15 | # ots-cli.js verify -d 1ddfb769eb0b8876bc570e25580e6a53afcf973362ee1ee4b54a807da2e5eed7 1ddfb769eb0b8876bc570e25580e6a53afcf973362ee1ee4b54a807da2e5eed7.ots 16 | # ots-cli.js info 1ddfb769eb0b8876bc570e25580e6a53afcf973362ee1ee4b54a807da2e5eed7.ots 17 | # ots-cli.js upgrade 1ddfb769eb0b8876bc570e25580e6a53afcf973362ee1ee4b54a807da2e5eed7.ots 18 | -------------------------------------------------------------------------------- /ots/otsserver/Dockerfile: -------------------------------------------------------------------------------- 1 | FROM python:3.6-alpine3.8 2 | 3 | ARG USER_ID 4 | ARG GROUP_ID 5 | ENV USERNAME otsuser 6 | ENV HOME /${USERNAME} 7 | ENV USER_ID ${USER_ID:-1000} 8 | ENV GROUP_ID ${GROUP_ID:-1000} 9 | 10 | RUN addgroup -g ${GROUP_ID} ${USERNAME} \ 11 | && adduser -u ${USER_ID} -G ${USERNAME} -D -s /bin/sh -h ${HOME} ${USERNAME} \ 12 | && apk add --update --no-cache git g++ libressl-dev 13 | 14 | USER ${USERNAME} 15 | WORKDIR ${HOME} 16 | 17 | RUN git clone https://github.com/opentimestamps/opentimestamps-server.git \ 18 | && cd opentimestamps-server \ 19 | && pip3 install --user -r requirements.txt \ 20 | && pip3 install --user requests \ 21 | && mkdir -p ~/.otsd/ ~/.bitcoin/ 22 | 23 | VOLUME ["${HOME}/.bitcoin"] 24 | VOLUME ["${HOME}/otsd"] 25 | 26 | # Must not expose here if wanting to run more than 1 server on the same machine 27 | #EXPOSE 14788 28 | 29 | ENTRYPOINT ["./opentimestamps-server/otsd"] 30 | CMD [ "--rpc-address","otsnode"] 31 | --------------------------------------------------------------------------------