-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 84b1d17
Showing
28 changed files
with
1,388 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
jam.s9pk | ||
image.tar | ||
scripts/*.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[submodule "jam-docker"] | ||
path = jam-docker | ||
url = https://github.com/joinmarket-webui/jam-docker.git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
FROM ghcr.io/joinmarket-webui/joinmarket-webui-standalone:v0.0.10-clientserver-v0.9.6@sha256:12bba3c1761a277a7e642cd0e9c29c97cc73fb697dc8f652a4e57bd2f99d89f3 | ||
RUN apt-get update && apt-get install -qq --no-install-recommends wget bash | ||
RUN wget https://github.com/mikefarah/yq/releases/download/v4.12.2/yq_linux_arm.tar.gz -O - |\ | ||
tar xz && mv yq_linux_arm /usr/bin/yq | ||
|
||
USER root | ||
|
||
ENV DATADIR /root/.joinmarket | ||
ENV CONFIG ${DATADIR}/joinmarket.cfg | ||
ENV DEFAULT_CONFIG /default.cfg | ||
ENV DEFAULT_AUTO_START /autostart | ||
ENV AUTO_START ${DATADIR}/autostart | ||
ENV JM_RPC_HOST="bitcoind.embassy" | ||
ENV JM_RPC_PORT="8332" | ||
ENV JM_RPC_USER="bitcoin" | ||
ENV JM_RPC_PASSWORD= | ||
ENV APP_USER "joinmarket" | ||
ENV APP_PASSWORD "joinmarket" | ||
ENV JMWEBUI_JMWALLETD_HOST "jam.embassy" | ||
ENV JMWEBUI_JMWALLETD_API_PORT "28183" | ||
ENV JMWEBUI_JMWALLETD_WEBSOCKET_PORT "28283" | ||
ENV ENSURE_WALLET true | ||
|
||
ADD jam-docker/standalone/autostart / | ||
ADD jam-docker/standalone/default.cfg / | ||
ADD jam-docker/standalone/torrc / | ||
RUN chmod a+x /autostart | ||
RUN chmod a+x /default.cfg | ||
RUN chmod a+x /torrc | ||
|
||
ADD docker_entrypoint.sh /usr/local/bin/docker_entrypoint.sh | ||
ADD assets/utils/check-web.sh /usr/local/bin/check-web.sh | ||
ADD assets/utils/check-api.sh /usr/local/bin/check-api.sh | ||
ADD actions/unlock-wallet.sh /usr/local/bin/unlock-wallet.sh | ||
RUN chmod a+x /usr/local/bin/*.sh | ||
|
||
EXPOSE 80 28183 27183 8080 | ||
|
||
ENTRYPOINT ["/usr/local/bin/docker_entrypoint.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2020 Start9 Labs | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
ASSETS := $(shell yq e '.assets.[].src' manifest.yaml) | ||
ASSET_PATHS := $(addprefix assets/,$(ASSETS)) | ||
VERSION := $(shell yq e ".version" manifest.yaml) | ||
S9PK_PATH=$(shell find . -name jam.s9pk -print) | ||
|
||
# delete the target of a rule if it has changed and its recipe exits with a nonzero exit status | ||
.DELETE_ON_ERROR: | ||
|
||
all: verify | ||
|
||
verify: jam.s9pk $(S9PK_PATH) | ||
embassy-sdk verify s9pk $(S9PK_PATH) | ||
|
||
install: all jam.s9pk | ||
embassy-cli package install jam.s9pk | ||
|
||
clean: | ||
rm -f jam.s9pk | ||
rm -f image.tar | ||
rm -f scripts/*.js | ||
|
||
jam.s9pk: manifest.yaml assets/compat/* image.tar scripts/embassy.js docs/instructions.md $(ASSET_PATHS) | ||
embassy-sdk pack | ||
|
||
image.tar: Dockerfile docker_entrypoint.sh assets/utils/* | ||
DOCKER_CLI_EXPERIMENTAL=enabled docker buildx build --tag start9/jam/main:$(VERSION) --platform=linux/arm64 -o type=docker,dest=image.tar . | ||
|
||
scripts/embassy.js: scripts/**/*.ts | ||
deno bundle scripts/embassy.ts scripts/embassy.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
# Wrapper for JAM | ||
|
||
JAM is a web UI for JoinMarket with focus on user-friendliness. It aims to provide sensible defaults and be easy to use for beginners while still providing the features advanced users expect. | ||
|
||
## Dependencies | ||
|
||
- [docker](https://docs.docker.com/get-docker) | ||
- [docker-buildx](https://docs.docker.com/buildx/working-with-buildx/) | ||
- [yq](https://mikefarah.gitbook.io/yq) | ||
- [deno](https://deno.land/)s | ||
- [embassy-sdk](https://github.com/Start9Labs/embassy-os/tree/master/backend) | ||
- [make](https://www.gnu.org/software/make/) | ||
|
||
## Build enviroment | ||
Prepare your EmbassyOS build enviroment. In this example we are using Ubuntu 20.04. | ||
|
||
1. Install docker | ||
``` | ||
curl -fsSL https://get.docker.com -o- | bash | ||
sudo usermod -aG docker "$USER" | ||
exec sudo su -l $USER | ||
``` | ||
2. Set buildx as the default builder | ||
``` | ||
docker buildx install | ||
docker buildx create --use | ||
``` | ||
3. Enable cross-arch emulated builds in docker | ||
``` | ||
docker run --privileged --rm linuxkit/binfmt:v0.8 | ||
``` | ||
4. Install yq | ||
``` | ||
sudo snap install yq | ||
``` | ||
5. Install essentials build packages | ||
``` | ||
sudo apt-get install -y build-essential openssl libssl-dev libc6-dev clang libclang-dev ca-certificates | ||
``` | ||
6. Install Rust | ||
``` | ||
curl https://sh.rustup.rs -sSf | sh | ||
# Choose nr 1 (default install) | ||
source $HOME/.cargo/env | ||
``` | ||
7. Install toml | ||
``` | ||
cargo install toml-cli | ||
``` | ||
8. Build and install embassy-sdk | ||
``` | ||
cd ~/ && git clone https://github.com/Start9Labs/embassy-os.git | ||
cd embassy-os/backend/ | ||
./install-sdk.sh | ||
``` | ||
|
||
## Cloning | ||
|
||
Clone the project locally. Note the submodule link to the original project(s). | ||
|
||
``` | ||
git clone https://github.com/Start9Labs/jam-wrapper.git | ||
cd jam-wrapper | ||
git submodule update --init --recursive | ||
``` | ||
## Building | ||
|
||
To build the project, run the following commands: | ||
|
||
``` | ||
docker run --rm --privileged multiarch/qemu-user-static --reset -p yes | ||
docker buildx create --name multiarch --driver docker-container --use | ||
docker buildx inspect --bootstrap | ||
``` | ||
|
||
You should only run the above commands once to create a custom builder. Afterwards you will only need the below command to make the .s9pk file | ||
|
||
``` | ||
make | ||
``` | ||
|
||
## Installing (on Embassy) | ||
|
||
SSH into an Embassy device. | ||
`scp` the `.s9pk` to any directory from your local machine. | ||
Run the following command to install the package: | ||
|
||
``` | ||
embassy-cli auth login | ||
#Enter your embassy password then run: | ||
embassy-cli package install /path/to/jam.s9pk | ||
``` | ||
## Verify Install | ||
|
||
Go to your Embassy Services page, select JAM and start the service. | ||
|
||
#Done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#!/bin/sh | ||
|
||
set -e | ||
|
||
count=`find /root/.joinmarket/wallets -type f -iname ".*.jmdat.lock" | wc -l` | ||
if [ $count != 0 ] | ||
then | ||
rm -rf /root/.joinmarket/wallets/.*.jmdat.lock | ||
export action_result_running=" { | ||
\"version\": \"0\", | ||
\"message\": \"All wallets unlocked.\", | ||
\"value\": null, | ||
\"copyable\": false, | ||
\"qr\": false | ||
}" >/dev/null && echo $action_result_running | ||
else | ||
export action_result_error=" { | ||
\"version\": \"0\", | ||
\"message\": \"No locked wallets found.\", | ||
\"value\": null, | ||
\"copyable\": false, | ||
\"qr\": false | ||
}" >/dev/null && echo $action_result_error | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
- rule: "rpc.enable?" | ||
description: "Must have an RPC enabled" | ||
suggestions: | ||
- SET: | ||
var: "rpc.enable" | ||
to-value: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
- rule: '''users.*.name = "jam"' | ||
description: 'Must have an RPC user named "jam"' | ||
suggestions: | ||
- PUSH: | ||
to: "users" | ||
value: | ||
name: jam | ||
allowed-calls: [] | ||
- SET: | ||
var: 'users.[first(item => ''item.name = "jam")].password' | ||
to-entropy: | ||
charset: "a-z,A-Z,0-9" | ||
len: 22 | ||
- rule: '''users.[first(item => ''item.name = "jam")].allowed-calls.* = "getindexinfo"' | ||
description: 'RPC user "jam" must have "getindexinfo" enabled' | ||
suggestions: | ||
- PUSH: | ||
to: 'users.[first(item => ''item.name = "jam")].allowed-calls' | ||
value: "getindexinfo" | ||
- rule: '''users.[first(item => ''item.name = "jam")].allowed-calls.* = "getblockcount"' | ||
description: 'RPC user "jam" must have "getblockcount" enabled' | ||
suggestions: | ||
- PUSH: | ||
to: 'users.[first(item => ''item.name = "jam")].allowed-calls' | ||
value: "getblockcount" | ||
- rule: '''users.[first(item => ''item.name = "jam")].allowed-calls.* = "getchaintips"' | ||
description: 'RPC user "jam" must have "getchaintips" enabled' | ||
suggestions: | ||
- PUSH: | ||
to: 'users.[first(item => ''item.name = "jam")].allowed-calls' | ||
value: "getchaintips" | ||
- rule: '''users.[first(item => ''item.name = "jam")].allowed-calls.* = "getmempoolinfo"' | ||
description: 'RPC user "jam" must have "getmempoolinfo" enabled' | ||
suggestions: | ||
- PUSH: | ||
to: 'users.[first(item => ''item.name = "jam")].allowed-calls' | ||
value: "getmempoolinfo" | ||
- rule: '''users.[first(item => ''item.name = "jam")].allowed-calls.* = "getblockchaininfo"' | ||
description: 'RPC user "jam" must have "getblockchaininfo" enabled' | ||
suggestions: | ||
- PUSH: | ||
to: 'users.[first(item => ''item.name = "jam")].allowed-calls' | ||
value: "getblockchaininfo" | ||
- rule: '''users.[first(item => ''item.name = "jam")].allowed-calls.* = "getblockhash"' | ||
description: 'RPC user "jam" must have "getblockhash" enabled' | ||
suggestions: | ||
- PUSH: | ||
to: 'users.[first(item => ''item.name = "jam")].allowed-calls' | ||
value: "getblockhash" | ||
- rule: '''users.[first(item => ''item.name = "jam")].allowed-calls.* = "getblock"' | ||
description: 'RPC user "jam" must have "getblock" enabled' | ||
suggestions: | ||
- PUSH: | ||
to: 'users.[first(item => ''item.name = "jam")].allowed-calls' | ||
value: "getblock" | ||
- rule: '''users.[first(item => ''item.name = "jam")].allowed-calls.* = "getmempoolentry"' | ||
description: 'RPC user "jam" must have "getmempoolentry" enabled' | ||
suggestions: | ||
- PUSH: | ||
to: 'users.[first(item => ''item.name = "jam")].allowed-calls' | ||
value: "getmempoolentry" | ||
- rule: '''users.[first(item => ''item.name = "jam")].allowed-calls.* = "getrawtransaction"' | ||
description: 'RPC user "jam" must have "getrawtransaction" enabled' | ||
suggestions: | ||
- PUSH: | ||
to: 'users.[first(item => ''item.name = "jam")].allowed-calls' | ||
value: "getrawtransaction" | ||
- rule: '''users.[first(item => ''item.name = "jam")].allowed-calls.* = "getrawmempool"' | ||
description: 'RPC user "jam" must have "getrawmempool" enabled' | ||
suggestions: | ||
- PUSH: | ||
to: 'users.[first(item => ''item.name = "jam")].allowed-calls' | ||
value: "getrawmempool" | ||
- rule: '''users.[first(item => ''item.name = "jam")].allowed-calls.* = "gettxout"' | ||
description: 'RPC user "jam" must have "gettxout" enabled' | ||
suggestions: | ||
- PUSH: | ||
to: 'users.[first(item => ''item.name = "jam")].allowed-calls' | ||
value: "gettxout" | ||
- rule: '''users.[first(item => ''item.name = "jam")].allowed-calls.* = "validateaddress"' | ||
description: 'RPC user "jam" must have "validateaddress" enabled' | ||
suggestions: | ||
- PUSH: | ||
to: 'users.[first(item => ''item.name = "jam")].allowed-calls' | ||
value: "validateaddress" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# This is where any configuration rules related to the configuration would go. These ensure that the user can only create a valid config. | ||
|
||
[] |
Oops, something went wrong.