Skip to content

Commit 224d921

Browse files
authored
Update/v26 (#132)
* update submodule * Add release notes and bump version * Switch build to new SDK * Update instructions * Readme update * use wildcard for s9pk * Dockerfile refactor * Update guides * Add config warnings for user and password change * Update dependencies for manager * Adding build and release workflow * remove Interactive terminal * test gcc build * No need for compat.h patching anymore * remobe deprecated secp256k1 patching * bring back clang as compiler and try -O1 build * Add v2 transport protocol support * Use online documentation * update start-sdk link * Release notes and readme update * Build and Release workflows update * return config true
1 parent 6d62cd9 commit 224d921

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

57 files changed

+604
-726
lines changed

.github/workflows/buildService.yml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
name: Build Service
2+
3+
on:
4+
workflow_dispatch:
5+
pull_request:
6+
paths-ignore: ['*.md']
7+
branches: ['main', 'master']
8+
push:
9+
paths-ignore: ['*.md']
10+
branches: ['main', 'master']
11+
12+
jobs:
13+
BuildPackage:
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Prepare StartOS SDK
17+
uses: Start9Labs/sdk@v1
18+
19+
- name: Checkout services repository
20+
uses: actions/checkout@v3
21+
22+
- name: Build the service package
23+
id: build
24+
run: |
25+
git submodule update --init --recursive
26+
start-sdk init
27+
make
28+
PACKAGE_ID=$(yq -oy ".id" manifest.*)
29+
echo "::set-output name=package_id::$PACKAGE_ID"
30+
shell: bash
31+
32+
- name: Upload .s9pk
33+
uses: actions/upload-artifact@v3
34+
with:
35+
name: ${{ steps.build.outputs.package_id }}.s9pk
36+
path: ./${{ steps.build.outputs.package_id }}.s9pk
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
name: Release Service
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*.*'
7+
8+
jobs:
9+
ReleasePackage:
10+
runs-on: ubuntu-latest
11+
permissions:
12+
contents: write
13+
steps:
14+
- name: Prepare StartOS SDK
15+
uses: Start9Labs/sdk@v1
16+
17+
- name: Checkout services repository
18+
uses: actions/checkout@v3
19+
20+
- name: Build the service package
21+
run: |
22+
git submodule update --init --recursive
23+
start-sdk init
24+
make
25+
26+
- name: Setting package ID and title from the manifest
27+
id: package
28+
run: |
29+
echo "::set-output name=package_id::$(yq -oy ".id" manifest.*)"
30+
echo "::set-output name=package_title::$(yq -oy ".title" manifest.*)"
31+
shell: bash
32+
33+
- name: Generate sha256 checksum
34+
run: |
35+
PACKAGE_ID=${{ steps.package.outputs.package_id }}
36+
sha256sum ${PACKAGE_ID}.s9pk > ${PACKAGE_ID}.s9pk.sha256
37+
shell: bash
38+
39+
- name: Generate changelog
40+
run: |
41+
PACKAGE_ID=${{ steps.package.outputs.package_id }}
42+
echo "## What's Changed" > change-log.txt
43+
yq e '.release-notes' manifest.yaml >> change-log.txt
44+
echo "## SHA256 Hash" >> change-log.txt
45+
echo '```' >> change-log.txt
46+
sha256sum ${PACKAGE_ID}.s9pk >> change-log.txt
47+
echo '```' >> change-log.txt
48+
shell: bash
49+
50+
- name: Create GitHub Release
51+
uses: softprops/action-gh-release@v1
52+
with:
53+
tag_name: ${{ github.ref_name }}
54+
name: ${{ steps.package.outputs.package_title }} ${{ github.ref_name }}
55+
prerelease: true
56+
body_path: change-log.txt
57+
files: |
58+
./${{ steps.package.outputs.package_id }}.s9pk
59+
./${{ steps.package.outputs.package_id }}.s9pk.sha256
60+
61+
- name: Publish to Registry
62+
env:
63+
S9USER: ${{ secrets.S9USER }}
64+
S9PASS: ${{ secrets.S9PASS }}
65+
S9REGISTRY: ${{ secrets.S9REGISTRY }}
66+
run: |
67+
if [[ -z "$S9USER" || -z "$S9PASS" || -z "$S9REGISTRY" ]]; then
68+
echo "Publish skipped: missing registry credentials."
69+
else
70+
start-sdk publish https://$S9USER:$S9PASS@$S9REGISTRY ${{ steps.package.outputs.package_id }}.s9pk
71+
fi

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
manager/target/
22
**/*.rs.bk
3-
bitcoind.s9pk
3+
*.s9pk
44
.DS_Store
55
.vscode/
66
scripts/embassy.js

Dockerfile

Lines changed: 33 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -4,54 +4,57 @@
44
FROM lncm/berkeleydb as berkeleydb
55

66
# Build stage for Bitcoin Core
7-
FROM alpine:3.16 as bitcoin-core
7+
FROM alpine:3.18 as bitcoin-core
88

99
COPY --from=berkeleydb /opt /opt
1010

1111
RUN sed -i 's/http\:\/\/dl-cdn.alpinelinux.org/https\:\/\/alpine.global.ssl.fastly.net/g' /etc/apk/repositories
12-
RUN apk --no-cache add autoconf
13-
RUN apk --no-cache add automake
14-
RUN apk --no-cache add boost-dev
15-
RUN apk --no-cache add build-base
16-
RUN apk --no-cache add chrpath
17-
RUN apk --no-cache add file
18-
RUN apk --no-cache add gnupg
19-
RUN apk --no-cache add libevent-dev
20-
RUN apk --no-cache add libressl
21-
RUN apk --no-cache add libtool
22-
RUN apk --no-cache add linux-headers
23-
RUN apk --no-cache add sqlite-dev
24-
RUN apk --no-cache add zeromq-dev
12+
RUN apk --no-cache add \
13+
autoconf \
14+
automake \
15+
boost-dev \
16+
build-base \
17+
clang \
18+
chrpath \
19+
file \
20+
gnupg \
21+
libevent-dev \
22+
libressl \
23+
libtool \
24+
linux-headers \
25+
sqlite-dev \
26+
zeromq-dev
2527

2628
ADD ./bitcoin /bitcoin
2729

28-
2930
ENV BITCOIN_PREFIX=/opt/bitcoin
3031

3132
WORKDIR /bitcoin
3233

33-
RUN sed -i '/AX_PROG_CC_FOR_BUILD/a\AR_FLAGS=cr' src/secp256k1/configure.ac
3434
RUN ./autogen.sh
3535
RUN ./configure LDFLAGS=-L`ls -d /opt/db*`/lib/ CPPFLAGS=-I`ls -d /opt/db*`/include/ \
3636
# If building on Mac make sure to increase Docker VM memory, or uncomment this line. See https://github.com/bitcoin/bitcoin/issues/6658 for more info.
3737
# CXXFLAGS="--param ggc-min-expand=1 --param ggc-min-heapsize=32768" \
38+
CXXFLAGS="-O1" \
39+
CXX=clang++ CC=clang \
3840
--prefix=${BITCOIN_PREFIX} \
39-
--mandir=/usr/share/man \
41+
--disable-man \
4042
--disable-tests \
4143
--disable-bench \
4244
--disable-ccache \
4345
--with-gui=no \
4446
--with-utils \
4547
--with-libs \
48+
--with-sqlite=yes \
4649
--with-daemon
47-
RUN make -j$(($(nproc) - 1))
50+
RUN make -j$(nproc)
4851
RUN make install
4952
RUN strip ${BITCOIN_PREFIX}/bin/*
5053
RUN strip ${BITCOIN_PREFIX}/lib/libbitcoinconsensus.a
5154
RUN strip ${BITCOIN_PREFIX}/lib/libbitcoinconsensus.so.0.0.0
5255

5356
# Build stage for compiled artifacts
54-
FROM alpine:3.16
57+
FROM alpine:3.18
5558

5659
LABEL maintainer.0="João Fonseca (@joaopaulofonseca)" \
5760
maintainer.1="Pedro Branco (@pedrobranco)" \
@@ -68,8 +71,8 @@ RUN apk --no-cache add \
6871
libevent \
6972
libzmq \
7073
sqlite-dev \
71-
tini\
72-
yq
74+
tini \
75+
yq \
7376
RUN rm -rf /var/cache/apk/*
7477

7578
ARG ARCH
@@ -79,16 +82,15 @@ ENV BITCOIN_PREFIX=/opt/bitcoin
7982
ENV PATH=${BITCOIN_PREFIX}/bin:$PATH
8083

8184
COPY --from=bitcoin-core /opt /opt
82-
ADD ./manager/target/${ARCH}-unknown-linux-musl/release/bitcoind-manager /usr/local/bin/bitcoind-manager
83-
RUN chmod a+x /usr/local/bin/bitcoind-manager
84-
ADD ./docker_entrypoint.sh /usr/local/bin/docker_entrypoint.sh
85-
RUN chmod a+x /usr/local/bin/docker_entrypoint.sh
86-
ADD ./actions/reindex.sh /usr/local/bin/reindex.sh
87-
RUN chmod a+x /usr/local/bin/reindex.sh
88-
ADD ./check-rpc.sh /usr/local/bin/check-rpc.sh
89-
RUN chmod a+x /usr/local/bin/check-rpc.sh
90-
ADD ./check-synced.sh /usr/local/bin/check-synced.sh
91-
RUN chmod a+x /usr/local/bin/check-synced.sh
85+
COPY ./manager/target/${ARCH}-unknown-linux-musl/release/bitcoind-manager \
86+
./docker_entrypoint.sh \
87+
./actions/reindex.sh \
88+
./check-rpc.sh \
89+
./check-synced.sh \
90+
/usr/local/bin/
91+
92+
RUN chmod a+x /usr/local/bin/bitcoind-manager \
93+
/usr/local/bin/*.sh
9294

9395
EXPOSE 8332 8333
9496

Makefile

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -13,35 +13,35 @@ clean:
1313
rm -f scripts/*.js
1414

1515
verify: $(PKG_ID).s9pk
16-
@embassy-sdk verify s9pk $(PKG_ID).s9pk
16+
@start-sdk verify s9pk $(PKG_ID).s9pk
1717
@echo " Done!"
1818
@echo " Filesize: $(shell du -h $(PKG_ID).s9pk) is ready"
1919

2020
# for rebuilding just the arm image.
2121
arm:
2222
@rm -f docker-images/x86_64.tar
23-
ARCH=aarch64 $(MAKE)
23+
@ARCH=aarch64 $(MAKE) -s
2424

2525
# for rebuilding just the x86 image.
2626
x86:
2727
@rm -f docker-images/aarch64.tar
28-
ARCH=x86_64 $(MAKE)
28+
@ARCH=x86_64 $(MAKE) -s
2929

3030
$(PKG_ID).s9pk: manifest.yaml assets/compat/* docker-images/aarch64.tar docker-images/x86_64.tar instructions.md scripts/embassy.js
3131
ifeq ($(ARCH),aarch64)
32-
@echo "embassy-sdk: Preparing aarch64 package ..."
32+
@echo "start-sdk: Preparing aarch64 package ..."
3333
else ifeq ($(ARCH),x86_64)
34-
@echo "embassy-sdk: Preparing x86_64 package ..."
34+
@echo "start-sdk: Preparing x86_64 package ..."
3535
else
36-
@echo "embassy-sdk: Preparing Universal Package ..."
36+
@echo "start-sdk: Preparing Universal Package ..."
3737
endif
38-
@embassy-sdk pack
38+
@start-sdk pack
3939

40-
install: $(PKG_ID).s9pk
40+
install:
4141
ifeq (,$(wildcard ~/.embassy/config.yaml))
42-
@echo; echo "You must define \"host: http://embassy-server-name.local\" in ~/.embassy/config.yaml config file first"; echo
42+
@echo; echo "You must define \"host: http://server-name.local\" in ~/.embassy/config.yaml config file first"; echo
4343
else
44-
embassy-cli package install $(PKG_ID).s9pk
44+
start-cli package install $(PKG_ID).s9pk
4545
endif
4646

4747
docker-images/aarch64.tar: Dockerfile docker_entrypoint.sh manager/target/aarch64-unknown-linux-musl/release/bitcoind-manager manifest.yaml check-rpc.sh check-synced.sh actions/*
@@ -59,10 +59,10 @@ else
5959
endif
6060

6161
manager/target/aarch64-unknown-linux-musl/release/bitcoind-manager: $(MANAGER_SRC)
62-
docker run --rm -it -v ~/.cargo/registry:/root/.cargo/registry -v "$(shell pwd)"/manager:/home/rust/src messense/rust-musl-cross:aarch64-musl cargo build --release
62+
docker run --rm -v ~/.cargo/registry:/root/.cargo/registry -v "$(shell pwd)"/manager:/home/rust/src messense/rust-musl-cross:aarch64-musl cargo build --release
6363

6464
manager/target/x86_64-unknown-linux-musl/release/bitcoind-manager: $(MANAGER_SRC)
65-
docker run --rm -it -v ~/.cargo/registry:/root/.cargo/registry -v "$(shell pwd)"/manager:/home/rust/src messense/rust-musl-cross:x86_64-musl cargo build --release
65+
docker run --rm -v ~/.cargo/registry:/root/.cargo/registry -v "$(shell pwd)"/manager:/home/rust/src messense/rust-musl-cross:x86_64-musl cargo build --release
6666

6767
scripts/embassy.js: scripts/**/*.ts
6868
deno bundle scripts/embassy.ts scripts/embassy.js

README.md

Lines changed: 39 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
1-
# Wrapper for Bitcoin Core
1+
<p align="center">
2+
<img src="icon.png" alt="Project Logo" width="21%">
3+
</p>
24

3-
This project wraps [Bitcoin](https://bitcoin.org) for EmbassyOS. Bitcoin uses peer-to-peer technology to operate with no central authority or banks - managing transactions and the issuing of bitcoins is carried out collectively by the network.
5+
# Bitcoin Core for StartOS
6+
7+
This project packages [Bitcoin](https://bitcoin.org) for StartOS. Bitcoin uses peer-to-peer technology to operate with no central authority or banks - managing transactions and the issuing of bitcoins is carried out collectively by the network.
48

59
## Contributing
610

@@ -12,7 +16,7 @@ For technical contributors, please fork this repository, make your changes accor
1216

1317
### Adding Config Options
1418

15-
To add config options, include the new config options in *both* `config_spec.yaml` and `assets/bitcoin.conf.template`, adhering to the syntax and conventions of those files. To view the full list of config options, complete with descriptions and specifications, check out this [site](https://jlopp.github.io/bitcoin-core-config-generator) from Jameson Lopp.
19+
To add config options, include the new config options in *both* `scripts/services/getConfig.ts` and `assets/compat/bitcoin.conf.template`, adhering to the syntax and conventions of those files. To view the full list of config options, complete with descriptions and specifications, check out this [site](https://jlopp.github.io/bitcoin-core-config-generator) from Jameson Lopp.
1620

1721
## Dependencies
1822

@@ -23,7 +27,7 @@ Install the following system dependencies to build this project by following the
2327
- [rust-musl-cross](https://github.com/Start9Labs/rust-musl-cross)
2428
- [yq](https://mikefarah.gitbook.io/yq)
2529
- [rust](https://rustup.rs)
26-
- [embassy-sdk](https://github.com/Start9Labs/embassy-os/blob/master/backend/install-sdk.sh)
30+
- [start-sdk](https://github.com/Start9Labs/start-os/tree/sdk)
2731
- [make](https://www.gnu.org/software/make/)
2832

2933
## Cloning
@@ -38,18 +42,43 @@ git submodule update --init
3842

3943
## Building
4044

45+
To build the project for all supported platforms, run the following command:
46+
4147
```
4248
make
4349
```
4450

45-
## Installing (on Embassy)
51+
To build the project for a single platform, run:
4652

4753
```
48-
scp bitcoind.s9pk root@embassy-<id>.local:/embassy-data/package-data/tmp # Copy S9PK to the external disk. Make sure to create the directory if it doesn't already exist
49-
ssh root@embassy-<id>.local
50-
embassy-cli auth login
51-
embassy-cli package install /embassy-data/pacakge-data/tmp/bitcoind.s9pk # Install the sideloaded package
54+
# for amd64
55+
make x86
56+
```
57+
or
58+
```
59+
# for arm64
60+
make arm
61+
```
62+
63+
## Installing (on Start9 server)
64+
65+
Run the following commands to determine successful install:
66+
> :information_source: Change server-name.local to your Start9 server address
67+
5268
```
69+
start-cli auth login
70+
# Enter your StartOS password
71+
start-cli --host https://server-name.local package install bitcoind.s9pk
72+
```
73+
74+
If you already have your `start-cli` config file setup with a default `host`, you can install simply by running:
75+
76+
```
77+
make install
78+
```
79+
80+
> **Tip:** You can also install the `bitcoind.s9pk` using **Sideload Service** under the **System > Manage** section.
81+
5382
## Integrations
5483

55-
Documentation guides for integrating with external applications can be found under [docs/integrations](/docs/integrations).
84+
Our [documentation](https://docs.start9.com/latest/service-guides/bitcoin/bitcoin-integrations) includes guides for integrating Bitcoin with external applications.

0 commit comments

Comments
 (0)