Merge remote-tracking branch 'origin/dev' into danger

This commit is contained in:
Duke Leto
2022-03-29 10:26:40 -04:00
13 changed files with 225 additions and 12 deletions

View File

@@ -2,6 +2,7 @@
Duke Leto https://git.hush.is/duke https://github.com/leto
Miodrag https://github.com/miodragpop
jahway603 https://git.hush.is/jahway603 https://github.com/jahway603
# The SuperNET Developers

View File

@@ -26,11 +26,12 @@ sudo swapon /swapfile
sudo apt-get install build-essential pkg-config libc6-dev m4 g++-multilib \
autoconf libtool ncurses-dev unzip git python zlib1g-dev wget \
bsdmainutils automake curl unzip nano libsodium-dev
# pull
# clone git repo
git clone https://git.hush.is/hush/hush3
cd hush3
# Build
./build.sh -j$(nproc)
# This uses 3 build processes, you need 2GB of RAM for each.
./build.sh -j3
```
### Building On Ubuntu 16.04 and older systems
@@ -45,6 +46,23 @@ apt-get install -y gcc-7 g++-7 && \
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-7 60
```
### Build on mac
These instructions are a work in progress. Please report issues to https://hush.is/tg_support
```
sudo port update
sudo port upgrade outdated
sudo port install qt5
# clone git repo
git clone https://git.hush.is/hush/hush3
cd hush3
# Build
# This uses 3 build processes, you need 2GB of RAM for each.
./build.sh -j3
```
## Run a HUSH Node
After you have compiled Hush, then you can run it with the following command:
@@ -80,5 +98,5 @@ Currently, any ARMv7 machine will not be able to build this repo, because the
underlying tech (zcash and the zksnark library) do not support that instruction
set.
This also means that RaspberryPi devices will not work, unless they have a
newer ARMv8-based Raspberry Pi.
This also means that old RaspberryPi devices will not work, unless they have a
newer ARMv8-based Raspberry Pi. Raspberry Pi 4 and newer are known to work.

View File

@@ -11,6 +11,6 @@ Vcs-Git: https://git.hush.is/hush/hush3.git
Vcs-Browser: https://git.hush.is/hush/hush3
Package: hush
Architecture: amd64
Architecture: amd64 arm64
Depends: ${shlibs:Depends}
Description: Hush cryptocoin full node. Speak And Transact Freely. Hush inherits from Bitcoin Protocol and Zcash Protocol and is focused on private communications.

44
contrib/sdl_checkpoints.pl Executable file
View File

@@ -0,0 +1,44 @@
#!/usr/bin/perl
# Copyright (c) 2016-2022 The Hush developers
# Distributed under the GPLv3 software license, see the accompanying
# file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html
# This script is used to generate the data used by the silentdragonlite-cli checkpoints.rs file
# https://git.hush.is/hush/silentdragonlite-cli/src/branch/master/lib/src/lightclient/checkpoints.rs#L24
use warnings;
use strict;
my $hush = "./src/hush-cli";
my $gethash = "$hush getblockhash";
my $gettree = "$hush getblockmerkletree";
my $start = shift || 300000;
my $end = shift || 840000;
my $stride = shift || 10000;
my $blocks = qx{$hush getblockcount};
if($?) {
print "ERROR, is hushd running? exiting...\n";
exit 1;
}
if ($end > $blocks) {
print "The block $end is beyond how many blocks this node knows about, exiting...\n";
exit 1;
}
if ($start < 1) {
print "Invalid start block $start, exiting...\n";
exit 1;
}
my $block = $start;
while (1) {
last if $block > $end;
my $blockhash = qx{$gethash $block};
my $merkle = qx{$gettree $block};
chomp $merkle;
chomp $blockhash;
print qq{($block,"$blockhash",\n\t"$merkle"\n),\n};
$block += $stride;
}

View File

@@ -48,7 +48,7 @@ std::string HelpMessageCli()
strUsage += HelpMessageGroup(_("Options:"));
strUsage += HelpMessageOpt("-?", _("This help message"));
strUsage += HelpMessageOpt("-conf=<file>", strprintf(_("Specify configuration file (default: %s)"), "HUSH3.conf"));
strUsage += HelpMessageOpt("-datadir=<dir>", _("Specify data directory"));
strUsage += HelpMessageOpt("-datadir=<dir>", _("Specify data directory (this path cannot use '~')"));
strUsage += HelpMessageOpt("-testnet", _("Use the test network"));
strUsage += HelpMessageOpt("-regtest", _("Enter regression test mode, which uses a special chain in which blocks can be "
"solved instantly. This is intended for regression testing tools and app development."));

