Merge branch 'duke' into dev

This commit is contained in:
Duke Leto
2021-07-09 16:01:36 -04:00
17 changed files with 120 additions and 62 deletions

View File

@@ -1,4 +1,7 @@
#!/bin/sh
# Copyright (c) 2016-2021 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
set -e
srcdir="$(dirname $0)"
cd "$srcdir"

View File

@@ -1,8 +1,8 @@
dnl require autoconf 2.60 (AS_ECHO/AS_ECHO_N)
AC_PREREQ([2.60])
define(_CLIENT_VERSION_MAJOR, 3)
define(_CLIENT_VERSION_MINOR, 7)
define(_CLIENT_VERSION_REVISION, 1)
define(_CLIENT_VERSION_MINOR, 8)
define(_CLIENT_VERSION_REVISION, 0)
define(_CLIENT_VERSION_BUILD, 50)
define(_ZC_BUILD_VAL, m4_if(m4_eval(_CLIENT_VERSION_BUILD < 25), 1, m4_incr(_CLIENT_VERSION_BUILD), m4_eval(_CLIENT_VERSION_BUILD < 50), 1, m4_eval(_CLIENT_VERSION_BUILD - 24), m4_eval(_CLIENT_VERSION_BUILD == 50), 1, , m4_eval(_CLIENT_VERSION_BUILD - 50)))
define(_CLIENT_VERSION_SUFFIX, m4_if(m4_eval(_CLIENT_VERSION_BUILD < 25), 1, _CLIENT_VERSION_REVISION-beta$1, m4_eval(_CLIENT_VERSION_BUILD < 50), 1, _CLIENT_VERSION_REVISION-rc$1, m4_eval(_CLIENT_VERSION_BUILD == 50), 1, _CLIENT_VERSION_REVISION, _CLIENT_VERSION_REVISION-$1)))

View File

@@ -1,9 +1,9 @@
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.13.
.TH HUSH-CLI "1" "April 2021" "hush-cli v3.7.1" "User Commands"
.TH HUSH-CLI "1" "July 2021" "hush-cli v3.8.0" "User Commands"
.SH NAME
hush-cli \- manual page for hush-cli v3.7.1
hush-cli \- manual page for hush-cli v3.8.0
.SH DESCRIPTION
Hush RPC client version v3.7.1\-2da07fe58\-dirty
Hush RPC client version v3.8.0\-10a6706e7\-dirty
.PP
In order to ensure you are adequately protecting your privacy when using Hush,
please see <https://hush.is/security/>.

View File

@@ -1,9 +1,9 @@
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.13.
.TH HUSH-TX "1" "April 2021" "hush-tx v3.7.1" "User Commands"
.TH HUSH-TX "1" "July 2021" "hush-tx v3.8.0" "User Commands"
.SH NAME
hush-tx \- manual page for hush-tx v3.7.1
hush-tx \- manual page for hush-tx v3.8.0
.SH DESCRIPTION
hush\-tx utility version v3.7.1\-2da07fe58\-dirty
hush\-tx utility version v3.8.0\-10a6706e7\-dirty
.SS "Usage:"
.TP
hush\-tx [options] <hex\-tx> [commands]

View File

