diff --git a/AUTHORS b/AUTHORS index d2d49e2e0..20bd581e2 100644 --- a/AUTHORS +++ b/AUTHORS @@ -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 diff --git a/INSTALL.md b/INSTALL.md index eba94faa0..114ef1775 100644 --- a/INSTALL.md +++ b/INSTALL.md @@ -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. diff --git a/contrib/debian/control b/contrib/debian/control index 4b542452a..8526dd6b4 100644 --- a/contrib/debian/control +++ b/contrib/debian/control @@ -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. diff --git a/contrib/sdl_checkpoints.pl b/contrib/sdl_checkpoints.pl new file mode 100755 index 000000000..e140fb0ec --- /dev/null +++ b/contrib/sdl_checkpoints.pl @@ -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; +} diff --git a/src/bitcoin-cli.cpp b/src/bitcoin-cli.cpp index e9623f9bd..79e7701fc 100644 --- a/src/bitcoin-cli.cpp +++ b/src/bitcoin-cli.cpp @@ -48,7 +48,7 @@ std::string HelpMessageCli() strUsage += HelpMessageGroup(_("Options:")); strUsage += HelpMessageOpt("-?", _("This help message")); strUsage += HelpMessageOpt("-conf=", strprintf(_("Specify configuration file (default: %s)"), "HUSH3.conf")); - strUsage += HelpMessageOpt("-datadir=", _("Specify data directory")); + strUsage += HelpMessageOpt("-datadir=", _("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.")); diff --git a/src/hush/tlsmanager.cpp b/src/hush/tlsmanager.cpp index c0c280a42..51e2ea064 100644 --- a/src/hush/tlsmanager.cpp +++ b/src/hush/tlsmanager.cpp @@ -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(); } } diff --git a/src/hush_utils.h b/src/hush_utils.h index 81030a268..d4d92bc1a 100644 --- a/src/hush_utils.h +++ b/src/hush_utils.h @@ -1810,7 +1810,7 @@ void hush_args(char *argv0) vector 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 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() ); diff --git a/src/init.cpp b/src/init.cpp index 2aaa490a0..90cad3b02 100644 --- a/src/init.cpp +++ b/src/init.cpp @@ -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=", _("Specify data directory")); + strUsage += HelpMessageOpt("-datadir=", _("Specify data directory (this path cannot use '~')")); strUsage += HelpMessageOpt("-exportdir=", _("Specify directory to be used when exporting data")); strUsage += HelpMessageOpt("-dbcache=", strprintf(_("Set database cache size in megabytes (%d to %d, default: %d)"), nMinDbCache, nMaxDbCache, nDefaultDbCache)); strUsage += HelpMessageOpt("-loadblock=", _("Imports blocks from external blk000??.dat file") + " " + _("on startup")); diff --git a/src/rpc/blockchain.cpp b/src/rpc/blockchain.cpp index 5f3a54d2f..90b8e7201 100644 --- a/src/rpc/blockchain.cpp +++ b/src/rpc/blockchain.cpp @@ -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 }, diff --git a/src/rpc/client.cpp b/src/rpc/client.cpp index 916273043..e427ec3ff 100644 --- a/src/rpc/client.cpp +++ b/src/rpc/client.cpp @@ -63,6 +63,7 @@ static const CRPCConvertParam vRPCConvertParams[] = { "getbalance", 1 }, { "getbalance", 2 }, { "getblockhash", 0 }, + { "getblockmerkletree", 0 }, { "move", 2 }, { "move", 3 }, { "sendfrom", 2 }, diff --git a/src/rpc/rawtransaction.cpp b/src/rpc/rawtransaction.cpp index 69e614f3b..a48df8e44 100644 --- a/src/rpc/rawtransaction.cpp +++ b/src/rpc/rawtransaction.cpp @@ -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" diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index e3f5e5064..c4dd9c7fc 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -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 . Also see z_viewtransaction for ztx details\n" + "\nGet detailed information about in-wallet transaction . 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" diff --git a/zcutil/build-debian-package-ARM.sh b/zcutil/build-debian-package-ARM.sh new file mode 100755 index 000000000..a2f9629cf --- /dev/null +++ b/zcutil/build-debian-package-ARM.sh @@ -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