feat: add Dash Core (dash-qt)

This commit is contained in:
AJ ONeal
2023-06-08 08:55:10 +00:00
parent b944352e1b
commit 731d3c95c1
6 changed files with 402 additions and 0 deletions

187
dashcore/README.md Normal file
View File

@@ -0,0 +1,187 @@
---
title: Dash Core Desktop Wallet
homepage: https://github.com/dashpay/dash
tagline: |
Dash Core is the Desktop Wallet for Digital Cash (DASH)
---
To update or switch versions, run `webi dashcore@stable` (or `@v19`, `@beta`,
etc).
### System Requirements
- 50GB Free Storage (100GB recommended)
- 4GB RAM (8GB recommended)
- 4 hours for initial sync
### Files
These are the files / directories that are created and/or modified with this
install:
```txt
~/.config/envman/PATH.env
~/.local/opt/dashcore/
# For convenience
~/.local/bin/dash-qt-hd
~/.local/bin/dash-qt-testnet
# Linux
~/.dashcore/settings.json
~/.dashcore/testnet3/
# macOS
~/Library/Application Support/DashCore/settings.json
~/Library/Application Support/DashCore/testnet3/
~/Library/Saved Application State/org.dash.Dash-Qt.savedState
~/Library/Preferences/org.dash.Dash-Qt.plist
```
## Cheat Sheet
> _DASH_ (portmanteau of _Digital Cash_) is an international currency. _Dash
> Core_ is the original suite of tools for _Dash_, maintained by DCG.
The original tools include:
- `dash-qt` - a _Desktop Wallet_ for sending and receiving money
- [`dashd`](../dashd/) - the [_Full Node_](../dashd/) server daemon \
(for APIs, servers, and such)
- `dash-cli` - send RPC commands (same as the dash-qt command console)
- `dash-tx` - create and debug raw (hex) transactions
- `dash-wallet` - interact with wallet files offline
The webi installer also includes two convenience wrapper scripts:
- `dash-qt-hd`
- `dash-qt-testnet`
To open an existing (or create a new) Dash Desktop Wallet:
```sh
dash-qt \
-usehd \
-walletdir="$HOME/.config/dashcore/wallets/" \
-settings="$HOME/.config/dashcore/settings.json" \
-datadir="$HOME/.dashcore/_data/" \
-blocksdir="$HOME/.dashcore/_caches/"
```
Or pass `-testnet` to use with _TestNet_:
```sh
dash-qt \
-testnet \
-usehd \
-walletdir="$HOME/.config/dashcore/wallets/" \
-settings="$HOME/.config/dashcore/settings.json" \
-datadir="$HOME/.dashcore/_data/" \
-blocksdir="$HOME/.dashcore/_caches/"
```
### IMPORTANT: How to NOT Lose Money!
`dash-qt-hd` should be preferred to `dash-qt`.
For historical reasons, `dash-qt` uses **lossy keys** by default!
This is very dangerous - without a Wallet Phrase to recover HD Keys, file
corruption (or losing the device) can lead to losing money permanently.
To avoid this you may use `dash-qt-hd`, or create your wallet with `-usehd`
(optionally with `-mnemonic=<wallet phrase>` if you'd like to recover an
existing wallet), or `upgradetohd`.
### How to Convert from Lossy to HD
If you used `dash-qt` without `-usehd` and already created a wallet, you can fix
it from the command console, which can be found in _Window => Console_.
```text
# Usage
# upgradetohd [wallet phrase] [legacy salt] <wallet encryption phrase>
# Example
upgradetohd "" "" "correct horse battery staple"
# Example with the "zoomonic" and a legacy salt
upgradetohd "zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo zoo wrong" \
"TREZOR" "correct horse battery staple"
```
It's a good idea to back up your wallet before running the conversion.
For more detail see:
<https://docs.dash.org/en/stable/docs/user/wallets/dashcore/advanced.html>
### How to Separate Caches from Data
You can make your data much safer by separating it from the caches you may need
to delete by setting:
- `-walletdir=` your money!!
- `-settings=` desktop app settings!
- `-conf=` server settings
- `-datadir=` miscellaneous
- `-blocksdir=` generic caches
```sh
dash-qt \
-usehd \
-settings="$HOME/.config/dashcore/settings.json" \
-walletdir="$HOME/.config/dashcore/wallets/" \
-datadir="$HOME/.dashcore/_data/" \
-blocksdir="$HOME/.dashcore/_caches/" \
-enablecoinjoin=1 \
-coinjoinautostart=1 \
-coinjoinrounds=16 \
-coinjoindenomsgoal=10 \
-coinjoindenomshardcap=25
```
### How to Mix with CoinJoin
CoinJoin aids in preventing some bad actors and malicious observers being able
to easily reconstruct details about your transactions from the publicly
available data by creating many excess transactions. \
(be aware, however, that dedicated bad actors can use sophisticated software that
will reveal much of the same information over time)
`dash-qt` does not enable CoinJoin mixing by default.
`dash-qt-hd` does. It runs the following:
```sh
dash-qt \
-usehd \
-enablecoinjoin=1 \
-coinjoinautostart=1 \
-coinjoinrounds=16 \
-coinjoindenomsgoal=10 \
-coinjoindenomshardcap=25
```
The `coinjoindenomsgoal` and `coinjoindenomshardcap` prevent CoinJoin from
splitting coins down into hundreds of small, unusable coins.
### Other Tools
- [`dashphrase`](https://github.com/dashhive/dashphrase-cli) for generating
secure Wallet Phrases
- [`dashsight`](https://github.com/dashhive/dashphrase-cli) for inspecting
balances, transactions, etc via API (without downloading the indexes)
### More Documentation
All of the **command line flags and options** for the Dash Core Desktop Wallet
are documented between these two pages:
- https://docs.dash.org/projects/core/en/stable/docs/dashcore/wallet-arguments-and-commands-dash-qt.html
- https://docs.dash.org/projects/core/en/stable/docs/dashcore/wallet-arguments-and-commands-dashd.html
The **config files** `dash.conf` (mainly for _Full Nodes_) and `settings.json`
(mainly for Desktop Wallets) are documented at:
- <https://github.com/dashpay/dash/blob/master/contrib/debian/examples/dash.conf>
- <https://docs.dash.org/projects/core/en/stable/docs/dashcore/wallet-configuration-file.html>

21
dashcore/dash-qt-hd Normal file
View File

@@ -0,0 +1,21 @@
#!/bin/sh
set -e
set -u
# I don't have the gall to change the defaults (Webi values),
# but I would *strongly* recommend that you do!
#
# Instance-specific data should be separate from global caches:
#
# -settings="$HOME/.config/dashcore/settings.json" \
# -walletdir="$HOME/.config/dashcore/wallets/" \
# -datadir="$HOME/.dashcore/_data/" \
# -blocksdir="$HOME/.dashcore/_caches/" \
dash-qt \
-usehd \
-enablecoinjoin=1 \
-coinjoinautostart=1 \
-coinjoinrounds=16 \
-coinjoindenomsgoal=10 \
-coinjoindenomshardcap=25

22
dashcore/dash-qt-testnet Normal file
View File

@@ -0,0 +1,22 @@
#!/bin/sh
set -e
set -u
# I don't have the gall to change the defaults (Webi values),
# but I would *strongly* recommend that you do!
#
# Instance-specific data should be separate from global caches:
#
# -settings="$HOME/.config/dashcore/settings.json" \
# -walletdir="$HOME/.config/dashcore/wallets/" \
# -datadir="$HOME/.dashcore/_data/" \
# -blocksdir="$HOME/.dashcore/_caches/" \
dash-qt \
-testnet \
-usehd \
-enablecoinjoin=1 \
-coinjoinautostart=1 \
-coinjoinrounds=16 \
-coinjoindenomsgoal=10 \
-coinjoindenomshardcap=25

56
dashcore/install.ps1 Normal file
View File

@@ -0,0 +1,56 @@
#!/usr/bin/env pwsh
####################
# Install dashcore #
####################
# Every package should define these variables
$pkg_cmd_name = "dash-qt"
$pkg_dst_cmd = "$Env:USERPROFILE\.local\opt\dashcore\bin\dash-qt.exe"
$pkg_dst_dir = "$Env:USERPROFILE\.local\opt\dashcore"
$pkg_dst = "$pkg_dst_cmd"
$pkg_src_cmd = "$Env:USERPROFILE\.local\opt\dashcore-v$Env:WEBI_VERSION\bin\dash-qt.exe"
$pkg_src_bin = "$Env:USERPROFILE\.local\opt\dashcore-v$Env:WEBI_VERSION\bin"
$pkg_src_dir = "$Env:USERPROFILE\.local\opt\dashcore-v$Env:WEBI_VERSION"
$pkg_src = "$pkg_src_cmd"
New-Item "$Env:USERPROFILE\Downloads\webi" -ItemType Directory -Force | out-null
$pkg_download = "$Env:USERPROFILE\Downloads\webi\$Env:WEBI_PKG_FILE"
# Fetch archive
IF (!(Test-Path -Path "$Env:USERPROFILE\Downloads\webi\$Env:WEBI_PKG_FILE"))
{
echo "Downloading dashcore from $Env:WEBI_PKG_URL to $pkg_download"
& curl.exe -A "$Env:WEBI_UA" -fsSL "$Env:WEBI_PKG_URL" -o "$pkg_download.part"
& move "$pkg_download.part" "$pkg_download"
}
IF (!(Test-Path -Path "$pkg_src_dir"))
{
echo "Installing dashcore"
# TODO: create package-specific temp directory
# Enter tmp
pushd .local\tmp
# Remove any leftover tmp cruft
Remove-Item -Path ".\dashcore*" -Recurse -ErrorAction Ignore
# Unpack archive file into this temporary directory
# Windows BSD-tar handles zip. Imagine that.
echo "Unpacking $pkg_download"
& tar xf "$pkg_download"
# Settle unpacked archive into place
echo "Install Location: $pkg_src_cmd"
Move-Item -Path ".\dashcore*" -Destination "$pkg_src_dir"
# Exit tmp
popd
}
echo "Copying into '$pkg_dst_cmd' from '$pkg_src_cmd'"
Remove-Item -Path "$pkg_dst_cmd" -Recurse -ErrorAction Ignore | out-null
Copy-Item -Path "$pkg_src" -Destination "$pkg_dst" -Recurse

88
dashcore/install.sh Normal file
View File

@@ -0,0 +1,88 @@
#!/bin/sh
# shellcheck disable=SC2034
# "'pkg_cmd_name' appears unused. Verify it or export it."
__init_dashcore() {
set -e
set -u
####################
# Install dashcore #
####################
# Every package should define these 6 variables
pkg_cmd_name="dash-qt"
pkg_dst_cmd="$HOME/.local/opt/dashcore/bin/dash-qt"
pkg_dst_dir="$HOME/.local/opt/dashcore"
pkg_dst="$pkg_dst_dir"
pkg_src_cmd="$HOME/.local/opt/dashcore-v$WEBI_VERSION/bin/dash-qt"
pkg_src_dir="$HOME/.local/opt/dashcore-v$WEBI_VERSION"
pkg_src="$pkg_src_dir"
# pkg_install must be defined by every package
pkg_install() {
# mv ./dashcore-* ~/.local/opt/dashcore-v0.19.1
mv ./dashcore-* "${pkg_src_dir}"
if ! test -e "${HOME}/.dashcore"; then
mkdir -p "${HOME}/.dashcore"
chmod 0700 "${HOME}/.dashcore" || true
fi
# if ! test -e "${HOME}/.dashcore/dash.conf"; then
# my_main_pass="$(xxd -l16 -ps /dev/urandom)"
# my_test_pass="$(xxd -l16 -ps /dev/urandom)"
# {
# echo '[main]'
# echo "rpcuser=$(id -u -n)"
# echo "rpcpassword=${my_main_pass}"
# echo ''
# echo '[test]'
# echo "rpcuser=$(id -u -n)-test"
# echo "rpcpassword=${my_test_pass}"
# echo ''
# } >> "${HOME}/.dashcore/dash.conf"
# chmod 0600 "${HOME}/.dashcore/dash.conf" || true
# fi
# if ! test -e "${HOME}/.dashcore/settings.json"; then
# echo '{}' >> "${HOME}/.dashcore/settings.json"
# chmod 0600 "${HOME}/.dashcore/settings.json" || true
# fi
# Always try to correct the permissions due to
# https://github.com/dashpay/dash/issues/5420
chmod -R og-rwx "${HOME}/.dashcore/" || true
if ! test -e "$HOME/.local/bin/dash-qt-hd"; then
webi_download \
"$WEBI_HOST/packages/dashcore/dash-qt-hd" \
"$HOME/.local/bin/dash-qt-hd"
chmod a+x "$HOME/.local/bin/dash-qt-hd"
fi
if ! test -e "$HOME/.local/bin/dash-qt-testnet"; then
webi_download \
"$WEBI_HOST/packages/dashcore/dash-qt-testnet" \
"$HOME/.local/bin/dash-qt-testnet"
chmod a+x "$HOME/.local/bin/dash-qt-testnet"
fi
}
# pkg_get_current_version is recommended, but not required
pkg_get_current_version() {
# 'dash-qt' doesn't have version info, so we use 'dashd'
# 'dashd --version' has output in this format:
# Dash Core Daemon version v19.1.0
# This trims it down to just the version number:
# 19.1.0
dashd --version 2> /dev/null |
head -n 1 |
cut -d ' ' -f 5 |
sed 's:^v::'
}
}
__init_dashcore

28
dashcore/releases.js Normal file
View File

@@ -0,0 +1,28 @@
'use strict';
var github = require('../_common/github.js');
var owner = 'dashpay';
var repo = 'dash';
module.exports = function (request) {
return github(request, owner, repo).then(function (all) {
all.releases = all.releases.filter(function (rel) {
return !rel.name.endsWith('.asc');
});
all.releases.forEach(function (rel) {
if (rel.name.includes('osx64')) {
rel.os = 'macos';
}
});
return all;
});
};
if (module === require.main) {
module.exports(require('@root/request')).then(function (all) {
all = require('../_webi/normalize.js')(all);
// just select the first 5 for demonstration
all.releases = all.releases.slice(0, 5);
console.info(JSON.stringify(all, null, 2));
});
}