Author Topic: 2 x 300 PTS Bounty to Import Electrum or Armory Wallet [CLOSED]  (Read 8051 times)

0 Members and 1 Guest are viewing this topic.

Offline thisisausername

Well, I spoke a bit soon.  Everything works great under python, but attempting to use the cython-generated code I get,
Code: [Select]
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.
« Last Edit: February 13, 2014, 07:13:46 am by thisisausername »
Pjo39s6hfpWexsZ6gEBC9iwH9HTAgiEXTG

Offline bytemaster

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: http://bytemaster.bitshares.org
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.

Offline thisisausername

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

Offline bytemaster

I'm almost finished with this for electrum.

I have cython generating

Code: [Select]
std::vector<std::string> pyimport_electrum_wallet(std::string &__pyx_v_path, std::string &__pyx_v_pp)
and am calling it like

Code: [Select]
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: http://bytemaster.bitshares.org
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.

Offline thisisausername

I'm almost finished with this for electrum.

I have cython generating

Code: [Select]
std::vector<std::string> pyimport_electrum_wallet(std::string &__pyx_v_path, std::string &__pyx_v_pp)
and am calling it like

Code: [Select]
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

Offline bytemaster

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.

Code: [Select]
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
« Last Edit: February 28, 2014, 07:36:00 pm by bytemaster »
For the latest updates checkout my blog: http://bytemaster.bitshares.org
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.