View File

@@ -619,7 +619,7 @@ int TLSManager::threadSocketHandler(CNode* pnode, fd_set& fdsetRecv, fd_set& fds
if (nRet != WOLFSSL_ERROR_WANT_READ && nRet != WOLFSSL_ERROR_WANT_WRITE)
{
if (!pnode->fDisconnect)
LogPrintf("TSL: ERROR: SSL_read %s\n", ERR_error_string(nRet, NULL));
LogPrintf("TLS: ERROR: SSL_read %s\n", ERR_error_string(nRet, NULL));
pnode->CloseSocketDisconnect();
unsigned long error = ERR_get_error();
@@ -634,7 +634,7 @@ int TLSManager::threadSocketHandler(CNode* pnode, fd_set& fdsetRecv, fd_set& fds
} else {
if (nRet != WSAEWOULDBLOCK && nRet != WSAEMSGSIZE && nRet != WSAEINTR && nRet != WSAEINPROGRESS) {
if (!pnode->fDisconnect)
LogPrintf("TSL: ERROR: socket recv %s\n", NetworkErrorString(nRet));
LogPrintf("TLS: ERROR: socket recv %s\n", NetworkErrorString(nRet));
pnode->CloseSocketDisconnect();
}
}

View File

@@ -1810,7 +1810,7 @@ void hush_args(char *argv0)
vector<string> HUSH_nodes= {"node1.hush.is","node2.hush.is","node3.hush.is",
"node4.hush.is","node5.hush.is","node6.hush.is",
"node7.hush.is","node8.hush.is","node1.hush.land", "node2.hush.land"};
"node7.hush.is","node8.hush.is","node1.hush.land", "node2.hush.land", "node3.hush.land", "node4.hush.land", "node5.hush.land"};
vector<string> more_nodes = mapMultiArgs["-addnode"];
if (more_nodes.size() > 0) {
fprintf(stderr,"%s: Adding %lu more nodes via custom -addnode arguments\n", __func__, more_nodes.size() );

View File

@@ -389,7 +389,7 @@ std::string HelpMessage(HelpMessageMode mode)
strUsage += HelpMessageOpt("-daemon", _("Run in the background as a daemon and accept commands"));
#endif
}
strUsage += HelpMessageOpt("-datadir=<dir>", _("Specify data directory"));
strUsage += HelpMessageOpt("-datadir=<dir>", _("Specify data directory (this path cannot use '~')"));
strUsage += HelpMessageOpt("-exportdir=<dir>", _("Specify directory to be used when exporting data"));
strUsage += HelpMessageOpt("-dbcache=<n>", strprintf(_("Set database cache size in megabytes (%d to %d, default: %d)"), nMinDbCache, nMaxDbCache, nDefaultDbCache));
strUsage += HelpMessageOpt("-loadblock=<file>", _("Imports blocks from external blk000??.dat file") + " " + _("on startup"));

View File

@@ -856,6 +856,39 @@ UniValue gettxoutsetinfo(const UniValue& params, bool fHelp, const CPubKey& mypk
return ret;
}
UniValue getblockmerkletree(const UniValue& params, bool fHelp, const CPubKey& mypk)
{
if (fHelp || params.size() != 1 )
throw runtime_error(
"getblockmerkletree height\n"
"\nGet full merkletree for a given Hush or HSC block height.\n"
"\nArguments:\n"
"1. height (int, required) block height\n"
"\nResult:\n"
"\"hex\" (string) the merkle tree hex encoded\n"
+ HelpExampleCli("getblockmerkletree", "290000")
+ HelpExampleRpc("getblockmerkletree", "290000")
);
CBlockIndex* phushblockindex;
uint256 blockRoot;
SaplingMerkleTree tree;
int nHeight = params[0].get_int();
if ( (nHeight < 1) || (nHeight > chainActive.LastTip()->GetHeight()) ) {
throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid Hush or HSC block height parameter");
}
phushblockindex = chainActive[nHeight];
blockRoot = phushblockindex->hashFinalSaplingRoot;
if( pcoinsTip->GetSaplingAnchorAt(blockRoot, tree) ) {
CDataStream ss(SER_NETWORK, PROTOCOL_VERSION);
ss << tree;
return HexStr(ss.begin(), ss.end());
} else {
throw JSONRPCError(RPC_INVALID_PARAMETER, "Could not find merkletree");
}
}
UniValue kvsearch(const UniValue& params, bool fHelp, const CPubKey& mypk)
{
@@ -1877,6 +1910,7 @@ static const CRPCCommand commands[] =
{ "blockchain", "getblockcount", &getblockcount, true },
{ "blockchain", "getblock", &getblock, true },
{ "blockchain", "getblockhash", &getblockhash, true },
{ "blockchain", "getblockmerkletree", &getblockmerkletree, true },
{ "blockchain", "getblockheader", &getblockheader, true },
{ "blockchain", "getchaintips", &getchaintips, true },
{ "blockchain", "getchaintxstats", &getchaintxstats, true },

View File

@@ -63,6 +63,7 @@ static const CRPCConvertParam vRPCConvertParams[] =
{ "getbalance", 1 },
{ "getbalance", 2 },
{ "getblockhash", 0 },
{ "getblockmerkletree", 0 },
{ "move", 2 },
{ "move", 3 },
{ "sendfrom", 2 },

View File

@@ -353,7 +353,7 @@ UniValue getrawtransaction(const UniValue& params, bool fHelp, const CPubKey& my
"\nNOTE: By default this function only works sometimes. This is when the tx is in the mempool\n"
"or there is an unspent output in the utxo for this transaction. To make it always work,\n"
"you need to maintain a transaction index, using the -txindex command line option.\n"
"\nReturn the raw transaction data.\n"
"\nReturn the raw transaction data. Also see z_viewtransaction for ztx details.\n"
"\nIf verbose=0, returns a string that is serialized, hex-encoded data for 'txid'.\n"
"If verbose is non-zero, returns an Object with information about 'txid'.\n"

View File

@@ -2257,7 +2257,7 @@ UniValue gettransaction(const UniValue& params, bool fHelp, const CPubKey& mypk)
if (fHelp || params.size() < 1 || params.size() > 2)
throw runtime_error(
"gettransaction \"txid\" ( includeWatchonly )\n"
"\nGet detailed information about in-wallet transaction <txid>. Also see z_viewtransaction for ztx details\n"
"\nGet detailed information about in-wallet transaction <txid>. Also see z_viewtransaction for ztx details.\n"
"\nArguments:\n"
"1. \"txid\" (string, required) The transaction id\n"
"2. \"includeWatchonly\" (bool, optional, default=false) Whether to include watchonly addresses in balance calculation and details[]\n"

View File

@@ -0,0 +1,115 @@
#!/usr/bin/env bash
# Copyright (c) 2016-2022 The Hush developers
# Distributed under the GPLv3 software license, see the accompanying
# file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html
#
# Remix for SBC (Single Board Computer) like PineBook, Rock64, Raspberry Pi, etc.
## Usage: ./zcutil/build-debian-package-ARM.sh
# Pre-requisite checks
# Check if lintian is installed and exit if it is not
if ! [ -x "$(command -v lintian)" ]; then
echo 'Error: lintian is not installed yet. Consult your Linux version package manager...' >&2
echo 'On Debian/Ubuntu, try "sudo apt install lintian"'
echo ""
exit 1
fi
# Check if fakeroot is installed and exit if it is not
if ! [ -x "$(command -v fakeroot)" ]; then
echo 'Error: fakeroot is not installed yet. Consult your Linux version package manager...' >&2
echo 'On Debian/Ubuntu, try "sudo apt install fakeroot"'
echo ""
exit 1
fi
echo "Let There Be Hush Debian ARM Packages"
echo ""
echo " ______"
echo " |\_______________ (_____\\______________"
echo "HH======#H###############H#######################"
echo ' ~"""""""""""""""`##(_))#H\"""""Y########'
echo " )) \#H\ ##Y###"
echo 'dew " }#H)'
echo ""
set -e
set -x
BUILD_PATH="/tmp/hush-debian-$$"
PACKAGE_NAME="hush"
SRC_PATH=`pwd`
SRC_DEB=$SRC_PATH/contrib/debian
SRC_DOC=$SRC_PATH/doc
ARCH="aarch64"
umask 022
if [ ! -d $BUILD_PATH ]; then
mkdir $BUILD_PATH
fi
PACKAGE_VERSION=$($SRC_PATH/src/hushd --version|grep version|cut -d' ' -f4|cut -d- -f1|sed 's/v//g')
DEBVERSION=$(echo $PACKAGE_VERSION | sed 's/-beta/~beta/' | sed 's/-rc/~rc/' | sed 's/-/+/')
BUILD_DIR="$BUILD_PATH/$PACKAGE_NAME-$PACKAGE_VERSION-$ARCH"
if [ -d $BUILD_DIR ]; then
rm -R $BUILD_DIR
fi
DEB_BIN=$BUILD_DIR/usr/bin
DEB_CMP=$BUILD_DIR/usr/share/bash-completion/completions
DEB_DOC=$BUILD_DIR/usr/share/doc/$PACKAGE_NAME
DEB_MAN=$BUILD_DIR/usr/share/man/man1
DEB_SHR=$BUILD_DIR/usr/share/hush
mkdir -p $BUILD_DIR/DEBIAN $DEB_CMP $DEB_BIN $DEB_DOC $DEB_MAN $DEB_SHR
chmod 0755 -R $BUILD_DIR/*
# Package maintainer scripts (currently empty)
#cp $SRC_DEB/postinst $BUILD_DIR/DEBIAN
#cp $SRC_DEB/postrm $BUILD_DIR/DEBIAN
#cp $SRC_DEB/preinst $BUILD_DIR/DEBIAN
#cp $SRC_DEB/prerm $BUILD_DIR/DEBIAN
cp $SRC_PATH/contrib/asmap/asmap.dat $DEB_SHR
cp $SRC_PATH/sapling-spend.params $DEB_SHR
cp $SRC_PATH/sapling-output.params $DEB_SHR
cp $SRC_PATH/src/hushd $DEB_BIN
strip $DEB_BIN/hushd
cp $SRC_PATH/src/hush-cli $DEB_BIN
strip $DEB_BIN/hush-cli
cp $SRC_PATH/src/hush-tx $DEB_BIN
strip $DEB_BIN/hush-tx
cp $SRC_PATH/src/hush-smart-chain $DEB_BIN
#cp $SRC_DEB/changelog $DEB_DOC/changelog.Debian
cp $SRC_DEB/copyright $DEB_DOC
cp -r $SRC_DEB/examples $DEB_DOC
# Copy manpages
cp $SRC_DOC/man/hushd.1 $DEB_MAN/hushd.1
cp $SRC_DOC/man/hush-cli.1 $DEB_MAN/hush-cli.1
cp $SRC_DOC/man/hush-tx.1 $DEB_MAN/hush-tx.1
# Copy bash completion files
cp $SRC_PATH/contrib/hushd.bash-completion $DEB_CMP/hushd
cp $SRC_PATH/contrib/hush-cli.bash-completion $DEB_CMP/hush-cli
cp $SRC_PATH/contrib/hush-tx.bash-completion $DEB_CMP/hush-tx
# Gzip files
#gzip --best -n $DEB_DOC/changelog
#gzip --best -n $DEB_DOC/changelog.Debian
gzip --best -n $DEB_MAN/hushd.1
gzip --best -n $DEB_MAN/hush-cli.1
gzip --best -n $DEB_MAN/hush-tx.1
cd $SRC_PATH/contrib
# Create the control file
dpkg-shlibdeps $DEB_BIN/hushd $DEB_BIN/hush-cli $DEB_BIN/hush-tx
dpkg-gencontrol -P$BUILD_DIR -v$DEBVERSION
#dpkg-gencontrol -P$BUILD_DIR
# Create the Debian package
fakeroot dpkg-deb --build $BUILD_DIR
cp $BUILD_PATH/$PACKAGE_NAME-$PACKAGE_VERSION-$ARCH.deb $SRC_PATH
shasum -a 256 $SRC_PATH/$PACKAGE_NAME-$PACKAGE_VERSION-$ARCH.deb
# Analyze with Lintian, reporting bugs and policy violations
lintian -i $SRC_PATH/$PACKAGE_NAME-$PACKAGE_VERSION-$ARCH.deb
exit 0