@@ -1,9 +1,9 @@
.\" DO NOT MODIFY THIS FILE! It was generated by help2man 1.47.13.
.TH HUSHD "1" "April 2021" "hushd v3.7.1" "User Commands"
.TH HUSHD "1" "July 2021" "hushd v3.8.0" "User Commands"
.SH NAME
hushd \- manual page for hushd v3.7.1
hushd \- manual page for hushd v3.8.0
.SH DESCRIPTION
Hush Daemon version v3.7.1\-2da07fe58\-dirty
Hush Daemon version v3.8.0\-10a6706e7\-dirty
.PP
In order to ensure you are adequately protecting your privacy when using Hush,
please see <https://hush.is/security/>.
@@ -341,10 +341,19 @@ Minimum fee (in HUSH/kB) to allow for OP_RETURN transactions (default:
.IP
Fee (in HUSH/kB) to add to transactions you send (default: 0.00)
.HP
\fB\-keepnotewitnesscache\fR
.IP
Keep partial Sapling Note Witness cache. Must be used with \fB\-rescanheight\fR
to find missing cache items.
.HP
\fB\-rescan\fR
.IP
Rescan the block chain for missing wallet transactions on startup
.HP
\fB\-rescanheight\fR
.IP
Rescan from specified height when rescan=1 on startup
.HP
\fB\-salvagewallet\fR
.IP
Attempt to recover private keys from a corrupt wallet.dat on startup

View File

@@ -10,6 +10,32 @@ and no longer on Github, since they banned Duke Leto and
also because they censor many people around the world and work with
evil organizations.
# Hush 3.8.0 "XXX YYY"
This is an OPTIONAL release, but since it contains many privacy improvements, it's HIGHLY RECOMMENDED for all users to upgrade.
* New Sietch feature: Randomized change output location
* Zcash and Pirate always put the change as the last shielded output, which leaks metadata. Hush no longer has this metadata leakage.
* This feature improves the `z_sendmany`, `z_mergetoaddress` and `z_shieldtocoinbase` since it's done in the Hush TransactionBuilder.
* New Sietch feature: Sitech-ified `z_shieldcoinbase`
* This RPC now leaks less metadata by making it hard for blockchain analysts to know which of the three outputs has value.
* This also increases Hush's "anonset velocity", which is how fast we increase our anonymity set, or "anonset".
* Previously you could only run `stop` while Hush was in RPC warmup, but now additional RPCs are allowed:
* `stop` - Oops, you started hushd on accident a few seconds ago? Now you can stop it without waiting.
* `help` - Get help during long rescans, finally!
* `z_listaddresses` - See a list of all zaddrs in this wallet, even during a long rescan!
* `z_exportkey` - Export a key from this node, even during rescan!
* `listaddresses` - See a list of taddrs as soon as we load the wallet.
* `dumpprivkey` - Dump the private key of a taddr, even when node isn't fully synced!
* `getpeerinfo` - See current peers even before we get enough peers to start syncing or a long rescan!
* `-keepnotewitnesscache` prevents the Sapling Note Witness cache from being deleted from wallet.dat on shutdown.
* `-rescanheight` can be used with `-keepnotewitnesscache` and `-rescan` to do a partial rescan of history and avoid completely rebuilding the Witness Cache.
* `-zindex` data is now stored on disk in the new `zindex.dat` file
* All nodes that use `-zindex` will now have reliable anonset statistics even after a restart
* Improvements to the RPC help documentation
* `hushd.bat` for Windows now uses the ASN map via `-asmap` and has the latest seed nodes
* `hushd-tx.bat` for Windows now exists for making raw transactions on Windows
# Hush 3.7.1 "Neologistic Nautilus"
```

View File

@@ -29,8 +29,8 @@
//! These need to be macros, as clientversion.cpp's and bitcoin*-res.rc's voodoo requires it
// Must be kept in sync with configure.ac , ugh!
#define CLIENT_VERSION_MAJOR 3
#define CLIENT_VERSION_MINOR 7
#define CLIENT_VERSION_REVISION 1
#define CLIENT_VERSION_MINOR 8
#define CLIENT_VERSION_REVISION 0
#define CLIENT_VERSION_BUILD 50
//! Set to true for release, false for prerelease or test build

14
src/hush-tx.bat Normal file
View File

@@ -0,0 +1,14 @@
@call :GET_CURRENT_DIR
@cd %THIS_DIR%
komodo-tx.exe -ac_name=HUSH3 %1 %2 %3 %4 %5 %6 %7 %8 %9
@goto :EOF
:GET_CURRENT_DIR
@pushd %~dp0
@set THIS_DIR=%CD%
@popd
@goto :EOF

View File

@@ -1,6 +1,6 @@
@call :GET_CURRENT_DIR
@cd %THIS_DIR%
komodod.exe -ac_name=HUSH3 -ac_sapling=1 -ac_reward=0,1125000000,562500000 -ac_halving=129,340000,840000 -ac_end=128,340000,5422111 -ac_eras=3 -ac_blocktime=150 -ac_cc=2 -ac_ccenable=228,234,235,236,241 -ac_founders=1 -ac_supply=6178674 -ac_perc=11111111 -clientname=GoldenSandtrout -addnode=64.120.113.130 -addnode=209.58.144.205 -addnode=94.130.35.94 -addnode=188.165.212.101 -ac_cclib=hush3 -ac_script=76a9145eb10cf64f2bab1b457f1f25e658526155928fac88ac -daemon %1 %2 %3 %4 %5 %6 %7 %8 %9
komodod.exe -ac_name=HUSH3 -ac_sapling=1 -ac_reward=0,1125000000,562500000 -ac_halving=129,340000,840000 -ac_end=128,340000,5422111 -ac_eras=3 -ac_blocktime=150 -ac_cc=2 -ac_ccenable=228,234,235,236,241 -ac_founders=1 -ac_supply=6178674 -ac_perc=11111111 -clientname=GoldenSandtrout -asmap -addnode=node1.hush.is -addnode=node2.hush.is -addnode=node3.hush.is -addnode=node4.hush.is -addnode=node5.hush.is -addnode=node6.hush.is -addnode=node7.hush.is -addnode=node8.hush.is -ac_cclib=hush3 -ac_script=76a9145eb10cf64f2bab1b457f1f25e658526155928fac88ac -daemon %1 %2 %3 %4 %5 %6 %7 %8 %9
@goto :EOF
:GET_CURRENT_DIR

View File

@@ -466,6 +466,9 @@ std::string HelpMessage(HelpMessageMode mode)
CURRENCY_UNIT, FormatMoney(CWallet::minTxFee.GetFeePerK())));
strUsage += HelpMessageOpt("-opretmintxfee=<amt>", strprintf(_("Minimum fee (in %s/kB) to allow for OP_RETURN transactions (default: %s)"), CURRENCY_UNIT, 400000 ));
strUsage += HelpMessageOpt("-paytxfee=<amt>", strprintf(_("Fee (in %s/kB) to add to transactions you send (default: %s)"), CURRENCY_UNIT, FormatMoney(payTxFee.GetFeePerK())));
// If this is used incorrectly (-rescanheight too large), then the local wallet may attempt to spend funds which it does not have witness data about
// which will cause a "missing inputs" error when added to the mempool. Rescanning from correct height will fix this.
strUsage += HelpMessageOpt("-keepnotewitnesscache", _("Keep partial Sapling Note Witness cache. Must be used with -rescanheight to find missing cache items."));
strUsage += HelpMessageOpt("-rescan", _("Rescan the block chain for missing wallet transactions") + " " + _("on startup"));
strUsage += HelpMessageOpt("-rescanheight", _("Rescan from specified height when rescan=1 on startup"));
strUsage += HelpMessageOpt("-salvagewallet", _("Attempt to recover private keys from a corrupt wallet.dat") + " " + _("on startup"));

View File

@@ -210,10 +210,6 @@ CBlockTemplate* CreateNewBlock(CPubKey _pk,const CScript& _scriptPubKeyIn, int32
// Collect memory pool transactions into the block
CAmount nFees = 0;
// we will attempt to spend any cheats we see
CTransaction cheatTx;
boost::optional<CTransaction> cheatSpend;
uint256 cbHash;
boost::this_thread::interruption_point(); // exit thread before entering locks.
@@ -861,19 +857,26 @@ CBlockTemplate* CreateNewBlockWithKey(CReserveKey& reservekey, int32_t nHeight,
scriptPubKey = CScript() << ParseHex(HexStr(pubkey)) << OP_CHECKSIG;
} else {
{
if (!reservekey.GetReservedKey(pubkey))
{
return NULL;
}
scriptPubKey.resize(35);
ptr = (uint8_t *)pubkey.begin();
scriptPubKey[0] = 33;
for (i=0; i<33; i++) {
scriptPubKey[i+1] = ptr[i];
}
scriptPubKey[34] = OP_CHECKSIG;
}
}
// Support mining with -disablewallet and minetolocalwallet=0
if (!GetBoolArg("-disablewallet", false)) {
// wallet enabled
if (!reservekey.GetReservedKey(pubkey))
return NULL;
scriptPubKey.clear();
scriptPubKey = CScript() << ToByteVector(pubkey) << OP_CHECKSIG;
} else {
// wallet disabled
CTxDestination dest = DecodeDestination(GetArg("-mineraddress", ""));
if (IsValidDestination(dest)) {
// CKeyID keyID = boost::get<CKeyID>(dest);
// scriptPubKey = CScript() << OP_DUP << OP_HASH160 << ToByteVector(keyID) << OP_EQUALVERIFY << OP_CHECKSIG;
scriptPubKey = GetScriptForDestination(dest);
} else {
return NULL;
}
}
}
}
return CreateNewBlock(pubkey, scriptPubKey, gpucount, isStake);
}
@@ -895,29 +898,6 @@ void komodo_sendmessage(int32_t minpeers,int32_t maxpeers,const char *message,st
}
}
void komodo_broadcast(CBlock *pblock,int32_t limit)
{
if (IsInitialBlockDownload())
return;
int32_t n = 1;
//fprintf(stderr,"broadcast new block t.%u\n",(uint32_t)time(NULL));
{
LOCK(cs_vNodes);
BOOST_FOREACH(CNode* pnode, vNodes)
{
if ( pnode->hSocket == INVALID_SOCKET )
continue;
if ( (rand() % n) == 0 )
{
pnode->PushMessage("block", *pblock);
if ( n++ > limit )
break;
}
}
}
//fprintf(stderr,"finished broadcast new block t.%u\n",(uint32_t)time(NULL));
}
static bool ProcessBlockFound(CBlock* pblock, CWallet& wallet, CReserveKey& reservekey)
#else
static bool ProcessBlockFound(CBlock* pblock)
@@ -972,7 +952,6 @@ static bool ProcessBlockFound(CBlock* pblock)
return error("HushMiner: ProcessNewBlock, block not accepted");
TrackMinedBlock(pblock->GetHash());
//komodo_broadcast(pblock,16);
return true;
}

View File

@@ -646,7 +646,7 @@ UniValue createrawtransaction(const UniValue& params, bool fHelp, const CPubKey&
" ]\n"
"2. \"outputs\" (object, required) a json object with outputs\n"
" {\n"
" \"address\": x.xxx, (numeric or string, required) The key is the komodo address or script (in hex), the numeric value (can be string) is the " + CURRENCY_UNIT + " amount\n"
" \"address\": x.xxx, (numeric or string, required) The key is the HUSH address or script (in hex), the numeric value (can be string) is the " + CURRENCY_UNIT + " amount\n"
" \"data\": \"hex\" (string, required) The key is \"data\", the value is hex encoded data\n"
" ,...\n"
" }\n"
@@ -821,7 +821,7 @@ UniValue decoderawtransaction(const UniValue& params, bool fHelp, const CPubKey&
" \"reqSigs\" : n, (numeric) The required sigs\n"
" \"type\" : \"pubkeyhash\", (string) The type, eg 'pubkeyhash'\n"
" \"addresses\" : [ (json array of string)\n"
" \"RTZMZHDFSTFQst8XmX2dR4DaH87cEUs3gC\" (string) komodo address\n"
" \"RTZMZHDFSTFQst8XmX2dR4DaH87cEUs3gC\" (string) HUSH address\n"
" ,...\n"
" ]\n"
" }\n"

View File

@@ -59,6 +59,13 @@ void TransactionBuilder::AddSaplingOutput(
mtx.valueBalance -= value;
}
// randomize the order of outputs
void TransactionBuilder::ShuffleOutputs()
{
LogPrintf("%s: Shuffling %d zouts\n", __func__, outputs.size() );
random_shuffle( outputs.begin(), outputs.end(), GetRandInt );
}
void TransactionBuilder::AddTransparentInput(COutPoint utxo, CScript scriptPubKey, CAmount value, uint32_t _nSequence)
{
if (keystore == nullptr) {
@@ -212,6 +219,9 @@ boost::optional<CTransaction> TransactionBuilder::Build()
mtx.vShieldedSpend.push_back(sdesc);
}
// Prevent leaking metadata about the position of change output
ShuffleOutputs();
// Create Sapling OutputDescriptions
for (auto output : outputs) {
auto cm = output.note.cm();

View File

@@ -92,6 +92,8 @@ public:
CAmount value,
std::array<unsigned char, HUSH_MEMO_SIZE> memo = {{0}});
void ShuffleOutputs();
// Assumes that the value correctly corresponds to the provided UTXO.
void AddTransparentInput(COutPoint utxo, CScript scriptPubKey, CAmount value, uint32_t nSequence = 0xffffffff);

View File

@@ -21,7 +21,7 @@
#define HUSH_VERSION_H
// network protocol versioning
static const int PROTOCOL_VERSION = 1987422;
static const int PROTOCOL_VERSION = 1987423;
//! initial proto version, to be increased after version/verack negotiation
static const int INIT_PROTO_VERSION = 209;
//! In this version, 'getheaders' was introduced.

View File

@@ -46,6 +46,7 @@
using namespace libzcash;
extern uint64_t ASSETCHAINS_TIMELOCKGTE;
extern string randomSietchZaddr();
AsyncRPCOperation_shieldcoinbase::AsyncRPCOperation_shieldcoinbase(
TransactionBuilder builder,
@@ -229,6 +230,17 @@ bool ShieldToAddress::operator()(const libzcash::SaplingPaymentAddress &zaddr) c
// Send all value to the target z-addr
m_op->builder_.SendChangeTo(zaddr, ovk);
// Sietchified Shielding of Coinbase Funds
// Add Sietch zouts so it's unclear which zout contains value :)
// This reduces metadata leakage of coinbase t=>z tx's
CAmount amount = 0;
auto zdust1 = DecodePaymentAddress(randomSietchZaddr());
auto zdust2 = DecodePaymentAddress(randomSietchZaddr());
auto sietchZout1 = boost::get<libzcash::SaplingPaymentAddress>(zdust1);
auto sietchZout2 = boost::get<libzcash::SaplingPaymentAddress>(zdust2);
m_op->builder_.AddSaplingOutput(ovk, sietchZout1, amount);
m_op->builder_.AddSaplingOutput(ovk, sietchZout2, amount);
// Build the transaction
auto maybe_tx = m_op->builder_.Build();
if (!maybe_tx) {

View File

@@ -201,7 +201,7 @@ UniValue importprivkey(const UniValue& params, bool fHelp, const CPubKey& mypk)
"3. rescan (boolean, optional, default=true) Rescan the wallet for transactions\n"
"4. height (integer, optional, default=0) start at block height?\n"
"5. secret_key (integer, optional, default=188) decimal value used to import WIFs of other coins\n"
"\nNote: This call can take minutes to complete if rescan is true.\n"
"\nNote: This call can take a long time to complete if rescan is true.\n"
"\nExamples:\n"
"\nDump a private key\n"
+ HelpExampleCli("dumpprivkey", "\"myaddress\"") +
@@ -295,7 +295,7 @@ UniValue importaddress(const UniValue& params, bool fHelp, const CPubKey& mypk)
"1. \"address\" (string, required) The address\n"
"2. \"label\" (string, optional, default=\"\") An optional label\n"
"3. rescan (boolean, optional, default=true) Rescan the wallet for transactions\n"
"\nNote: This call can take minutes to complete if rescan is true.\n"
"\nNote: This call can take a long time to complete if rescan is true.\n"
"\nExamples:\n"
"\nImport an address with rescan\n"
+ HelpExampleCli("importaddress", "\"myaddress\"") +
@@ -749,7 +749,7 @@ UniValue z_importkey(const UniValue& params, bool fHelp, const CPubKey& mypk)
"1. \"zkey\" (string, required) The zkey (see z_exportkey)\n"
"2. rescan (string, optional, default=\"whenkeyisnew\") Rescan the wallet for transactions - can be \"yes\", \"no\" or \"whenkeyisnew\"\n"
"3. startHeight (numeric, optional, default=0) Block height to start rescan from\n"
"\nNote: This call can take minutes to complete if rescan is true.\n"
"\nNote: This call can take a long time to complete if rescan is true.\n"
"\nExamples:\n"
"\nExport a zkey\n"
+ HelpExampleCli("z_exportkey", "\"myaddress\"") +
@@ -841,7 +841,7 @@ UniValue z_importviewingkey(const UniValue& params, bool fHelp, const CPubKey& m
"2. rescan (string, optional, default=\"whenkeyisnew\") Rescan the wallet for transactions - can be \"yes\", \"no\" or \"whenkeyisnew\"\n"
"3. startHeight (numeric, optional, default=0) Block height to start rescan from\n"
"4. zaddr (string, optional, default=\"\") zaddr in case of importing viewing key for Sapling\n"
"\nNote: This call can take minutes to complete if rescan is true.\n"
"\nNote: This call can take a long time to complete if rescan is true.\n"
"\nExamples:\n"
"\nImport a viewing key\n"
+ HelpExampleCli("z_importviewingkey", "\"vkey\"") +