Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update for StartOS 0.3.6 #149

Draft
wants to merge 31 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
45693dc
wip
Dominion5254 Jul 29, 2024
0ccb115
progress
MattDHill Jul 30, 2024
ca074d8
complete addnode/connect config
Dominion5254 Aug 13, 2024
99507b1
update sdk to alpha7
Dominion5254 Aug 13, 2024
a088aac
remove comments
Dominion5254 Aug 13, 2024
1d0960e
re-add bitcoin submodule at latest tag
Dominion5254 Aug 13, 2024
7502f75
add testnet to config
Dominion5254 Aug 20, 2024
4fb961b
update sdk to alpha8
Dominion5254 Aug 20, 2024
1fc2fcb
update v2transport default to match Core
Dominion5254 Aug 20, 2024
560a3c9
add datadir and conf args
Dominion5254 Aug 20, 2024
e762197
add btc_rpc_proxy dockerTag
Dominion5254 Aug 20, 2024
526f392
add proxy daemon placeholder
Dominion5254 Aug 28, 2024
57bcd9f
make zmq conditional on config not input
Dominion5254 Aug 30, 2024
b7237de
add todos and wip
Dominion5254 Oct 9, 2024
80a83ff
updates for latest sdk chnages
MattDHill Oct 10, 2024
331c076
bumop sdk version
MattDHill Oct 10, 2024
238d86c
clean up runtime info
MattDHill Oct 11, 2024
a706531
update action for new response type and main
MattDHill Oct 22, 2024
4022487
use async iterator properly
MattDHill Oct 23, 2024
dd71d01
file-model changes and rpcauth wip
Dominion5254 Nov 21, 2024
12bc094
alpha 21 and progress towards config
MattDHill Nov 21, 2024
e5636e0
update sdk to alpha22
Dominion5254 Nov 22, 2024
4e429ae
add actions for generate/delete rpc auth
Dominion5254 Nov 27, 2024
c35c23d
make remaining config shape attributes optional
Dominion5254 Nov 29, 2024
2f2540a
update sdk to beta1
Dominion5254 Dec 19, 2024
24dcb66
remove unusable credentials action (rpc pass not persisted)
Dominion5254 Dec 19, 2024
23c1da0
minor fixes
Dominion5254 Dec 19, 2024
e06b9a7
fix BindOptions import
Dominion5254 Dec 20, 2024
595bcd1
update to beta 3
Dominion5254 Jan 15, 2025
54cea75
fix assets
Dominion5254 Jan 15, 2025
3c5e624
remove btc-rpc-proxy tag
Dominion5254 Jan 17, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
manager/target/
**/*.rs.bk
*.s9pk
startos/*.js
node_modules/
.DS_Store
.vscode/
scripts/embassy.js
docker-images/
docker-images
javascript
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[submodule "bitcoin"]
path = bitcoin
url = https://github.com/bitcoin/bitcoin
url = https://github.com/bitcoin/bitcoin/
82 changes: 24 additions & 58 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,67 +1,33 @@
PKG_VERSION := $(shell yq e ".version" manifest.yaml)
PKG_ID := $(shell yq e ".id" manifest.yaml)
MANAGER_SRC := $(shell find ./manager -name '*.rs') manager/Cargo.toml manager/Cargo.lock
VERSION_CORE := $(shell (cd bitcoin && git describe) | sed 's/^v//')
PACKAGE_ID := bitcoind

.DELETE_ON_ERROR:
# Phony targets
.PHONY: all clean install

all: verify
# Default target
all: ${PACKAGE_ID}.s9pk

clean:
rm -f $(PKG_ID).s9pk
rm -f docker-images/*.tar
rm -f scripts/*.js
# Build targets
${PACKAGE_ID}.s9pk: $(shell start-cli s9pk list-ingredients)
start-cli s9pk pack

verify: $(PKG_ID).s9pk
@start-sdk verify s9pk $(PKG_ID).s9pk
@echo " Done!"
@echo " Filesize: $(shell du -h $(PKG_ID).s9pk) is ready"
javascript/index.js: $(shell git ls-files startos) tsconfig.json node_modules package.json
npm run build

# for rebuilding just the arm image.
arm:
@rm -f docker-images/x86_64.tar
@ARCH=aarch64 $(MAKE) -s
node_modules: package.json package-lock.json
npm ci

# for rebuilding just the x86 image.
x86:
@rm -f docker-images/aarch64.tar
@ARCH=x86_64 $(MAKE) -s
package-lock.json: package.json
npm i

$(PKG_ID).s9pk: manifest.yaml assets/compat/* docker-images/aarch64.tar docker-images/x86_64.tar instructions.md scripts/embassy.js
ifeq ($(ARCH),aarch64)
@echo "start-sdk: Preparing aarch64 package ..."
else ifeq ($(ARCH),x86_64)
@echo "start-sdk: Preparing x86_64 package ..."
else
@echo "start-sdk: Preparing Universal Package ..."
endif
@start-sdk pack
# Clean target
clean:
rm -rf ${PACKAGE_ID}.s9pk
rm -rf javascript
rm -rf node_modules

# Install target
install:
@if [ ! -f ~/.embassy/config.yaml ]; then echo "You must define \"host: http://server-name.local\" in ~/.embassy/config.yaml config file first."; exit 1; fi
@echo "\nInstalling to $$(grep -v '^#' ~/.embassy/config.yaml | cut -d'/' -f3) ...\n"
@[ -f $(PKG_ID).s9pk ] || ( $(MAKE) && echo "\nInstalling to $$(grep -v '^#' ~/.embassy/config.yaml | cut -d'/' -f3) ...\n" )
@start-cli package install $(PKG_ID).s9pk

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/*
ifeq ($(ARCH),x86_64)
else
mkdir -p docker-images
docker buildx build --tag start9/$(PKG_ID)/main:$(PKG_VERSION) --build-arg ARCH=aarch64 --build-arg PLATFORM=arm64 --platform=linux/arm64 -o type=docker,dest=docker-images/aarch64.tar .
endif

docker-images/x86_64.tar: Dockerfile docker_entrypoint.sh manager/target/x86_64-unknown-linux-musl/release/bitcoind-manager manifest.yaml check-rpc.sh check-synced.sh actions/*
ifeq ($(ARCH),aarch64)
else
mkdir -p docker-images
docker buildx build --tag start9/$(PKG_ID)/main:$(PKG_VERSION) --build-arg ARCH=x86_64 --build-arg PLATFORM=amd64 --platform=linux/amd64 -o type=docker,dest=docker-images/x86_64.tar .
endif

manager/target/aarch64-unknown-linux-musl/release/bitcoind-manager: $(MANAGER_SRC)
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

manager/target/x86_64-unknown-linux-musl/release/bitcoind-manager: $(MANAGER_SRC)
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

scripts/embassy.js: scripts/**/*.ts
deno bundle scripts/embassy.ts scripts/embassy.js
@if [ ! -f ~/.startos/config.yaml ]; then echo "You must define \"host: http://server-name.local\" in ~/.startos/config.yaml config file first."; exit 1; fi
@echo "\nInstalling to $$(grep -v '^#' ~/.startos/config.yaml | cut -d'/' -f3) ...\n"
@[ -f $(PACKAGE_ID).s9pk ] || ( $(MAKE) && echo "\nInstalling to $$(grep -v '^#' ~/.startos/config.yaml | cut -d'/' -f3) ...\n" )
@start-cli package install -s $(PACKAGE_ID).s9pk
7 changes: 7 additions & 0 deletions Old/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
manager/target/
**/*.rs.bk
*.s9pk
.DS_Store
.vscode/
scripts/embassy.js
docker-images/
3 changes: 3 additions & 0 deletions Old/.gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "bitcoin"]
path = bitcoin
url = https://github.com/bitcoin/bitcoin
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -123,13 +123,13 @@ export const getConfig: T.ExpectedExports.getConfig = async (effects) => {
"zmq-enabled": {
type: "boolean",
name: "ZeroMQ Enabled",
description: "The ZeroMQ interface is useful for some applications which might require data related to block and transaction events from Bitcoin Core. For example, LND requires ZeroMQ be enabled for LND to get the latest block data",
description: "The ZeroMQ interface is useful for some applications which might require data related to block and transaction events from Bitcoin. For example, LND requires ZeroMQ be enabled for LND to get the latest block data",
default: true,
},
txindex: {
type: "boolean",
name: "Transaction Index",
description: "By enabling Transaction Index (txindex) Bitcoin Core will build a complete transaction index. This allows Bitcoin Core to access any transaction with commands like `gettransaction`.",
description: "By enabling Transaction Index (txindex) Bitcoin will build a complete transaction index. This allows Bitcoin to access any transaction with commands like `gettransaction`.",
default: allowUnpruned,
},
coinstatsindex: {
Expand Down Expand Up @@ -302,7 +302,7 @@ export const getConfig: T.ExpectedExports.getConfig = async (effects) => {
},
},
},
pruning: {
prune: {
type: "union",
name: "Pruning Settings",
description:
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
43 changes: 43 additions & 0 deletions assets/rpcauth/rpcauth.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/usr/bin/env python3
# Copyright (c) 2015-2021 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.

from argparse import ArgumentParser
from getpass import getpass
from secrets import token_hex, token_urlsafe
import hmac

def generate_salt(size):
"""Create size byte hex salt"""
return token_hex(size)

def generate_password():
"""Create 32 byte b64 password"""
return token_urlsafe(32)

def password_to_hmac(salt, password):
m = hmac.new(salt.encode('utf-8'), password.encode('utf-8'), 'SHA256')
return m.hexdigest()

def main():
parser = ArgumentParser(description='Create login credentials for a JSON-RPC user')
parser.add_argument('username', help='the username for authentication')
parser.add_argument('password', help='leave empty to generate a random password or specify "-" to prompt for password', nargs='?')
args = parser.parse_args()

if not args.password:
args.password = generate_password()
elif args.password == '-':
args.password = getpass()

# Create 16 byte hex salt
salt = generate_salt(16)
password_hmac = password_to_hmac(salt, args.password)

print('String to be appended to bitcoin.conf:')
print(f'rpcauth={args.username}:{salt}${password_hmac}')
print(f'Your password:\n{args.password}')

if __name__ == '__main__':
main()
Loading