Generate information for root regular/master.

This commit is contained in:
Arthur Britto
2012-05-10 15:50:58 -07:00
parent 5097eab666
commit 9a7e7b961c

View File

@@ -106,16 +106,64 @@ void Application::run()
//
mConnectionPool.start();
// New stuff.
NewcoinAddress rootSeedMaster;
NewcoinAddress rootSeedRegular;
NewcoinAddress rootGeneratorMaster;
NewcoinAddress rootGeneratorRegular;
NewcoinAddress reservedPublicRegular;
NewcoinAddress reservedPrivateRegular;
NewcoinAddress rootAddress;
rootSeedMaster.setFamilySeed(CKey::PassPhraseToKey("Master passphrase."));
rootSeedRegular.setFamilySeed(CKey::PassPhraseToKey("Regular passphrase."));
std::cerr << "Master seed: " << rootSeedMaster.humanFamilySeed() << std::endl;
std::cerr << "Regular seed: " << rootSeedRegular.humanFamilySeed() << std::endl;
rootGeneratorMaster.setFamilyGenerator(rootSeedMaster);
rootGeneratorRegular.setFamilyGenerator(rootSeedRegular);
std::cerr << "Master generator: " << rootGeneratorMaster.humanFamilyGenerator() << std::endl;
std::cerr << "Regular generator: " << rootGeneratorRegular.humanFamilyGenerator() << std::endl;
rootAddress.setAccountPublic(rootGeneratorMaster, 0);
std::cerr << "Regular address: " << rootAddress.humanAccountPublic() << std::endl;
reservedPublicRegular.setAccountPublic(rootGeneratorRegular, -1);
reservedPrivateRegular.setAccountPrivate(rootGeneratorRegular, rootSeedRegular, -1);
std::cerr << "Reserved public regular: " << reservedPublicRegular.humanAccountPublic() << std::endl;
std::cerr << "Reserved private regular: " << reservedPrivateRegular.humanAccountPrivate() << std::endl;
// hash of regular account #reserved public key.
uint160 uiGeneratorID = reservedPublicRegular.getAccountID();
// std::cerr << "uiGeneratorID: " << uiGeneratorID << std::endl;
// Encrypt with regular account #reserved private key.
std::vector<unsigned char> vucGeneratorCipher = reservedPrivateRegular.accountPrivateEncrypt(reservedPublicRegular, rootGeneratorMaster.getFamilyGenerator());
std::cerr << "Plain: " << strHex(rootGeneratorMaster.getFamilyGenerator()) << std::endl;
std::cerr << "Cipher: " << strHex(vucGeneratorCipher) << std::endl;
std::vector<unsigned char> vucGeneratorText = reservedPrivateRegular.accountPrivateDecrypt(reservedPublicRegular, vucGeneratorCipher);
std::cerr << "Plain: " << strHex(vucGeneratorText) << std::endl;
// Temporary root account will be ["This is my payphrase."]:0
NewcoinAddress rootFamilySeed; // Hold the 128 password.
NewcoinAddress rootFamilyGenerator; // Hold the generator.
NewcoinAddress rootAddress;
// NewcoinAddress rootAddress;
rootFamilySeed.setFamilySeed(CKey::PassPhraseToKey("This is my payphrase."));
rootFamilyGenerator.setFamilyGenerator(rootFamilySeed);
rootAddress.setAccountPublic(rootFamilyGenerator, 0);
std::cerr << "Root account: " << rootAddress.humanAccountID() << std::endl;
Ledger::pointer firstLedger = boost::make_shared<Ledger>(rootAddress, 100000000);
assert(!!firstLedger->getAccountState(rootAddress));
firstLedger->updateHash();