Author Topic: 250 PTS - BOUNTY - Import wallet.dat Private Keys via API call (2 PTS Referral)  (Read 20586 times)

0 Members and 1 Guest are viewing this topic.

Offline pvaladares

  • Full Member
  • ***
  • Posts: 100
    • View Profile
PTS : PkbJAm9uxuGgC9n2NVwWYs8bvX3Mj8uAg3 | MMC : M91vp33SSVBG7N3X9CbrgMcwSBxTDQeDAb
BTC : 1CrAkkYZrVCnwDKSBw3bcnMSYMakEhfB6N
Trade BTC/PTS @ cryptsy.com

Offline toast

  • Hero Member
  • *****
  • Posts: 4001
    • View Profile
  • BitShares: nikolai
It is cool if I add some more files? Specifically, base58.h and some of its dependencies

https://github.com/bitcoin/bitcoin/blob/f76c122e2eac8ef66f69d142231bd33c88a24c50/src/base58.h

Edit: I see you have base58 stuff in fc/crypto already, what I actually need is CBitcoinSecret, I can stick that in a more clearly named file if you prefer

edit 2: fuck it I'll just put everything in the new bitcoin_wallet
« Last Edit: December 30, 2013, 11:09:24 pm by toast »
Do not use this post as information for making any important decisions. The only agreements I ever make are informal and non-binding. Take the same precautions as when dealing with a compromised account, scammer, sockpuppet, etc.

Offline toast

  • Hero Member
  • *****
  • Posts: 4001
    • View Profile
  • BitShares: nikolai
What platform? For me it was just "brew install boost" on osx
Do not use this post as information for making any important decisions. The only agreements I ever make are informal and non-binding. Take the same precautions as when dealing with a compromised account, scammer, sockpuppet, etc.

Offline pvaladares

  • Full Member
  • ***
  • Posts: 100
    • View Profile
When I try to compile I get the boost error

Code: [Select]
CMake Error at /usr/share/cmake-2.8/Modules/FindBoost.cmake:1126 (message):
  Unable to find the requested Boost libraries.

  Boost version: 1.53.0

  Boost include path: /usr/include

  The following Boost libraries could not be found:

          boost_coroutine

  Some (but not all) of the required Boost libraries were found.  You may
  need to install these additional Boost libraries.  Alternatively, set
  BOOST_LIBRARYDIR to the directory containing Boost libraries or BOOST_ROOT
  to the location of Boost.
Call Stack (most recent call first):
  CMakeLists.txt:57 (FIND_PACKAGE)


-- Boost version: 1.53.0
-- Found the following Boost libraries:
--   thread
--   date_time
--   system
--   filesystem
--   program_options
--   signals
--   serialization
--   chrono
--   unit_test_framework
--   context
CMake Warning (dev) at CMakeLists.txt:87 (set):
  Cannot set "BOOST_LIBRARIES": current scope has no parent.
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Configuring incomplete, errors occurred!

Is there any guide on how to properly install latest version?
PTS : PkbJAm9uxuGgC9n2NVwWYs8bvX3Mj8uAg3 | MMC : M91vp33SSVBG7N3X9CbrgMcwSBxTDQeDAb
BTC : 1CrAkkYZrVCnwDKSBw3bcnMSYMakEhfB6N
Trade BTC/PTS @ cryptsy.com

Offline toast

  • Hero Member
  • *****
  • Posts: 4001
    • View Profile
  • BitShares: nikolai
Finally got everything to build (when in doubt, nuke the directory and redo "cmake ."). Added nearly-empty files / tests / updated cmake. Now we can get rolling.

https://github.com/nmushegian/BitShares
Do not use this post as information for making any important decisions. The only agreements I ever make are informal and non-binding. Take the same precautions as when dealing with a compromised account, scammer, sockpuppet, etc.

Offline arcke

  • Full Member
  • ***
  • Posts: 115
    • View Profile
    • Diaspora
Yeah, I've looked through the code and it shouldn't be too hard, I think once I actually start working I'll be able to finish in less than a day. arcke, want to split the work somehow?

Right now I'm almost done getting this to build, successfully got it to use g++ for CXX objects but still working on getting it to use gcc instead of clang for C objects. Very good learning experience. Turns out OSX mavericks quitely links g++/gcc to clang, how nice
Yes, when I find an opportunity to split work I will let you know. For now I am still just investigating.

First method of interest I found is CWallet::Unlock. Reverse engineering this will tell us how we can decrypt an encrypted wallet with a passphrase. To be done: investigate if we can reuse code from bitcoin/protoshares to do this.

