mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
Get rid of word Family from NewcoinAddress routines.
This commit is contained in:
@@ -107,7 +107,7 @@ void Application::run()
|
||||
NewcoinAddress rootAddress = NewcoinAddress::createAccountPublic(rootGeneratorMaster, 0);
|
||||
|
||||
// Print enough information to be able to claim root account.
|
||||
std::cerr << "Root master seed: " << rootSeedMaster.humanFamilySeed() << std::endl;
|
||||
std::cerr << "Root master seed: " << rootSeedMaster.humanSeed() << std::endl;
|
||||
std::cerr << "Root account: " << rootAddress.humanAccountID() << std::endl;
|
||||
|
||||
Ledger::pointer firstLedger = boost::make_shared<Ledger>(rootAddress, SYSTEM_CURRENCY_START);
|
||||
|
||||
@@ -180,7 +180,7 @@ void Config::load()
|
||||
RPC_ALLOW_REMOTE = boost::lexical_cast<bool>(strTemp);
|
||||
|
||||
if (sectionSingleB(secConfig, SECTION_VALIDATION_SEED, strTemp))
|
||||
VALIDATION_SEED.setFamilySeedGeneric(strTemp);
|
||||
VALIDATION_SEED.setSeedGeneric(strTemp);
|
||||
|
||||
(void) sectionSingleB(secConfig, SECTION_PEER_SSL_CIPHER_LIST, PEER_SSL_CIPHER_LIST);
|
||||
if (sectionSingleB(secConfig, SECTION_PEER_SCAN_INTERVAL_MIN, strTemp))
|
||||
|
||||
@@ -158,7 +158,7 @@ static BIGNUM* makeHash(const NewcoinAddress& pubGen, int seq, BIGNUM* order)
|
||||
do
|
||||
{
|
||||
Serializer s((33*8+32+32)/8);
|
||||
s.addRaw(pubGen.getFamilyGenerator());
|
||||
s.addRaw(pubGen.getGenerator());
|
||||
s.add32(seq);
|
||||
s.add32(subSeq++);
|
||||
uint256 root=s.getSHA512Half();
|
||||
@@ -173,7 +173,7 @@ static BIGNUM* makeHash(const NewcoinAddress& pubGen, int seq, BIGNUM* order)
|
||||
// --> public generator
|
||||
EC_KEY* CKey::GeneratePublicDeterministicKey(const NewcoinAddress& pubGen, int seq)
|
||||
{ // publicKey(n) = rootPublicKey EC_POINT_+ Hash(pubHash|seq)*point
|
||||
EC_KEY* rootKey = CKey::GenerateRootPubKey(pubGen.getFamilyGeneratorBN());
|
||||
EC_KEY* rootKey = CKey::GenerateRootPubKey(pubGen.getGeneratorBN());
|
||||
const EC_POINT* rootPubKey = EC_KEY_get0_public_key(rootKey);
|
||||
BN_CTX* ctx = BN_CTX_new();
|
||||
EC_KEY* pkey = EC_KEY_new_by_curve_name(NID_secp256k1);
|
||||
|
||||
@@ -60,7 +60,7 @@ void NewcoinAddress::clear()
|
||||
|
||||
NewcoinAddress NewcoinAddress::createNodePublic(const NewcoinAddress& naSeed)
|
||||
{
|
||||
CKey ckSeed(naSeed.getFamilySeed());
|
||||
CKey ckSeed(naSeed.getSeed());
|
||||
NewcoinAddress naNew;
|
||||
|
||||
// YYY Should there be a GetPubKey() equiv that returns a uint256?
|
||||
@@ -163,7 +163,7 @@ NewcoinAddress NewcoinAddress::createNodePrivate(const NewcoinAddress& naSeed)
|
||||
{
|
||||
uint256 uPrivKey;
|
||||
NewcoinAddress naNew;
|
||||
CKey ckSeed(naSeed.getFamilySeed());
|
||||
CKey ckSeed(naSeed.getSeed());
|
||||
|
||||
ckSeed.GetPrivateKeyU(uPrivKey);
|
||||
|
||||
@@ -445,7 +445,7 @@ void NewcoinAddress::setAccountPrivate(uint256 hash256)
|
||||
|
||||
void NewcoinAddress::setAccountPrivate(const NewcoinAddress& naGenerator, const NewcoinAddress& naSeed, int seq)
|
||||
{
|
||||
CKey ckPubkey = CKey(naSeed.getFamilySeed());
|
||||
CKey ckPubkey = CKey(naSeed.getSeed());
|
||||
CKey ckPrivkey = CKey(naGenerator, ckPubkey.GetSecretBN(), seq);
|
||||
uint256 uPrivKey;
|
||||
|
||||
@@ -557,10 +557,10 @@ std::vector<unsigned char> NewcoinAddress::accountPrivateDecrypt(const NewcoinAd
|
||||
}
|
||||
|
||||
//
|
||||
// Family Generators
|
||||
// Generators
|
||||
//
|
||||
|
||||
BIGNUM* NewcoinAddress::getFamilyGeneratorBN() const
|
||||
BIGNUM* NewcoinAddress::getGeneratorBN() const
|
||||
{ // returns the public generator
|
||||
switch (nVersion) {
|
||||
case VER_NONE:
|
||||
@@ -579,7 +579,7 @@ BIGNUM* NewcoinAddress::getFamilyGeneratorBN() const
|
||||
return ret;
|
||||
}
|
||||
|
||||
const std::vector<unsigned char>& NewcoinAddress::getFamilyGenerator() const
|
||||
const std::vector<unsigned char>& NewcoinAddress::getGenerator() const
|
||||
{ // returns the public generator
|
||||
switch (nVersion) {
|
||||
case VER_NONE:
|
||||
@@ -594,7 +594,7 @@ const std::vector<unsigned char>& NewcoinAddress::getFamilyGenerator() const
|
||||
}
|
||||
}
|
||||
|
||||
std::string NewcoinAddress::humanFamilyGenerator() const
|
||||
std::string NewcoinAddress::humanGenerator() const
|
||||
{
|
||||
switch (nVersion) {
|
||||
case VER_NONE:
|
||||
@@ -608,31 +608,31 @@ std::string NewcoinAddress::humanFamilyGenerator() const
|
||||
}
|
||||
}
|
||||
|
||||
bool NewcoinAddress::setFamilyGenerator(const std::string& strGenerator)
|
||||
bool NewcoinAddress::setGenerator(const std::string& strGenerator)
|
||||
{
|
||||
return SetString(strGenerator.c_str(), VER_FAMILY_GENERATOR);
|
||||
}
|
||||
|
||||
void NewcoinAddress::setFamilyGenerator(const std::vector<unsigned char>& vPublic)
|
||||
void NewcoinAddress::setGenerator(const std::vector<unsigned char>& vPublic)
|
||||
{
|
||||
SetData(VER_FAMILY_GENERATOR, vPublic);
|
||||
}
|
||||
|
||||
NewcoinAddress NewcoinAddress::createGeneratorPublic(const NewcoinAddress& naSeed)
|
||||
{
|
||||
CKey ckSeed(naSeed.getFamilySeed());
|
||||
CKey ckSeed(naSeed.getSeed());
|
||||
NewcoinAddress naNew;
|
||||
|
||||
naNew.setFamilyGenerator(ckSeed.GetPubKey());
|
||||
naNew.setGenerator(ckSeed.GetPubKey());
|
||||
|
||||
return naNew;
|
||||
}
|
||||
|
||||
//
|
||||
// Family Seed
|
||||
// Seed
|
||||
//
|
||||
|
||||
uint128 NewcoinAddress::getFamilySeed() const
|
||||
uint128 NewcoinAddress::getSeed() const
|
||||
{
|
||||
switch (nVersion) {
|
||||
case VER_NONE:
|
||||
@@ -646,7 +646,7 @@ uint128 NewcoinAddress::getFamilySeed() const
|
||||
}
|
||||
}
|
||||
|
||||
std::string NewcoinAddress::humanFamilySeed1751() const
|
||||
std::string NewcoinAddress::humanSeed1751() const
|
||||
{
|
||||
switch (nVersion) {
|
||||
case VER_NONE:
|
||||
@@ -657,7 +657,7 @@ std::string NewcoinAddress::humanFamilySeed1751() const
|
||||
std::string strHuman;
|
||||
std::string strLittle;
|
||||
std::string strBig;
|
||||
uint128 uSeed = getFamilySeed();
|
||||
uint128 uSeed = getSeed();
|
||||
|
||||
strLittle.assign(uSeed.begin(), uSeed.end());
|
||||
|
||||
@@ -673,7 +673,7 @@ std::string NewcoinAddress::humanFamilySeed1751() const
|
||||
}
|
||||
}
|
||||
|
||||
std::string NewcoinAddress::humanFamilySeed() const
|
||||
std::string NewcoinAddress::humanSeed() const
|
||||
{
|
||||
switch (nVersion) {
|
||||
case VER_NONE:
|
||||
@@ -687,7 +687,7 @@ std::string NewcoinAddress::humanFamilySeed() const
|
||||
}
|
||||
}
|
||||
|
||||
int NewcoinAddress::setFamilySeed1751(const std::string& strHuman1751)
|
||||
int NewcoinAddress::setSeed1751(const std::string& strHuman1751)
|
||||
{
|
||||
std::string strKey;
|
||||
int iResult = eng2key(strKey, strHuman1751);
|
||||
@@ -697,18 +697,18 @@ int NewcoinAddress::setFamilySeed1751(const std::string& strHuman1751)
|
||||
std::vector<unsigned char> vchLittle(strKey.rbegin(), strKey.rend());
|
||||
uint128 uSeed(vchLittle);
|
||||
|
||||
setFamilySeed(uSeed);
|
||||
setSeed(uSeed);
|
||||
}
|
||||
|
||||
return iResult;
|
||||
}
|
||||
|
||||
bool NewcoinAddress::setFamilySeed(const std::string& strSeed)
|
||||
bool NewcoinAddress::setSeed(const std::string& strSeed)
|
||||
{
|
||||
return SetString(strSeed.c_str(), VER_FAMILY_SEED);
|
||||
}
|
||||
|
||||
bool NewcoinAddress::setFamilySeedGeneric(const std::string& strText)
|
||||
bool NewcoinAddress::setSeedGeneric(const std::string& strText)
|
||||
{
|
||||
NewcoinAddress naTemp;
|
||||
bool bResult = true;
|
||||
@@ -720,12 +720,12 @@ bool NewcoinAddress::setFamilySeedGeneric(const std::string& strText)
|
||||
{
|
||||
bResult = false;
|
||||
}
|
||||
else if (setFamilySeed(strText))
|
||||
else if (setSeed(strText))
|
||||
{
|
||||
// std::cerr << "Recognized seed." << std::endl;
|
||||
nothing();
|
||||
}
|
||||
else if (1 == setFamilySeed1751(strText))
|
||||
else if (1 == setSeed1751(strText))
|
||||
{
|
||||
// std::cerr << "Recognized 1751 seed." << std::endl;
|
||||
nothing();
|
||||
@@ -733,31 +733,31 @@ bool NewcoinAddress::setFamilySeedGeneric(const std::string& strText)
|
||||
else
|
||||
{
|
||||
// std::cerr << "Creating seed from pass phrase." << std::endl;
|
||||
setFamilySeed(CKey::PassPhraseToKey(strText));
|
||||
setSeed(CKey::PassPhraseToKey(strText));
|
||||
}
|
||||
|
||||
return bResult;
|
||||
}
|
||||
|
||||
void NewcoinAddress::setFamilySeed(uint128 hash128) {
|
||||
void NewcoinAddress::setSeed(uint128 hash128) {
|
||||
SetData(VER_FAMILY_SEED, hash128.begin(), 16);
|
||||
}
|
||||
|
||||
void NewcoinAddress::setFamilySeedRandom()
|
||||
void NewcoinAddress::setSeedRandom()
|
||||
{
|
||||
// XXX Maybe we should call MakeNewKey
|
||||
uint128 key;
|
||||
|
||||
RAND_bytes((unsigned char *) &key, sizeof(key));
|
||||
|
||||
NewcoinAddress::setFamilySeed(key);
|
||||
NewcoinAddress::setSeed(key);
|
||||
}
|
||||
|
||||
NewcoinAddress NewcoinAddress::createSeedRandom()
|
||||
{
|
||||
NewcoinAddress naNew;
|
||||
|
||||
naNew.setFamilySeedRandom();
|
||||
naNew.setSeedRandom();
|
||||
|
||||
return naNew;
|
||||
}
|
||||
@@ -766,7 +766,7 @@ NewcoinAddress NewcoinAddress::createSeedGeneric(const std::string& strText)
|
||||
{
|
||||
NewcoinAddress naNew;
|
||||
|
||||
naNew.setFamilySeedGeneric(strText);
|
||||
naNew.setSeedGeneric(strText);
|
||||
|
||||
return naNew;
|
||||
}
|
||||
@@ -778,8 +778,8 @@ BOOST_AUTO_TEST_CASE( check_crypto )
|
||||
// Construct a seed.
|
||||
NewcoinAddress naSeed;
|
||||
|
||||
BOOST_CHECK(naSeed.setFamilySeedGeneric("masterpassphrase"));
|
||||
BOOST_CHECK_MESSAGE(naSeed.humanFamilySeed() == "snoPBiXtMeMyMHUVTgbuqAfg1SUTb", naSeed.humanFamilySeed());
|
||||
BOOST_CHECK(naSeed.setSeedGeneric("masterpassphrase"));
|
||||
BOOST_CHECK_MESSAGE(naSeed.humanSeed() == "snoPBiXtMeMyMHUVTgbuqAfg1SUTb", naSeed.humanSeed());
|
||||
|
||||
// Create node public/private key pair
|
||||
NewcoinAddress naNodePublic = NewcoinAddress::createNodePublic(naSeed);
|
||||
@@ -799,7 +799,7 @@ BOOST_AUTO_TEST_CASE( check_crypto )
|
||||
// Construct a public generator from the seed.
|
||||
NewcoinAddress naGenerator = NewcoinAddress::createGeneratorPublic(naSeed);
|
||||
|
||||
BOOST_CHECK_MESSAGE(naGenerator.humanFamilyGenerator() == "fhuJKihSDzV2SkjLn9qbwm5AaRmixDPfFsHDCP6yfDZWcxDFz4mt", naGenerator.humanFamilyGenerator());
|
||||
BOOST_CHECK_MESSAGE(naGenerator.humanGenerator() == "fhuJKihSDzV2SkjLn9qbwm5AaRmixDPfFsHDCP6yfDZWcxDFz4mt", naGenerator.humanGenerator());
|
||||
|
||||
// Create account #0 public/private key pair.
|
||||
NewcoinAddress naAccountPublic0 = NewcoinAddress::createAccountPublic(naGenerator, 0);
|
||||
|
||||
@@ -141,34 +141,34 @@ public:
|
||||
}
|
||||
|
||||
//
|
||||
// Family Generators
|
||||
// Generators
|
||||
// Use to generate a master or regular family.
|
||||
//
|
||||
BIGNUM* getFamilyGeneratorBN() const; // DEPRECATED
|
||||
const std::vector<unsigned char>& getFamilyGenerator() const;
|
||||
BIGNUM* getGeneratorBN() const; // DEPRECATED
|
||||
const std::vector<unsigned char>& getGenerator() const;
|
||||
|
||||
std::string humanFamilyGenerator() const;
|
||||
std::string humanGenerator() const;
|
||||
|
||||
bool setFamilyGenerator(const std::string& strGenerator);
|
||||
void setFamilyGenerator(const std::vector<unsigned char>& vPublic);
|
||||
// void setFamilyGenerator(const NewcoinAddress& seed);
|
||||
bool setGenerator(const std::string& strGenerator);
|
||||
void setGenerator(const std::vector<unsigned char>& vPublic);
|
||||
// void setGenerator(const NewcoinAddress& seed);
|
||||
|
||||
// Create generator for making public deterministic keys.
|
||||
static NewcoinAddress createGeneratorPublic(const NewcoinAddress& naSeed);
|
||||
|
||||
//
|
||||
// Family Seeds
|
||||
// Seeds
|
||||
// Clients must disallow reconizable entries from being seeds.
|
||||
uint128 getFamilySeed() const;
|
||||
uint128 getSeed() const;
|
||||
|
||||
std::string humanFamilySeed() const;
|
||||
std::string humanFamilySeed1751() const;
|
||||
std::string humanSeed() const;
|
||||
std::string humanSeed1751() const;
|
||||
|
||||
bool setFamilySeed(const std::string& strSeed);
|
||||
int setFamilySeed1751(const std::string& strHuman1751);
|
||||
bool setFamilySeedGeneric(const std::string& strText);
|
||||
void setFamilySeed(uint128 hash128);
|
||||
void setFamilySeedRandom();
|
||||
bool setSeed(const std::string& strSeed);
|
||||
int setSeed1751(const std::string& strHuman1751);
|
||||
bool setSeedGeneric(const std::string& strText);
|
||||
void setSeed(uint128 hash128);
|
||||
void setSeedRandom();
|
||||
|
||||
static NewcoinAddress createSeedRandom();
|
||||
static NewcoinAddress createSeedGeneric(const std::string& strText);
|
||||
|
||||
@@ -262,7 +262,7 @@ Json::Value RPCServer::getMasterGenerator(const uint256& uLedger, const NewcoinA
|
||||
return RPCError(rpcFAIL_GEN_DECRPYT);
|
||||
}
|
||||
|
||||
naMasterGenerator.setFamilyGenerator(vucMasterGenerator);
|
||||
naMasterGenerator.setGenerator(vucMasterGenerator);
|
||||
|
||||
return Json::Value(Json::objectValue);
|
||||
}
|
||||
@@ -362,7 +362,7 @@ Json::Value RPCServer::accountFromString(const uint256& uLedger, NewcoinAddress&
|
||||
bIndex = false;
|
||||
}
|
||||
// Must be a seed.
|
||||
else if (!naSeed.setFamilySeedGeneric(strIdent))
|
||||
else if (!naSeed.setSeedGeneric(strIdent))
|
||||
{
|
||||
return RPCError(rpcBAD_SEED);
|
||||
}
|
||||
@@ -395,7 +395,7 @@ Json::Value RPCServer::accountFromString(const uint256& uLedger, NewcoinAddress&
|
||||
RPCError(rpcNO_GEN_DECRPYT);
|
||||
}
|
||||
|
||||
naGenerator.setFamilyGenerator(vucMasterGenerator);
|
||||
naGenerator.setGenerator(vucMasterGenerator);
|
||||
}
|
||||
|
||||
bIndex = !iIndex;
|
||||
@@ -413,7 +413,7 @@ Json::Value RPCServer::doAccountEmailSet(Json::Value ¶ms)
|
||||
NewcoinAddress naSeed;
|
||||
uint256 uLedger = mNetOps->getCurrentLedger();
|
||||
|
||||
if (!naSeed.setFamilySeedGeneric(params[0u].asString()))
|
||||
if (!naSeed.setSeedGeneric(params[0u].asString()))
|
||||
{
|
||||
return RPCError(rpcBAD_SEED);
|
||||
}
|
||||
@@ -617,7 +617,7 @@ Json::Value RPCServer::doAccountMessageSet(Json::Value& params) {
|
||||
uint256 uLedger = mNetOps->getCurrentLedger();
|
||||
NewcoinAddress naMessagePubKey;
|
||||
|
||||
if (!naSeed.setFamilySeedGeneric(params[0u].asString()))
|
||||
if (!naSeed.setSeedGeneric(params[0u].asString()))
|
||||
{
|
||||
return RPCError(rpcBAD_SEED);
|
||||
}
|
||||
@@ -668,7 +668,7 @@ Json::Value RPCServer::doAccountWalletSet(Json::Value& params) {
|
||||
NewcoinAddress naSeed;
|
||||
uint256 uLedger = mNetOps->getCurrentLedger();
|
||||
|
||||
if (!naSeed.setFamilySeedGeneric(params[0u].asString()))
|
||||
if (!naSeed.setSeedGeneric(params[0u].asString()))
|
||||
{
|
||||
return RPCError(rpcBAD_SEED);
|
||||
}
|
||||
@@ -753,7 +753,7 @@ Json::Value RPCServer::doCreditSet(Json::Value& params)
|
||||
uint256 uLedger = mNetOps->getCurrentLedger();
|
||||
uint32 uAcceptRate = params.size() >= 6 ? boost::lexical_cast<uint32>(params[5u].asString()) : 0;
|
||||
|
||||
if (!naSeed.setFamilySeedGeneric(params[0u].asString()))
|
||||
if (!naSeed.setSeedGeneric(params[0u].asString()))
|
||||
{
|
||||
return RPCError(rpcBAD_SEED);
|
||||
}
|
||||
@@ -796,7 +796,7 @@ Json::Value RPCServer::doCreditSet(Json::Value& params)
|
||||
|
||||
obj["transaction"] = trans->getSTransaction()->getJson(0);
|
||||
obj["status"] = trans->getStatus();
|
||||
obj["seed"] = naSeed.humanFamilySeed();
|
||||
obj["seed"] = naSeed.humanSeed();
|
||||
obj["srcAccountID"] = naSrcAccountID.humanAccountID();
|
||||
obj["dstAccountID"] = naDstAccountID.humanAccountID();
|
||||
obj["limitAmount"] = saLimitAmount.getText();
|
||||
@@ -897,7 +897,7 @@ Json::Value RPCServer::doNicknameSet(Json::Value& params)
|
||||
NewcoinAddress naSeed;
|
||||
uint256 uLedger = mNetOps->getCurrentLedger();
|
||||
|
||||
if (!naSeed.setFamilySeedGeneric(params[0u].asString()))
|
||||
if (!naSeed.setSeedGeneric(params[0u].asString()))
|
||||
{
|
||||
return RPCError(rpcBAD_SEED);
|
||||
}
|
||||
@@ -983,7 +983,7 @@ Json::Value RPCServer::doPasswordFund(Json::Value ¶ms)
|
||||
NewcoinAddress naSeed;
|
||||
uint256 uLedger = mNetOps->getCurrentLedger();
|
||||
|
||||
if (!naSeed.setFamilySeedGeneric(params[0u].asString()))
|
||||
if (!naSeed.setSeedGeneric(params[0u].asString()))
|
||||
{
|
||||
return RPCError(rpcBAD_SEED);
|
||||
}
|
||||
@@ -1032,12 +1032,12 @@ Json::Value RPCServer::doPasswordSet(Json::Value& params)
|
||||
NewcoinAddress naRegularSeed;
|
||||
NewcoinAddress naAccountID;
|
||||
|
||||
if (!naMasterSeed.setFamilySeedGeneric(params[0u].asString()))
|
||||
if (!naMasterSeed.setSeedGeneric(params[0u].asString()))
|
||||
{
|
||||
// Should also not allow account id's as seeds.
|
||||
return RPCError(rpcBAD_SEED);
|
||||
}
|
||||
else if (!naRegularSeed.setFamilySeedGeneric(params[1u].asString()))
|
||||
else if (!naRegularSeed.setSeedGeneric(params[1u].asString()))
|
||||
{
|
||||
// Should also not allow account id's as seeds.
|
||||
return RPCError(rpcBAD_SEED);
|
||||
@@ -1065,7 +1065,7 @@ Json::Value RPCServer::doPasswordSet(Json::Value& params)
|
||||
|
||||
// Hash of regular account #0 public key.
|
||||
// uint160 uGeneratorID = naRegular0Public.getAccountID();
|
||||
std::vector<unsigned char> vucGeneratorCipher = naRegular0Private.accountPrivateEncrypt(naRegular0Public, naMasterGenerator.getFamilyGenerator());
|
||||
std::vector<unsigned char> vucGeneratorCipher = naRegular0Private.accountPrivateEncrypt(naRegular0Public, naMasterGenerator.getGenerator());
|
||||
std::vector<unsigned char> vucGeneratorSig;
|
||||
|
||||
// Prove that we have the corresponding private key to the generator id. So, we can get the generator id.
|
||||
@@ -1108,10 +1108,10 @@ Json::Value RPCServer::doPasswordSet(Json::Value& params)
|
||||
Json::Value obj(Json::objectValue);
|
||||
|
||||
// We "echo" the seeds so they can be checked.
|
||||
obj["master_seed"] = naMasterSeed.humanFamilySeed();
|
||||
obj["master_key"] = naMasterSeed.humanFamilySeed1751();
|
||||
obj["regular_seed"] = naRegularSeed.humanFamilySeed();
|
||||
obj["regular_key"] = naRegularSeed.humanFamilySeed1751();
|
||||
obj["master_seed"] = naMasterSeed.humanSeed();
|
||||
obj["master_key"] = naMasterSeed.humanSeed1751();
|
||||
obj["regular_seed"] = naRegularSeed.humanSeed();
|
||||
obj["regular_key"] = naRegularSeed.humanSeed1751();
|
||||
|
||||
obj["transaction"] = trns->getSTransaction()->getJson(0);
|
||||
obj["status"] = trns->getStatus();
|
||||
@@ -1146,7 +1146,7 @@ Json::Value RPCServer::doSend(Json::Value& params)
|
||||
if (params.size() >= 7)
|
||||
sSrcCurrency = params[6u].asString();
|
||||
|
||||
if (!naSeed.setFamilySeedGeneric(params[0u].asString()))
|
||||
if (!naSeed.setSeedGeneric(params[0u].asString()))
|
||||
{
|
||||
return RPCError(rpcBAD_SEED);
|
||||
}
|
||||
@@ -1231,7 +1231,7 @@ Json::Value RPCServer::doSend(Json::Value& params)
|
||||
|
||||
obj["transaction"] = trans->getSTransaction()->getJson(0);
|
||||
obj["status"] = trans->getStatus();
|
||||
obj["seed"] = naSeed.humanFamilySeed();
|
||||
obj["seed"] = naSeed.humanSeed();
|
||||
obj["fee"] = saFee.getText();
|
||||
obj["create"] = bCreate;
|
||||
obj["srcAccountID"] = naSrcAccountID.humanAccountID();
|
||||
@@ -1267,7 +1267,7 @@ Json::Value RPCServer::doTransitSet(Json::Value& params)
|
||||
if (params.size() >= 8)
|
||||
sTransitExpire = params[8u].asString();
|
||||
|
||||
if (!naSeed.setFamilySeedGeneric(params[0u].asString()))
|
||||
if (!naSeed.setSeedGeneric(params[0u].asString()))
|
||||
{
|
||||
return RPCError(rpcBAD_SEED);
|
||||
}
|
||||
@@ -1306,7 +1306,7 @@ Json::Value RPCServer::doTransitSet(Json::Value& params)
|
||||
|
||||
obj["transaction"] = trans->getSTransaction()->getJson(0);
|
||||
obj["status"] = trans->getStatus();
|
||||
obj["seed"] = naSeed.humanFamilySeed();
|
||||
obj["seed"] = naSeed.humanSeed();
|
||||
obj["srcAccountID"] = naSrcAccountID.humanAccountID();
|
||||
obj["transitRate"] = uTransitRate;
|
||||
obj["transitStart"] = uTransitStart;
|
||||
@@ -1490,16 +1490,16 @@ Json::Value RPCServer::doValidationCreate(Json::Value& params) {
|
||||
{
|
||||
std::cerr << "Creating random validation seed." << std::endl;
|
||||
|
||||
naSeed.setFamilySeedRandom(); // Get a random seed.
|
||||
naSeed.setSeedRandom(); // Get a random seed.
|
||||
}
|
||||
else if (!naSeed.setFamilySeedGeneric(params[0u].asString()))
|
||||
else if (!naSeed.setSeedGeneric(params[0u].asString()))
|
||||
{
|
||||
return RPCError(rpcBAD_SEED);
|
||||
}
|
||||
|
||||
obj["validation_public_key"] = NewcoinAddress::createNodePublic(naSeed).humanNodePublic();
|
||||
obj["validation_seed"] = naSeed.humanFamilySeed();
|
||||
obj["validation_key"] = naSeed.humanFamilySeed1751();
|
||||
obj["validation_seed"] = naSeed.humanSeed();
|
||||
obj["validation_key"] = naSeed.humanSeed1751();
|
||||
|
||||
return obj;
|
||||
}
|
||||
@@ -1517,15 +1517,15 @@ Json::Value RPCServer::doValidationSeed(Json::Value& params) {
|
||||
|
||||
theConfig.VALIDATION_SEED.clear();
|
||||
}
|
||||
else if (!theConfig.VALIDATION_SEED.setFamilySeedGeneric(params[0u].asString()))
|
||||
else if (!theConfig.VALIDATION_SEED.setSeedGeneric(params[0u].asString()))
|
||||
{
|
||||
return RPCError(rpcBAD_SEED);
|
||||
}
|
||||
else
|
||||
{
|
||||
obj["validation_public_key"] = NewcoinAddress::createNodePublic(theConfig.VALIDATION_SEED).humanNodePublic();
|
||||
obj["validation_seed"] = theConfig.VALIDATION_SEED.humanFamilySeed();
|
||||
obj["validation_key"] = theConfig.VALIDATION_SEED.humanFamilySeed1751();
|
||||
obj["validation_seed"] = theConfig.VALIDATION_SEED.humanSeed();
|
||||
obj["validation_key"] = theConfig.VALIDATION_SEED.humanSeed1751();
|
||||
}
|
||||
|
||||
return obj;
|
||||
@@ -1568,7 +1568,7 @@ Json::Value RPCServer::doWalletAccounts(Json::Value& params)
|
||||
NewcoinAddress naSeed;
|
||||
uint256 uLedger = mNetOps->getCurrentLedger();
|
||||
|
||||
if (!naSeed.setFamilySeedGeneric(params[0u].asString()))
|
||||
if (!naSeed.setSeedGeneric(params[0u].asString()))
|
||||
{
|
||||
return RPCError(rpcBAD_SEED);
|
||||
}
|
||||
@@ -1611,7 +1611,7 @@ Json::Value RPCServer::doWalletAdd(Json::Value& params)
|
||||
std::string sDstCurrency;
|
||||
uint256 uLedger = mNetOps->getCurrentLedger();
|
||||
|
||||
if (!naRegularSeed.setFamilySeedGeneric(params[0u].asString()))
|
||||
if (!naRegularSeed.setSeedGeneric(params[0u].asString()))
|
||||
{
|
||||
return RPCError(rpcBAD_SEED);
|
||||
}
|
||||
@@ -1619,7 +1619,7 @@ Json::Value RPCServer::doWalletAdd(Json::Value& params)
|
||||
{
|
||||
return RPCError(rpcSRC_ACT_MALFORMED);
|
||||
}
|
||||
else if (!naMasterSeed.setFamilySeedGeneric(params[2u].asString()))
|
||||
else if (!naMasterSeed.setSeedGeneric(params[2u].asString()))
|
||||
{
|
||||
return RPCError(rpcBAD_SEED);
|
||||
}
|
||||
@@ -1712,12 +1712,12 @@ Json::Value RPCServer::doWalletClaim(Json::Value& params)
|
||||
NewcoinAddress naMasterSeed;
|
||||
NewcoinAddress naRegularSeed;
|
||||
|
||||
if (!naMasterSeed.setFamilySeedGeneric(params[0u].asString()))
|
||||
if (!naMasterSeed.setSeedGeneric(params[0u].asString()))
|
||||
{
|
||||
// Should also not allow account id's as seeds.
|
||||
return RPCError(rpcBAD_SEED);
|
||||
}
|
||||
else if (!naRegularSeed.setFamilySeedGeneric(params[1u].asString()))
|
||||
else if (!naRegularSeed.setSeedGeneric(params[1u].asString()))
|
||||
{
|
||||
// Should also not allow account id's as seeds.
|
||||
return RPCError(rpcBAD_SEED);
|
||||
@@ -1752,7 +1752,7 @@ Json::Value RPCServer::doWalletClaim(Json::Value& params)
|
||||
|
||||
// Hash of regular account #0 public key.
|
||||
uint160 uGeneratorID = naRegular0Public.getAccountID();
|
||||
std::vector<unsigned char> vucGeneratorCipher = naRegular0Private.accountPrivateEncrypt(naRegular0Public, naMasterGenerator.getFamilyGenerator());
|
||||
std::vector<unsigned char> vucGeneratorCipher = naRegular0Private.accountPrivateEncrypt(naRegular0Public, naMasterGenerator.getGenerator());
|
||||
std::vector<unsigned char> vucGeneratorSig;
|
||||
|
||||
// Prove that we have the corresponding private key to the generator id. So, we can get the generator id.
|
||||
@@ -1771,10 +1771,10 @@ Json::Value RPCServer::doWalletClaim(Json::Value& params)
|
||||
Json::Value obj(Json::objectValue);
|
||||
|
||||
// We "echo" the seeds so they can be checked.
|
||||
obj["master_seed"] = naMasterSeed.humanFamilySeed();
|
||||
obj["master_key"] = naMasterSeed.humanFamilySeed1751();
|
||||
obj["regular_seed"] = naRegularSeed.humanFamilySeed();
|
||||
obj["regular_key"] = naRegularSeed.humanFamilySeed1751();
|
||||
obj["master_seed"] = naMasterSeed.humanSeed();
|
||||
obj["master_key"] = naMasterSeed.humanSeed1751();
|
||||
obj["regular_seed"] = naRegularSeed.humanSeed();
|
||||
obj["regular_key"] = naRegularSeed.humanSeed1751();
|
||||
|
||||
obj["account_id"] = naAccountPublic.humanAccountID();
|
||||
obj["generator_id"] = strHex(uGeneratorID);
|
||||
@@ -1799,7 +1799,7 @@ Json::Value RPCServer::doWalletCreate(Json::Value& params)
|
||||
NewcoinAddress naSeed;
|
||||
uint256 uLedger = mNetOps->getCurrentLedger();
|
||||
|
||||
if (!naSeed.setFamilySeedGeneric(params[0u].asString()))
|
||||
if (!naSeed.setSeedGeneric(params[0u].asString()))
|
||||
{
|
||||
return RPCError(rpcBAD_SEED);
|
||||
}
|
||||
@@ -1858,15 +1858,15 @@ Json::Value RPCServer::doWalletPropose(Json::Value& params)
|
||||
NewcoinAddress naSeed;
|
||||
NewcoinAddress naAccount;
|
||||
|
||||
naSeed.setFamilySeedRandom();
|
||||
naSeed.setSeedRandom();
|
||||
|
||||
NewcoinAddress naGenerator = NewcoinAddress::createGeneratorPublic(naSeed);
|
||||
naAccount.setAccountPublic(naGenerator, 0);
|
||||
|
||||
Json::Value obj(Json::objectValue);
|
||||
|
||||
obj["master_seed"] = naSeed.humanFamilySeed();
|
||||
obj["master_key"] = naSeed.humanFamilySeed1751();
|
||||
obj["master_seed"] = naSeed.humanSeed();
|
||||
obj["master_key"] = naSeed.humanSeed1751();
|
||||
obj["account_id"] = naAccount.humanAccountID();
|
||||
|
||||
return obj;
|
||||
@@ -1878,7 +1878,7 @@ Json::Value RPCServer::doWalletSeed(Json::Value& params)
|
||||
NewcoinAddress naSeed;
|
||||
|
||||
if (params.size()
|
||||
&& !naSeed.setFamilySeedGeneric(params[0u].asString()))
|
||||
&& !naSeed.setSeedGeneric(params[0u].asString()))
|
||||
{
|
||||
return RPCError(rpcBAD_SEED);
|
||||
}
|
||||
@@ -1888,7 +1888,7 @@ Json::Value RPCServer::doWalletSeed(Json::Value& params)
|
||||
|
||||
if (!params.size())
|
||||
{
|
||||
naSeed.setFamilySeedRandom();
|
||||
naSeed.setSeedRandom();
|
||||
}
|
||||
|
||||
NewcoinAddress naGenerator = NewcoinAddress::createGeneratorPublic(naSeed);
|
||||
@@ -1897,8 +1897,8 @@ Json::Value RPCServer::doWalletSeed(Json::Value& params)
|
||||
|
||||
Json::Value obj(Json::objectValue);
|
||||
|
||||
obj["seed"] = naSeed.humanFamilySeed();
|
||||
obj["key"] = naSeed.humanFamilySeed1751();
|
||||
obj["seed"] = naSeed.humanSeed();
|
||||
obj["key"] = naSeed.humanSeed1751();
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user