diff --git a/configure.ac b/configure.ac index 94d70e44d1..3878c751a1 100644 --- a/configure.ac +++ b/configure.ac @@ -1,7 +1,7 @@ dnl require autoconf 2.60 (AS_ECHO/AS_ECHO_N) AC_PREREQ([2.60]) define(_CLIENT_VERSION_MAJOR, 4) -define(_CLIENT_VERSION_MINOR, 1) +define(_CLIENT_VERSION_MINOR, 2) define(_CLIENT_VERSION_REVISION, 0) define(_CLIENT_VERSION_BUILD, 0) define(_CLIENT_VERSION_IS_RELEASE, true) diff --git a/src/qt/assetsdialog.cpp b/src/qt/assetsdialog.cpp index 0111dc24b9..c731a3ceac 100644 --- a/src/qt/assetsdialog.cpp +++ b/src/qt/assetsdialog.cpp @@ -366,7 +366,7 @@ void AssetsDialog::on_sendButton_clicked() std::vector< std::pair >vTransfers; for (auto recipient : recipients) { - vTransfers.emplace_back(std::make_pair(CAssetTransfer(recipient.assetName.toStdString(), recipient.amount), recipient.address.toStdString())); + vTransfers.emplace_back(std::make_pair(CAssetTransfer(recipient.assetName.toStdString(), recipient.amount, DecodeAssetData(recipient.message.toStdString()), 0), recipient.address.toStdString())); } // Always use a CCoinControl instance, use the AssetControlDialog instance if CoinControl has been enabled diff --git a/src/qt/sendassetsentry.cpp b/src/qt/sendassetsentry.cpp index 03aa73bd82..7eab846f74 100644 --- a/src/qt/sendassetsentry.cpp +++ b/src/qt/sendassetsentry.cpp @@ -303,7 +303,7 @@ SendAssetsRecipient SendAssetsEntry::getValue() recipient.address = ui->payTo->text(); recipient.label = ui->addAsLabel->text(); recipient.amount = ui->payAssetAmount->value(); - recipient.message = ui->messageTextLabel->text(); + recipient.message = ui->memoBox->text(); return recipient; } diff --git a/src/rpc/rawtransaction.cpp b/src/rpc/rawtransaction.cpp index 2c36f36aa7..986a326980 100644 --- a/src/rpc/rawtransaction.cpp +++ b/src/rpc/rawtransaction.cpp @@ -1625,7 +1625,7 @@ UniValue decodescript(const JSONRPCRequest& request) r.push_back(Pair("asset_name", transfer.strName)); r.push_back(Pair("amount", ValueFromAmount(transfer.nAmount))); if (!transfer.message.empty()) - r.push_back(Pair("message", transfer.message)); + r.push_back(Pair("message", EncodeAssetData(transfer.message))); if (transfer.nExpireTime) r.push_back(Pair("expire_time", transfer.nExpireTime)); diff --git a/src/version.h b/src/version.h index d825e8d1a9..8fbd3508d5 100644 --- a/src/version.h +++ b/src/version.h @@ -13,12 +13,12 @@ // Update these four values on every release cycle // These values should match the values in configure.ac // Used for checking the Ravencoin releases on github -static const std::string SOFTWARE_VERSION = "v4.1.0"; +static const std::string SOFTWARE_VERSION = "v4.2.0"; static const int MAIN_SOFTWARE_VERSION = 4; -static const int SECOND_SOFTWARE_VERSION = 1; +static const int SECOND_SOFTWARE_VERSION = 2; static const int THIRD_SOFTWARE_VERSION = 0; -static const int PROTOCOL_VERSION = 70027; +static const int PROTOCOL_VERSION = 70028; //! initial proto version, to be increased after version/verack negotiation static const int INIT_PROTO_VERSION = 209; diff --git a/src/wallet/rpcdump.cpp b/src/wallet/rpcdump.cpp index 086a67547e..1c6f3598b9 100644 --- a/src/wallet/rpcdump.cpp +++ b/src/wallet/rpcdump.cpp @@ -669,7 +669,14 @@ UniValue dumpwallet(const JSONRPCRequest& request) CRavenExtKey b58extkey; b58extkey.SetKey(masterKey); + CExtPubKey pubkey; + pubkey = masterKey.Neuter(); + + CRavenExtPubKey b58extpubkey; + b58extpubkey.SetKey(pubkey); + file << "# extended private masterkey: " << b58extkey.ToString() << "\n\n"; + file << "# extended public masterkey: " << b58extpubkey.ToString() << "\n\n"; } } @@ -690,7 +697,14 @@ UniValue dumpwallet(const JSONRPCRequest& request) CRavenExtKey b58extkey; b58extkey.SetKey(masterKey); + CExtPubKey pubkey; + pubkey = masterKey.Neuter(); + + CRavenExtPubKey b58extpubkey; + b58extpubkey.SetKey(pubkey); + file << "# extended private masterkey: " << b58extkey.ToString() << "\n\n"; + file << "# extended public masterkey: " << b58extpubkey.ToString() << "\n\n"; file << "# HD seed: " << HexStr(vchSeed) << "\n"; file << "# mnemonic: " << std::string(vchWords.begin(), vchWords.end()).c_str() << "\n"; @@ -729,6 +743,154 @@ UniValue dumpwallet(const JSONRPCRequest& request) return reply; } +UniValue getmasterkeyinfo(const JSONRPCRequest& request) +{ + CWallet * const pwallet = GetWalletForJSONRPCRequest(request); + if (!EnsureWalletIsAvailable(pwallet, request.fHelp)) { + return NullUniValue; + } + + if (request.fHelp || request.params.size() != 0) + throw std::runtime_error( + "getmasterkeyinfo\n" + "\nFetches and displays the master private key and the master public key.\n" + "\nResult:\n" + "{ (json object)\n" + " \"bip32_root_private\" : (string) extended master private key,\n" + " \"bip32_root_public\" : (string) extended master public key,\n" + " \"account_derivation_path\" : (string) The derivation path to the account public/private keys\n" + " \"account_extended_private_key\" : (string) extended account private key,\n" + " \"account_extended_public_key\" : (string) extended account public key,\n" + "}\n" + "\nExamples:\n" + + HelpExampleCli("getmasterkeyinfo", "") + + HelpExampleRpc("getmasterkeyinfo", "") + ); + + LOCK2(cs_main, pwallet->cs_wallet); + + EnsureWalletIsUnlocked(pwallet); + + UniValue ret(UniValue::VOBJ); + + // add the base58check encoded extended master if the wallet uses HD + CKeyID seed_id = pwallet->GetHDChain().seed_id; + if (!seed_id.IsNull()) + { + + if (!pwallet->GetHDChain().IsBip44()) { + CKey seed; + if (pwallet->GetKey(seed_id, seed)) { + + // Create the master key + CExtKey masterKey; + masterKey.SetSeed(seed.begin(), seed.size());; + + // Get the Raven Ext Key from the master key + CRavenExtKey b58extkey; + b58extkey.SetKey(masterKey); + + // Get the public key from the master key + CExtPubKey pubkey; + pubkey = masterKey.Neuter(); + + // Get the Raven Ext Key from the public key + CRavenExtPubKey b58extpubkey; + b58extpubkey.SetKey(pubkey); + + // Add the private and public key to the output + ret.push_back(std::make_pair("bip32_root_private", b58extkey.ToString())); + ret.push_back(std::make_pair("bip32_root_public", b58extpubkey.ToString())); + ret.push_back(std::make_pair("account_derivation_path", "m/0'")); + + CExtKey accountKey; + // derive m/account' + masterKey.Derive(accountKey, 0 | 0x80000000); + + // Create the account public key from the account private key + CExtPubKey account_extended_public_key; + account_extended_public_key = accountKey.Neuter(); + + // Create the Raven Account Ext Private Key + CRavenExtKey b58accountextprivatekey; + b58accountextprivatekey.SetKey(accountKey); + + // Create the Raven Account Ext Public Key + CRavenExtPubKey b58actextpubkey; + b58actextpubkey.SetKey(account_extended_public_key); + + // Add the account extended public and private keys to the return + ret.push_back(std::make_pair("account_extended_private_key", b58accountextprivatekey.ToString())); + ret.push_back(std::make_pair("account_extended_public_key", b58actextpubkey.ToString())); + + } + } + + if(pwallet->GetHDChain().IsBip44()) + { + CWalletDB walletdb(pwallet->GetDBHandle()); + + std::vector vchWords; + std::vector vchPassphrase; + std::vector vchSeed; + uint256 hash; + + pwallet->GetBip39Data(hash, vchWords, vchPassphrase, vchSeed); + + // Create the master key + CExtKey masterKey; + masterKey.SetSeed(vchSeed.data(), vchSeed.size()); + + // Get the Raven Ext Key from the master key + CRavenExtKey b58extkey; + b58extkey.SetKey(masterKey); + + // Get the public key from the master key + CExtPubKey pubkey; + pubkey = masterKey.Neuter(); + + // Get the Raven Ext Key from the public key + CRavenExtPubKey b58extpubkey; + b58extpubkey.SetKey(pubkey); + + // Add the private and public key to the output + ret.push_back(std::make_pair("bip32_root_private", b58extkey.ToString())); + ret.push_back(std::make_pair("bip32_root_public", b58extpubkey.ToString())); + std::string path = strprintf("m/44'/%d'/%d'", GetParams().ExtCoinType(), 0); + ret.push_back(std::make_pair("account_derivation_path", path)); + + // Lets generate the account private and public keys + CExtKey purposeKey; + CExtKey coinTypeKey; + CExtKey accountKey; + // derive m/purpose' + masterKey.Derive(purposeKey, 44 | 0x80000000); + // derive m/purpose'/coin_type' + purposeKey.Derive(coinTypeKey, GetParams().ExtCoinType() | 0x80000000); + // derive m/purpose'/coin_type'/account' + coinTypeKey.Derive(accountKey, 0 | 0x80000000); + + // Create the account public key from the account private key + CExtPubKey account_extended_public_key; + account_extended_public_key = accountKey.Neuter(); + + // Create the Raven Account Ext Private Key + CRavenExtKey b58accountextprivatekey; + b58accountextprivatekey.SetKey(accountKey); + + // Create the Raven Account Ext Public Key + CRavenExtPubKey b58actextpubkey; + b58actextpubkey.SetKey(account_extended_public_key); + + // Add the account extended public and private keys to the return + ret.push_back(std::make_pair("account_extended_private_key", b58accountextprivatekey.ToString())); + ret.push_back(std::make_pair("account_extended_public_key", b58actextpubkey.ToString())); + } + } + + return ret; +} + UniValue ProcessImport(CWallet * const pwallet, const UniValue& data, const int64_t timestamp) { diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp index 38fc3f4993..6b9730eeeb 100644 --- a/src/wallet/rpcwallet.cpp +++ b/src/wallet/rpcwallet.cpp @@ -3514,6 +3514,7 @@ extern UniValue importprivkey(const JSONRPCRequest& request); extern UniValue importaddress(const JSONRPCRequest& request); extern UniValue importpubkey(const JSONRPCRequest& request); extern UniValue dumpwallet(const JSONRPCRequest& request); +extern UniValue getmasterkeyinfo(const JSONRPCRequest& request); extern UniValue importwallet(const JSONRPCRequest& request); extern UniValue importprunedfunds(const JSONRPCRequest& request); extern UniValue removeprunedfunds(const JSONRPCRequest& request); @@ -3538,7 +3539,8 @@ static const CRPCCommand commands[] = { "wallet", "getaccount", &getaccount, {"address"} }, { "wallet", "getaddressesbyaccount", &getaddressesbyaccount, {"account"} }, { "wallet", "getbalance", &getbalance, {"account","minconf","include_watchonly"} }, - { "wallet", "getmywords", &getmywords, {} }, + { "wallet", "getmasterkeyinfo", &getmasterkeyinfo, {} }, + { "wallet", "getmywords", &getmywords, {} }, { "wallet", "getnewaddress", &getnewaddress, {"account"} }, { "wallet", "getrawchangeaddress", &getrawchangeaddress, {} }, { "wallet", "getreceivedbyaccount", &getreceivedbyaccount, {"account","minconf"} },