Skip to content

Commit

Permalink
Stealth addresses
Browse files Browse the repository at this point in the history
  • Loading branch information
Bushstar committed Dec 1, 2014
1 parent be5c45b commit 5122103
Show file tree
Hide file tree
Showing 35 changed files with 2,495 additions and 227 deletions.
4 changes: 3 additions & 1 deletion deepcoin-qt.pro
Expand Up @@ -165,6 +165,7 @@ HEADERS += src/qt/bitcoingui.h \
src/db.h \ src/db.h \
src/walletdb.h \ src/walletdb.h \
src/script.h \ src/script.h \
src/stealth.h \
src/init.h \ src/init.h \
src/bloom.h \ src/bloom.h \
src/mruset.h \ src/mruset.h \
Expand Down Expand Up @@ -301,7 +302,8 @@ SOURCES += src/qt/bitcoin.cpp \
src/shavite.c \ src/shavite.c \
src/echo.c \ src/echo.c \
src/simd.c \ src/simd.c \
src/checkpointsync.cpp src/checkpointsync.cpp \
src/stealth.cpp


RESOURCES += src/qt/bitcoin.qrc RESOURCES += src/qt/bitcoin.qrc


Expand Down
2 changes: 2 additions & 0 deletions src/base58.h
Expand Up @@ -264,6 +264,7 @@ class CBitcoinAddressVisitor : public boost::static_visitor<bool>
CBitcoinAddressVisitor(CBitcoinAddress *addrIn) : addr(addrIn) { } CBitcoinAddressVisitor(CBitcoinAddress *addrIn) : addr(addrIn) { }
bool operator()(const CKeyID &id) const; bool operator()(const CKeyID &id) const;
bool operator()(const CScriptID &id) const; bool operator()(const CScriptID &id) const;
bool operator()(const CStealthAddress &stxAddr) const;
bool operator()(const CNoDestination &no) const; bool operator()(const CNoDestination &no) const;
}; };


Expand Down Expand Up @@ -392,6 +393,7 @@ class CBitcoinAddress : public CBase58Data


bool inline CBitcoinAddressVisitor::operator()(const CKeyID &id) const { return addr->Set(id); } bool inline CBitcoinAddressVisitor::operator()(const CKeyID &id) const { return addr->Set(id); }
bool inline CBitcoinAddressVisitor::operator()(const CScriptID &id) const { return addr->Set(id); } bool inline CBitcoinAddressVisitor::operator()(const CScriptID &id) const { return addr->Set(id); }
bool inline CBitcoinAddressVisitor::operator()(const CStealthAddress &stxAddr) const { return false; }
bool inline CBitcoinAddressVisitor::operator()(const CNoDestination &id) const { return false; } bool inline CBitcoinAddressVisitor::operator()(const CNoDestination &id) const { return false; }


/** A base58-encoded secret key */ /** A base58-encoded secret key */
Expand Down
8 changes: 8 additions & 0 deletions src/bitcoinrpc.cpp
Expand Up @@ -271,6 +271,13 @@ static const CRPCCommand vRPCCommands[] =
{ "lockunspent", &lockunspent, false, false, true }, { "lockunspent", &lockunspent, false, false, true },
{ "listlockunspent", &listlockunspent, false, false, true }, { "listlockunspent", &listlockunspent, false, false, true },
{ "verifychain", &verifychain, true, false, false }, { "verifychain", &verifychain, true, false, false },
{ "getnewstealthaddress", &getnewstealthaddress, false, false, true },
{ "liststealthaddresses", &liststealthaddresses, false, false, true },
{ "importstealthaddress", &importstealthaddress, false, false, true },
{ "sendtostealthaddress", &sendtostealthaddress, false, false, true },
{ "clearwallettransactions",&clearwallettransactions,false, false, true },
{ "scanforalltxns", &scanforalltxns, false, false, true },
{ "scanforstealthtxns", &scanforstealthtxns, false, false, true },
}; };


