diff options
author | Pieter Wuille <pieter.wuille@gmail.com> | 2011-07-13 11:56:38 +0200 |
---|---|---|
committer | Pieter Wuille <sipa@ulyssis.org> | 2011-12-17 21:49:48 +0100 |
commit | 95d888a6d1f659a5cb81124e0d97966b9de1f139 (patch) | |
tree | db17f76d0517ddbf12fd9144948816e930439eef /src/bitcoinrpc.cpp | |
parent | 30ab2c9c46ce38197017ce6a6e13869617e692c7 (diff) |
Key import and export
Introduces two new RPC calls:
* dumpprivkey: retrieve the private key corresponding to an address
* importprivkey: add a private key to your wallet
The private key format is analoguous to the address format. It is
a 51-character base58-encoded string, that includes a version number
and a checksum.
Includes patch by mhanne:
* add optional account parameter for importprivkey, if omitted use default
Diffstat (limited to 'src/bitcoinrpc.cpp')
-rw-r--r-- | src/bitcoinrpc.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/bitcoinrpc.cpp b/src/bitcoinrpc.cpp index fcf2482ee0..e3378782c0 100644 --- a/src/bitcoinrpc.cpp +++ b/src/bitcoinrpc.cpp @@ -9,6 +9,7 @@ #include "init.h" #undef printf #include <boost/asio.hpp> +#include <boost/filesystem.hpp> #include <boost/iostreams/concepts.hpp> #include <boost/iostreams/stream.hpp> #include <boost/algorithm/string.hpp> @@ -42,6 +43,8 @@ static std::string strRPCUserColonPass; static int64 nWalletUnlockTime; static CCriticalSection cs_nWalletUnlockTime; +extern Value dumpprivkey(const Array& params, bool fHelp); +extern Value importprivkey(const Array& params, bool fHelp); Object JSONRPCError(int code, const string& message) { @@ -1599,7 +1602,6 @@ Value validateaddress(const Array& params, bool fHelp) return ret; } - Value getwork(const Array& params, bool fHelp) { if (fHelp || params.size() > 1) @@ -1840,13 +1842,15 @@ pair<string, rpcfn_type> pCallTable[] = make_pair("sendmany", &sendmany), make_pair("gettransaction", &gettransaction), make_pair("listtransactions", &listtransactions), - make_pair("signmessage", &signmessage), - make_pair("verifymessage", &verifymessage), + make_pair("signmessage", &signmessage), + make_pair("verifymessage", &verifymessage), make_pair("getwork", &getwork), make_pair("listaccounts", &listaccounts), make_pair("settxfee", &settxfee), make_pair("getmemorypool", &getmemorypool), - make_pair("listsinceblock", &listsinceblock), + make_pair("listsinceblock", &listsinceblock), + make_pair("dumpprivkey", &dumpprivkey), + make_pair("importprivkey", &importprivkey) }; map<string, rpcfn_type> mapCallTable(pCallTable, pCallTable + sizeof(pCallTable)/sizeof(pCallTable[0])); |