Author

Topic: [Armory] Does lmdb file contains the private key? Reading complete LMDB file (Read 67 times)

legendary
Activity: 3766
Merit: 1364
Armory Developer
That file only contains address hashes, no private data exists in there.
newbie
Activity: 1
Merit: 0
[Armory][1] creates `Wallet file` and `lmdb` file when a new wallet is created. I did a super deep disk clean to see if I could recover the wallet file but I was unable to find it. Only file I was able to find that is `armory_*****_wallet.lmdb` mainly around 102KiB. I am not sure does it contains anything related to the `Wallet file` but I am just trying to read what's in it.

I have created a wallet from scratch and share my results with it, example [lmdb file][2] that is created by the `Armory`.

I have followed [guide-1][3], [guide-2][4], and [guide-3][5] to be able to read the file.

My script:

```
#!/usr/bin/env python3

import lmdb
import caffe

lmdb_file = "armory_2tG9psLQX_wallet.lmdb"
lmdb_env = lmdb.open(lmdb_file, subdir=False)
lmdb_txn = lmdb_env.begin()
lmdb_cursor = lmdb_txn.cursor()
datum = caffe.proto.caffe_pb2.Datum()

for key, value in lmdb_cursor:
    print(key)
    print(value)

print("\n--------------\n")
for key, value in lmdb_cursor:
    print(key.decode('utf-8'))
    print(value.decode('utf-8'))
```

---------

This only prints out:

```
b'99AxiN7y'
b'\x00\x00\x00\x00\x00\x00\x02\x00\x01\x00\x00\x00\x00\x00\x00\x00\x04\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00k\x00\x00\x00\x00\x00\x00\x00\n\x00\x00\x00\x00\x00\x00\x00'
b'WalletHeader'
b'\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x03\x00\x00\x00\x00\x00\x00\x00\x06\x00\x00\x00\x00\x00\x00\x00'

--------------

99AxiN7y
k

WalletHeader

```

Since the file size is much larger I am not sure why does it able to print only a single character as a value. Is there any other way to read the `lmdb` file in depth or its size does not matter? Seems like `99AxiN7y` is the wallet-id of the original wallet file.

I am sure the file is not corrupted where I have tried with a new `armory_***wallet.lmdb` file that is created by the `Armory` and similiar result is generated.

=> The real question is if the lmdb file contains the private keys too and can we recover our wallet from it?

  [1]: https://www.bitcoinarmory.com
  [2]: https://gist.github.com/avatar-lavventura/4e361d3dc56a267f94f831bcbb43dcf5
  [3]: https://research.beenfrog.com/code/2015/03/28/read-leveldb-lmdb-for-caffe-with-python.html
  [4]: https://gist.github.com/0leynik/a0cf6118f355c1a8170dd80bd351e885
  [5]: https://stackoverflow.com/a/33123313/2402577
Jump to: