This commit is contained in:
Sonkeng 2025-03-26 18:42:27 +00:00 committed by GitHub
commit f1654d3423
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 183 additions and 0 deletions

View file

@ -118,6 +118,12 @@ BasicSwap is compatible with the following digital assets.
<td>DOGE
</td>
</tr>
<tr>
<td>Ghostcoin
</td>
<td>GHOST
</td>
</tr>
</table>
If youd like to add a cryptocurrency to BasicSwap, refer to how other cryptocurrencies have been integrated to the DEX by following [this link](https://academy.particl.io/en/latest/basicswap-guides/basicswapguides_apply.html).

View file

@ -913,6 +913,16 @@ class BasicSwap(BaseApp):
from .interface.nav import NAVInterface
return NAVInterface(self.coin_clients[coin], self.chain, self)
elif coin == Coins.GHOST:
interface = PARTInterface(self.coin_clients[coin], self.chain, self)
self.coin_clients[coin]["interface_anon"] = PARTInterfaceAnon(
self.coin_clients[coin], self.chain, self
)
self.coin_clients[coin]["interface_blind"] = PARTInterfaceBlind(
self.coin_clients[coin], self.chain, self
)
return interface
else:
raise ValueError("Unknown coin type")
@ -940,6 +950,7 @@ class BasicSwap(BaseApp):
"dash",
"firo",
"bitcoincash",
"ghost"
):
pidfilename += "d"

View file

