From 39141f7e8dbfc70ce6c842b50035d411ffafd1de Mon Sep 17 00:00:00 2001 From: Sonkeng Maldini Date: Wed, 18 Dec 2024 08:03:08 +0100 Subject: [PATCH] Initial settings for ghost --- basicswap/chainparams.py | 43 ++++++++++++++++++ basicswap/config.py | 9 ++++ basicswap/static/images/coins/Ghost-20.png | Bin 0 -> 1734 bytes basicswap/static/images/coins/Ghost.png | Bin 0 -> 1734 bytes .../production/compose-fragments/1_ghost.yml | 16 +++++++ docker/production/example.env | 8 ++++ docker/production/ghost/Dockerfile | 25 ++++++++++ docker/production/ghost/entrypoint.sh | 11 +++++ 8 files changed, 112 insertions(+) create mode 100644 basicswap/static/images/coins/Ghost-20.png create mode 100644 basicswap/static/images/coins/Ghost.png create mode 100644 docker/production/compose-fragments/1_ghost.yml create mode 100644 docker/production/ghost/Dockerfile create mode 100755 docker/production/ghost/entrypoint.sh diff --git a/basicswap/chainparams.py b/basicswap/chainparams.py index c1ce0ef..57163f3 100644 --- a/basicswap/chainparams.py +++ b/basicswap/chainparams.py @@ -31,6 +31,8 @@ class Coins(IntEnum): LTC_MWEB = 15 # ZANO = 16 BCH = 17 + GHOST = 18 + GHOST_ANON = 19 chainparams = { @@ -478,6 +480,47 @@ chainparams = { "max_amount": 10000000 * COIN, }, }, + + Coins.GHOST: { + "name": "ghost", + "ticker": "GHOST", + "message_magic": "Bitcoin Signed Message:\n", + "blocks_target": 60 * 2, + "decimal_places": 8, + "mainnet": { + "rpcport": 51728, + "pubkey_address": 0x26, + "script_address": 0x61, + "key_prefix": 0xA6, + "stealth_key_prefix": 0x14, + "hrp": "gw", + "bip44": 44, + "min_amount": 100000, + "max_amount": 10000000 * COIN, + }, + "testnet": { + "rpcport": 51928, + "pubkey_address": 0x4B, + "script_address": 0x89, + "key_prefix": 0x2E, + "stealth_key_prefix": 0x14, + "hrp": "tpw", + "bip44": 1, + "min_amount": 100000, + "max_amount": 10000000 * COIN, + }, + "regtest": { + "rpcport": 51936, + "pubkey_address": 0x76, + "script_address": 0x7A, + "key_prefix": 0x2E, + "stealth_key_prefix": 0x15, + "hrp": "rtpw", + "bip44": 1, + "min_amount": 100000, + "max_amount": 10000000 * COIN, + }, + }, } ticker_map = {} diff --git a/basicswap/config.py b/basicswap/config.py index 2ee7648..34e8cd4 100644 --- a/basicswap/config.py +++ b/basicswap/config.py @@ -49,4 +49,13 @@ XMR_BINDIR = os.path.expanduser( XMRD = os.getenv("XMRD", "monerod" + bin_suffix) XMR_WALLET_RPC = os.getenv("XMR_WALLET_RPC", "monero-wallet-rpc" + bin_suffix) + +GHOST_BINDIR = os.path.expanduser( + os.getenv("GHOST_BINDIR", os.path.join(DEFAULT_TEST_BINDIR, "ghost")) +) + +GHOSTD = os.getenv("GHOSTD", "ghostd" + bin_suffix) +GHOST_CLI = os.getenv("GHOST_CLI", "GHOST-cli" + bin_suffix) +GHOST_TX = os.getenv("GHOST_TX", "ghost-tx" + bin_suffix) + # NOTE: Adding coin definitions here is deprecated. Please add in coin test file. diff --git a/basicswap/static/images/coins/Ghost-20.png b/basicswap/static/images/coins/Ghost-20.png new file mode 100644 index 0000000000000000000000000000000000000000..3895e204d7714ee91ecfdaf20aacbba580632979 GIT binary patch literal 1734 zcmV;%208hOP) ze@I&IaCkLF)NhAsM|&{bF_ z3Dtraj8cSxR2to6HTq-y8p^dvtl!SE>vg+&;JBjYgx0dU$yL9F%{fGE8_H2}5(IO?GwRyzjZ+As?vD&M^T z&L|{`X`*$vOMx7@&T0S$6%@p3`@__FD+Vy)15r%t3xhZp0vPp?D5kv@WO4EVeB?t> zOnX*=9I|l0$D)|FBWR-R2!JRCbw)QTkWVRG2H^LA2xCy6E1x@Qc`gX^Du5anuHzPE z)XzEM=bP9TppueqLYONR$nTOl98h6|z3o#?7Awi1iXtop;3}@AJD;4wzuDj@3T zhy51xN}Apca)}Z41J}dNRbuKwGVxTw)#Bt5W;>H#6{+WliL=DyL`_W%;_*0Qu^6J! zD9Xx2H^Dt3kqGMQ>d@2EgUQKB^!D~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OJ_YTBnjh=I7jTUBr{Hj z*qMmY>qAQv<{q0swyKu~^(eA@9O$785f)jd7ILxvuqRdqk5ZzOS!N1%Iuz!5Kis(L zA9h|r=M{@t!rN^A#+=69Wb^xH0N$fl-v+9qG!nQDK-+oTJYiEhlspY7OqAG6zTFV^ z#HfIEDCbbv6QT;wrHL}1rOwf~%w1{1yrq+`4y7c@8NYv^I*5p2oC9G`f{MIi8Me`A cG{FbJKi6F;l>tq28~^|S07*qoM6N<$f~;vPhyVZp literal 0 HcmV?d00001 diff --git a/basicswap/static/images/coins/Ghost.png b/basicswap/static/images/coins/Ghost.png new file mode 100644 index 0000000000000000000000000000000000000000..3895e204d7714ee91ecfdaf20aacbba580632979 GIT binary patch literal 1734 zcmV;%208hOP) ze@I&IaCkLF)NhAsM|&{bF_ z3Dtraj8cSxR2to6HTq-y8p^dvtl!SE>vg+&;JBjYgx0dU$yL9F%{fGE8_H2}5(IO?GwRyzjZ+As?vD&M^T z&L|{`X`*$vOMx7@&T0S$6%@p3`@__FD+Vy)15r%t3xhZp0vPp?D5kv@WO4EVeB?t> zOnX*=9I|l0$D)|FBWR-R2!JRCbw)QTkWVRG2H^LA2xCy6E1x@Qc`gX^Du5anuHzPE z)XzEM=bP9TppueqLYONR$nTOl98h6|z3o#?7Awi1iXtop;3}@AJD;4wzuDj@3T zhy51xN}Apca)}Z41J}dNRbuKwGVxTw)#Bt5W;>H#6{+WliL=DyL`_W%;_*0Qu^6J! zD9Xx2H^Dt3kqGMQ>d@2EgUQKB^!D~Ty*7(5928NDC8zgvUtgb*&ceci(cj;1)YsRu z)(<5mB}OzFHO9xs4J(zEl}>#9=@(&cagv~+p`mjUV=_8AYE)HKNf)K9t<6Xz61LZE zXlQWiQ+j7}sS6K^sU8vS__Y9%0O9~*PAkJ?GHLr;b#*lc1_rQs^Jb({sU?Q`f0~<{ z(b3V7^=}f1gj2V>0eoY117MsM8_q8|U$Q@}q)}X4EVG3E2H;6V&wvSVo zV;n&@H8mNtv$Gi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*qoM6N<$f~;vPhyVZp literal 0 HcmV?d00001 diff --git a/docker/production/compose-fragments/1_ghost.yml b/docker/production/compose-fragments/1_ghost.yml new file mode 100644 index 0000000..a602b87 --- /dev/null +++ b/docker/production/compose-fragments/1_ghost.yml @@ -0,0 +1,16 @@ + ghost_core: + image: i_ghost + build: + context: ghost + dockerfile: Dockerfile + container_name: ghost_core + volumes: + - ${DATA_PATH}/ghost-core:/data + expose: + - ${WOW_RPC_PORT} + logging: + driver: "json-file" + options: + max-size: "10m" + max-file: "3" + restart: unless-stopped diff --git a/docker/production/example.env b/docker/production/example.env index f451d38..fa13f47 100644 --- a/docker/production/example.env +++ b/docker/production/example.env @@ -78,3 +78,11 @@ BCH_RPC_HOST=bitcoincash_core BCH_RPC_PORT=19797 BCH_RPC_USER=bitcoincash_user BCH_RPC_PWD=bitcoincash_pwd + + +GHOST_DATA_DIR=/data/ghost +GHOST_RPC_HOST=ghost_core +GHOST_RPC_PORT=51728 +GHOST_ZMQ_PORT=20792 +GHOST_RPC_USER=ghost_user +GHOST_RPC_PWD=ghost_pwd \ No newline at end of file diff --git a/docker/production/ghost/Dockerfile b/docker/production/ghost/Dockerfile new file mode 100644 index 0000000..5d79ffd --- /dev/null +++ b/docker/production/ghost/Dockerfile @@ -0,0 +1,25 @@ +FROM i_swapclient as install_stage + +RUN basicswap-prepare --preparebinonly --bindir=/coin_bin --withcoin=ghost,particl && \ + find /coin_bin -name *.tar.gz -delete + +FROM debian:bullseye-slim +COPY --from=install_stage /coin_bin . + +ENV GHOST_DATA /data + +RUN groupadd -r ghost && useradd -r -m -g ghost ghost \ + && apt-get update \ + && apt-get install -qq --no-install-recommends gosu \ + && rm -rf /var/lib/apt/lists/* \ + && mkdir -p "$GHOST_DATA" \ + && chown -R ghost:ghost "$GHOST_DATA" \ + && ln -sfn "$GHOST_DATA" /home/ghost/.ghost \ + && chown -h ghost:ghost /home/ghost/.ghost +VOLUME /data + +COPY entrypoint.sh /entrypoint.sh +ENTRYPOINT ["/entrypoint.sh"] + +EXPOSE 51735 20792 51738 +CMD ["/ghost/ghostd", "--datadir=/data"] diff --git a/docker/production/ghost/entrypoint.sh b/docker/production/ghost/entrypoint.sh new file mode 100755 index 0000000..609856f --- /dev/null +++ b/docker/production/ghost/entrypoint.sh @@ -0,0 +1,11 @@ +#!/bin/bash +set -e + +if [[ "$1" == "ghost-cli" || "$1" == "ghost-tx" || "$1" == "ghostd" || "$1" == "test_ghost" ]]; then + mkdir -p "$ghost_DATA" + + chown -h ghost:ghost /home/ghost/.ghost + exec gosu ghost "$@" +else + exec "$@" +fi