Bitcoin Forum
December 05, 2016, 10:49:48 AM *
News: Latest stable version of Bitcoin Core: 0.13.1  [Torrent].
 
   Home   Help Search Donate Login Register  
Pages: [1]
  Print  
Author Topic: Protobuf wallets in C++, python, C - anyone fancy it ?  (Read 953 times)
jim618
Legendary
*
Offline Offline

Activity: 1708



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.
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
etotheipi
Legendary
*
expert
Offline Offline

Activity: 1428


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: 1092



View Profile WWW
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

Bitcoin Extra Wallet | Peercoin Android Wallet
BTC: 1D5A1q5d192j5gYuWiP3CSE5fcaaZxe6E9  PPC: PH7fVn1Xs7nkUFmdwCX2ZRYfLPCSwGxAq9
jim618
Legendary
*
Offline Offline

Activity: 1708



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: 666


mycelium.com


View Profile WWW
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:  

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!