Bitcoin Forum
December 14, 2024, 01:03:43 AM *
News: Latest Bitcoin Core release: 28.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Protobuf wallets in C++, python, C - anyone fancy it ?  (Read 1201 times)
jim618 (OP)
Legendary
*
Offline Offline

Activity: 1708
Merit: 1066



View Profile WWW
June 18, 2012, 08:07:11 PM
 #1

If you are a C++, python or C dev and fancy playing about with Protocol buffers here is a useful project for you . . .

Some time ago Andreas's Android bitcoin wallet moved their wallet format from a Java specific one to one based on protocol buffers (protobuf). I have just upgraded MultiBit to use the same format for new wallets.

It is the data format used for the majority of Google's machine-to-machine chatter and is compact and easy to extend.
You can auto-generate accessor code in a variety of programming languages using a message definition file, which for bitcoinj is here:
http://code.google.com/p/bitcoinj/source/browse/core/src/bitcoin.proto?name=release-0.5

There are protobuf generators for (at least) C++, python and C that I know of.

Having a bitcoin wallet format that is easy to read and write to in a variety of programming languages sounds like it is a Good Thing To Have so if you have the skills, the time and the inclination please, well, give it a go!


MultiBit HD   Lightweight desktop client.                    Bitcoin Solutions Ltd   Bespoke software. Consultancy.
etotheipi
Legendary
*
expert
Offline Offline

Activity: 1428
Merit: 1093


Core Armory Developer


View Profile WWW
June 18, 2012, 09:32:26 PM
 #2

If you are a C++, python or C dev and fancy playing about with Protocol buffers here is a useful project for you . . .

Some time ago Andreas's Android bitcoin wallet moved their wallet format from a Java specific one to one based on protocol buffers (protobuf). I have just upgraded MultiBit to use the same format for new wallets.

It is the data format used for the majority of Google's machine-to-machine chatter and is compact and easy to extend.
You can auto-generate accessor code in a variety of programming languages using a message definition file, which for bitcoinj is here:
http://code.google.com/p/bitcoinj/source/browse/core/src/bitcoin.proto?name=release-0.5

There are protobuf generators for (at least) C++, python and C that I know of.

Having a bitcoin wallet format that is easy to read and write to in a variety of programming languages sounds like it is a Good Thing To Have so if you have the skills, the time and the inclination please, well, give it a go!

Jim, I really like google's protobuf library, and was looking forward to using them for something.  They seem to have great support across multiple languages.

However, for Armory wallets, I'm sticking to pure, manual, binary files.  I may just be stupid stubborn, but I like the 100.0% control over every bit in the file, and not letting any outside library touch it.  I recognize this is much smaller scope than the BSD-DB library that let to the wallet encryption bug, but I'm still paranoid about it.  The wallet is one the thing I won't outsource to any other code.

However, for just about anything else (or most other apps, where the developers aren't as paranoid as me), I think it's great Smiley


Founder and CEO of Armory Technologies, Inc.
Armory Bitcoin Wallet: Bringing cold storage to the average user!
Only use Armory software signed by the Armory Offline Signing Key (0x98832223)

Please donate to the Armory project by clicking here!    (or donate directly via 1QBDLYTDFHHZAABYSKGKPWKLSXZWCCJQBX -- yes, it's a real address!)
MatthewLM
Legendary
*
Offline Offline

Activity: 1190
Merit: 1004


View Profile
June 18, 2012, 09:39:09 PM
 #3

etotheipi: You could write your own code to serialise/deserialise wallets in the Protobuf format. It seems pretty simple: https://developers.google.com/protocol-buffers/docs/encoding
jim618 (OP)
Legendary
*
Offline Offline

Activity: 1708
Merit: 1066



View Profile WWW
June 18, 2012, 10:22:57 PM
 #4

Hi Alan,

Yes you are right anywhere where there is a translation layer there is the possibility of introduction of 'infidelity'. If it was a homebrew format I would not be comfortable but I think protobuf is established enough and our proto file is pretty vanilla. There are also a variety of roundtrip wallet tests in both bitcoinj and MultiBit (and I am sure in Andreas's codebase too).

It is orders of magnitude better than the Java serialisation we have been using previously which is so brittle it has been a real pain to work with.

One of the things I want to raise on the bitcoinj mailing list in the next couple of weeks is the best protobuf format to use for encrypted private key wallets so I would be interested in your input on that (even though I appreciate you probably would not want to use protobuf for wallets in Armory for the reasons you have stated).

I wonder how similar the message file structure is to what you use in Armory ? If they were similar you might be able to import/ export to and from protobuf whilst never using it internally.  Even as a thought exercise it might be useful as you are months ahead of what bitcoinj has in terms of encrypted wallets and deterministic wallets. I expect support for both of those to go into the protobuf wallet in time. At the moment the message definitions to support those wallet types are not done yet.

Cheers,

Jim

MultiBit HD   Lightweight desktop client.                    Bitcoin Solutions Ltd   Bespoke software. Consultancy.
apetersson
Hero Member
*****
Offline Offline

Activity: 668
Merit: 501



View Profile
June 18, 2012, 10:31:51 PM
 #5

i still remember the bitcoin-qt bug where it stored critical parts of the wallet unencrypted. this went unnoticed because hardly anyone could read the format.

so to solve this, a common, open public format that is easy to parse would really help here. maybe one day also with wallet interoperability.
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!