Skip to content

Commit 548fd1c

Browse files
committed
feat: add bitcoind-knots support
1 parent 711755f commit 548fd1c

40 files changed

+516
-14
lines changed

docker/README.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,24 @@ $ docker buildx build --platform linux/amd64,linux/arm64 --build-arg BITCOIN_VER
4747

4848
Replace `<version>` with the desired bitcoind version (ex: `0.18.1`)
4949

50+
## Bitcoin Knots
51+
52+
### Tags
53+
54+
- `29.2` ([bitcoind-knots/Dockerfile](https://github.com/jamaljsr/polar/blob/master/docker/bitcoind-knots/Dockerfile))
55+
- `28.0` ([bitcoind-knots/Dockerfile](https://github.com/jamaljsr/polar/blob/master/docker/bitcoind-knots/Dockerfile))
56+
- `27.0` ([bitcoind-knots/Dockerfile](https://github.com/jamaljsr/polar/blob/master/docker/bitcoind-knots/Dockerfile))
57+
- `26.0` ([bitcoind-knots/Dockerfile](https://github.com/jamaljsr/polar/blob/master/docker/bitcoind-knots/Dockerfile))
58+
59+
**Building the image**
60+
61+
```sh
62+
$ cd bitcoind-knots
63+
$ docker buildx build --platform linux/amd64,linux/arm64 --build-arg BITCOIN_VERSION=<version> --build-arg KNOTS_DATE=<date> -t polarlightning/bitcoind-knots:<version> --push .
64+
```
65+
66+
Replace `<version>` with the desired Bitcoin Knots version (ex: `29.2`) and `<date>` with the Knots release date suffix (ex: `20251110`)
67+
5068
## LND
5169

5270
### Tags

docker/bitcoind-knots/Dockerfile

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
FROM debian:stable-slim
2+
3+
ARG BITCOIN_VERSION
4+
ARG KNOTS_DATE
5+
ENV FULL_VERSION=${BITCOIN_VERSION}.knots${KNOTS_DATE}
6+
ENV PATH=/opt/bitcoin-${FULL_VERSION}/bin:$PATH
7+
8+
RUN apt-get update -y \
9+
&& apt-get install -y curl gosu \
10+
&& apt-get clean \
11+
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
12+
13+
RUN SYS_ARCH="$(uname -m)" \
14+
&& MAJOR_VERSION="$(echo ${BITCOIN_VERSION} | cut -d. -f1)" \
15+
&& curl -SLO https://bitcoinknots.org/files/${MAJOR_VERSION}.x/${FULL_VERSION}/bitcoin-${FULL_VERSION}-${SYS_ARCH}-linux-gnu.tar.gz \
16+
&& tar -xzf *.tar.gz -C /opt \
17+
&& rm *.tar.gz
18+
19+
RUN curl -SLO https://raw.githubusercontent.com/bitcoin/bitcoin/master/contrib/completions/bash/bitcoin-cli.bash \
20+
&& mkdir -p /etc/bash_completion.d \
21+
&& mv bitcoin-cli.bash /etc/bash_completion.d/bitcoin-cli.bash-completion \
22+
&& curl -SLO https://raw.githubusercontent.com/scop/bash-completion/master/bash_completion \
23+
&& mv bash_completion /usr/share/bash-completion/
24+
25+
COPY docker-entrypoint.sh /entrypoint.sh
26+
COPY bashrc /home/bitcoin/.bashrc
27+
28+
RUN chmod a+x /entrypoint.sh
29+
30+
VOLUME ["/home/bitcoin/.bitcoin"]
31+
32+
EXPOSE 18443 18444 28334 28335
33+
34+
ENTRYPOINT ["/entrypoint.sh"]
35+
36+
CMD ["bitcoind"]

docker/bitcoind-knots/bashrc

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# enable bash completion in interactive shells
2+
if ! shopt -oq posix; then
3+
if [ -f /usr/share/bash-completion/bash_completion ]; then
4+
. /usr/share/bash-completion/bash_completion
5+
elif [ -f /etc/bash_completion ]; then
6+
. /etc/bash_completion
7+
fi
8+
fi
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
#!/bin/sh
2+
set -e
3+
4+
# containers on linux share file permissions with hosts.
5+
# assigning the same uid/gid from the host user
6+
# ensures that the files can be read/write from both sides
7+
if ! id bitcoin > /dev/null 2>&1; then
8+
USERID=${USERID:-1000}
9+
GROUPID=${GROUPID:-1000}
10+
11+
echo "adding user bitcoin ($USERID:$GROUPID)"
12+
groupadd -f -g $GROUPID bitcoin
13+
useradd -r -u $USERID -g $GROUPID bitcoin
14+
chown -R $USERID:$GROUPID /home/bitcoin
15+
fi
16+
17+
if [ $(echo "$1" | cut -c1) = "-" ]; then
18+
echo "$0: assuming arguments for bitcoind"
19+
20+
set -- bitcoind "$@"
21+
fi
22+
23+
if [ "$1" = "bitcoind" ] || [ "$1" = "bitcoin-cli" ] || [ "$1" = "bitcoin-tx" ]; then
24+
echo "Running as bitcoin user: $@"
25+
exec gosu bitcoin "$@"
26+
fi
27+
28+
echo "$@"
29+
exec "$@"

docker/nodes.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,10 @@
4646
"latest": "30.0",
4747
"versions": ["30.0", "29.0", "28.0", "27.0", "26.0"]
4848
},
49+
"bitcoind-knots": {
50+
"latest": "29.3",
51+
"versions": ["29.3", "29.2", "28.0", "27.0", "26.0"]
52+
},
4953
"btcd": {
5054
"latest": "",
5155
"versions": []

src/components/common/ImageUpdatesModal.spec.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ describe('ImageUpdatesModal', () => {
7777
eclair: [],
7878
litd: [],
7979
bitcoind: ['4.5.6'],
80+
'bitcoind-knots': [],
8081
btcd: [],
8182
tapd: [],
8283
},

src/components/common/RenameNodeModal.spec.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ describe('RenameNodeModal', () => {
3636
eclairNodes: 1,
3737
litdNodes: 1,
3838
bitcoindNodes: 3,
39+
bitcoindKnotsNodes: 0,
3940
tapdNodes: 1,
4041
status,
4142
repoState: defaultRepoState,

src/components/designer/Sidebar.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,10 @@ const Sidebar: React.FC<Props> = ({ network, chart }) => {
2020
if (type === 'node') {
2121
const { bitcoin, lightning, tap } = network.nodes;
2222
const node = [...bitcoin, ...lightning, ...tap].find(n => n.name === id);
23-
if (node && node.implementation === 'bitcoind') {
23+
if (
24+
node &&
25+
(node.implementation === 'bitcoind' || node.implementation === 'bitcoind-knots')
26+
) {
2427
return <BitcoindDetails node={node as BitcoindNode} />;
2528
} else if (node && node.type === 'lightning') {
2629
return <LightningDetails node={node as LightningNode} />;

src/components/designer/bitcoin/actions/SendOnChainModal.spec.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ describe('SendOnChainModal', () => {
2525
clightningNodes: 1,
2626
eclairNodes: 1,
2727
bitcoindNodes: 3,
28+
bitcoindKnotsNodes: 0,
2829
tapdNodes: 0,
2930
litdNodes: 0,
3031
status: Status.Started,

src/components/designer/lightning/actions/CreateInvoiceModal.spec.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ describe('CreateInvoiceModal', () => {
144144
clightningNodes: 0,
145145
eclairNodes: 0,
146146
bitcoindNodes: 1,
147+
bitcoindKnotsNodes: 0,
147148
tapdNodes: 0,
148149
litdNodes: 3,
149150
status: Status.Started,

0 commit comments

Comments
 (0)