2 x 300 PTS Bounty to Import Electrum or Armory Wallet [CLOSED]

Started by bytemaster, February 11, 2014, 04:14:07 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

thisisausername

#6
Well, I spoke a bit soon.  Everything works great under python, but attempting to use the cython-generated code I get, Exception NameError: "name 'WalletStorage' is not defined" in 'lib.wallet.pyimport_electrum_wallet' ignored at runtime.

Anyone have any idea what's up with that?  I've previously only ever cython'd much more simple programs and things have 'just worked'.  It works using nuitka, but I'm not sure how to specify nicely callable C++ functions using it (calling an external executable just seems too ugly.)

I'll hack on this a bit more tomorrow; see if I can figure it out.
Pjo39s6hfpWexsZ6gEBC9iwH9HTAgiEXTG

bytemaster

Quote from: thisisausername on February 13, 2014, 01:12:52 AM
Quote from: bytemaster on February 13, 2014, 12:38:12 AM
FC_ASSERT( fc::exists( wallet_dat ), "unable to find ${wallet}", ("wallet",wallet_dat) ) is better than returning nothing...
or better yet use FC_THROW_EXCEPTION( file_not_found... )

Done.  Here are my changes as they currently stand, https://github.com/tiau/BitShares/compare .  I haven't initiated a pull request since I'm still waiting on boost to be able to test the changes.  There are almost certainly bugs in the not-cython-generated C++ portion and I doubt I did the CMakeList.txt changes right either...

One question: Is electrum_python.cpp okay as it stands (50,000 lines of mostly dead code) since the C++ compiler will remove all the cruft anyways or should it be cleaned up?

For 300 PTS it should be cleaned up.
For the latest updates checkout my blog: [url="http://bytemaster.bitshares.org"]http://bytemaster.bitshares.org[/url]
Anything said on these forums does not constitute an intent to create a legal obligation or contract between myself and anyone else.   These are merely my opinions and I reserve the right to change them at any time.

thisisausername

Quote from: bytemaster on February 13, 2014, 12:38:12 AM
FC_ASSERT( fc::exists( wallet_dat ), "unable to find ${wallet}", ("wallet",wallet_dat) ) is better than returning nothing...
or better yet use FC_THROW_EXCEPTION( file_not_found... )

Done.  Here are my changes as they currently stand, https://github.com/tiau/BitShares/compare .  I haven't initiated a pull request since I'm still waiting on boost to be able to test the changes.  There are almost certainly bugs in the not-cython-generated C++ portion and I doubt I did the CMakeList.txt changes right either...

One question: Is electrum_python.cpp okay as it stands (50,000 lines of mostly dead code) since the C++ compiler will remove all the cruft anyways or should it be cleaned up?
Pjo39s6hfpWexsZ6gEBC9iwH9HTAgiEXTG

bytemaster

Quote from: thisisausername on February 13, 2014, 12:07:35 AM
I'm almost finished with this for electrum.

I have cython generating

std::vector<std::string> pyimport_electrum_wallet(std::string &__pyx_v_path, std::string &__pyx_v_pp)

and am calling it like

namespace bts
{
   std::vector<fc::ecc:private_key> import_electrum_wallet( const fc::path& wallet_dat, const string& passphrase )
   {
      size_t i;
      std::vector<fc::ecc::private_key> keysRet;

      if (!fc::exists(wallet_dat)
         return std::vector<fc::ecc::private_key>();

      std::vector<string> keys = pyimport_electrum_wallet(wallet_dat.to_native_ansi_path(), passphrase);
      for( i = 0; i < keys.size(); i++ )
      {
         fc::datastream<const char*> stream(keys[i].c_str(), keys[i].size());
         fc::sha256 bits;
         stream >> bits;
         keysRet.push_back(fc::ecc::private_key::regenerate(bits));
      }
      return keysRet;
   }


I'm not so sure about the C++ part.  I still can't compile anything under BTS, waiting for my boost to finish upgrading to 1.53 (Gentoo...)

Also have to figure out how to do pull requests and whatnot.

FC_ASSERT( fc::exists( wallet_dat ), "unable to find ${wallet}", ("wallet",wallet_dat) ) is better than returning nothing...
or better yet use FC_THROW_EXCEPTION( file_not_found... ) 

For the latest updates checkout my blog: [url="http://bytemaster.bitshares.org"]http://bytemaster.bitshares.org[/url]
Anything said on these forums does not constitute an intent to create a legal obligation or contract between myself and anyone else.   These are merely my opinions and I reserve the right to change them at any time.

thisisausername

I'm almost finished with this for electrum.

I have cython generating

std::vector<std::string> pyimport_electrum_wallet(std::string &__pyx_v_path, std::string &__pyx_v_pp)

and am calling it like

namespace bts
{
   std::vector<fc::ecc:private_key> import_electrum_wallet( const fc::path& wallet_dat, const string& passphrase )
   {
      size_t i;
      std::vector<fc::ecc::private_key> keysRet;

      if (!fc::exists(wallet_dat)
         return std::vector<fc::ecc::private_key>();

      std::vector<string> keys = pyimport_electrum_wallet(wallet_dat.to_native_ansi_path(), passphrase);
      for( i = 0; i < keys.size(); i++ )
      {
         fc::datastream<const char*> stream(keys[i].c_str(), keys[i].size());
         fc::sha256 bits;
         stream >> bits;
         keysRet.push_back(fc::ecc::private_key::regenerate(bits));
      }
      return keysRet;
   }


I'm not so sure about the C++ part.  I still can't compile anything under BTS, waiting for my boost to finish upgrading to 1.53 (Gentoo...)

Also have to figure out how to do pull requests and whatnot.
Pjo39s6hfpWexsZ6gEBC9iwH9HTAgiEXTG

bytemaster

#1
In the spirit of supporting all wallets that can contribute to AGS I would like to start a bounty to extract the private keys from any wallet. 

Assuming Armory doesn't use the bitcoinqt wallet.dat, then it qualifies.  Otherwise it does not.

This 300 PTS bounty is for EITHER Electrum or Armory and both can be won for a total of 600 PTS

To win this bounty you must produce a pull request that successfully implements the following import method in a single .cpp and .hpp file with minimal dependencies.   The pull request must work on all platforms.


namespace bts  {
      std::vector<fc::ecc::private_key> import_electrum_wallet( const fc::path& wallet_dat, const std::string& passphrase );
}



toast edit: s/electrium/electrum/g
For the latest updates checkout my blog: [url="http://bytemaster.bitshares.org"]http://bytemaster.bitshares.org[/url]
Anything said on these forums does not constitute an intent to create a legal obligation or contract between myself and anyone else.   These are merely my opinions and I reserve the right to change them at any time.