I am working on Linux, cant help you with the OSX build specifics.
OpenPGP: 0x22d7e9cc35375665
PTS - PawnbhoiXhmkrKJEPAsCiwkpP81nRXJGTD
Diaspora profile - https://pod.orkz.net/u/arcke

Offline bytemaster

Yeah, I've looked through the code and it shouldn't be too hard, I think once I actually start working I'll be able to finish in less than a day. arcke, want to split the work somehow?

Right now I'm almost done getting this to build, successfully got it to use g++ for CXX objects but still working on getting it to use gcc instead of clang for C objects. Very good learning experience. Turns out OSX mavericks quitely links g++/gcc to clang, how nice

I haven't upgraded to Mavericks yet on my primary development machine.   FYI, once this task is done I will have more follow-on tasks as fast as I can specify them, which is becoming my full time job :)
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 toast

  • Hero Member
  • *****
  • Posts: 4001
    • View Profile
  • BitShares: nikolai
Yeah, I've looked through the code and it shouldn't be too hard, I think once I actually start working I'll be able to finish in less than a day. arcke, want to split the work somehow?

Right now I'm almost done getting this to build, successfully got it to use g++ for CXX objects but still working on getting it to use gcc instead of clang for C objects. Very good learning experience. Turns out OSX mavericks quitely links g++/gcc to clang, how nice
Do not use this post as information for making any important decisions. The only agreements I ever make are informal and non-binding. Take the same precautions as when dealing with a compromised account, scammer, sockpuppet, etc.

Offline arcke

  • Full Member
  • ***
  • Posts: 115
    • View Profile
    • Diaspora
This means we can reuse code from bitcoin. I have been looking at bitcoin/src/wallet.{h,cpp}. I might be able to do this basing my solution on bitcoin code. For now we should make unit tests firsts and put them online.
OpenPGP: 0x22d7e9cc35375665
PTS - PawnbhoiXhmkrKJEPAsCiwkpP81nRXJGTD
Diaspora profile - https://pod.orkz.net/u/arcke

Offline bytemaster

Quote
To be accepted, a unit test case must be provided using boost unit tests that verifies that the keys can be imported and converted to the proper PTS address.
I am in doubt regarding the task demanded by the bounty. What types of wallets should the method import? Should it import protoshares wallets into bitshares or is this method universally importing wallets of all bitcoin-forks or just bitcoin?

Bitcoin-QT and ProtoShares use the same wallet format, these are the only wallets required by this bounty. 
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 arcke

  • Full Member
  • ***
  • Posts: 115
    • View Profile
    • Diaspora
Quote
To be accepted, a unit test case must be provided using boost unit tests that verifies that the keys can be imported and converted to the proper PTS address.
I am in doubt regarding the task demanded by the bounty. What types of wallets should the method import? Should it import protoshares wallets into bitshares or is this method universally importing wallets of all bitcoin-forks or just bitcoin?
OpenPGP: 0x22d7e9cc35375665
PTS - PawnbhoiXhmkrKJEPAsCiwkpP81nRXJGTD
Diaspora profile - https://pod.orkz.net/u/arcke

Offline bytemaster

You are using XCodes clang++ compiler rather than g++. 
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 toast

  • Hero Member
  • *****
  • Posts: 4001
    • View Profile
  • BitShares: nikolai
Code: [Select]
boost-1.54.0 already installed
I'm using brew though.


I did get this during cmake, is it relevant?:

