Bitcoin Forum
November 18, 2017, 04:55:25 AM *
News: Latest stable version of Bitcoin Core: 0.15.1  [Torrent].
 
   Home   Help Search Donate Login Register  
Pages: [1]
  Print  
Author Topic: pure Java code (Xtend actually) to read keys from wallet.dat  (Read 2486 times)
prof7bit
Hero Member
*****
Offline Offline

Activity: 672



View Profile WWW
May 21, 2014, 09:32:02 PM
 #1

...decrypt it and and create c.g.bitcoin.core.ECKey instances from the keys.

If anybody of you ever felt the urge to parse a Berkeley database (wallet.dat) without linking against libdb, and use the keys in your bitcoinj based application: here is some inspiration: https://github.com/prof7bit/wallet-key-tool/blob/master/src/main/java/prof7bit/bitcoin/wallettool/fileformats/WalletDatHandler.xtend

 Grin

Old Bitcoins recycling and disposal: 1N7ZcHoe77JncRYAg27RVqJZbrjqUQ77WE
Blockchain.info -> Multibit converter (and much more) https://github.com/prof7bit/wallet-key-tool
1510980925
Hero Member
*
Offline Offline

Posts: 1510980925

View Profile Personal Message (Offline)

Ignore
1510980925
Reply with quote  #2

1510980925
Report to moderator
1510980925
Hero Member
*
Offline Offline

Posts: 1510980925

View Profile Personal Message (Offline)

Ignore
1510980925
Reply with quote  #2

1510980925
Report to moderator
Coinlancer is Disrupting the Freelance marketplace!
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
1510980925
Hero Member
*
Offline Offline

Posts: 1510980925

View Profile Personal Message (Offline)

Ignore
1510980925
Reply with quote  #2

1510980925
Report to moderator
1510980925
Hero Member
*
Offline Offline

Posts: 1510980925

View Profile Personal Message (Offline)

Ignore
1510980925
Reply with quote  #2

1510980925
Report to moderator
Mike Hearn
Moderator
Legendary
*
Offline Offline

Activity: 1526


View Profile
May 22, 2014, 10:54:50 AM
 #2

Nice!! Xtend compiles down to Java source-to-source, right? Perhaps we could merge the result into bitcoinj.
prof7bit
Hero Member
*****
Offline Offline

Activity: 672



View Profile WWW
May 22, 2014, 05:32:31 PM
 #3

Nice!! Xtend compiles down to Java source-to-source, right? Perhaps we could merge the result into bitcoinj.

Yes, Xtend is for Java what CoffeScript is for JavaScript (so it should actually be called "Coffee"). The only downside is that other than Eclipse there is zero IDE support (but the Eclipse support is excellent). But I would not try to reuse the generated Java code directly, sometimes its readable but when using lambdas and some of the syntactic sugar the generated code quickly becomes impossible to understand. The wallet.dat parsing code is actually totally imperative and straightforward, so it should be easy to translate it manually to Java without first trying to make sense of the Xtend compiler output, most of the time you would just need to add all the missing type declarations and a semicolon to the end of every line and 90% of the work would be done.

Old Bitcoins recycling and disposal: 1N7ZcHoe77JncRYAg27RVqJZbrjqUQ77WE
Blockchain.info -> Multibit converter (and much more) https://github.com/prof7bit/wallet-key-tool
altsay
Sr. Member
****
Offline Offline

Activity: 333


View Profile
August 03, 2014, 08:03:54 AM
 #4

Does it handle altcoin wallets as well?

Thank me || accuse me...with evidence.
prof7bit
Hero Member
*****
Offline Offline

Activity: 672



View Profile WWW
August 03, 2014, 11:46:31 AM
 #5

Does it handle altcoin wallets as well?
No, not yet. The bitcoinj library I am using to do all EC-Key related stuff and conversion to/from base58 address format (after importing from wallet.dat) only knows the parameters needed to create bitcoin addresses (It can be given different parameters for other coins, maybe (probably) this would work but I haven't tested it yet).

The low level wallet.dat related code itself (the parsing of the Berkeley file) should work (or easily be adaptable) for all altcoin wallets that are based on the bitcoin core client.

Old Bitcoins recycling and disposal: 1N7ZcHoe77JncRYAg27RVqJZbrjqUQ77WE
Blockchain.info -> Multibit converter (and much more) https://github.com/prof7bit/wallet-key-tool
Pages: [1]
  Print  
 
Jump to:  

Sponsored by , a Bitcoin-accepting VPN.
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!