CRPCTable::CRPCTable() CRPCTable::CRPCTable()
Expand Down Expand Up @@ -1208,6 +1215,7 @@ Array RPCConvertValues(const std::string &strMethod, const std::vector<std::stri
if (strMethod == "sendalert" && n > 5) ConvertTo<boost::int64_t>(params[5]); if (strMethod == "sendalert" && n > 5) ConvertTo<boost::int64_t>(params[5]);
if (strMethod == "sendalert" && n > 6) ConvertTo<boost::int64_t>(params[6]); if (strMethod == "sendalert" && n > 6) ConvertTo<boost::int64_t>(params[6]);
if (strMethod == "enforcecheckpoint" && n > 0) ConvertTo<bool>(params[0]); if (strMethod == "enforcecheckpoint" && n > 0) ConvertTo<bool>(params[0]);
if (strMethod == "sendtostealthaddress" && n > 1) ConvertTo<double>(params[1]);


return params; return params;
} }
Expand Down
8 changes: 8 additions & 0 deletions src/bitcoinrpc.h
Expand Up @@ -212,4 +212,12 @@ extern json_spirit::Value gettxoutsetinfo(const json_spirit::Array& params, bool
extern json_spirit::Value gettxout(const json_spirit::Array& params, bool fHelp); extern json_spirit::Value gettxout(const json_spirit::Array& params, bool fHelp);
extern json_spirit::Value verifychain(const json_spirit::Array& params, bool fHelp); extern json_spirit::Value verifychain(const json_spirit::Array& params, bool fHelp);


extern json_spirit::Value getnewstealthaddress(const json_spirit::Array& params, bool fHelp);
extern json_spirit::Value liststealthaddresses(const json_spirit::Array& params, bool fHelp);
extern json_spirit::Value importstealthaddress(const json_spirit::Array& params, bool fHelp);
extern json_spirit::Value sendtostealthaddress(const json_spirit::Array& params, bool fHelp);
extern json_spirit::Value clearwallettransactions(const json_spirit::Array& params, bool fHelp);
extern json_spirit::Value scanforalltxns(const json_spirit::Array& params, bool fHelp);
extern json_spirit::Value scanforstealthtxns(const json_spirit::Array& params, bool fHelp);

#endif #endif
2 changes: 1 addition & 1 deletion src/keystore.cpp
Expand Up @@ -73,7 +73,7 @@ bool CCryptoKeyStore::SetCrypted()
return true; return true;
} }


bool CCryptoKeyStore::Lock() bool CCryptoKeyStore::LockKeyStore()
{ {
if (!SetCrypted()) if (!SetCrypted())
return false; return false;
Expand Down
9 changes: 4 additions & 5 deletions src/keystore.h
Expand Up @@ -105,15 +105,14 @@ typedef std::map<CKeyID, std::pair<CPubKey, std::vector<unsigned char> > > Crypt
class CCryptoKeyStore : public CBasicKeyStore class CCryptoKeyStore : public CBasicKeyStore
{ {
private: private:
CryptedKeyMap mapCryptedKeys;

CKeyingMaterial vMasterKey;

// if fUseCrypto is true, mapKeys must be empty // if fUseCrypto is true, mapKeys must be empty
// if fUseCrypto is false, vMasterKey must be empty // if fUseCrypto is false, vMasterKey must be empty
bool fUseCrypto; bool fUseCrypto;


protected: protected:
CryptedKeyMap mapCryptedKeys;
CKeyingMaterial vMasterKey;

bool SetCrypted(); bool SetCrypted();


// will encrypt previously unencrypted keys // will encrypt previously unencrypted keys
Expand Down Expand Up @@ -143,7 +142,7 @@ class CCryptoKeyStore : public CBasicKeyStore
return result; return result;
} }


bool Lock(); bool LockKeyStore();


virtual bool AddCryptedKey(const CPubKey &vchPubKey, const std::vector<unsigned char> &vchCryptedSecret); virtual bool AddCryptedKey(const CPubKey &vchPubKey, const std::vector<unsigned char> &vchCryptedSecret);
bool AddKey(const CKey& key); bool AddKey(const CKey& key);
Expand Down
138 changes: 0 additions & 138 deletions src/makefile.linux-mingw

This file was deleted.

3 changes: 2 additions & 1 deletion src/makefile.mingw
Expand Up @@ -107,7 +107,8 @@ OBJS= \
obj/echo.o \ obj/echo.o \
obj/shavite.o \ obj/shavite.o \
obj/simd.o \ obj/simd.o \
obj/checkpointsync.o obj/checkpointsync.o \
obj/stealth.o


all: deepcoind.exe all: deepcoind.exe


Expand Down
3 changes: 2 additions & 1 deletion src/makefile.osx
Expand Up @@ -113,7 +113,8 @@ OBJS= \
obj/echo.o \ obj/echo.o \
obj/shavite.o \ obj/shavite.o \
obj/simd.o \ obj/simd.o \
obj/checkpointsync.o obj/checkpointsync.o \
obj/stealth.o


ifndef USE_UPNP ifndef USE_UPNP
override USE_UPNP = - override USE_UPNP = -
Expand Down
3 changes: 2 additions & 1 deletion src/makefile.unix
Expand Up @@ -149,7 +149,8 @@ OBJS= \
obj/echo.o \ obj/echo.o \
obj/shavite.o \ obj/shavite.o \
obj/simd.o \ obj/simd.o \
obj/checkpointsync.o obj/checkpointsync.o \
obj/stealth.o


all: deepcoind all: deepcoind


Expand Down

0 comments on commit 5122103

Please sign in to comment.