Code: [Select]
(~/projects/BitShares (cmake .
statusCompiling on UNIX
-- Boost version: 1.54.0
-- Found the following Boost libraries:
--   thread
--   date_time
--   system
--   filesystem
--   program_options
--   signals
--   serialization
--   chrono
--   unit_test_framework
--   context
--   coroutine
-- Boost version: 1.54.0
-- Found the following Boost libraries:
--   thread
--   date_time
--   system
--   filesystem
--   program_options
--   signals
--   serialization
--   chrono
--   unit_test_framework
--   context
CMake Warning (dev) at CMakeLists.txt:87 (set):
  Cannot set "BOOST_LIBRARIES": current scope has no parent.

the full errors I'm getting during make

Code: [Select]
[  1%] Building CXX object CMakeFiles/bshare.dir/src/network/server.cpp.o
clang: warning: argument unused during compilation: '-fmax-errors=3'
warning: unknown warning option '-Wno-unused-local-typedefs' [-Wunknown-warning-option]
In file included from /Users/nikolai/projects/BitShares/src/network/server.cpp:1:
In file included from /Users/nikolai/projects/BitShares/include/bts/network/server.hpp:2:
In file included from /Users/nikolai/projects/BitShares/include/bts/network/message.hpp:2:
In file included from /Users/nikolai/projects/BitShares/include/bts/network/channel_id.hpp:76:
In file included from /Users/nikolai/projects/BitShares/fc/include/fc/reflect/reflect.hpp:9:
In file included from /Users/nikolai/projects/BitShares/fc/include/fc/utility.hpp:3:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/new:56:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/exception:81:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/type_traits:770:38: error: implicit instantiation of undefined template
      'std::__1::hash<fc::ip::endpoint>'
    : public integral_constant<bool, __is_empty(_Tp)> {};
                                     ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/unordered_map:327:54: note: in instantiation of template class
      'std::__1::is_empty<std::__1::hash<fc::ip::endpoint> >' requested here
template <class _Key, class _Tp, class _Hash, bool = is_empty<_Hash>::value
                                                     ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/unordered_map:678:13: note: in instantiation of default argument for
      '__unordered_map_hasher<fc::ip::endpoint, std::__1::shared_ptr<bts::network::connection>, std::__1::hash<fc::ip::endpoint> >' required here
    typedef __unordered_map_hasher<key_type, mapped_type, hasher>   __hasher;
            ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Users/nikolai/projects/BitShares/src/network/server.cpp:62:71: note: in instantiation of template class 'std::__1::unordered_map<fc::ip::endpoint, std::__1::shared_ptr<bts::network::connection>,
      std::__1::hash<fc::ip::endpoint>, std::__1::equal_to<fc::ip::endpoint>, std::__1::allocator<std::__1::pair<const fc::ip::endpoint, std::__1::shared_ptr<bts::network::connection> > > >' requested
      here
          std::unordered_map<fc::ip::endpoint,connection_ptr>         connections;
                                                                      ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/memory:3081:29: note: template is declared here
template <class _Tp> struct hash;
                            ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/memory:2147:15: error: no matching constructor for initialization of 'bts::network::connection'
              __second_(_VSTD::forward<_Args2>(get<_I2>(__second_args))...)
              ^         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/memory:2421:15: note: in instantiation of function template specialization
      'std::__1::__libcpp_compressed_pair_imp<std::__1::allocator<bts::network::connection>, bts::network::connection, 1>::__libcpp_compressed_pair_imp<std::__1::allocator<bts::network::connection> &,
      const std::__1::shared_ptr<bts::network::stcp_socket> &, bts::network::detail::server_impl *&&, 0, 0, 1>' requested here
            : base(__pc, _VSTD::move(__first_args), _VSTD::move(__second_args),
              ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/memory:3703:16: note: in instantiation of function template specialization
      'std::__1::__compressed_pair<std::__1::allocator<bts::network::connection>, bts::network::connection>::__compressed_pair<std::__1::allocator<bts::network::connection> &, const
      std::__1::shared_ptr<bts::network::stcp_socket> &, bts::network::detail::server_impl *&&>' requested here
            :  __data_(piecewise_construct, _VSTD::forward_as_tuple(__a),
               ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/memory:4277:26: note: in instantiation of function template specialization
      'std::__1::__shared_ptr_emplace<bts::network::connection, std::__1::allocator<bts::network::connection> >::__shared_ptr_emplace<const std::__1::shared_ptr<bts::network::stcp_socket> &,
      bts::network::detail::server_impl *>' requested here
    ::new(__hold2.get()) _CntrlBlk(__a2, _VSTD::forward<_Args>(__args)...);
                         ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/memory:4636:12: note: in instantiation of function template specialization
      'std::__1::shared_ptr<bts::network::connection>::make_shared<const std::__1::shared_ptr<bts::network::stcp_socket> &, bts::network::detail::server_impl *>' requested here
    return shared_ptr<_Tp>::make_shared(_VSTD::forward<_Args>(__args)...);
           ^
/Users/nikolai/projects/BitShares/src/network/server.cpp:116:28: note: in instantiation of function template specialization 'std::__1::make_shared<bts::network::connection, const
      std::__1::shared_ptr<bts::network::stcp_socket> &, bts::network::detail::server_impl *>' requested here
                auto con = std::make_shared<connection>(s,this);
                           ^
/Users/nikolai/projects/BitShares/include/bts/network/connection.hpp:61:9: note: candidate constructor not viable: no known conversion from 'bts::network::detail::server_impl *' to
      'bts::network::connection_delegate *' for 2nd argument
        connection( const stcp_socket_ptr& c, connection_delegate* d);
        ^
/Users/nikolai/projects/BitShares/include/bts/network/connection.hpp:62:9: note: candidate constructor not viable: requires single argument 'd', but 2 arguments were provided
        connection( connection_delegate* d );
        ^
/Users/nikolai/projects/BitShares/include/bts/network/connection.hpp:58:10: note: candidate constructor (the implicit copy constructor) not viable: requires 1 argument, but 2 were provided
   class connection : public std::enable_shared_from_this<connection>
         ^
In file included from /Users/nikolai/projects/BitShares/src/network/server.cpp:1:
In file included from /Users/nikolai/projects/BitShares/include/bts/network/server.hpp:2:
In file included from /Users/nikolai/projects/BitShares/include/bts/network/message.hpp:2:
In file included from /Users/nikolai/projects/BitShares/include/bts/network/channel_id.hpp:76:
In file included from /Users/nikolai/projects/BitShares/fc/include/fc/reflect/reflect.hpp:18:
In file included from /Users/nikolai/projects/BitShares/fc/include/fc/reflect/typename.hpp:2:
In file included from /Users/nikolai/projects/BitShares/fc/include/fc/string.hpp:7:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/string:434:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/algorithm:594:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/memory:2147:15: error: no matching constructor for initialization of 'bts::network::connection'
              __second_(_VSTD::forward<_Args2>(get<_I2>(__second_args))...)
              ^         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/memory:2421:15: note: in instantiation of function template specialization
      'std::__1::__libcpp_compressed_pair_imp<std::__1::allocator<bts::network::connection>, bts::network::connection, 1>::__libcpp_compressed_pair_imp<std::__1::allocator<bts::network::connection> &,
      bts::network::detail::server_impl *&&, 0, 0>' requested here
            : base(__pc, _VSTD::move(__first_args), _VSTD::move(__second_args),
              ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/memory:3703:16: note: in instantiation of function template specialization
      'std::__1::__compressed_pair<std::__1::allocator<bts::network::connection>, bts::network::connection>::__compressed_pair<std::__1::allocator<bts::network::connection> &,
      bts::network::detail::server_impl *&&>' requested here
            :  __data_(piecewise_construct, _VSTD::forward_as_tuple(__a),
               ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/memory:4277:26: note: in instantiation of function template specialization
      'std::__1::__shared_ptr_emplace<bts::network::connection, std::__1::allocator<bts::network::connection> >::__shared_ptr_emplace<bts::network::detail::server_impl *>' requested here
    ::new(__hold2.get()) _CntrlBlk(__a2, _VSTD::forward<_Args>(__args)...);
                         ^
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/c++/v1/memory:4636:12: note: in instantiation of function template specialization
      'std::__1::shared_ptr<bts::network::connection>::make_shared<bts::network::detail::server_impl *>' requested here
    return shared_ptr<_Tp>::make_shared(_VSTD::forward<_Args>(__args)...);
           ^
/Users/nikolai/projects/BitShares/src/network/server.cpp:251:29: note: in instantiation of function template specialization 'std::__1::make_shared<bts::network::connection,
      bts::network::detail::server_impl *>' requested here
       connection_ptr con = std::make_shared<connection>( my.get() );
                            ^
/Users/nikolai/projects/BitShares/include/bts/network/connection.hpp:58:10: note: candidate constructor (the implicit copy constructor) not viable: no known conversion from
      'bts::network::detail::server_impl *' to 'const bts::network::connection' for 1st argument
   class connection : public std::enable_shared_from_this<connection>
         ^
/Users/nikolai/projects/BitShares/include/bts/network/connection.hpp:62:9: note: candidate constructor not viable: no known conversion from 'bts::network::detail::server_impl *' to
      'bts::network::connection_delegate *' for 1st argument
        connection( connection_delegate* d );
        ^
/Users/nikolai/projects/BitShares/include/bts/network/connection.hpp:61:9: note: candidate constructor not viable: requires 2 arguments, but 1 was provided
        connection( const stcp_socket_ptr& c, connection_delegate* d);
        ^
1 warning and 3 errors generated.
make[2]: *** [CMakeFiles/bshare.dir/src/network/server.cpp.o] Error 1
make[1]: *** [CMakeFiles/bshare.dir/all] Error 2
make: *** [all] Error 2
Do not use this post as information for making any important decisions. The only agreements I ever make are informal and non-binding. Take the same precautions as when dealing with a compromised account, scammer, sockpuppet, etc.

Offline bytemaster

got it, getting other build errors but it's probably due to my environment

anyone developing this on OSX that I can chat with?

Me :)   

g++4.8 from mac ports
build boost 1.54 from source and install

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 toast

  • Hero Member
  • *****
  • Posts: 4001
    • View Profile
  • BitShares: nikolai
got it, getting other build errors but it's probably due to my environment

anyone developing this on OSX that I can chat with?
Do not use this post as information for making any important decisions. The only agreements I ever make are informal and non-binding. Take the same precautions as when dealing with a compromised account, scammer, sockpuppet, etc.