Browse Source

Cleaned up extraneous stuff and added icon

umbrel-mod
reid 3 years ago
parent
commit
89490b279f
  1. 6
      Dockerfile
  2. 8
      README.md
  3. 93
      bin/get-bitcoin.sh
  4. 9
      rpc/mainnet-start.sh
  5. 9
      rpc/server.js

6
Dockerfile

@ -5,8 +5,8 @@ RUN apt-get update && \
apt-get install -y xz-utils python && \
rm -rf /var/lib/apt/lists/*
RUN curl https://nodejs.org/dist/v14.18.1/node-v14.18.1-linux-arm64.tar.xz --output node-v14.18.1-linux-arm64.tar.xz
RUN tar xvf node-v14.18.1-linux-arm64.tar.xz
RUN curl https://nodejs.org/dist/v14.18.1/node-v14.18.1-linux-x64.tar.xz --output node-v14.18.1-linux-x64.tar.xz
RUN tar xvf node-v14.18.1-linux-x64.tar.xz
# urbit-bitcoin-rpc Builder container
@ -40,7 +40,7 @@ RUN groupadd -g $GID -o $USERNAME && \
echo "$USERNAME ALL=(ALL:ALL) NOPASSWD: /usr/bin/append-to-hosts" | tee -a /etc/sudoers
# Copy files from the builder containers
COPY --from=nodejs-builder /node-v14.18.1-linux-arm64/ /usr/local/
COPY --from=nodejs-builder /node-v14.18.1-linux-x64/ /usr/local/
COPY --from=urbit-rpc-builder /urbit-bitcoin-rpc/* /
COPY --from=urbit-rpc-builder /urbit-bitcoin-rpc/src /src

8
README.md

@ -6,8 +6,12 @@ Since Umbrel ships with `bitcoind` and `electrs` out of the box, the only remain
The Docker Compose file is included for reference. Most importantly it imports env vars that describe the `bitcoind` and `electrs` servers to communicate with. This package does not need persistent storage.
Once you've got it running, try curling it:
Once running on a fully synced Umbrel, you can connect your ship to it like this:
```
$> curl http://ip.address.here:50002/addresses/info/bc1qm7cegwfd0pvv9ypvz5nhstage00xkxevtrpshc
dojo> |rein %bitcoin [& %btc-provider]
dojo> =network %main
dojo> :btc-provider +bitcoin!btc-provider/command [%set-credentials api-url='http://addresshere:50002' network]
```
If it's working, you will be able to see a new block announcement in your dojo.

93
bin/get-bitcoin.sh

@ -1,93 +0,0 @@
#!/usr/bin/env bash
set -e
# For debugging:
# set -x
# Versions available (per https://bitcoincore.org/bin) are:
#
# (there are earlier versions available, but the binary URLs don't conform to the
# same pattern.)
#
VERSIONS=(
0.13.0
0.13.1
0.13.2
0.14.3
0.15.2
0.16.3
0.17.0
0.17.0.1
0.17.1
0.17.2
0.18.0
0.18.1
0.19.0.1
0.19.1
0.20.0
0.20.1
0.20.2
0.21.0
0.21.1
0.21.2
)
err() {
>&2 echo "$@"
}
if [ ! -f /etc/debian_version ] && [ ! -f /etc/lsb_release ]; then
err "This script is intended for use on Debian-based systems."
exit 1
fi
VERSION="$1"
INSTALL_PREFIX="${2:-/}"
URL_BASE="https://bitcoincore.org/bin/bitcoin-core-${VERSION}"
FILENAME="bitcoin-${VERSION}-x86_64-linux-gnu.tar.gz"
if [ -z "${VERSION}" ]; then
err "Usage: get-bitcoin.sh <version> [<install-prefix>]"
err
err "Available versions are:"
for v in "${VERSIONS[@]}"; do
err " ${v}"
done
err
exit 1
fi
TMPDIR=$(mktemp -d)
cd "$TMPDIR"
# Verify this signing key fingerprint here:
#
# https://github.com/bitcoin/bitcoin/tree/master/contrib/verifybinaries
#
gpg --keyserver hkp://keyserver.ubuntu.com --recv-keys 01EA5486DE18A882D4C2684590C8019E36C2E964
curl -O "${URL_BASE}/SHA256SUMS.asc"
curl -O "${URL_BASE}/${FILENAME}"
sha256sum --ignore-missing --check SHA256SUMS.asc \
| tee - | grep -o "${FILENAME}: OK"
gpg --verify SHA256SUMS.asc >gpg_verify_out 2>&1
grep '^gpg: Good signature from "Wladimir J. van der Laan' gpg_verify_out
grep '^Primary key fingerprint: 01EA 5486 DE18 A882 D4C2 6845 90C8 019E 36C2 E964' gpg_verify_out
tar -xzvf "${FILENAME}"
DIR=$(find . -name 'bitcoin-*' -type d | head -n 1)
ls -lah ${DIR}
rm "${DIR}"/bin/bitcoin-qt
cp -r "${DIR}"/* "${INSTALL_PREFIX}"
echo
echo "Bitcoin installed:"
echo
"${INSTALL_PREFIX}/bin/bitcoind" --version || true

9
rpc/mainnet-start.sh

@ -3,12 +3,9 @@
# Set host.docker.internal
sudo /usr/bin/append-to-hosts "$(ip -4 route list match 0/0 | awk '{print $3 "\thost.docker.internal"}')"
echo Running modified mainnet script...
export BTC_RPC_PORT=${BITCOIN_RPC_PORT}
export ELECTRS_HOST=${ELECTRUM_IP}
export ELECTRS_PORT=${ELECTRUM_PORT}
# docker-compose.yml also passes the folllowing env vars:
# $BITCOIN_RPC_USER, $BITCOIN_RPC_PASS, $BITCOIN_RPC_AUTH,
# and $BITCOIN_IP
# docker-compose.yml passes the folllowing env vars:
# $BITCOIN_RPC_AUTH, $BITCOIN_PORT, $BITCOIN_IP, $BITCOIN_PORT,
# $ELECTRUM_IP, and $ELECTRUM_PORT
export PROXY_PORT=50002
node src/server.js

9
rpc/server.js

@ -5,14 +5,11 @@ const BigNumber = require("bignumber.js");
const request = require("request");
//var electrsHost = 'electrs';
const btcCookiePass = process.env.BTC_RPC_COOKIE_PASS;
const btcRpcPort = process.env.BTC_RPC_PORT;
const btcRpcPort = process.env.BITCOIN_RPC_PORT;
const btcIp = process.env.BITCOIN_IP;
const btcRpcUrl = `${btcIp}:${btcRpcPort}/`;
const electrsHost = process.env.ELECTRS_HOST;
const electrsPort = process.env.ELECTRS_PORT;
const btcRpcUser = process.env.BITCOIN_RPC_USER;
const btcRpcPass = process.env.BITCOIN_RPC_PASSWORD;
const electrsHost = process.env.ELECTRUM_IP;
const electrsPort = process.env.ELECTRUM_PORT;
const btcRpcAuth = process.env.BITCOIN_RPC_AUTH;
// console.log(`INFO PROXY: btc rpc pass: ${btcCookiePass}`)
console.log(`INFO PROXY: Electrs host: ${electrsHost}:${electrsPort}`);

Loading…
Cancel
Save