@ -91,6 +91,10 @@ BITCOINCASH_VERSION_TAG = os.getenv("BITCOINCASH_VERSION_TAG", "")
DOGECOIN_VERSION = os.getenv("DOGECOIN_VERSION", "23.2.1")
DOGECOIN_VERSION_TAG = os.getenv("DOGECOIN_VERSION_TAG", "")
GHOST_VERSION = os.getenv("GHOST_VERSION", "0.23.0.0")
GHOST_VERSION_TAG = os.getenv("GHOST_VERSION_TAG", "")
GHOST_LINUX_EXTRA = os.getenv("GHOST_LINUX_EXTRA", "")
GUIX_SSL_CERT_DIR = None
OVERRIDE_DISABLED_COINS = toBool(os.getenv("OVERRIDE_DISABLED_COINS", "false"))
@ -112,6 +116,7 @@ known_coins = {
"navcoin": (NAV_VERSION, NAV_VERSION_TAG, ("nav_builder",)),
"bitcoincash": (BITCOINCASH_VERSION, BITCOINCASH_VERSION_TAG, ("Calin_Culianu",)),
"dogecoin": (DOGECOIN_VERSION, DOGECOIN_VERSION_TAG, ("tecnovert",)),
"ghost": (GHOST_VERSION, GHOST_VERSION_TAG, ("tizymandias",)),
}
disabled_coins = [
@ -136,6 +141,7 @@ expected_key_ids = {
"nicolasdorier": ("6618763EF09186FE", "223FDA69DEBEA82D", "62FE85647DEDDA2E"),
"decred_release": ("6D897EDF518A031D",),
"Calin_Culianu": ("21810A542031C02C",),
"tizymandias": ("")
}
USE_PLATFORM = os.getenv("USE_PLATFORM", platform.system())
@ -266,6 +272,14 @@ DOGE_ONION_PORT = int(os.getenv("DOGE_ONION_PORT", 6969))
DOGE_RPC_USER = os.getenv("DOGE_RPC_USER", "")
DOGE_RPC_PWD = os.getenv("DOGE_RPC_PWD", "")
GHOST_ZMQ_PORT = int(os.getenv("GHOST_ZMQ_PORT", 20792))
GHOST_RPC_HOST = os.getenv("GHOST_RPC_HOST", "127.0.0.1")
GHOST_RPC_PORT = int(os.getenv("GHOST_RPC_PORT", 51728))
GHOST_ONION_PORT = int(os.getenv("GHOST_ONION_PORT", 51734))
GHOST_RPC_USER = os.getenv("GHOST_RPC_USER", "")
GHOST_RPC_PWD = os.getenv("GHOST_RPC_PWD", "")
TOR_PROXY_HOST = os.getenv("TOR_PROXY_HOST", "127.0.0.1")
TOR_PROXY_PORT = int(os.getenv("TOR_PROXY_PORT", 9050))
TOR_CONTROL_PORT = int(os.getenv("TOR_CONTROL_PORT", 9051))
@ -689,6 +703,8 @@ def extractCore(coin, version_data, settings, bin_dir, release_path, extra_opts=
return "{}-{}_nousb/bin/{}".format(dir_name, version + version_tag, b)
elif coin == "decred":
return "{}-{}-v{}/{}".format(dir_name, extra_opts["arch_name"], version, b)
elif coin == "ghost":
return "{}-{}/{}".format(dir_name, version + version_tag, b)
else:
return "{}-{}/bin/{}".format(dir_name, version + version_tag, b)
@ -711,7 +727,9 @@ def extractCore(coin, version_data, settings, bin_dir, release_path, extra_opts=
else:
with tarfile.open(release_path) as ft:
for b in bins:
print("FOR VALUE {}", bin_dir)
out_path = os.path.join(bin_dir, b)
print("OUT PATH ", out_path)
if not os.path.exists(out_path) or extract_core_overwrite:
with (
open(out_path, "wb") as fout,
@ -1002,6 +1020,19 @@ def prepareCore(coin, version_data, settings, data_dir, extra_opts={}):
assert_url = "https://github.com/navcoin/navcoin-core/releases/download/{}/{}".format(
version + version_tag, assert_filename
)
elif coin == "ghost":
arch_name = BIN_ARCH
if BIN_ARCH == "x86_64-linux-gnu":
arch_name = "x86_64-pc-linux-gnu"
elif BIN_ARCH == "osx64":
arch_name = "MacOS64.tar.gz"
release_filename = "{}-{}-{}.{}".format(coin, version, arch_name, FILE_EXT)
release_url = "https://github.com/ghost-coin/ghost-core/releases/download/v{}/{}".format(
version + version_tag, release_filename
)
assert_url = "https://github.com/ghost-coin/ghost-core/releases/download/v{}/hashes.txt".format(version + version_tag)
else:
raise ValueError("Unknown coin")
@ -1019,6 +1050,7 @@ def prepareCore(coin, version_data, settings, data_dir, extra_opts={}):
if coin not in (
"firo",
"bitcoincash",
"ghost"
):
assert_sig_url = assert_url + (".asc" if use_guix else ".sig")
if coin not in ("nav",):
@ -1041,6 +1073,13 @@ def prepareCore(coin, version_data, settings, data_dir, extra_opts={}):
)
logger.info("Found release hash in assert file.")
if coin == "ghost":
logger.warning(
"Skipping binary signature check as ghost doesn't support it yet."
)
extractCore(coin, version_data, settings, bin_dir, release_path, extra_opts)
return
if SKIP_GPG_VALIDATION:
logger.warning(
"Skipping binary signature check as SKIP_GPG_VALIDATION env var is set."
@ -2571,6 +2610,21 @@ def main():
"core_version_no": getKnownVersion("wownero"),
"core_type_group": "xmr",
},
"ghost": {
"connection_type": "rpc",
"manage_daemon": shouldManageDaemon("GHOST"),
"rpchost": GHOST_RPC_HOST,
"rpcport": GHOST_RPC_PORT + port_offset,
"onionport": PART_ONION_PORT + port_offset,
"datadir": os.getenv("GHOST_DATA_DIR", os.path.join(data_dir, "ghost")),
"bindir": os.path.join(bin_dir, "ghost"),
"blocks_confirmed": 2,
"override_feerate": 0.002,
"conf_target": 2,
"core_version_no": getKnownVersion("ghost"),
"core_version_group": 0,
},
}
for coin_name, coin_settings in chainclients.items():

View file

@ -33,6 +33,8 @@ class Coins(IntEnum):
# ZANO = 16
BCH = 17
DOGE = 18
GHOST = 19
GHOST_ANON = 20
class Fiat(IntEnum):
@ -533,6 +535,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,
},
},
}
name_map = {}

View file

@ -53,4 +53,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.

Binary file not shown.

After

(image error) Size: 989 B

Binary file not shown.

After

(image error) Size: 1.7 KiB

View file

@ -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

View file

@ -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

View file

@ -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"]

View file

@ -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